@veritree/services 2.62.0 → 2.63.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veritree/services",
3
- "version": "2.62.0",
3
+ "version": "2.63.0",
4
4
  "description": "A collection of javascript functions/services to talk to veritree API",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -1,9 +1,9 @@
1
- import Api from '../helpers/api';
1
+ import Api from "../helpers/api";
2
2
 
3
3
  class ResellersApi extends Api {
4
4
  constructor(resource) {
5
5
  super(resource);
6
- this.resource = 'resellers';
6
+ this.resource = "resellers";
7
7
  }
8
8
 
9
9
  statsSold() {
@@ -13,7 +13,7 @@ class ResellersApi extends Api {
13
13
  try {
14
14
  response = await this.get(url);
15
15
  } catch (e) {
16
- console.log('error ', e);
16
+ console.log("error ", e);
17
17
  }
18
18
  return response;
19
19
  };
@@ -32,6 +32,63 @@ class ResellersApi extends Api {
32
32
  all,
33
33
  };
34
34
  }
35
+
36
+ /**
37
+ * Creates a sales report object with methods to fetch sales data for a specific reseller.
38
+ *
39
+ * @param {string} resellerId - The unique identifier of the reseller for which the sales report is generated.
40
+ * @returns {Object} An object with methods to retrieve sales data.
41
+ * @memberof Resellers
42
+ */
43
+ salesReport(resellerId) {
44
+ /**
45
+ * Fetches all sales data for the specified reseller.
46
+ *
47
+ * @param {Object} params - Additional parameters for customizing the request.
48
+ * @param {string} params.format - The desired format of the sales report (e.g., 'csv', 'json').
49
+ * @returns {Promise} A promise that resolves to the sales data.
50
+ * @memberof Resellers.salesReport
51
+ */
52
+ const all = async (params) => {
53
+ const url = `${this.getUrl()}/${resellerId}/sales-report${this.getUrlParams(
54
+ params
55
+ )}`;
56
+
57
+ return await this.get(url);
58
+ };
59
+
60
+ return {
61
+ all,
62
+ };
63
+ }
64
+
65
+ /**
66
+ * Creates an allocation progress report object with methods to fetch allocation progress data for a specific reseller.
67
+ *
68
+ * @param {string} resellerId - The unique identifier of the reseller for which the allocation progress report is generated.
69
+ * @returns {Object} An object with methods to retrieve allocation progress data.
70
+ * @memberof Resellers
71
+ */
72
+ allocationProgressReport(resellerId) {
73
+ /**
74
+ * Fetches all allocation progress data for the specified reseller.
75
+ *
76
+ * @param {Object} params - Additional parameters for customizing the request.
77
+ * @returns {Promise} A promise that resolves to the allocation progress data.
78
+ * @memberof Resellers.allocationProgressReport
79
+ */
80
+ const all = async (params) => {
81
+ const url = `${this.getUrl()}/${resellerId}/allocation-progress-report${this.getUrlParams(
82
+ params
83
+ )}`;
84
+
85
+ return await this.get(url);
86
+ };
87
+
88
+ return {
89
+ all,
90
+ };
91
+ }
35
92
  }
36
93
 
37
94
  export const Resellers = new ResellersApi();