@gofynd/fdk-client-javascript 1.0.1 → 1.0.2

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 (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
@@ -5,52 +5,58 @@ declare class Analytics {
5
5
  applicationId: any;
6
6
  /**
7
7
  * @param {Object} arg - Arg object.
8
+ * @returns {Promise<StatsGroups>} - Success response
8
9
  * @summary: Get statistics groups
9
10
  * @description: Get statistics groups
10
11
  */
11
- getStatiscticsGroups({}?: any): Promise<any>;
12
+ getStatiscticsGroups({}?: any): Promise<StatsGroups>;
12
13
  /**
13
14
  * @param {Object} arg - Arg object.
14
15
  * @param {string} arg.groupName - Group name
16
+ * @returns {Promise<StatsGroupComponents>} - Success response
15
17
  * @summary: Get statistics group components
16
18
  * @description: Get statistics group components
17
19
  */
18
20
  getStatiscticsGroupComponents({ groupName }?: {
19
21
  groupName: string;
20
- }): Promise<any>;
22
+ }): Promise<StatsGroupComponents>;
21
23
  /**
22
24
  * @param {Object} arg - Arg object.
23
25
  * @param {string} arg.componentName - Component name
26
+ * @returns {Promise<string>} - Success response
24
27
  * @summary: Get component statistics csv
25
28
  * @description: Get component statistics csv
26
29
  */
27
30
  getComponentStatsCSV({ componentName }?: {
28
31
  componentName: string;
29
- }): Promise<any>;
32
+ }): Promise<string>;
30
33
  /**
31
34
  * @param {Object} arg - Arg object.
32
35
  * @param {string} arg.componentName - Component name
36
+ * @returns {Promise<string>} - Success response
33
37
  * @summary: Get component statistics pdf
34
38
  * @description: Get component statistics pdf
35
39
  */
36
40
  getComponentStatsPDF({ componentName }?: {
37
41
  componentName: string;
38
- }): Promise<any>;
42
+ }): Promise<string>;
39
43
  /**
40
44
  * @param {Object} arg - Arg object.
41
45
  * @param {string} arg.componentName - Component name
46
+ * @returns {Promise<StatsRes>} - Success response
42
47
  * @summary: Get component statistics
43
48
  * @description: Get component statistics
44
49
  */
45
50
  getComponentStats({ componentName }?: {
46
51
  componentName: string;
47
- }): Promise<any>;
52
+ }): Promise<StatsRes>;
48
53
  /**
49
54
  * @param {Object} arg - Arg object.
50
55
  * @param {string} arg.fromDate - From date
51
56
  * @param {string} arg.toDate - To date
52
57
  * @param {number} [arg.pageNo] - Current page number
53
58
  * @param {number} [arg.pageSize] - Current page size
59
+ * @returns {Promise<AbandonCartsList>} - Success response
54
60
  * @summary: Get abandon carts list
55
61
  * @description: Get abandon carts list
56
62
  */
@@ -59,7 +65,7 @@ declare class Analytics {
59
65
  toDate: string;
60
66
  pageNo?: number;
61
67
  pageSize?: number;
62
- }): Promise<any>;
68
+ }): Promise<AbandonCartsList>;
63
69
  /**
64
70
  * @param {Object} arg - Arg object.
65
71
  * @param {string} arg.companyId - Company Id
@@ -81,21 +87,23 @@ declare class Analytics {
81
87
  * @param {Object} arg - Arg object.
82
88
  * @param {string} arg.fromDate - From date
83
89
  * @param {string} arg.toDate - To date
90
+ * @returns {Promise<string>} - Success response
84
91
  * @summary: Get abandon carts csv
85
92
  * @description: Get abandon carts csv
86
93
  */
87
94
  getAbandonCartsCSV({ fromDate, toDate }?: {
88
95
  fromDate: string;
89
96
  toDate: string;
90
- }): Promise<any>;
97
+ }): Promise<string>;
91
98
  /**
92
99
  * @param {Object} arg - Arg object.
93
100
  * @param {string} arg.cartId - Cart Id
101
+ * @returns {Promise<AbandonCartDetail>} - Success response
94
102
  * @summary: Get abandon carts details
95
103
  * @description: Get abandon cart details
96
104
  */
97
105
  getAbandonCartDetail({ cartId }?: {
98
106
  cartId: string;
99
- }): Promise<any>;
107
+ }): Promise<AbandonCartDetail>;
100
108
  }
101
109
  import Paginator = require("../../common/Paginator");
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
2
2
  const PlatformAPIClient = require("../PlatformAPIClient");
3
3
  const { FDKClientValidationError } = require("../../common/FDKError");
4
4
  const AnalyticsValidator = require("./AnalyticsPlatformApplicationValidator");
5
+ const AnalyticsModel = require("./AnalyticsPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class Analytics {
7
9
  constructor(config, applicationId) {
@@ -11,10 +13,11 @@ class Analytics {
11
13
 
12
14
  /**
13
15
  * @param {Object} arg - Arg object.
16
+ * @returns {Promise<StatsGroups>} - Success response
14
17
  * @summary: Get statistics groups
15
18
  * @description: Get statistics groups
16
19
  */
17
- getStatiscticsGroups({} = {}) {
20
+ async getStatiscticsGroups({} = {}) {
18
21
  const { error } = AnalyticsValidator.getStatiscticsGroups().validate(
19
22
  {},
20
23
  { abortEarly: false, allowUnknown: true }
@@ -31,28 +34,47 @@ class Analytics {
31
34
  { abortEarly: false, allowUnknown: false }
32
35
  );
33
36
  if (warrning) {
34
- console.log("Parameter Validation warrnings for getStatiscticsGroups");
35
- console.log(warrning);
37
+ Logger({
38
+ level: "WARN",
39
+ message: "Parameter Validation warrnings for getStatiscticsGroups",
40
+ });
41
+ Logger({ level: "WARN", message: warrning });
36
42
  }
37
43
 
38
44
  const query_params = {};
39
45
 
40
- return PlatformAPIClient.execute(
46
+ const response = await PlatformAPIClient.execute(
41
47
  this.config,
42
48
  "get",
43
49
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/group`,
44
50
  query_params,
45
51
  undefined
46
52
  );
53
+
54
+ const { error: res_error } = AnalyticsModel.StatsGroups().validate(
55
+ response,
56
+ { abortEarly: false, allowUnknown: false }
57
+ );
58
+
59
+ if (res_error) {
60
+ Logger({
61
+ level: "WARN",
62
+ message: "Response Validation Warnnings for getStatiscticsGroups",
63
+ });
64
+ Logger({ level: "WARN", message: res_error });
65
+ }
66
+
67
+ return response;
47
68
  }
48
69
 
49
70
  /**
50
71
  * @param {Object} arg - Arg object.
51
72
  * @param {string} arg.groupName - Group name
73
+ * @returns {Promise<StatsGroupComponents>} - Success response
52
74
  * @summary: Get statistics group components
53
75
  * @description: Get statistics group components
54
76
  */
55
- getStatiscticsGroupComponents({ groupName } = {}) {
77
+ async getStatiscticsGroupComponents({ groupName } = {}) {
56
78
  const {
57
79
  error,
58
80
  } = AnalyticsValidator.getStatiscticsGroupComponents().validate(
@@ -75,30 +97,51 @@ class Analytics {
75
97
  { abortEarly: false, allowUnknown: false }
76
98
  );
77
99
  if (warrning) {
78
- console.log(
79
- "Parameter Validation warrnings for getStatiscticsGroupComponents"
80
- );
81
- console.log(warrning);
100
+ Logger({
101
+ level: "WARN",
102
+ message:
103
+ "Parameter Validation warrnings for getStatiscticsGroupComponents",
104
+ });
105
+ Logger({ level: "WARN", message: warrning });
82
106
  }
83
107
 
84
108
  const query_params = {};
85
109
 
86
- return PlatformAPIClient.execute(
110
+ const response = await PlatformAPIClient.execute(
87
111
  this.config,
88
112
  "get",
89
113
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/group/${groupName}`,
90
114
  query_params,
91
115
  undefined
92
116
  );
117
+
118
+ const {
119
+ error: res_error,
120
+ } = AnalyticsModel.StatsGroupComponents().validate(response, {
121
+ abortEarly: false,
122
+ allowUnknown: false,
123
+ });
124
+
125
+ if (res_error) {
126
+ Logger({
127
+ level: "WARN",
128
+ message:
129
+ "Response Validation Warnnings for getStatiscticsGroupComponents",
130
+ });
131
+ Logger({ level: "WARN", message: res_error });
132
+ }
133
+
134
+ return response;
93
135
  }
94
136
 
95
137
  /**
96
138
  * @param {Object} arg - Arg object.
97
139
  * @param {string} arg.componentName - Component name
140
+ * @returns {Promise<string>} - Success response
98
141
  * @summary: Get component statistics csv
99
142
  * @description: Get component statistics csv
100
143
  */
101
- getComponentStatsCSV({ componentName } = {}) {
144
+ async getComponentStatsCSV({ componentName } = {}) {
102
145
  const { error } = AnalyticsValidator.getComponentStatsCSV().validate(
103
146
  {
104
147
  componentName,
@@ -119,28 +162,46 @@ class Analytics {
119
162
  { abortEarly: false, allowUnknown: false }
120
163
  );
121
164
  if (warrning) {
122
- console.log("Parameter Validation warrnings for getComponentStatsCSV");
123
- console.log(warrning);
165
+ Logger({
166
+ level: "WARN",
167
+ message: "Parameter Validation warrnings for getComponentStatsCSV",
168
+ });
169
+ Logger({ level: "WARN", message: warrning });
124
170
  }
125
171
 
126
172
  const query_params = {};
127
173
 
128
- return PlatformAPIClient.execute(
174
+ const response = await PlatformAPIClient.execute(
129
175
  this.config,
130
176
  "get",
131
177
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/{component_name}.csv`,
132
178
  query_params,
133
179
  undefined
134
180
  );
181
+
182
+ const { error: res_error } = Joi.string()
183
+ .allow("")
184
+ .validate(response, { abortEarly: false, allowUnknown: false });
185
+
186
+ if (res_error) {
187
+ Logger({
188
+ level: "WARN",
189
+ message: "Response Validation Warnnings for getComponentStatsCSV",
190
+ });
191
+ Logger({ level: "WARN", message: res_error });
192
+ }
193
+
194
+ return response;
135
195
  }
136
196
 
137
197
  /**
138
198
  * @param {Object} arg - Arg object.
139
199
  * @param {string} arg.componentName - Component name
200
+ * @returns {Promise<string>} - Success response
140
201
  * @summary: Get component statistics pdf
141
202
  * @description: Get component statistics pdf
142
203
  */
143
- getComponentStatsPDF({ componentName } = {}) {
204
+ async getComponentStatsPDF({ componentName } = {}) {
144
205
  const { error } = AnalyticsValidator.getComponentStatsPDF().validate(
145
206
  {
146
207
  componentName,
@@ -161,28 +222,46 @@ class Analytics {
161
222
  { abortEarly: false, allowUnknown: false }
162
223
  );
163
224
  if (warrning) {
164
- console.log("Parameter Validation warrnings for getComponentStatsPDF");
165
- console.log(warrning);
225
+ Logger({
226
+ level: "WARN",
227
+ message: "Parameter Validation warrnings for getComponentStatsPDF",
228
+ });
229
+ Logger({ level: "WARN", message: warrning });
166
230
  }
167
231
 
168
232
  const query_params = {};
169
233
 
170
- return PlatformAPIClient.execute(
234
+ const response = await PlatformAPIClient.execute(
171
235
  this.config,
172
236
  "get",
173
237
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/{component_name}.pdf`,
174
238
  query_params,
175
239
  undefined
176
240
  );
241
+
242
+ const { error: res_error } = Joi.string()
243
+ .allow("")
244
+ .validate(response, { abortEarly: false, allowUnknown: false });
245
+
246
+ if (res_error) {
247
+ Logger({
248
+ level: "WARN",
249
+ message: "Response Validation Warnnings for getComponentStatsPDF",
250
+ });
251
+ Logger({ level: "WARN", message: res_error });
252
+ }
253
+
254
+ return response;
177
255
  }
178
256
 
179
257
  /**
180
258
  * @param {Object} arg - Arg object.
181
259
  * @param {string} arg.componentName - Component name
260
+ * @returns {Promise<StatsRes>} - Success response
182
261
  * @summary: Get component statistics
183
262
  * @description: Get component statistics
184
263
  */
185
- getComponentStats({ componentName } = {}) {
264
+ async getComponentStats({ componentName } = {}) {
186
265
  const { error } = AnalyticsValidator.getComponentStats().validate(
187
266
  {
188
267
  componentName,
@@ -201,19 +280,37 @@ class Analytics {
201
280
  { abortEarly: false, allowUnknown: false }
202
281
  );
203
282
  if (warrning) {
204
- console.log("Parameter Validation warrnings for getComponentStats");
205
- console.log(warrning);
283
+ Logger({
284
+ level: "WARN",
285
+ message: "Parameter Validation warrnings for getComponentStats",
286
+ });
287
+ Logger({ level: "WARN", message: warrning });
206
288
  }
207
289
 
208
290
  const query_params = {};
209
291
 
210
- return PlatformAPIClient.execute(
292
+ const response = await PlatformAPIClient.execute(
211
293
  this.config,
212
294
  "get",
213
295
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/${componentName}`,
214
296
  query_params,
215
297
  undefined
216
298
  );
299
+
300
+ const { error: res_error } = AnalyticsModel.StatsRes().validate(response, {
301
+ abortEarly: false,
302
+ allowUnknown: false,
303
+ });
304
+
305
+ if (res_error) {
306
+ Logger({
307
+ level: "WARN",
308
+ message: "Response Validation Warnnings for getComponentStats",
309
+ });
310
+ Logger({ level: "WARN", message: res_error });
311
+ }
312
+
313
+ return response;
217
314
  }
218
315
 
219
316
  /**
@@ -222,10 +319,11 @@ class Analytics {
222
319
  * @param {string} arg.toDate - To date
223
320
  * @param {number} [arg.pageNo] - Current page number
224
321
  * @param {number} [arg.pageSize] - Current page size
322
+ * @returns {Promise<AbandonCartsList>} - Success response
225
323
  * @summary: Get abandon carts list
226
324
  * @description: Get abandon carts list
227
325
  */
228
- getAbandonCartList({ fromDate, toDate, pageNo, pageSize } = {}) {
326
+ async getAbandonCartList({ fromDate, toDate, pageNo, pageSize } = {}) {
229
327
  const { error } = AnalyticsValidator.getAbandonCartList().validate(
230
328
  {
231
329
  fromDate,
@@ -252,21 +350,41 @@ class Analytics {
252
350
  { abortEarly: false, allowUnknown: false }
253
351
  );
254
352
  if (warrning) {
255
- console.log("Parameter Validation warrnings for getAbandonCartList");
256
- console.log(warrning);
353
+ Logger({
354
+ level: "WARN",
355
+ message: "Parameter Validation warrnings for getAbandonCartList",
356
+ });
357
+ Logger({ level: "WARN", message: warrning });
257
358
  }
258
359
 
259
360
  const query_params = {};
260
361
  query_params["page_no"] = pageNo;
261
362
  query_params["page_size"] = pageSize;
262
363
 
263
- return PlatformAPIClient.execute(
364
+ const response = await PlatformAPIClient.execute(
264
365
  this.config,
265
366
  "get",
266
367
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/from/${fromDate}/to/${toDate}/abandon-cart/`,
267
368
  query_params,
268
369
  undefined
269
370
  );
371
+
372
+ const {
373
+ error: res_error,
374
+ } = AnalyticsModel.AbandonCartsList().validate(response, {
375
+ abortEarly: false,
376
+ allowUnknown: false,
377
+ });
378
+
379
+ if (res_error) {
380
+ Logger({
381
+ level: "WARN",
382
+ message: "Response Validation Warnnings for getAbandonCartList",
383
+ });
384
+ Logger({ level: "WARN", message: res_error });
385
+ }
386
+
387
+ return response;
270
388
  }
271
389
 
272
390
  /**
@@ -313,10 +431,11 @@ class Analytics {
313
431
  * @param {Object} arg - Arg object.
314
432
  * @param {string} arg.fromDate - From date
315
433
  * @param {string} arg.toDate - To date
434
+ * @returns {Promise<string>} - Success response
316
435
  * @summary: Get abandon carts csv
317
436
  * @description: Get abandon carts csv
318
437
  */
319
- getAbandonCartsCSV({ fromDate, toDate } = {}) {
438
+ async getAbandonCartsCSV({ fromDate, toDate } = {}) {
320
439
  const { error } = AnalyticsValidator.getAbandonCartsCSV().validate(
321
440
  {
322
441
  fromDate,
@@ -339,28 +458,46 @@ class Analytics {
339
458
  { abortEarly: false, allowUnknown: false }
340
459
  );
341
460
  if (warrning) {
342
- console.log("Parameter Validation warrnings for getAbandonCartsCSV");
343
- console.log(warrning);
461
+ Logger({
462
+ level: "WARN",
463
+ message: "Parameter Validation warrnings for getAbandonCartsCSV",
464
+ });
465
+ Logger({ level: "WARN", message: warrning });
344
466
  }
345
467
 
346
468
  const query_params = {};
347
469
 
348
- return PlatformAPIClient.execute(
470
+ const response = await PlatformAPIClient.execute(
349
471
  this.config,
350
472
  "get",
351
473
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/${fromDate}/to/${toDate}/abandon-cart.csv`,
352
474
  query_params,
353
475
  undefined
354
476
  );
477
+
478
+ const { error: res_error } = Joi.string()
479
+ .allow("")
480
+ .validate(response, { abortEarly: false, allowUnknown: false });
481
+
482
+ if (res_error) {
483
+ Logger({
484
+ level: "WARN",
485
+ message: "Response Validation Warnnings for getAbandonCartsCSV",
486
+ });
487
+ Logger({ level: "WARN", message: res_error });
488
+ }
489
+
490
+ return response;
355
491
  }
356
492
 
357
493
  /**
358
494
  * @param {Object} arg - Arg object.
359
495
  * @param {string} arg.cartId - Cart Id
496
+ * @returns {Promise<AbandonCartDetail>} - Success response
360
497
  * @summary: Get abandon carts details
361
498
  * @description: Get abandon cart details
362
499
  */
363
- getAbandonCartDetail({ cartId } = {}) {
500
+ async getAbandonCartDetail({ cartId } = {}) {
364
501
  const { error } = AnalyticsValidator.getAbandonCartDetail().validate(
365
502
  {
366
503
  cartId,
@@ -381,19 +518,39 @@ class Analytics {
381
518
  { abortEarly: false, allowUnknown: false }
382
519
  );
383
520
  if (warrning) {
384
- console.log("Parameter Validation warrnings for getAbandonCartDetail");
385
- console.log(warrning);
521
+ Logger({
522
+ level: "WARN",
523
+ message: "Parameter Validation warrnings for getAbandonCartDetail",
524
+ });
525
+ Logger({ level: "WARN", message: warrning });
386
526
  }
387
527
 
388
528
  const query_params = {};
389
529
 
390
- return PlatformAPIClient.execute(
530
+ const response = await PlatformAPIClient.execute(
391
531
  this.config,
392
532
  "get",
393
533
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/abandon-cart/${cartId}`,
394
534
  query_params,
395
535
  undefined
396
536
  );
537
+
538
+ const {
539
+ error: res_error,
540
+ } = AnalyticsModel.AbandonCartDetail().validate(response, {
541
+ abortEarly: false,
542
+ allowUnknown: false,
543
+ });
544
+
545
+ if (res_error) {
546
+ Logger({
547
+ level: "WARN",
548
+ message: "Response Validation Warnnings for getAbandonCartDetail",
549
+ });
550
+ Logger({ level: "WARN", message: res_error });
551
+ }
552
+
553
+ return response;
397
554
  }
398
555
  }
399
556
  module.exports = Analytics;
@@ -6,30 +6,33 @@ declare class Analytics {
6
6
  * @param {Object} arg - Arg object.
7
7
  * @param {string} arg.exportType - Export type / format
8
8
  * @param {ExportJobReq} arg.body
9
+ * @returns {Promise<ExportJobRes>} - Success response
9
10
  * @summary: Create data export job in required format
10
11
  * @description: Create data export job in required format
11
12
  */
12
13
  createExportJob({ exportType, body }?: {
13
14
  exportType: string;
14
15
  body: ExportJobReq;
15
- }): Promise<any>;
16
+ }): Promise<ExportJobRes>;
16
17
  /**
17
18
  * @param {Object} arg - Arg object.
18
19
  * @param {string} arg.exportType - Export type / format
19
20
  * @param {string} arg.jobId - Export job id
21
+ * @returns {Promise<ExportJobStatusRes>} - Success response
20
22
  * @summary: Get data export job status
21
23
  * @description: Get data export job status
22
24
  */
23
25
  getExportJobStatus({ exportType, jobId }?: {
24
26
  exportType: string;
25
27
  jobId: string;
26
- }): Promise<any>;
28
+ }): Promise<ExportJobStatusRes>;
27
29
  /**
28
30
  * @param {Object} arg - Arg object.
29
31
  * @param {string} arg.logType - Log type
30
32
  * @param {number} [arg.pageNo] - Current page number
31
33
  * @param {number} [arg.pageSize] - Current page size
32
34
  * @param {GetLogsListReq} arg.body
35
+ * @returns {Promise<GetLogsListRes>} - Success response
33
36
  * @summary: Get logs list
34
37
  * @description: Get logs list
35
38
  */
@@ -38,7 +41,7 @@ declare class Analytics {
38
41
  pageNo?: number;
39
42
  pageSize?: number;
40
43
  body: GetLogsListReq;
41
- }): Promise<any>;
44
+ }): Promise<GetLogsListRes>;
42
45
  /**
43
46
  * @param {Object} arg - Arg object.
44
47
  * @param {string} arg.logType - Log type
@@ -58,6 +61,7 @@ declare class Analytics {
58
61
  * @param {number} [arg.pageSize] - Current page size
59
62
  * @param {string} arg.logType - Log type
60
63
  * @param {SearchLogReq} arg.body
64
+ * @returns {Promise<SearchLogRes>} - Success response
61
65
  * @summary: Search logs
62
66
  * @description: Search logs
63
67
  */
@@ -66,7 +70,7 @@ declare class Analytics {
66
70
  pageSize?: number;
67
71
  logType: string;
68
72
  body: SearchLogReq;
69
- }): Promise<any>;
73
+ }): Promise<SearchLogRes>;
70
74
  /**
71
75
  * @param {Object} arg - Arg object.
72
76
  * @param {number} [arg.pageSize] - Current page size