1.0.8 • Published 5 months ago

node-lightspeed-retail-sdk v1.0.8

Weekly downloads
-
License
ISC
Repository
github
Last release
5 months ago

node-lightspeed-retail-sdk

This SDK provides a convenient interface to interact with the Lightspeed Retail API using Node.js. It abstracts the complexities of API requests behind a simple and easy-to-use interface.

Features

  • Token Management: Automatic handling of fetching and refreshing access tokens.
  • Rate Limiting: Intelligent handling of rate limits, delaying requests as needed to comply with Lightspeed's API rate limits.
  • Resource Models: Includes models for various Lightspeed Retail resources such as Categories, Customers, Manufacturers, Products, Sales, and Vendors, simplifying interactions with the API.

Installation

Install the SDK using npm:

npm install node-lightspeed-retail-sdk

Usage

Initialize the SDK

JavaScript

import LightspeedRetailSDK from 'node-lightspeed-retail-sdk';

const sdk = new LightspeedRetailSDK({
  clientID: 'YOUR_CLIENT_ID',
  clientSecret: 'YOUR_CLIENT_SECRET',
  refreshToken: 'YOUR_REFRESH_TOKEN',
  accountID: 'YOUR_ACCOUNT_ID'
});

TypeScript

import LightspeedRetailSDK from 'node-lightspeed-retail-sdk';
import { ILightspeedRetailSDKOptions } from 'node-lightspeed-retail-sdk/dist/types';

const config: ILightspeedRetailSDKOptions = {
  clientID: 'YOUR_CLIENT_ID',
  clientSecret: 'YOUR_CLIENT_SECRET',
  refreshToken: 'YOUR_REFRESH_TOKEN',
  accountID: 'YOUR_ACCOUNT_ID'
};

const sdk = new LightspeedRetailSDK(config);

Examples

Fetching All Categories

import Category from 'node-lightspeed-retail-sdk/dist/models/Category';

const categoryModel = new Category(sdk);
const categories = await categoryModel.getAll();
console.log(categories);

Fetching a Specific Customer

import Customer from 'node-lightspeed-retail-sdk/dist/models/Customer';

const customerModel = new Customer(sdk);
const customer = await customerModel.getById('CUSTOMER_ID');
console.log(customer);

Contributing

Contributions are welcome and appreciated. If you'd like to contribute, please:

  • Fork the repository.
  • Create a feature branch (git checkout -b feature/my-new-feature).
  • Make your changes and commit (git commit -am 'Add some feature').
  • Push to the branch (git push origin feature/my-new-feature).
  • Create a new Pull Request.
1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

5 months ago

1.0.3

5 months ago

1.0.2

5 months ago

1.0.1

6 months ago

1.0.0

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago