lightspeed-retail-sdk 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +4 -0
  2. package/index.js +36 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -14,6 +14,8 @@ getItem(id: int, relations?: string)
14
14
  getItems(relations?: string)
15
15
  getMultipleItems(ids: string = "[102, 103]", relations?: string)
16
16
  getVendorItems(id: int relations?: string)
17
+ getMatrixItems(relations? string)
18
+ getMatrixItem(id: int, relations? string)
17
19
  getCategory(id: int, relations?: string)
18
20
  getCategories(relations?: string)
19
21
  getManufacturer(id: int, relations?: string)
@@ -42,6 +44,8 @@ const api = new LightspeedRetailSDK({
42
44
  clientSecret: "Your client secret.",
43
45
  refreshToken: "Your refresh token.",
44
46
  });
47
+
48
+ export default api
45
49
  ```
46
50
 
47
51
  ## Example Request
package/index.js CHANGED
@@ -238,6 +238,42 @@ class LightspeedRetailSDK {
238
238
  }
239
239
  }
240
240
 
241
+ // Get all Matrix Items
242
+ async getMatrixItems(relations) {
243
+ const options = {
244
+ url: `${this.baseUrl}/${this.accountID}/ItemMatrix.json`,
245
+ method: "GET",
246
+ };
247
+
248
+ if (relations) options.url = options.url + `?load_relations=${relations}`;
249
+
250
+ try {
251
+ const response = await this.getAllData(options);
252
+ return response;
253
+ } catch (error) {
254
+ return this.handleError("GET ITEM ERROR", error);
255
+ }
256
+ }
257
+
258
+ // Get Matrix Item by ID
259
+ async getItem(id, relations) {
260
+ const options = {
261
+ url: `${this.baseUrl}/${this.accountID}/ItemMatrix/${id}.json`,
262
+ method: "GET",
263
+ };
264
+
265
+ if (!id) return this.handleError("You need to provide a itemID");
266
+
267
+ if (relations) options.url = options.url + `?load_relations=${relations}`;
268
+
269
+ try {
270
+ const response = await this.getAllData(options);
271
+ return response;
272
+ } catch (error) {
273
+ return this.handleError("GET ITEM ERROR", error);
274
+ }
275
+ }
276
+
241
277
  // Get category by ID
242
278
  async getCategory(id, relations) {
243
279
  const options = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightspeed-retail-sdk",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "Another unofficial Lightspeed Retail API SDK for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {