lightspeed-retail-sdk 1.0.6 → 1.0.8

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 +1 -0
  2. package/index.js +19 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,6 +8,7 @@ We currently have the following methods available:
8
8
  getCustomers()
9
9
  getItem()
10
10
  getAllItems()
11
+ getVendorItems()
11
12
  getMultipleItems() // await api.getMultipleItems("[7957, 7944]");
12
13
  getCategories()
13
14
  getCategory()
package/index.js CHANGED
@@ -144,7 +144,7 @@ class LightspeedRetailSDK {
144
144
  }
145
145
  }
146
146
 
147
- async getMultipleItems(items) {
147
+ async getMultipleItems(items, relations) {
148
148
  const options = {
149
149
  url: `${this.baseUrl}/${this.accountID}/Item.json`,
150
150
  method: "GET",
@@ -154,6 +154,8 @@ class LightspeedRetailSDK {
154
154
 
155
155
  if (items) options.url = options.url + `?itemID=IN,${items}`;
156
156
 
157
+ if (relations) options.url = options.url + `&load_relations=${relations}`;
158
+
157
159
  try {
158
160
  const response = await this.getAllData(options);
159
161
  return response;
@@ -178,6 +180,22 @@ class LightspeedRetailSDK {
178
180
  }
179
181
  }
180
182
 
183
+ async getvendorItems(vendorID, relations) {
184
+ const options = {
185
+ url: `${this.baseUrl}/${this.accountID}/Item.json?defaultVendorID=${vendorID}`,
186
+ method: "GET",
187
+ };
188
+
189
+ if (relations) options.url = options.url + `?load_relations=${relations}`;
190
+
191
+ try {
192
+ const response = await this.getAllData(options);
193
+ return response;
194
+ } catch (error) {
195
+ return this.handleError("GET ITEMS ERROR", error.response);
196
+ }
197
+ }
198
+
181
199
  async getItem(itemID, relations) {
182
200
  const options = {
183
201
  url: `${this.baseUrl}/${this.accountID}/Item/${itemID}.json`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightspeed-retail-sdk",
3
- "version": "1.0.6",
3
+ "version": "1.0.8",
4
4
  "description": "Another unofficial Lightspeed Retail API SDK for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {