OpenAPI client for Section.io
Please find all the information about Section here.
This package implements Axios-based client for Section REST service endpoints.
Navigate to the folder of your consuming project and run the following command:
npm install --save section-io-axios-client
or
yarn add section-io-axios-client
import { AccountApi } from './api';
const accountApi = new AccountApi();
...
const accountId = 123;
const account = await accountApi.accountGet(accountId)
Section API documentation is here.
This generator creates TypeScript/JavaScript client that utilizes axios. The generated Node module can be used in the following environments:
Environment
- Node.js
- Webpack
- Browserify
Language level
- ES5 - you must have a Promises/A+ library installed
- ES6
Module system
- CommonJS
- ES6 module system
It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via package.json
. (Reference)
To build and compile the typescript sources to javascript use:
npm install
npm run build
First build the package then run npm publish
navigate to the folder of your consuming project and run one of the following commands.
published:
npm install section-io-axios-client --save
unPublished (not recommended):
npm install PATH_TO_GENERATED_PACKAGE --save
Contributing to this package implies one to regenerate client *.ts
files. Manual changes will be lost. Now, some flaws in the source swagger declaration file prevent us from the clear approach and minor code fixes are required to make the code compile. The goal is to fix that yaml
file and streamline the development of the package so that no extra code changes are required.
To regenerate TypeScript files follow these steps:
- Download the declaration file from the Section swagger. Now it resides here:
https://aperture.section.io/api/v1/swagger.yaml - Download the latest swagger-codegen CLI as described here.
- Unzip and install the CLI.
- Run the command to generate
*.ts
files to the current directory:java -jar /path/to/swagger-codegen-cli.jar generate -l typescript-axios -i /path/to/section.io/swagger.yaml -o .
- Move the codegen output files in respective directories.
- Build the project running the following:
yarn build
If any question, please create an issue.