0.1.1 • Published 5 years ago

wahib-go-live-service-client v0.1.1

Weekly downloads
4
License
-
Repository
-
Last release
5 years ago

Generating Node Client

Generate client

  1. Go to your workspace folder
  2. Install
# install the latest version of "openapi-generator-cli"
$ npm install @openapitools/openapi-generator-cli -D
  1. 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

  1. Run script
$ npm run generate-node-client

Publishing client to NPM

  1. Generate client (as instructed above), then go to the client directory
  2. Add package.json file for the client like in the example in this directory
  3. add .npmrc file like in the example. (You can put and commit the read only token, but you must use write token to publish)
  4. Publish library
$ npm publish
  • make sure you publish the correct version

Using client

  1. Add the package to your app dependency
  2. Npm install
  3. 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