Generate your client
Make sure to first read the setup the repository tooling section first.
This section is only about adding to the existing API clients, to support a new programming language, see Support a new language.
Configuration file
Most of the configuration is determined by the api-clients-automation CLI (
scripts/
).
The file config/clients.config.json
contains information that's common to all clients generated for each language, you can find its JSON schema here.
CLI Commands
Use the CLI to generate your client:
Generate a pre-release client
Only the JavaScript client releases standalone packages along with the main algoliasearch
package, so it's the only possible "generated" solution for pre-releases (alpha or beta).
The clients
field define which specification to generate and their output location. In order to create a pre-release for your API, it needs to be standalone only (non bundled with algoliasearch
).
{
"name": "awesomeapi", // this must match the name of the specification
"output": "clients/algoliasearch-client-javascript/packages/awesomeapi", // make sure to keep everything in `clients/algoliasearch-client-javascript/packages/`
"isStandaloneClient": true // this tells the generator not to put it in the `algoliasearch` bundle
},
- Generate your client
With just the above changes, you can now run yarn cli generate -h
which should output a complete list of the available APIs for Javascript, awesomeapi
should be in it.
Running yarn cli generate javascript awesomeapi
will generate the client and format it, and yarn cli build clients javascript awesomeapi
will bundle it.
- Test the client
At least one test per operation is required, you can read more about it in the Common Test Suite section.
- Release
We take care of it, open your pull request :)