Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 16, 2024. It is now read-only.

launchnotes/moments-api-client

Repository files navigation

Moments API Client

Client that allows you to interface with LaunchNotes' Moments API.

Installing the client

# via yarn
yarn add @launchnotes/moments-api-client
# via npm
npm i @launchnotes/moments-api-client

Using the client to create Moments

The client is based off of OpenAPI's typescript-axios generator. You will first have to create a Configuration instance with your API key and create a MomentsApi instance with that config.

From there, you should be able to make POST requests to the Moments API using MomentsApi.postMoments().

import {
  MomentsApi,
  PostMomentsRequest,
  Configuration,
} from '@launchnotes/moments-api-client';

const config = new Configuration({
  accessToken: 'manage_abc123',
  basePath: 'https://pathtoapi.local:8080',
})
const api = new MomentsApi(config);
const request: PostMomentsRequest = {
  schemaId: 'https://schema.launchnotes.dev/schemas/test.json',
  projectId: 'pro_abc123',
  data: {},
};

const response = api.postMoments(request).then((result) => {
  console.log(result);
}).catch((error) => {
  console.log(error);
});

Testing the client

The client is tested using jest and are located in the test directory. You can run these tests by doing yarn test.

OpenAPI generator and Axios

The client was generated by OpenAPI's typescript-axios generator using an OpenAPI spec YAML file. For more information, please refer to these articles:

About

Node package to allow you to interact with the Moments API.

Resources

License

Stars

Watchers

Forks