Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/darrylmorley/node-lightspeed-retail-sdk
node-lightspeed-retail-sdk
https://github.com/darrylmorley/node-lightspeed-retail-sdk
lightspeed-retail nodejs sdk-js
Last synced: about 2 months ago
JSON representation
node-lightspeed-retail-sdk
- Host: GitHub
- URL: https://github.com/darrylmorley/node-lightspeed-retail-sdk
- Owner: darrylmorley
- Created: 2023-10-24T13:38:18.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-21T16:50:12.000Z (about 1 year ago)
- Last Synced: 2023-11-22T10:51:33.204Z (about 1 year ago)
- Topics: lightspeed-retail, nodejs, sdk-js
- Language: TypeScript
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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:
```bash
npm install node-lightspeed-retail-sdk
```## Usage
## Initialize the SDKJavaScript
```bash
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
```bash
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```bash
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
```bash
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.