1.0.20 • Published 8 months ago

@chift/chift-nodejs v1.0.20

Weekly downloads
-
License
Apache License 2....
Repository
-
Last release
8 months ago

Chift Node.js Library

npm version Build Coverage Status code style: prettier

The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).

Documentation

See the API docs.

Requirements

Node 18 or higher.

Installation

Install the package with:

npm install @chift/chift-nodejs
# or
yarn add @chift/chift-nodejs

Example

const chift = require('@chift/chift-nodejs');
const client = new chift.API({
    clientId: process.env.CHIFT_TESTING_CLIENTID,
    clientSecret: process.env.CHIFT_TESTING_CLIENTSECRET,
    accountId: process.env.CHIFT_TESTING_ACCOUNTID,
});
const consumers = await client.Consumers.getConsumers();
// my first consumer has a POS connection
const locations = await consumers[0].pos.getLocations();

Development

How to generate the typescript schemas from the OpenAPI schema of Chift:

npx openapi-typescript https://api.chift.eu/openapi.json --output src/types/public-api/schema.d.ts

Add routes

The library handles pagination. If the route parameters in the schema contain page and size, you should use the generic type AutoPaginatedParams<T> for the route parameters in the module.

If the query parameter is optional in the schema, it should also be declared as optional in the module.

For example, in accounting.ts, the parameters['query'] for operations['accounting_get_analytic_plans'] should be replaced with AutoPaginatedParams<operations['accounting_get_analytic_plans']['parameters']['query']>.

Since query is optional, the getAnalyticPlans function should be declared like this: getAnalyticPlans(params?: GetAnalyticPlansParams).

1.0.20

8 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

9 months ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

1 year ago

1.0.9

1 year ago

1.0.10

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago