lightspeed-retail-sdk 1.0.12 → 1.0.13

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 +18 -0
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,6 +22,7 @@ getSales()
22
22
  getSale()
23
23
  getSaleLinesByItem()
24
24
  getSaleLinesByItems(`39, 2126, 3505`, startDate?, endDate?)
25
+ getSaleLinesByVendorID(vendorID, startDate?, endDate?)
25
26
  getOrdersByVendorID()
26
27
  getOpenOrdersByVendorID()
27
28
  ```
package/index.js CHANGED
@@ -437,6 +437,24 @@ class LightspeedRetailSDK {
437
437
  return this.handleError("GET SALE ERROR", error);
438
438
  }
439
439
  }
440
+
441
+ async getSaleLinesByVendorID(vendorID, startDate = undefined, endDate = undefined) {
442
+ const options = {
443
+ url: `${this.baseUrl}/${this.accountID}/SaleLine.json?load_relations=["Item"]&Item.defaultVendorID=${vendorID}`,
444
+ method: "GET",
445
+ };
446
+
447
+ if (startDate && endDate)
448
+ options.url =
449
+ options.url + `&timeStamp=%3E%3C%2C${startDate}%2C${endDate}&sort=timeStamp`;
450
+
451
+ try {
452
+ const response = await this.getAllData(options);
453
+ return response;
454
+ } catch (error) {
455
+ return this.handleError("GET SALE ERROR", error);
456
+ }
457
+ }
440
458
  }
441
459
 
442
460
  export default LightspeedRetailSDK;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lightspeed-retail-sdk",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Another unofficial Lightspeed Retail API SDK for Node.js",
5
5
  "main": "index.js",
6
6
  "scripts": {