DO NOT EDIT src
folder. This is autogenerated sdk based on neuron-api.yaml
file.
this uses openapi-generator to generate sdk.
Documentation for the SDK is generated automatically using Typedoc and can be found here: https://cerebruminc.github.io/neuron-sdk.
- run yarn/npm install in the project where you want to use
npm install @cerebruminc/neuron-sdk
or
yarn add @cerebruminc/neuron-sdk
- intialize sdk
import { Configuration, NeuronApi } from "@cerebruminc/neuron-sdk";
export const neuronSdk = new NeuronApi(
new Configuration({
basePath: NEURON_API_BASE_URL as string,
baseOptions: {
withCredentials: true,
},
})
);
- use sdk functions
await neuronSdk.getSession();
- run neuron api
- hit
/api-yaml
endpoint which will download yml file - replace that yml file content into
neuron-api.yaml
file in this repo - do
yarn build
which will generated latest sdk from yaml file - To publish, follow publishing guide below.
If you don't have a Java runtime environment on your workstation, or you want to run the build in an isolated environment, you can use the openapitools Docker image to build the SDK.
docker run --rm \
-v $PWD:/local openapitools/openapi-generator-cli:v6.2.0 generate \
-i /local/neuron-api.yaml \
-g typescript-axios \
-o /local/src \
--skip-validate-spec
- do
yarn
in neuron-sdk - do
yarn dev
which will watch for any files changes and recompiles files - do
yalc link neuron-sdk
in the project where you want to use this sdk - to generate sdk from neuron-api.yaml run
yarn generate-sdk
command.
- do
npm version <major|minor|patch|specific version>
- do
npm publish
which will build the sdk and publish to npm. ( to run this successfully, one will need publish access key which you can find from 1password )