0.1.1 • Published 5 years ago
wahib-go-live-service-client v0.1.1
Generating Node Client
Generate client
- Go to your workspace folder
- Install
# install the latest version of "openapi-generator-cli"
$ npm install @openapitools/openapi-generator-cli -D
- add script Add script to your package.json, example:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"generate-client": "openapi-generator generate -i spec/api.yaml -g typescript-axios -o clients/v0"
}
You might want to modify the script to change target spec file or destination directory
- Run script
$ npm run generate-node-client
Publishing client to NPM
- Generate client (as instructed above), then go to the client directory
- Add
package.json
file for the client like in the example in this directory - add
.npmrc
file like in the example. (You can put and commit the read only token, but you must use write token to publish) - Publish library
$ npm publish
- make sure you publish the correct version
Using client
- Add the package to your app dependency
- Npm install
- Init the client, use (at least) this object for Configuration parameter
{
basePath: process.env.GO_LIVE_SERVICE_URL,
baseOptions: {
headers: {
'X-API-KEY': process.env.GO_LIVE_SERVICE_API_KEY
}
}
}
0.1.1
5 years ago