@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
@@ -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 CatalogValidator = require("./CatalogPlatformApplicationValidator");
5
+ const CatalogModel = require("./CatalogPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
5
7
 
6
8
  class Catalog {
7
9
  constructor(config, applicationId) {
@@ -13,10 +15,11 @@ class Catalog {
13
15
  * @param {Object} arg - Arg object.
14
16
  * @param {string} arg.id - A `id` is a unique identifier for a particular
15
17
  * detail. Pass the `id` of the keywords which you want to retrieve.
18
+ * @returns {Promise<GetSearchWordsDetailResponse>} - Success response
16
19
  * @summary: Get a Search Keywords Details
17
20
  * @description: Get the details of a words by its `id`. If successful, returns a Collection resource in the response body specified in `GetSearchWordsDetailResponseSchema`
18
21
  */
19
- getSearchKeywords({ id } = {}) {
22
+ async getSearchKeywords({ id } = {}) {
20
23
  const { error } = CatalogValidator.getSearchKeywords().validate(
21
24
  {
22
25
  id,
@@ -35,19 +38,39 @@ class Catalog {
35
38
  { abortEarly: false, allowUnknown: false }
36
39
  );
37
40
  if (warrning) {
38
- console.log("Parameter Validation warrnings for getSearchKeywords");
39
- console.log(warrning);
41
+ Logger({
42
+ level: "WARN",
43
+ message: "Parameter Validation warrnings for getSearchKeywords",
44
+ });
45
+ Logger({ level: "WARN", message: warrning });
40
46
  }
41
47
 
42
48
  const query_params = {};
43
49
 
44
- return PlatformAPIClient.execute(
50
+ const response = await PlatformAPIClient.execute(
45
51
  this.config,
46
52
  "get",
47
53
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/${id}/`,
48
54
  query_params,
49
55
  undefined
50
56
  );
57
+
58
+ const {
59
+ error: res_error,
60
+ } = CatalogModel.GetSearchWordsDetailResponse().validate(response, {
61
+ abortEarly: false,
62
+ allowUnknown: false,
63
+ });
64
+
65
+ if (res_error) {
66
+ Logger({
67
+ level: "WARN",
68
+ message: "Response Validation Warnnings for getSearchKeywords",
69
+ });
70
+ Logger({ level: "WARN", message: res_error });
71
+ }
72
+
73
+ return response;
51
74
  }
52
75
 
53
76
  /**
@@ -55,10 +78,11 @@ class Catalog {
55
78
  * @param {string} arg.id - A `id` is a unique identifier for a particular
56
79
  * detail. Pass the `id` of the keywords which you want to delete.
57
80
  * @param {CreateSearchKeyword} arg.body
81
+ * @returns {Promise<GetSearchWordsData>} - Success response
58
82
  * @summary: Update Search Keyword
59
83
  * @description: Update Search Keyword by its id. On successful request, returns the updated collection
60
84
  */
61
- updateSearchKeywords({ id, body } = {}) {
85
+ async updateSearchKeywords({ id, body } = {}) {
62
86
  const { error } = CatalogValidator.updateSearchKeywords().validate(
63
87
  {
64
88
  id,
@@ -81,29 +105,50 @@ class Catalog {
81
105
  { abortEarly: false, allowUnknown: false }
82
106
  );
83
107
  if (warrning) {
84
- console.log("Parameter Validation warrnings for updateSearchKeywords");
85
- console.log(warrning);
108
+ Logger({
109
+ level: "WARN",
110
+ message: "Parameter Validation warrnings for updateSearchKeywords",
111
+ });
112
+ Logger({ level: "WARN", message: warrning });
86
113
  }
87
114
 
88
115
  const query_params = {};
89
116
 
90
- return PlatformAPIClient.execute(
117
+ const response = await PlatformAPIClient.execute(
91
118
  this.config,
92
119
  "put",
93
120
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/${id}/`,
94
121
  query_params,
95
122
  body
96
123
  );
124
+
125
+ const {
126
+ error: res_error,
127
+ } = CatalogModel.GetSearchWordsData().validate(response, {
128
+ abortEarly: false,
129
+ allowUnknown: false,
130
+ });
131
+
132
+ if (res_error) {
133
+ Logger({
134
+ level: "WARN",
135
+ message: "Response Validation Warnnings for updateSearchKeywords",
136
+ });
137
+ Logger({ level: "WARN", message: res_error });
138
+ }
139
+
140
+ return response;
97
141
  }
98
142
 
99
143
  /**
100
144
  * @param {Object} arg - Arg object.
101
145
  * @param {string} arg.id - A `id` is a unique identifier for a particular
102
146
  * detail. Pass the `id` of the keywords which you want to delete.
147
+ * @returns {Promise<DeleteResponse>} - Success response
103
148
  * @summary: Delete a Search Keywords
104
149
  * @description: Delete a keywords by it's id. Returns an object that tells whether the keywords was deleted successfully
105
150
  */
106
- deleteSearchKeywords({ id } = {}) {
151
+ async deleteSearchKeywords({ id } = {}) {
107
152
  const { error } = CatalogValidator.deleteSearchKeywords().validate(
108
153
  {
109
154
  id,
@@ -124,29 +169,53 @@ class Catalog {
124
169
  { abortEarly: false, allowUnknown: false }
125
170
  );
126
171
  if (warrning) {
127
- console.log("Parameter Validation warrnings for deleteSearchKeywords");
128
- console.log(warrning);
172
+ Logger({
173
+ level: "WARN",
174
+ message: "Parameter Validation warrnings for deleteSearchKeywords",
175
+ });
176
+ Logger({ level: "WARN", message: warrning });
129
177
  }
130
178
 
131
179
  const query_params = {};
132
180
 
133
- return PlatformAPIClient.execute(
181
+ const response = await PlatformAPIClient.execute(
134
182
  this.config,
135
183
  "delete",
136
184
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/${id}/`,
137
185
  query_params,
138
186
  undefined
139
187
  );
188
+
189
+ const {
190
+ error: res_error,
191
+ } = CatalogModel.DeleteResponse().validate(response, {
192
+ abortEarly: false,
193
+ allowUnknown: false,
194
+ });
195
+
196
+ if (res_error) {
197
+ Logger({
198
+ level: "WARN",
199
+ message: "Response Validation Warnnings for deleteSearchKeywords",
200
+ });
201
+ Logger({ level: "WARN", message: res_error });
202
+ }
203
+
204
+ return response;
140
205
  }
141
206
 
142
207
  /**
143
208
  * @param {Object} arg - Arg object.
144
- * @summary: List all Search Custom Keyword Listing
145
- * @description: Custom Search Keyword allows you to map conditions with keywords to give you the ultimate results
209
+ * @param {CreateSearchKeyword} arg.body
210
+ * @returns {Promise<GetSearchWordsData>} - Success response
211
+ * @summary: Add a Custom Search Keywords
212
+ * @description: Create a Custom Search Keywords. See `CreateSearchKeywordSchema` for the list of attributes needed to create a mapping and /collections/query-options for the available options to create a rule. On successful request, returns a paginated list of collections specified in `CreateSearchKeywordSchema`
146
213
  */
147
- getAllSearchKeyword({} = {}) {
148
- const { error } = CatalogValidator.getAllSearchKeyword().validate(
149
- {},
214
+ async createCustomKeyword({ body } = {}) {
215
+ const { error } = CatalogValidator.createCustomKeyword().validate(
216
+ {
217
+ body,
218
+ },
150
219
  { abortEarly: false, allowUnknown: true }
151
220
  );
152
221
  if (error) {
@@ -154,37 +223,57 @@ class Catalog {
154
223
  }
155
224
 
156
225
  // Showing warrnings if extra unknown parameters are found
157
- const { error: warrning } = CatalogValidator.getAllSearchKeyword().validate(
158
- {},
226
+ const { error: warrning } = CatalogValidator.createCustomKeyword().validate(
227
+ {
228
+ body,
229
+ },
159
230
  { abortEarly: false, allowUnknown: false }
160
231
  );
161
232
  if (warrning) {
162
- console.log("Parameter Validation warrnings for getAllSearchKeyword");
163
- console.log(warrning);
233
+ Logger({
234
+ level: "WARN",
235
+ message: "Parameter Validation warrnings for createCustomKeyword",
236
+ });
237
+ Logger({ level: "WARN", message: warrning });
164
238
  }
165
239
 
166
240
  const query_params = {};
167
241
 
168
- return PlatformAPIClient.execute(
242
+ const response = await PlatformAPIClient.execute(
169
243
  this.config,
170
- "get",
244
+ "post",
171
245
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/`,
172
246
  query_params,
173
- undefined
247
+ body
174
248
  );
249
+
250
+ const {
251
+ error: res_error,
252
+ } = CatalogModel.GetSearchWordsData().validate(response, {
253
+ abortEarly: false,
254
+ allowUnknown: false,
255
+ });
256
+
257
+ if (res_error) {
258
+ Logger({
259
+ level: "WARN",
260
+ message: "Response Validation Warnnings for createCustomKeyword",
261
+ });
262
+ Logger({ level: "WARN", message: res_error });
263
+ }
264
+
265
+ return response;
175
266
  }
176
267
 
177
268
  /**
178
269
  * @param {Object} arg - Arg object.
179
- * @param {CreateSearchKeyword} arg.body
180
- * @summary: Add a Custom Search Keywords
181
- * @description: Create a Custom Search Keywords. See `CreateSearchKeywordSchema` for the list of attributes needed to create a mapping and /collections/query-options for the available options to create a rule. On successful request, returns a paginated list of collections specified in `CreateSearchKeywordSchema`
270
+ * @returns {Promise<GetSearchWordsResponse>} - Success response
271
+ * @summary: List all Search Custom Keyword Listing
272
+ * @description: Custom Search Keyword allows you to map conditions with keywords to give you the ultimate results
182
273
  */
183
- createCustomKeyword({ body } = {}) {
184
- const { error } = CatalogValidator.createCustomKeyword().validate(
185
- {
186
- body,
187
- },
274
+ async getAllSearchKeyword({} = {}) {
275
+ const { error } = CatalogValidator.getAllSearchKeyword().validate(
276
+ {},
188
277
  { abortEarly: false, allowUnknown: true }
189
278
  );
190
279
  if (error) {
@@ -192,36 +281,55 @@ class Catalog {
192
281
  }
193
282
 
194
283
  // Showing warrnings if extra unknown parameters are found
195
- const { error: warrning } = CatalogValidator.createCustomKeyword().validate(
196
- {
197
- body,
198
- },
284
+ const { error: warrning } = CatalogValidator.getAllSearchKeyword().validate(
285
+ {},
199
286
  { abortEarly: false, allowUnknown: false }
200
287
  );
201
288
  if (warrning) {
202
- console.log("Parameter Validation warrnings for createCustomKeyword");
203
- console.log(warrning);
289
+ Logger({
290
+ level: "WARN",
291
+ message: "Parameter Validation warrnings for getAllSearchKeyword",
292
+ });
293
+ Logger({ level: "WARN", message: warrning });
204
294
  }
205
295
 
206
296
  const query_params = {};
207
297
 
208
- return PlatformAPIClient.execute(
298
+ const response = await PlatformAPIClient.execute(
209
299
  this.config,
210
- "post",
300
+ "get",
211
301
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/`,
212
302
  query_params,
213
- body
303
+ undefined
214
304
  );
305
+
306
+ const {
307
+ error: res_error,
308
+ } = CatalogModel.GetSearchWordsResponse().validate(response, {
309
+ abortEarly: false,
310
+ allowUnknown: false,
311
+ });
312
+
313
+ if (res_error) {
314
+ Logger({
315
+ level: "WARN",
316
+ message: "Response Validation Warnnings for getAllSearchKeyword",
317
+ });
318
+ Logger({ level: "WARN", message: res_error });
319
+ }
320
+
321
+ return response;
215
322
  }
216
323
 
217
324
  /**
218
325
  * @param {Object} arg - Arg object.
219
326
  * @param {string} arg.id - A `id` is a unique identifier for a particular
220
327
  * detail. Pass the `id` of the keywords which you want to retrieve.
328
+ * @returns {Promise<GetAutocompleteWordsResponse>} - Success response
221
329
  * @summary: Get a Autocomplete Keywords Details
222
330
  * @description: Get the details of a words by its `id`. If successful, returns a keywords resource in the response body specified in `GetAutocompleteWordsResponseSchema`
223
331
  */
224
- getAutocompleteKeywordDetail({ id } = {}) {
332
+ async getAutocompleteKeywordDetail({ id } = {}) {
225
333
  const { error } = CatalogValidator.getAutocompleteKeywordDetail().validate(
226
334
  {
227
335
  id,
@@ -242,21 +350,41 @@ class Catalog {
242
350
  { abortEarly: false, allowUnknown: false }
243
351
  );
244
352
  if (warrning) {
245
- console.log(
246
- "Parameter Validation warrnings for getAutocompleteKeywordDetail"
247
- );
248
- console.log(warrning);
353
+ Logger({
354
+ level: "WARN",
355
+ message:
356
+ "Parameter Validation warrnings for getAutocompleteKeywordDetail",
357
+ });
358
+ Logger({ level: "WARN", message: warrning });
249
359
  }
250
360
 
251
361
  const query_params = {};
252
362
 
253
- return PlatformAPIClient.execute(
363
+ const response = await PlatformAPIClient.execute(
254
364
  this.config,
255
365
  "get",
256
366
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/${id}/`,
257
367
  query_params,
258
368
  undefined
259
369
  );
370
+
371
+ const {
372
+ error: res_error,
373
+ } = CatalogModel.GetAutocompleteWordsResponse().validate(response, {
374
+ abortEarly: false,
375
+ allowUnknown: false,
376
+ });
377
+
378
+ if (res_error) {
379
+ Logger({
380
+ level: "WARN",
381
+ message:
382
+ "Response Validation Warnnings for getAutocompleteKeywordDetail",
383
+ });
384
+ Logger({ level: "WARN", message: res_error });
385
+ }
386
+
387
+ return response;
260
388
  }
261
389
 
262
390
  /**
@@ -264,10 +392,11 @@ class Catalog {
264
392
  * @param {string} arg.id - A `id` is a unique identifier for a particular
265
393
  * detail. Pass the `id` of the keywords which you want to delete.
266
394
  * @param {CreateAutocompleteKeyword} arg.body
395
+ * @returns {Promise<GetAutocompleteWordsResponse>} - Success response
267
396
  * @summary: Create & Update Autocomplete Keyword
268
397
  * @description: Update a mapping by it's id. On successful request, returns the updated Keyword mapping
269
398
  */
270
- updateAutocompleteKeyword({ id, body } = {}) {
399
+ async updateAutocompleteKeyword({ id, body } = {}) {
271
400
  const { error } = CatalogValidator.updateAutocompleteKeyword().validate(
272
401
  {
273
402
  id,
@@ -290,31 +419,50 @@ class Catalog {
290
419
  { abortEarly: false, allowUnknown: false }
291
420
  );
292
421
  if (warrning) {
293
- console.log(
294
- "Parameter Validation warrnings for updateAutocompleteKeyword"
295
- );
296
- console.log(warrning);
422
+ Logger({
423
+ level: "WARN",
424
+ message: "Parameter Validation warrnings for updateAutocompleteKeyword",
425
+ });
426
+ Logger({ level: "WARN", message: warrning });
297
427
  }
298
428
 
299
429
  const query_params = {};
300
430
 
301
- return PlatformAPIClient.execute(
431
+ const response = await PlatformAPIClient.execute(
302
432
  this.config,
303
433
  "put",
304
434
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/${id}/`,
305
435
  query_params,
306
436
  body
307
437
  );
438
+
439
+ const {
440
+ error: res_error,
441
+ } = CatalogModel.GetAutocompleteWordsResponse().validate(response, {
442
+ abortEarly: false,
443
+ allowUnknown: false,
444
+ });
445
+
446
+ if (res_error) {
447
+ Logger({
448
+ level: "WARN",
449
+ message: "Response Validation Warnnings for updateAutocompleteKeyword",
450
+ });
451
+ Logger({ level: "WARN", message: res_error });
452
+ }
453
+
454
+ return response;
308
455
  }
309
456
 
310
457
  /**
311
458
  * @param {Object} arg - Arg object.
312
459
  * @param {string} arg.id - A `id` is a unique identifier for a particular
313
460
  * detail. Pass the `id` of the keywords which you want to delete.
461
+ * @returns {Promise<DeleteResponse>} - Success response
314
462
  * @summary: Delete a Autocomplete Keywords
315
463
  * @description: Delete a keywords by it's id. Returns an object that tells whether the keywords was deleted successfully
316
464
  */
317
- deleteAutocompleteKeyword({ id } = {}) {
465
+ async deleteAutocompleteKeyword({ id } = {}) {
318
466
  const { error } = CatalogValidator.deleteAutocompleteKeyword().validate(
319
467
  {
320
468
  id,
@@ -335,31 +483,53 @@ class Catalog {
335
483
  { abortEarly: false, allowUnknown: false }
336
484
  );
337
485
  if (warrning) {
338
- console.log(
339
- "Parameter Validation warrnings for deleteAutocompleteKeyword"
340
- );
341
- console.log(warrning);
486
+ Logger({
487
+ level: "WARN",
488
+ message: "Parameter Validation warrnings for deleteAutocompleteKeyword",
489
+ });
490
+ Logger({ level: "WARN", message: warrning });
342
491
  }
343
492
 
344
493
  const query_params = {};
345
494
 
346
- return PlatformAPIClient.execute(
495
+ const response = await PlatformAPIClient.execute(
347
496
  this.config,
348
497
  "delete",
349
498
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/${id}/`,
350
499
  query_params,
351
500
  undefined
352
501
  );
502
+
503
+ const {
504
+ error: res_error,
505
+ } = CatalogModel.DeleteResponse().validate(response, {
506
+ abortEarly: false,
507
+ allowUnknown: false,
508
+ });
509
+
510
+ if (res_error) {
511
+ Logger({
512
+ level: "WARN",
513
+ message: "Response Validation Warnnings for deleteAutocompleteKeyword",
514
+ });
515
+ Logger({ level: "WARN", message: res_error });
516
+ }
517
+
518
+ return response;
353
519
  }
354
520
 
355
521
  /**
356
522
  * @param {Object} arg - Arg object.
357
- * @summary: List all Autocomplete Keyword Listing
358
- * @description: Custom Autocomplete Keyword allows you to map conditions with keywords to give you the ultimate results
523
+ * @param {CreateAutocompleteKeyword} arg.body
524
+ * @returns {Promise<CreateAutocompleteWordsResponse>} - Success response
525
+ * @summary: Add a Custom Autocomplete Keywords
526
+ * @description: Create a Custom Autocomplete Keywords. See `CreateAutocompleteKeywordSchema` for the list of attributes needed to create a mapping and /collections/query-options for the available options to create a rule. On successful request, returns a paginated list of collections specified in `CreateAutocompleteKeywordSchema`
359
527
  */
360
- getAutocompleteConfig({} = {}) {
361
- const { error } = CatalogValidator.getAutocompleteConfig().validate(
362
- {},
528
+ async createCustomAutocompleteRule({ body } = {}) {
529
+ const { error } = CatalogValidator.createCustomAutocompleteRule().validate(
530
+ {
531
+ body,
532
+ },
363
533
  { abortEarly: false, allowUnknown: true }
364
534
  );
365
535
  if (error) {
@@ -369,37 +539,59 @@ class Catalog {
369
539
  // Showing warrnings if extra unknown parameters are found
370
540
  const {
371
541
  error: warrning,
372
- } = CatalogValidator.getAutocompleteConfig().validate(
373
- {},
542
+ } = CatalogValidator.createCustomAutocompleteRule().validate(
543
+ {
544
+ body,
545
+ },
374
546
  { abortEarly: false, allowUnknown: false }
375
547
  );
376
548
  if (warrning) {
377
- console.log("Parameter Validation warrnings for getAutocompleteConfig");
378
- console.log(warrning);
549
+ Logger({
550
+ level: "WARN",
551
+ message:
552
+ "Parameter Validation warrnings for createCustomAutocompleteRule",
553
+ });
554
+ Logger({ level: "WARN", message: warrning });
379
555
  }
380
556
 
381
557
  const query_params = {};
382
558
 
383
- return PlatformAPIClient.execute(
559
+ const response = await PlatformAPIClient.execute(
384
560
  this.config,
385
- "get",
561
+ "post",
386
562
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/`,
387
563
  query_params,
388
- undefined
564
+ body
389
565
  );
566
+
567
+ const {
568
+ error: res_error,
569
+ } = CatalogModel.CreateAutocompleteWordsResponse().validate(response, {
570
+ abortEarly: false,
571
+ allowUnknown: false,
572
+ });
573
+
574
+ if (res_error) {
575
+ Logger({
576
+ level: "WARN",
577
+ message:
578
+ "Response Validation Warnnings for createCustomAutocompleteRule",
579
+ });
580
+ Logger({ level: "WARN", message: res_error });
581
+ }
582
+
583
+ return response;
390
584
  }
391
585
 
392
586
  /**
393
587
  * @param {Object} arg - Arg object.
394
- * @param {CreateAutocompleteKeyword} arg.body
395
- * @summary: Add a Custom Autocomplete Keywords
396
- * @description: Create a Custom Autocomplete Keywords. See `CreateAutocompleteKeywordSchema` for the list of attributes needed to create a mapping and /collections/query-options for the available options to create a rule. On successful request, returns a paginated list of collections specified in `CreateAutocompleteKeywordSchema`
588
+ * @returns {Promise<GetAutocompleteWordsResponse>} - Success response
589
+ * @summary: List all Autocomplete Keyword Listing
590
+ * @description: Custom Autocomplete Keyword allows you to map conditions with keywords to give you the ultimate results
397
591
  */
398
- createCustomAutocompleteRule({ body } = {}) {
399
- const { error } = CatalogValidator.createCustomAutocompleteRule().validate(
400
- {
401
- body,
402
- },
592
+ async getAutocompleteConfig({} = {}) {
593
+ const { error } = CatalogValidator.getAutocompleteConfig().validate(
594
+ {},
403
595
  { abortEarly: false, allowUnknown: true }
404
596
  );
405
597
  if (error) {
@@ -409,37 +601,54 @@ class Catalog {
409
601
  // Showing warrnings if extra unknown parameters are found
410
602
  const {
411
603
  error: warrning,
412
- } = CatalogValidator.createCustomAutocompleteRule().validate(
413
- {
414
- body,
415
- },
604
+ } = CatalogValidator.getAutocompleteConfig().validate(
605
+ {},
416
606
  { abortEarly: false, allowUnknown: false }
417
607
  );
418
608
  if (warrning) {
419
- console.log(
420
- "Parameter Validation warrnings for createCustomAutocompleteRule"
421
- );
422
- console.log(warrning);
609
+ Logger({
610
+ level: "WARN",
611
+ message: "Parameter Validation warrnings for getAutocompleteConfig",
612
+ });
613
+ Logger({ level: "WARN", message: warrning });
423
614
  }
424
615
 
425
616
  const query_params = {};
426
617
 
427
- return PlatformAPIClient.execute(
618
+ const response = await PlatformAPIClient.execute(
428
619
  this.config,
429
- "post",
620
+ "get",
430
621
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/`,
431
622
  query_params,
432
- body
623
+ undefined
433
624
  );
625
+
626
+ const {
627
+ error: res_error,
628
+ } = CatalogModel.GetAutocompleteWordsResponse().validate(response, {
629
+ abortEarly: false,
630
+ allowUnknown: false,
631
+ });
632
+
633
+ if (res_error) {
634
+ Logger({
635
+ level: "WARN",
636
+ message: "Response Validation Warnnings for getAutocompleteConfig",
637
+ });
638
+ Logger({ level: "WARN", message: res_error });
639
+ }
640
+
641
+ return response;
434
642
  }
435
643
 
436
644
  /**
437
645
  * @param {Object} arg - Arg object.
438
646
  * @param {string} arg.itemId - Product id for a particular product.
647
+ * @returns {Promise<OwnerAppItemResponse>} - Success response
439
648
  * @summary: Get company application product data.
440
649
  * @description: Products are the core resource of an application. If successful, returns a Company Application Product resource in the response body depending upon filter sent.
441
650
  */
442
- getAppProduct({ itemId } = {}) {
651
+ async getAppProduct({ itemId } = {}) {
443
652
  const { error } = CatalogValidator.getAppProduct().validate(
444
653
  {
445
654
  itemId,
@@ -458,29 +667,50 @@ class Catalog {
458
667
  { abortEarly: false, allowUnknown: false }
459
668
  );
460
669
  if (warrning) {
461
- console.log("Parameter Validation warrnings for getAppProduct");
462
- console.log(warrning);
670
+ Logger({
671
+ level: "WARN",
672
+ message: "Parameter Validation warrnings for getAppProduct",
673
+ });
674
+ Logger({ level: "WARN", message: warrning });
463
675
  }
464
676
 
465
677
  const query_params = {};
466
678
 
467
- return PlatformAPIClient.execute(
679
+ const response = await PlatformAPIClient.execute(
468
680
  this.config,
469
681
  "get",
470
682
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product/${itemId}/`,
471
683
  query_params,
472
684
  undefined
473
685
  );
686
+
687
+ const {
688
+ error: res_error,
689
+ } = CatalogModel.OwnerAppItemResponse().validate(response, {
690
+ abortEarly: false,
691
+ allowUnknown: false,
692
+ });
693
+
694
+ if (res_error) {
695
+ Logger({
696
+ level: "WARN",
697
+ message: "Response Validation Warnnings for getAppProduct",
698
+ });
699
+ Logger({ level: "WARN", message: res_error });
700
+ }
701
+
702
+ return response;
474
703
  }
475
704
 
476
705
  /**
477
706
  * @param {Object} arg - Arg object.
478
707
  * @param {string} arg.itemId - Product id for which the custom_meta is associated.
479
708
  * @param {ApplicationItemMeta} arg.body
709
+ * @returns {Promise<SuccessResponse1>} - Success response
480
710
  * @summary: Update a single custom meta.
481
711
  * @description: This API helps to update data associated to a item custom meta.
482
712
  */
483
- updateAppProduct({ itemId, body } = {}) {
713
+ async updateAppProduct({ itemId, body } = {}) {
484
714
  const { error } = CatalogValidator.updateAppProduct().validate(
485
715
  {
486
716
  itemId,
@@ -501,19 +731,39 @@ class Catalog {
501
731
  { abortEarly: false, allowUnknown: false }
502
732
  );
503
733
  if (warrning) {
504
- console.log("Parameter Validation warrnings for updateAppProduct");
505
- console.log(warrning);
734
+ Logger({
735
+ level: "WARN",
736
+ message: "Parameter Validation warrnings for updateAppProduct",
737
+ });
738
+ Logger({ level: "WARN", message: warrning });
506
739
  }
507
740
 
508
741
  const query_params = {};
509
742
 
510
- return PlatformAPIClient.execute(
743
+ const response = await PlatformAPIClient.execute(
511
744
  this.config,
512
745
  "patch",
513
746
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product/${itemId}/`,
514
747
  query_params,
515
748
  body
516
749
  );
750
+
751
+ const {
752
+ error: res_error,
753
+ } = CatalogModel.SuccessResponse1().validate(response, {
754
+ abortEarly: false,
755
+ allowUnknown: false,
756
+ });
757
+
758
+ if (res_error) {
759
+ Logger({
760
+ level: "WARN",
761
+ message: "Response Validation Warnnings for updateAppProduct",
762
+ });
763
+ Logger({ level: "WARN", message: res_error });
764
+ }
765
+
766
+ return response;
517
767
  }
518
768
 
519
769
  /**
@@ -522,10 +772,11 @@ class Catalog {
522
772
  * defines a specific type of configuration.
523
773
  * @param {string} [arg.templateSlug] - Get configuration list filtered by
524
774
  * `template_slug` string. This is for the details and comparision groups.
775
+ * @returns {Promise<GetConfigMetadataResponse>} - Success response
525
776
  * @summary: Get configuration metadata details for catalog for admin panel
526
777
  * @description: Get the configuraion metadata details for catalog.
527
778
  */
528
- getConfigurationMetadata({ configType, templateSlug } = {}) {
779
+ async getConfigurationMetadata({ configType, templateSlug } = {}) {
529
780
  const { error } = CatalogValidator.getConfigurationMetadata().validate(
530
781
  {
531
782
  configType,
@@ -548,22 +799,107 @@ class Catalog {
548
799
  { abortEarly: false, allowUnknown: false }
549
800
  );
550
801
  if (warrning) {
551
- console.log(
552
- "Parameter Validation warrnings for getConfigurationMetadata"
553
- );
554
- console.log(warrning);
802
+ Logger({
803
+ level: "WARN",
804
+ message: "Parameter Validation warrnings for getConfigurationMetadata",
805
+ });
806
+ Logger({ level: "WARN", message: warrning });
555
807
  }
556
808
 
557
809
  const query_params = {};
558
810
  query_params["template_slug"] = templateSlug;
559
811
 
560
- return PlatformAPIClient.execute(
812
+ const response = await PlatformAPIClient.execute(
561
813
  this.config,
562
814
  "get",
563
815
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/metadata/`,
564
816
  query_params,
565
817
  undefined
566
818
  );
819
+
820
+ const {
821
+ error: res_error,
822
+ } = CatalogModel.GetConfigMetadataResponse().validate(response, {
823
+ abortEarly: false,
824
+ allowUnknown: false,
825
+ });
826
+
827
+ if (res_error) {
828
+ Logger({
829
+ level: "WARN",
830
+ message: "Response Validation Warnnings for getConfigurationMetadata",
831
+ });
832
+ Logger({ level: "WARN", message: res_error });
833
+ }
834
+
835
+ return response;
836
+ }
837
+
838
+ /**
839
+ * @param {Object} arg - Arg object.
840
+ * @param {string} arg.configType - A `config_type` is a unique identifier
841
+ * for a particular group configuration type.
842
+ * @param {AppConfigurationDetail} arg.body
843
+ * @returns {Promise<AppConfigurationDetail>} - Success response
844
+ * @summary: Create configuration for Group config types.
845
+ * @description: Create configuration for Group config types.
846
+ */
847
+ async createGroupConfiguration({ configType, body } = {}) {
848
+ const { error } = CatalogValidator.createGroupConfiguration().validate(
849
+ {
850
+ configType,
851
+ body,
852
+ },
853
+ { abortEarly: false, allowUnknown: true }
854
+ );
855
+ if (error) {
856
+ return Promise.reject(new FDKClientValidationError(error));
857
+ }
858
+
859
+ // Showing warrnings if extra unknown parameters are found
860
+ const {
861
+ error: warrning,
862
+ } = CatalogValidator.createGroupConfiguration().validate(
863
+ {
864
+ configType,
865
+ body,
866
+ },
867
+ { abortEarly: false, allowUnknown: false }
868
+ );
869
+ if (warrning) {
870
+ Logger({
871
+ level: "WARN",
872
+ message: "Parameter Validation warrnings for createGroupConfiguration",
873
+ });
874
+ Logger({ level: "WARN", message: warrning });
875
+ }
876
+
877
+ const query_params = {};
878
+
879
+ const response = await PlatformAPIClient.execute(
880
+ this.config,
881
+ "post",
882
+ `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups`,
883
+ query_params,
884
+ body
885
+ );
886
+
887
+ const {
888
+ error: res_error,
889
+ } = CatalogModel.AppConfigurationDetail().validate(response, {
890
+ abortEarly: false,
891
+ allowUnknown: false,
892
+ });
893
+
894
+ if (res_error) {
895
+ Logger({
896
+ level: "WARN",
897
+ message: "Response Validation Warnnings for createGroupConfiguration",
898
+ });
899
+ Logger({ level: "WARN", message: res_error });
900
+ }
901
+
902
+ return response;
567
903
  }
568
904
 
569
905
  /**
@@ -577,10 +913,11 @@ class Catalog {
577
913
  * @param {string} [arg.search] - Get configuration list filtered by `search` string.
578
914
  * @param {string} [arg.templateSlug] - Get configuration list filtered by
579
915
  * `template_slug` string. This is for the details and comparision groups.
916
+ * @returns {Promise<GetConfigResponse>} - Success response
580
917
  * @summary: Get the details of the application configured configurations of group config types.
581
918
  * @description: Get the details of the application configured configurations of group config types.
582
919
  */
583
- getGroupConfigurations({
920
+ async getGroupConfigurations({
584
921
  configType,
585
922
  pageNo,
586
923
  pageSize,
@@ -615,8 +952,11 @@ class Catalog {
615
952
  { abortEarly: false, allowUnknown: false }
616
953
  );
617
954
  if (warrning) {
618
- console.log("Parameter Validation warrnings for getGroupConfigurations");
619
- console.log(warrning);
955
+ Logger({
956
+ level: "WARN",
957
+ message: "Parameter Validation warrnings for getGroupConfigurations",
958
+ });
959
+ Logger({ level: "WARN", message: warrning });
620
960
  }
621
961
 
622
962
  const query_params = {};
@@ -625,27 +965,48 @@ class Catalog {
625
965
  query_params["search"] = search;
626
966
  query_params["template_slug"] = templateSlug;
627
967
 
628
- return PlatformAPIClient.execute(
968
+ const response = await PlatformAPIClient.execute(
629
969
  this.config,
630
970
  "get",
631
971
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups`,
632
972
  query_params,
633
973
  undefined
634
974
  );
975
+
976
+ const {
977
+ error: res_error,
978
+ } = CatalogModel.GetConfigResponse().validate(response, {
979
+ abortEarly: false,
980
+ allowUnknown: false,
981
+ });
982
+
983
+ if (res_error) {
984
+ Logger({
985
+ level: "WARN",
986
+ message: "Response Validation Warnnings for getGroupConfigurations",
987
+ });
988
+ Logger({ level: "WARN", message: res_error });
989
+ }
990
+
991
+ return response;
635
992
  }
636
993
 
637
994
  /**
638
995
  * @param {Object} arg - Arg object.
639
996
  * @param {string} arg.configType - A `config_type` is a unique identifier
640
997
  * for a particular group configuration type.
998
+ * @param {string} arg.groupSlug - A `group_slug` is a unique identifier of
999
+ * a particular configuration.
641
1000
  * @param {AppConfigurationDetail} arg.body
642
- * @summary: Create configuration for Group config types.
643
- * @description: Create configuration for Group config types.
1001
+ * @returns {Promise<AppConfigurationDetail>} - Success response
1002
+ * @summary: Update the group configurations for the application.
1003
+ * @description: Update the group configurations for the application.
644
1004
  */
645
- createGroupConfiguration({ configType, body } = {}) {
646
- const { error } = CatalogValidator.createGroupConfiguration().validate(
1005
+ async updateGroupConfiguration({ configType, groupSlug, body } = {}) {
1006
+ const { error } = CatalogValidator.updateGroupConfiguration().validate(
647
1007
  {
648
1008
  configType,
1009
+ groupSlug,
649
1010
  body,
650
1011
  },
651
1012
  { abortEarly: false, allowUnknown: true }
@@ -657,29 +1018,48 @@ class Catalog {
657
1018
  // Showing warrnings if extra unknown parameters are found
658
1019
  const {
659
1020
  error: warrning,
660
- } = CatalogValidator.createGroupConfiguration().validate(
1021
+ } = CatalogValidator.updateGroupConfiguration().validate(
661
1022
  {
662
1023
  configType,
1024
+ groupSlug,
663
1025
  body,
664
1026
  },
665
1027
  { abortEarly: false, allowUnknown: false }
666
1028
  );
667
1029
  if (warrning) {
668
- console.log(
669
- "Parameter Validation warrnings for createGroupConfiguration"
670
- );
671
- console.log(warrning);
1030
+ Logger({
1031
+ level: "WARN",
1032
+ message: "Parameter Validation warrnings for updateGroupConfiguration",
1033
+ });
1034
+ Logger({ level: "WARN", message: warrning });
672
1035
  }
673
1036
 
674
1037
  const query_params = {};
675
1038
 
676
- return PlatformAPIClient.execute(
1039
+ const response = await PlatformAPIClient.execute(
677
1040
  this.config,
678
- "post",
679
- `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups`,
1041
+ "put",
1042
+ `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups/${groupSlug}`,
680
1043
  query_params,
681
1044
  body
682
1045
  );
1046
+
1047
+ const {
1048
+ error: res_error,
1049
+ } = CatalogModel.AppConfigurationDetail().validate(response, {
1050
+ abortEarly: false,
1051
+ allowUnknown: false,
1052
+ });
1053
+
1054
+ if (res_error) {
1055
+ Logger({
1056
+ level: "WARN",
1057
+ message: "Response Validation Warnnings for updateGroupConfiguration",
1058
+ });
1059
+ Logger({ level: "WARN", message: res_error });
1060
+ }
1061
+
1062
+ return response;
683
1063
  }
684
1064
 
685
1065
  /**
@@ -688,16 +1068,15 @@ class Catalog {
688
1068
  * for a particular group configuration type.
689
1069
  * @param {string} arg.groupSlug - A `group_slug` is a unique identifier of
690
1070
  * a particular configuration.
691
- * @param {AppConfigurationDetail} arg.body
692
- * @summary: Update the group configurations for the application.
693
- * @description: Update the group configurations for the application.
1071
+ * @returns {Promise<ConfigSuccessResponse>} - Success response
1072
+ * @summary: Delete configuration of the product config type of the application.
1073
+ * @description: Delete configuration of the product config type of the application.
694
1074
  */
695
- updateGroupConfiguration({ configType, groupSlug, body } = {}) {
696
- const { error } = CatalogValidator.updateGroupConfiguration().validate(
1075
+ async deleteGroupConfiguration({ configType, groupSlug } = {}) {
1076
+ const { error } = CatalogValidator.deleteGroupConfiguration().validate(
697
1077
  {
698
1078
  configType,
699
1079
  groupSlug,
700
- body,
701
1080
  },
702
1081
  { abortEarly: false, allowUnknown: true }
703
1082
  );
@@ -708,46 +1087,63 @@ class Catalog {
708
1087
  // Showing warrnings if extra unknown parameters are found
709
1088
  const {
710
1089
  error: warrning,
711
- } = CatalogValidator.updateGroupConfiguration().validate(
1090
+ } = CatalogValidator.deleteGroupConfiguration().validate(
712
1091
  {
713
1092
  configType,
714
1093
  groupSlug,
715
- body,
716
1094
  },
717
1095
  { abortEarly: false, allowUnknown: false }
718
1096
  );
719
1097
  if (warrning) {
720
- console.log(
721
- "Parameter Validation warrnings for updateGroupConfiguration"
722
- );
723
- console.log(warrning);
1098
+ Logger({
1099
+ level: "WARN",
1100
+ message: "Parameter Validation warrnings for deleteGroupConfiguration",
1101
+ });
1102
+ Logger({ level: "WARN", message: warrning });
724
1103
  }
725
1104
 
726
1105
  const query_params = {};
727
1106
 
728
- return PlatformAPIClient.execute(
1107
+ const response = await PlatformAPIClient.execute(
729
1108
  this.config,
730
- "put",
1109
+ "delete",
731
1110
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups/${groupSlug}`,
732
1111
  query_params,
733
- body
1112
+ undefined
734
1113
  );
1114
+
1115
+ const {
1116
+ error: res_error,
1117
+ } = CatalogModel.ConfigSuccessResponse().validate(response, {
1118
+ abortEarly: false,
1119
+ allowUnknown: false,
1120
+ });
1121
+
1122
+ if (res_error) {
1123
+ Logger({
1124
+ level: "WARN",
1125
+ message: "Response Validation Warnnings for deleteGroupConfiguration",
1126
+ });
1127
+ Logger({ level: "WARN", message: res_error });
1128
+ }
1129
+
1130
+ return response;
735
1131
  }
736
1132
 
737
1133
  /**
738
1134
  * @param {Object} arg - Arg object.
739
1135
  * @param {string} arg.configType - A `config_type` is a unique identifier
740
- * for a particular group configuration type.
741
- * @param {string} arg.groupSlug - A `group_slug` is a unique identifier of
742
- * a particular configuration.
743
- * @summary: Delete configuration of the product config type of the application.
744
- * @description: Delete configuration of the product config type of the application.
1136
+ * for a particular listing configuration type.
1137
+ * @param {AppConfigurationsSort} arg.body
1138
+ * @returns {Promise<AppConfigurationsSort>} - Success response
1139
+ * @summary: Add configuration for listings
1140
+ * @description: Add configuration for listing.
745
1141
  */
746
- deleteGroupConfiguration({ configType, groupSlug } = {}) {
747
- const { error } = CatalogValidator.deleteGroupConfiguration().validate(
1142
+ async createListingConfiguration({ configType, body } = {}) {
1143
+ const { error } = CatalogValidator.createListingConfiguration().validate(
748
1144
  {
749
1145
  configType,
750
- groupSlug,
1146
+ body,
751
1147
  },
752
1148
  { abortEarly: false, allowUnknown: true }
753
1149
  );
@@ -758,29 +1154,48 @@ class Catalog {
758
1154
  // Showing warrnings if extra unknown parameters are found
759
1155
  const {
760
1156
  error: warrning,
761
- } = CatalogValidator.deleteGroupConfiguration().validate(
1157
+ } = CatalogValidator.createListingConfiguration().validate(
762
1158
  {
763
1159
  configType,
764
- groupSlug,
1160
+ body,
765
1161
  },
766
1162
  { abortEarly: false, allowUnknown: false }
767
1163
  );
768
1164
  if (warrning) {
769
- console.log(
770
- "Parameter Validation warrnings for deleteGroupConfiguration"
771
- );
772
- console.log(warrning);
1165
+ Logger({
1166
+ level: "WARN",
1167
+ message:
1168
+ "Parameter Validation warrnings for createListingConfiguration",
1169
+ });
1170
+ Logger({ level: "WARN", message: warrning });
773
1171
  }
774
1172
 
775
1173
  const query_params = {};
776
1174
 
777
- return PlatformAPIClient.execute(
1175
+ const response = await PlatformAPIClient.execute(
778
1176
  this.config,
779
- "delete",
780
- `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups/${groupSlug}`,
1177
+ "post",
1178
+ `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/`,
781
1179
  query_params,
782
- undefined
1180
+ body
783
1181
  );
1182
+
1183
+ const {
1184
+ error: res_error,
1185
+ } = CatalogModel.AppConfigurationsSort().validate(response, {
1186
+ abortEarly: false,
1187
+ allowUnknown: false,
1188
+ });
1189
+
1190
+ if (res_error) {
1191
+ Logger({
1192
+ level: "WARN",
1193
+ message: "Response Validation Warnnings for createListingConfiguration",
1194
+ });
1195
+ Logger({ level: "WARN", message: res_error });
1196
+ }
1197
+
1198
+ return response;
784
1199
  }
785
1200
 
786
1201
  /**
@@ -792,10 +1207,16 @@ class Catalog {
792
1207
  * @param {number} [arg.pageSize] - Number of items to retrieve in each
793
1208
  * page. Default is 12.
794
1209
  * @param {string} [arg.search] - Get configuration list filtered by `search` string.
1210
+ * @returns {Promise<GetConfigResponse>} - Success response
795
1211
  * @summary: Get the details of the application configured configurations of listing config types.
796
1212
  * @description: Get the details of the application configured configurations of listing config types.
797
1213
  */
798
- getListingConfigurations({ configType, pageNo, pageSize, search } = {}) {
1214
+ async getListingConfigurations({
1215
+ configType,
1216
+ pageNo,
1217
+ pageSize,
1218
+ search,
1219
+ } = {}) {
799
1220
  const { error } = CatalogValidator.getListingConfigurations().validate(
800
1221
  {
801
1222
  configType,
@@ -822,10 +1243,11 @@ class Catalog {
822
1243
  { abortEarly: false, allowUnknown: false }
823
1244
  );
824
1245
  if (warrning) {
825
- console.log(
826
- "Parameter Validation warrnings for getListingConfigurations"
827
- );
828
- console.log(warrning);
1246
+ Logger({
1247
+ level: "WARN",
1248
+ message: "Parameter Validation warrnings for getListingConfigurations",
1249
+ });
1250
+ Logger({ level: "WARN", message: warrning });
829
1251
  }
830
1252
 
831
1253
  const query_params = {};
@@ -833,61 +1255,30 @@ class Catalog {
833
1255
  query_params["page_size"] = pageSize;
834
1256
  query_params["search"] = search;
835
1257
 
836
- return PlatformAPIClient.execute(
1258
+ const response = await PlatformAPIClient.execute(
837
1259
  this.config,
838
1260
  "get",
839
1261
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/`,
840
1262
  query_params,
841
1263
  undefined
842
1264
  );
843
- }
844
1265
 
845
- /**
846
- * @param {Object} arg - Arg object.
847
- * @param {string} arg.configType - A `config_type` is a unique identifier
848
- * for a particular listing configuration type.
849
- * @param {AppConfigurationsSort} arg.body
850
- * @summary: Add configuration for listings
851
- * @description: Add configuration for listing.
852
- */
853
- createListingConfiguration({ configType, body } = {}) {
854
- const { error } = CatalogValidator.createListingConfiguration().validate(
855
- {
856
- configType,
857
- body,
858
- },
859
- { abortEarly: false, allowUnknown: true }
860
- );
861
- if (error) {
862
- return Promise.reject(new FDKClientValidationError(error));
863
- }
864
-
865
- // Showing warrnings if extra unknown parameters are found
866
1266
  const {
867
- error: warrning,
868
- } = CatalogValidator.createListingConfiguration().validate(
869
- {
870
- configType,
871
- body,
872
- },
873
- { abortEarly: false, allowUnknown: false }
874
- );
875
- if (warrning) {
876
- console.log(
877
- "Parameter Validation warrnings for createListingConfiguration"
878
- );
879
- console.log(warrning);
1267
+ error: res_error,
1268
+ } = CatalogModel.GetConfigResponse().validate(response, {
1269
+ abortEarly: false,
1270
+ allowUnknown: false,
1271
+ });
1272
+
1273
+ if (res_error) {
1274
+ Logger({
1275
+ level: "WARN",
1276
+ message: "Response Validation Warnnings for getListingConfigurations",
1277
+ });
1278
+ Logger({ level: "WARN", message: res_error });
880
1279
  }
881
1280
 
882
- const query_params = {};
883
-
884
- return PlatformAPIClient.execute(
885
- this.config,
886
- "post",
887
- `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/`,
888
- query_params,
889
- body
890
- );
1281
+ return response;
891
1282
  }
892
1283
 
893
1284
  /**
@@ -897,10 +1288,11 @@ class Catalog {
897
1288
  * @param {string} arg.configId - A `config_id` is a unique identifier of a
898
1289
  * particular configuration.
899
1290
  * @param {AppConfigurationsSort} arg.body
1291
+ * @returns {Promise<AppConfigurationsSort>} - Success response
900
1292
  * @summary: Update configuration for listings
901
1293
  * @description: Update configuration for listing.
902
1294
  */
903
- updateListingConfiguration({ configType, configId, body } = {}) {
1295
+ async updateListingConfiguration({ configType, configId, body } = {}) {
904
1296
  const { error } = CatalogValidator.updateListingConfiguration().validate(
905
1297
  {
906
1298
  configType,
@@ -925,21 +1317,40 @@ class Catalog {
925
1317
  { abortEarly: false, allowUnknown: false }
926
1318
  );
927
1319
  if (warrning) {
928
- console.log(
929
- "Parameter Validation warrnings for updateListingConfiguration"
930
- );
931
- console.log(warrning);
1320
+ Logger({
1321
+ level: "WARN",
1322
+ message:
1323
+ "Parameter Validation warrnings for updateListingConfiguration",
1324
+ });
1325
+ Logger({ level: "WARN", message: warrning });
932
1326
  }
933
1327
 
934
1328
  const query_params = {};
935
1329
 
936
- return PlatformAPIClient.execute(
1330
+ const response = await PlatformAPIClient.execute(
937
1331
  this.config,
938
1332
  "put",
939
1333
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/item/${configId}/`,
940
1334
  query_params,
941
1335
  body
942
1336
  );
1337
+
1338
+ const {
1339
+ error: res_error,
1340
+ } = CatalogModel.AppConfigurationsSort().validate(response, {
1341
+ abortEarly: false,
1342
+ allowUnknown: false,
1343
+ });
1344
+
1345
+ if (res_error) {
1346
+ Logger({
1347
+ level: "WARN",
1348
+ message: "Response Validation Warnnings for updateListingConfiguration",
1349
+ });
1350
+ Logger({ level: "WARN", message: res_error });
1351
+ }
1352
+
1353
+ return response;
943
1354
  }
944
1355
 
945
1356
  /**
@@ -948,10 +1359,11 @@ class Catalog {
948
1359
  * for a particular listing configuration type.
949
1360
  * @param {string} arg.configId - A `config_id` is a unique identifier of a
950
1361
  * particular configuration.
1362
+ * @returns {Promise<ConfigSuccessResponse>} - Success response
951
1363
  * @summary: Delete configuration for listings
952
1364
  * @description: Delete configuration for listing.
953
1365
  */
954
- deleteListingConfiguration({ configType, configId } = {}) {
1366
+ async deleteListingConfiguration({ configType, configId } = {}) {
955
1367
  const { error } = CatalogValidator.deleteListingConfiguration().validate(
956
1368
  {
957
1369
  configType,
@@ -974,30 +1386,50 @@ class Catalog {
974
1386
  { abortEarly: false, allowUnknown: false }
975
1387
  );
976
1388
  if (warrning) {
977
- console.log(
978
- "Parameter Validation warrnings for deleteListingConfiguration"
979
- );
980
- console.log(warrning);
1389
+ Logger({
1390
+ level: "WARN",
1391
+ message:
1392
+ "Parameter Validation warrnings for deleteListingConfiguration",
1393
+ });
1394
+ Logger({ level: "WARN", message: warrning });
981
1395
  }
982
1396
 
983
1397
  const query_params = {};
984
1398
 
985
- return PlatformAPIClient.execute(
1399
+ const response = await PlatformAPIClient.execute(
986
1400
  this.config,
987
1401
  "delete",
988
1402
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/item/${configId}/`,
989
1403
  query_params,
990
1404
  undefined
991
1405
  );
1406
+
1407
+ const {
1408
+ error: res_error,
1409
+ } = CatalogModel.ConfigSuccessResponse().validate(response, {
1410
+ abortEarly: false,
1411
+ allowUnknown: false,
1412
+ });
1413
+
1414
+ if (res_error) {
1415
+ Logger({
1416
+ level: "WARN",
1417
+ message: "Response Validation Warnnings for deleteListingConfiguration",
1418
+ });
1419
+ Logger({ level: "WARN", message: res_error });
1420
+ }
1421
+
1422
+ return response;
992
1423
  }
993
1424
 
994
1425
  /**
995
1426
  * @param {Object} arg - Arg object.
996
1427
  * @param {AllowSingleRequest} arg.body
1428
+ * @returns {Promise<ConfigSuccessResponse>} - Success response
997
1429
  * @summary: Update allow single flag for filters of the application.
998
1430
  * @description: Update allow single flag for filters of the application.
999
1431
  */
1000
- updateAllowSingle({ body } = {}) {
1432
+ async updateAllowSingle({ body } = {}) {
1001
1433
  const { error } = CatalogValidator.updateAllowSingle().validate(
1002
1434
  {
1003
1435
  body,
@@ -1016,28 +1448,49 @@ class Catalog {
1016
1448
  { abortEarly: false, allowUnknown: false }
1017
1449
  );
1018
1450
  if (warrning) {
1019
- console.log("Parameter Validation warrnings for updateAllowSingle");
1020
- console.log(warrning);
1451
+ Logger({
1452
+ level: "WARN",
1453
+ message: "Parameter Validation warrnings for updateAllowSingle",
1454
+ });
1455
+ Logger({ level: "WARN", message: warrning });
1021
1456
  }
1022
1457
 
1023
1458
  const query_params = {};
1024
1459
 
1025
- return PlatformAPIClient.execute(
1460
+ const response = await PlatformAPIClient.execute(
1026
1461
  this.config,
1027
1462
  "post",
1028
1463
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/filter/allow_single`,
1029
1464
  query_params,
1030
1465
  body
1031
1466
  );
1467
+
1468
+ const {
1469
+ error: res_error,
1470
+ } = CatalogModel.ConfigSuccessResponse().validate(response, {
1471
+ abortEarly: false,
1472
+ allowUnknown: false,
1473
+ });
1474
+
1475
+ if (res_error) {
1476
+ Logger({
1477
+ level: "WARN",
1478
+ message: "Response Validation Warnnings for updateAllowSingle",
1479
+ });
1480
+ Logger({ level: "WARN", message: res_error });
1481
+ }
1482
+
1483
+ return response;
1032
1484
  }
1033
1485
 
1034
1486
  /**
1035
1487
  * @param {Object} arg - Arg object.
1036
1488
  * @param {DefaultKeyRequest} arg.body
1489
+ * @returns {Promise<ConfigSuccessResponse>} - Success response
1037
1490
  * @summary: Update the default sort key configuration for the application.
1038
1491
  * @description: Update the default sort key configuration for the application.
1039
1492
  */
1040
- updateDefaultSort({ body } = {}) {
1493
+ async updateDefaultSort({ body } = {}) {
1041
1494
  const { error } = CatalogValidator.updateDefaultSort().validate(
1042
1495
  {
1043
1496
  body,
@@ -1056,27 +1509,48 @@ class Catalog {
1056
1509
  { abortEarly: false, allowUnknown: false }
1057
1510
  );
1058
1511
  if (warrning) {
1059
- console.log("Parameter Validation warrnings for updateDefaultSort");
1060
- console.log(warrning);
1512
+ Logger({
1513
+ level: "WARN",
1514
+ message: "Parameter Validation warrnings for updateDefaultSort",
1515
+ });
1516
+ Logger({ level: "WARN", message: warrning });
1061
1517
  }
1062
1518
 
1063
1519
  const query_params = {};
1064
1520
 
1065
- return PlatformAPIClient.execute(
1521
+ const response = await PlatformAPIClient.execute(
1066
1522
  this.config,
1067
1523
  "post",
1068
1524
  `/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/sort/default_key`,
1069
1525
  query_params,
1070
1526
  body
1071
1527
  );
1528
+
1529
+ const {
1530
+ error: res_error,
1531
+ } = CatalogModel.ConfigSuccessResponse().validate(response, {
1532
+ abortEarly: false,
1533
+ allowUnknown: false,
1534
+ });
1535
+
1536
+ if (res_error) {
1537
+ Logger({
1538
+ level: "WARN",
1539
+ message: "Response Validation Warnnings for updateDefaultSort",
1540
+ });
1541
+ Logger({ level: "WARN", message: res_error });
1542
+ }
1543
+
1544
+ return response;
1072
1545
  }
1073
1546
 
1074
1547
  /**
1075
1548
  * @param {Object} arg - Arg object.
1549
+ * @returns {Promise<GetCatalogConfigurationMetaData>} - Success response
1076
1550
  * @summary: Get configuration meta details for catalog for admin panel
1077
1551
  * @description: configuration meta details for catalog.
1078
1552
  */
1079
- getCatalogConfiguration({} = {}) {
1553
+ async getCatalogConfiguration({} = {}) {
1080
1554
  const { error } = CatalogValidator.getCatalogConfiguration().validate(
1081
1555
  {},
1082
1556
  { abortEarly: false, allowUnknown: true }
@@ -1093,27 +1567,115 @@ class Catalog {
1093
1567
  { abortEarly: false, allowUnknown: false }
1094
1568
  );
1095
1569
  if (warrning) {
1096
- console.log("Parameter Validation warrnings for getCatalogConfiguration");
1097
- console.log(warrning);
1570
+ Logger({
1571
+ level: "WARN",
1572
+ message: "Parameter Validation warrnings for getCatalogConfiguration",
1573
+ });
1574
+ Logger({ level: "WARN", message: warrning });
1098
1575
  }
1099
1576
 
1100
1577
  const query_params = {};
1101
1578
 
1102
- return PlatformAPIClient.execute(
1579
+ const response = await PlatformAPIClient.execute(
1103
1580
  this.config,
1104
1581
  "get",
1105
1582
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/metadata/`,
1106
1583
  query_params,
1107
1584
  undefined
1108
1585
  );
1586
+
1587
+ const {
1588
+ error: res_error,
1589
+ } = CatalogModel.GetCatalogConfigurationMetaData().validate(response, {
1590
+ abortEarly: false,
1591
+ allowUnknown: false,
1592
+ });
1593
+
1594
+ if (res_error) {
1595
+ Logger({
1596
+ level: "WARN",
1597
+ message: "Response Validation Warnnings for getCatalogConfiguration",
1598
+ });
1599
+ Logger({ level: "WARN", message: res_error });
1600
+ }
1601
+
1602
+ return response;
1109
1603
  }
1110
1604
 
1111
1605
  /**
1112
1606
  * @param {Object} arg - Arg object.
1607
+ * @param {AppConfiguration} arg.body
1608
+ * @returns {Promise<GetAppCatalogConfiguration>} - Success response
1609
+ * @summary: Add configuration for products & listings
1610
+ * @description: Add configuration for products & listing.
1611
+ */
1612
+ async createConfigurationProductListing({ body } = {}) {
1613
+ const {
1614
+ error,
1615
+ } = CatalogValidator.createConfigurationProductListing().validate(
1616
+ {
1617
+ body,
1618
+ },
1619
+ { abortEarly: false, allowUnknown: true }
1620
+ );
1621
+ if (error) {
1622
+ return Promise.reject(new FDKClientValidationError(error));
1623
+ }
1624
+
1625
+ // Showing warrnings if extra unknown parameters are found
1626
+ const {
1627
+ error: warrning,
1628
+ } = CatalogValidator.createConfigurationProductListing().validate(
1629
+ {
1630
+ body,
1631
+ },
1632
+ { abortEarly: false, allowUnknown: false }
1633
+ );
1634
+ if (warrning) {
1635
+ Logger({
1636
+ level: "WARN",
1637
+ message:
1638
+ "Parameter Validation warrnings for createConfigurationProductListing",
1639
+ });
1640
+ Logger({ level: "WARN", message: warrning });
1641
+ }
1642
+
1643
+ const query_params = {};
1644
+
1645
+ const response = await PlatformAPIClient.execute(
1646
+ this.config,
1647
+ "post",
1648
+ `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/`,
1649
+ query_params,
1650
+ body
1651
+ );
1652
+
1653
+ const {
1654
+ error: res_error,
1655
+ } = CatalogModel.GetAppCatalogConfiguration().validate(response, {
1656
+ abortEarly: false,
1657
+ allowUnknown: false,
1658
+ });
1659
+
1660
+ if (res_error) {
1661
+ Logger({
1662
+ level: "WARN",
1663
+ message:
1664
+ "Response Validation Warnnings for createConfigurationProductListing",
1665
+ });
1666
+ Logger({ level: "WARN", message: res_error });
1667
+ }
1668
+
1669
+ return response;
1670
+ }
1671
+
1672
+ /**
1673
+ * @param {Object} arg - Arg object.
1674
+ * @returns {Promise<GetAppCatalogConfiguration>} - Success response
1113
1675
  * @summary: Get configured details for catalog
1114
1676
  * @description: configured details for catalog.
1115
1677
  */
1116
- getConfigurations({} = {}) {
1678
+ async getConfigurations({} = {}) {
1117
1679
  const { error } = CatalogValidator.getConfigurations().validate(
1118
1680
  {},
1119
1681
  { abortEarly: false, allowUnknown: true }
@@ -1128,32 +1690,53 @@ class Catalog {
1128
1690
  { abortEarly: false, allowUnknown: false }
1129
1691
  );
1130
1692
  if (warrning) {
1131
- console.log("Parameter Validation warrnings for getConfigurations");
1132
- console.log(warrning);
1693
+ Logger({
1694
+ level: "WARN",
1695
+ message: "Parameter Validation warrnings for getConfigurations",
1696
+ });
1697
+ Logger({ level: "WARN", message: warrning });
1133
1698
  }
1134
1699
 
1135
1700
  const query_params = {};
1136
1701
 
1137
- return PlatformAPIClient.execute(
1702
+ const response = await PlatformAPIClient.execute(
1138
1703
  this.config,
1139
1704
  "get",
1140
1705
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/`,
1141
1706
  query_params,
1142
1707
  undefined
1143
1708
  );
1709
+
1710
+ const {
1711
+ error: res_error,
1712
+ } = CatalogModel.GetAppCatalogConfiguration().validate(response, {
1713
+ abortEarly: false,
1714
+ allowUnknown: false,
1715
+ });
1716
+
1717
+ if (res_error) {
1718
+ Logger({
1719
+ level: "WARN",
1720
+ message: "Response Validation Warnnings for getConfigurations",
1721
+ });
1722
+ Logger({ level: "WARN", message: res_error });
1723
+ }
1724
+
1725
+ return response;
1144
1726
  }
1145
1727
 
1146
1728
  /**
1147
1729
  * @param {Object} arg - Arg object.
1730
+ * @param {string} arg.type - Type can be brands, categories etc.
1148
1731
  * @param {AppConfiguration} arg.body
1149
- * @summary: Add configuration for products & listings
1150
- * @description: Add configuration for products & listing.
1732
+ * @returns {Promise<GetAppCatalogConfiguration>} - Success response
1733
+ * @summary: Add configuration for categories and brands
1734
+ * @description: Add configuration for categories & brands.
1151
1735
  */
1152
- createConfigurationProductListing({ body } = {}) {
1153
- const {
1154
- error,
1155
- } = CatalogValidator.createConfigurationProductListing().validate(
1736
+ async createConfigurationByType({ type, body } = {}) {
1737
+ const { error } = CatalogValidator.createConfigurationByType().validate(
1156
1738
  {
1739
+ type,
1157
1740
  body,
1158
1741
  },
1159
1742
  { abortEarly: false, allowUnknown: true }
@@ -1165,37 +1748,57 @@ class Catalog {
1165
1748
  // Showing warrnings if extra unknown parameters are found
1166
1749
  const {
1167
1750
  error: warrning,
1168
- } = CatalogValidator.createConfigurationProductListing().validate(
1751
+ } = CatalogValidator.createConfigurationByType().validate(
1169
1752
  {
1753
+ type,
1170
1754
  body,
1171
1755
  },
1172
1756
  { abortEarly: false, allowUnknown: false }
1173
1757
  );
1174
1758
  if (warrning) {
1175
- console.log(
1176
- "Parameter Validation warrnings for createConfigurationProductListing"
1177
- );
1178
- console.log(warrning);
1759
+ Logger({
1760
+ level: "WARN",
1761
+ message: "Parameter Validation warrnings for createConfigurationByType",
1762
+ });
1763
+ Logger({ level: "WARN", message: warrning });
1179
1764
  }
1180
1765
 
1181
1766
  const query_params = {};
1182
1767
 
1183
- return PlatformAPIClient.execute(
1768
+ const response = await PlatformAPIClient.execute(
1184
1769
  this.config,
1185
1770
  "post",
1186
- `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/`,
1771
+ `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${type}/`,
1187
1772
  query_params,
1188
1773
  body
1189
1774
  );
1775
+
1776
+ const {
1777
+ error: res_error,
1778
+ } = CatalogModel.GetAppCatalogConfiguration().validate(response, {
1779
+ abortEarly: false,
1780
+ allowUnknown: false,
1781
+ });
1782
+
1783
+ if (res_error) {
1784
+ Logger({
1785
+ level: "WARN",
1786
+ message: "Response Validation Warnnings for createConfigurationByType",
1787
+ });
1788
+ Logger({ level: "WARN", message: res_error });
1789
+ }
1790
+
1791
+ return response;
1190
1792
  }
1191
1793
 
1192
1794
  /**
1193
1795
  * @param {Object} arg - Arg object.
1194
1796
  * @param {string} arg.type - Type can be brands, categories etc.
1797
+ * @returns {Promise<GetAppCatalogEntityConfiguration>} - Success response
1195
1798
  * @summary: Get configured details for catalog
1196
1799
  * @description: configured details for catalog.
1197
1800
  */
1198
- getConfigurationByType({ type } = {}) {
1801
+ async getConfigurationByType({ type } = {}) {
1199
1802
  const { error } = CatalogValidator.getConfigurationByType().validate(
1200
1803
  {
1201
1804
  type,
@@ -1216,34 +1819,50 @@ class Catalog {
1216
1819
  { abortEarly: false, allowUnknown: false }
1217
1820
  );
1218
1821
  if (warrning) {
1219
- console.log("Parameter Validation warrnings for getConfigurationByType");
1220
- console.log(warrning);
1822
+ Logger({
1823
+ level: "WARN",
1824
+ message: "Parameter Validation warrnings for getConfigurationByType",
1825
+ });
1826
+ Logger({ level: "WARN", message: warrning });
1221
1827
  }
1222
1828
 
1223
1829
  const query_params = {};
1224
1830
 
1225
- return PlatformAPIClient.execute(
1831
+ const response = await PlatformAPIClient.execute(
1226
1832
  this.config,
1227
1833
  "get",
1228
1834
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${type}/`,
1229
1835
  query_params,
1230
1836
  undefined
1231
1837
  );
1838
+
1839
+ const {
1840
+ error: res_error,
1841
+ } = CatalogModel.GetAppCatalogEntityConfiguration().validate(response, {
1842
+ abortEarly: false,
1843
+ allowUnknown: false,
1844
+ });
1845
+
1846
+ if (res_error) {
1847
+ Logger({
1848
+ level: "WARN",
1849
+ message: "Response Validation Warnnings for getConfigurationByType",
1850
+ });
1851
+ Logger({ level: "WARN", message: res_error });
1852
+ }
1853
+
1854
+ return response;
1232
1855
  }
1233
1856
 
1234
1857
  /**
1235
1858
  * @param {Object} arg - Arg object.
1236
- * @param {string} arg.type - Type can be brands, categories etc.
1237
- * @param {AppConfiguration} arg.body
1238
- * @summary: Add configuration for categories and brands
1239
- * @description: Add configuration for categories & brands.
1859
+ * @returns {Promise<GetCollectionQueryOptionResponse>} - Success response
1860
+ * @summary: Get query filters to configure a collection
1861
+ * @description: Get query filters to configure a collection
1240
1862
  */
1241
- createConfigurationByType({ type, body } = {}) {
1242
- const { error } = CatalogValidator.createConfigurationByType().validate(
1243
- {
1244
- type,
1245
- body,
1246
- },
1863
+ async getQueryFilters({} = {}) {
1864
+ const { error } = CatalogValidator.getQueryFilters().validate(
1865
+ {},
1247
1866
  { abortEarly: false, allowUnknown: true }
1248
1867
  );
1249
1868
  if (error) {
@@ -1251,41 +1870,58 @@ class Catalog {
1251
1870
  }
1252
1871
 
1253
1872
  // Showing warrnings if extra unknown parameters are found
1254
- const {
1255
- error: warrning,
1256
- } = CatalogValidator.createConfigurationByType().validate(
1257
- {
1258
- type,
1259
- body,
1260
- },
1873
+ const { error: warrning } = CatalogValidator.getQueryFilters().validate(
1874
+ {},
1261
1875
  { abortEarly: false, allowUnknown: false }
1262
1876
  );
1263
1877
  if (warrning) {
1264
- console.log(
1265
- "Parameter Validation warrnings for createConfigurationByType"
1266
- );
1267
- console.log(warrning);
1878
+ Logger({
1879
+ level: "WARN",
1880
+ message: "Parameter Validation warrnings for getQueryFilters",
1881
+ });
1882
+ Logger({ level: "WARN", message: warrning });
1268
1883
  }
1269
1884
 
1270
1885
  const query_params = {};
1271
1886
 
1272
- return PlatformAPIClient.execute(
1887
+ const response = await PlatformAPIClient.execute(
1273
1888
  this.config,
1274
- "post",
1275
- `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${type}/`,
1889
+ "get",
1890
+ `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/query-options/`,
1276
1891
  query_params,
1277
- body
1892
+ undefined
1278
1893
  );
1894
+
1895
+ const {
1896
+ error: res_error,
1897
+ } = CatalogModel.GetCollectionQueryOptionResponse().validate(response, {
1898
+ abortEarly: false,
1899
+ allowUnknown: false,
1900
+ });
1901
+
1902
+ if (res_error) {
1903
+ Logger({
1904
+ level: "WARN",
1905
+ message: "Response Validation Warnnings for getQueryFilters",
1906
+ });
1907
+ Logger({ level: "WARN", message: res_error });
1908
+ }
1909
+
1910
+ return response;
1279
1911
  }
1280
1912
 
1281
1913
  /**
1282
1914
  * @param {Object} arg - Arg object.
1283
- * @summary: Get query filters to configure a collection
1284
- * @description: Get query filters to configure a collection
1915
+ * @param {CreateCollection} arg.body
1916
+ * @returns {Promise<CollectionCreateResponse>} - Success response
1917
+ * @summary: Add a Collection
1918
+ * @description: Create a collection. See `CreateCollectionRequestSchema` for the list of attributes needed to create a collection and collections/query-options for the available options to create a collection. On successful request, returns a paginated list of collections specified in `CollectionCreateResponse`
1285
1919
  */
1286
- getQueryFilters({} = {}) {
1287
- const { error } = CatalogValidator.getQueryFilters().validate(
1288
- {},
1920
+ async createCollection({ body } = {}) {
1921
+ const { error } = CatalogValidator.createCollection().validate(
1922
+ {
1923
+ body,
1924
+ },
1289
1925
  { abortEarly: false, allowUnknown: true }
1290
1926
  );
1291
1927
  if (error) {
@@ -1293,24 +1929,46 @@ class Catalog {
1293
1929
  }
1294
1930
 
1295
1931
  // Showing warrnings if extra unknown parameters are found
1296
- const { error: warrning } = CatalogValidator.getQueryFilters().validate(
1297
- {},
1932
+ const { error: warrning } = CatalogValidator.createCollection().validate(
1933
+ {
1934
+ body,
1935
+ },
1298
1936
  { abortEarly: false, allowUnknown: false }
1299
1937
  );
1300
1938
  if (warrning) {
1301
- console.log("Parameter Validation warrnings for getQueryFilters");
1302
- console.log(warrning);
1939
+ Logger({
1940
+ level: "WARN",
1941
+ message: "Parameter Validation warrnings for createCollection",
1942
+ });
1943
+ Logger({ level: "WARN", message: warrning });
1303
1944
  }
1304
1945
 
1305
1946
  const query_params = {};
1306
1947
 
1307
- return PlatformAPIClient.execute(
1948
+ const response = await PlatformAPIClient.execute(
1308
1949
  this.config,
1309
- "get",
1310
- `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/query-options/`,
1950
+ "post",
1951
+ `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/`,
1311
1952
  query_params,
1312
- undefined
1953
+ body
1313
1954
  );
1955
+
1956
+ const {
1957
+ error: res_error,
1958
+ } = CatalogModel.CollectionCreateResponse().validate(response, {
1959
+ abortEarly: false,
1960
+ allowUnknown: false,
1961
+ });
1962
+
1963
+ if (res_error) {
1964
+ Logger({
1965
+ level: "WARN",
1966
+ message: "Response Validation Warnnings for createCollection",
1967
+ });
1968
+ Logger({ level: "WARN", message: res_error });
1969
+ }
1970
+
1971
+ return response;
1314
1972
  }
1315
1973
 
1316
1974
  /**
@@ -1326,10 +1984,11 @@ class Catalog {
1326
1984
  * given set of results.
1327
1985
  * @param {number} [arg.pageSize] - Number of items to retrieve in each
1328
1986
  * page. Default is 12.
1987
+ * @returns {Promise<GetCollectionListingResponse>} - Success response
1329
1988
  * @summary: List all the collections
1330
1989
  * @description: A Collection allows you to organize your products into hierarchical groups. For example, a dress might be in the category _Clothing_, the individual product might also be in the collection _Summer_. On successful request, returns all the collections as specified in `CollectionListingSchema`
1331
1990
  */
1332
- getAllCollections({
1991
+ async getAllCollections({
1333
1992
  q,
1334
1993
  scheduleStatus,
1335
1994
  type,
@@ -1368,8 +2027,11 @@ class Catalog {
1368
2027
  { abortEarly: false, allowUnknown: false }
1369
2028
  );
1370
2029
  if (warrning) {
1371
- console.log("Parameter Validation warrnings for getAllCollections");
1372
- console.log(warrning);
2030
+ Logger({
2031
+ level: "WARN",
2032
+ message: "Parameter Validation warrnings for getAllCollections",
2033
+ });
2034
+ Logger({ level: "WARN", message: warrning });
1373
2035
  }
1374
2036
 
1375
2037
  const query_params = {};
@@ -1381,53 +2043,30 @@ class Catalog {
1381
2043
  query_params["page_no"] = pageNo;
1382
2044
  query_params["page_size"] = pageSize;
1383
2045
 
1384
- return PlatformAPIClient.execute(
2046
+ const response = await PlatformAPIClient.execute(
1385
2047
  this.config,
1386
2048
  "get",
1387
2049
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/`,
1388
2050
  query_params,
1389
2051
  undefined
1390
2052
  );
1391
- }
1392
-
1393
- /**
1394
- * @param {Object} arg - Arg object.
1395
- * @param {CreateCollection} arg.body
1396
- * @summary: Add a Collection
1397
- * @description: Create a collection. See `CreateCollectionRequestSchema` for the list of attributes needed to create a collection and collections/query-options for the available options to create a collection. On successful request, returns a paginated list of collections specified in `CollectionCreateResponse`
1398
- */
1399
- createCollection({ body } = {}) {
1400
- const { error } = CatalogValidator.createCollection().validate(
1401
- {
1402
- body,
1403
- },
1404
- { abortEarly: false, allowUnknown: true }
1405
- );
1406
- if (error) {
1407
- return Promise.reject(new FDKClientValidationError(error));
1408
- }
1409
2053
 
1410
- // Showing warrnings if extra unknown parameters are found
1411
- const { error: warrning } = CatalogValidator.createCollection().validate(
1412
- {
1413
- body,
1414
- },
1415
- { abortEarly: false, allowUnknown: false }
1416
- );
1417
- if (warrning) {
1418
- console.log("Parameter Validation warrnings for createCollection");
1419
- console.log(warrning);
2054
+ const {
2055
+ error: res_error,
2056
+ } = CatalogModel.GetCollectionListingResponse().validate(response, {
2057
+ abortEarly: false,
2058
+ allowUnknown: false,
2059
+ });
2060
+
2061
+ if (res_error) {
2062
+ Logger({
2063
+ level: "WARN",
2064
+ message: "Response Validation Warnnings for getAllCollections",
2065
+ });
2066
+ Logger({ level: "WARN", message: res_error });
1420
2067
  }
1421
2068
 
1422
- const query_params = {};
1423
-
1424
- return PlatformAPIClient.execute(
1425
- this.config,
1426
- "post",
1427
- `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/`,
1428
- query_params,
1429
- body
1430
- );
2069
+ return response;
1431
2070
  }
1432
2071
 
1433
2072
  /**
@@ -1435,10 +2074,11 @@ class Catalog {
1435
2074
  * @param {string} arg.slug - A `slug` is a human readable, URL friendly
1436
2075
  * unique identifier of an object. Pass the `slug` of the collection which
1437
2076
  * you want to retrieve.
2077
+ * @returns {Promise<CollectionDetailResponse>} - Success response
1438
2078
  * @summary: Get a particular collection
1439
2079
  * @description: Get the details of a collection by its `slug`. If successful, returns a Collection resource in the response body specified in `CollectionDetailResponse`
1440
2080
  */
1441
- getCollectionDetail({ slug } = {}) {
2081
+ async getCollectionDetail({ slug } = {}) {
1442
2082
  const { error } = CatalogValidator.getCollectionDetail().validate(
1443
2083
  {
1444
2084
  slug,
@@ -1457,29 +2097,50 @@ class Catalog {
1457
2097
  { abortEarly: false, allowUnknown: false }
1458
2098
  );
1459
2099
  if (warrning) {
1460
- console.log("Parameter Validation warrnings for getCollectionDetail");
1461
- console.log(warrning);
2100
+ Logger({
2101
+ level: "WARN",
2102
+ message: "Parameter Validation warrnings for getCollectionDetail",
2103
+ });
2104
+ Logger({ level: "WARN", message: warrning });
1462
2105
  }
1463
2106
 
1464
2107
  const query_params = {};
1465
2108
 
1466
- return PlatformAPIClient.execute(
2109
+ const response = await PlatformAPIClient.execute(
1467
2110
  this.config,
1468
2111
  "get",
1469
2112
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${slug}/`,
1470
2113
  query_params,
1471
2114
  undefined
1472
2115
  );
2116
+
2117
+ const {
2118
+ error: res_error,
2119
+ } = CatalogModel.CollectionDetailResponse().validate(response, {
2120
+ abortEarly: false,
2121
+ allowUnknown: false,
2122
+ });
2123
+
2124
+ if (res_error) {
2125
+ Logger({
2126
+ level: "WARN",
2127
+ message: "Response Validation Warnnings for getCollectionDetail",
2128
+ });
2129
+ Logger({ level: "WARN", message: res_error });
2130
+ }
2131
+
2132
+ return response;
1473
2133
  }
1474
2134
 
1475
2135
  /**
1476
2136
  * @param {Object} arg - Arg object.
1477
2137
  * @param {string} arg.id - A `id` is a unique identifier of a collection.
1478
2138
  * @param {UpdateCollection} arg.body
2139
+ * @returns {Promise<UpdateCollection>} - Success response
1479
2140
  * @summary: Update a collection
1480
2141
  * @description: Update a collection by it's id. On successful request, returns the updated collection
1481
2142
  */
1482
- updateCollection({ id, body } = {}) {
2143
+ async updateCollection({ id, body } = {}) {
1483
2144
  const { error } = CatalogValidator.updateCollection().validate(
1484
2145
  {
1485
2146
  id,
@@ -1500,28 +2161,49 @@ class Catalog {
1500
2161
  { abortEarly: false, allowUnknown: false }
1501
2162
  );
1502
2163
  if (warrning) {
1503
- console.log("Parameter Validation warrnings for updateCollection");
1504
- console.log(warrning);
2164
+ Logger({
2165
+ level: "WARN",
2166
+ message: "Parameter Validation warrnings for updateCollection",
2167
+ });
2168
+ Logger({ level: "WARN", message: warrning });
1505
2169
  }
1506
2170
 
1507
2171
  const query_params = {};
1508
2172
 
1509
- return PlatformAPIClient.execute(
2173
+ const response = await PlatformAPIClient.execute(
1510
2174
  this.config,
1511
2175
  "put",
1512
2176
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/`,
1513
2177
  query_params,
1514
2178
  body
1515
2179
  );
2180
+
2181
+ const {
2182
+ error: res_error,
2183
+ } = CatalogModel.UpdateCollection().validate(response, {
2184
+ abortEarly: false,
2185
+ allowUnknown: false,
2186
+ });
2187
+
2188
+ if (res_error) {
2189
+ Logger({
2190
+ level: "WARN",
2191
+ message: "Response Validation Warnnings for updateCollection",
2192
+ });
2193
+ Logger({ level: "WARN", message: res_error });
2194
+ }
2195
+
2196
+ return response;
1516
2197
  }
1517
2198
 
1518
2199
  /**
1519
2200
  * @param {Object} arg - Arg object.
1520
2201
  * @param {string} arg.id - A `id` is a unique identifier of a collection.
2202
+ * @returns {Promise<DeleteResponse>} - Success response
1521
2203
  * @summary: Delete a Collection
1522
2204
  * @description: Delete a collection by it's id. Returns an object that tells whether the collection was deleted successfully
1523
2205
  */
1524
- deleteCollection({ id } = {}) {
2206
+ async deleteCollection({ id } = {}) {
1525
2207
  const { error } = CatalogValidator.deleteCollection().validate(
1526
2208
  {
1527
2209
  id,
@@ -1540,40 +2222,54 @@ class Catalog {
1540
2222
  { abortEarly: false, allowUnknown: false }
1541
2223
  );
1542
2224
  if (warrning) {
1543
- console.log("Parameter Validation warrnings for deleteCollection");
1544
- console.log(warrning);
2225
+ Logger({
2226
+ level: "WARN",
2227
+ message: "Parameter Validation warrnings for deleteCollection",
2228
+ });
2229
+ Logger({ level: "WARN", message: warrning });
1545
2230
  }
1546
2231
 
1547
2232
  const query_params = {};
1548
2233
 
1549
- return PlatformAPIClient.execute(
2234
+ const response = await PlatformAPIClient.execute(
1550
2235
  this.config,
1551
2236
  "delete",
1552
2237
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/`,
1553
2238
  query_params,
1554
2239
  undefined
1555
2240
  );
2241
+
2242
+ const {
2243
+ error: res_error,
2244
+ } = CatalogModel.DeleteResponse().validate(response, {
2245
+ abortEarly: false,
2246
+ allowUnknown: false,
2247
+ });
2248
+
2249
+ if (res_error) {
2250
+ Logger({
2251
+ level: "WARN",
2252
+ message: "Response Validation Warnnings for deleteCollection",
2253
+ });
2254
+ Logger({ level: "WARN", message: res_error });
2255
+ }
2256
+
2257
+ return response;
1556
2258
  }
1557
2259
 
1558
2260
  /**
1559
2261
  * @param {Object} arg - Arg object.
1560
2262
  * @param {string} arg.id - A `id` is a unique identifier of a collection.
1561
- * @param {string} [arg.sortOn] - Each response will contain sort_on param,
1562
- * which should be sent back to make pagination work.
1563
- * @param {string} [arg.pageId] - Each response will contain next_id param,
1564
- * which should be sent back to make pagination work.
1565
- * @param {number} [arg.pageSize] - Number of items to retrieve in each
1566
- * page. Default is 12.
1567
- * @summary: Get the items for a collection
1568
- * @description: Get items from a collection specified by its `id`.
2263
+ * @param {CollectionItemUpdate} arg.body
2264
+ * @returns {Promise<UpdatedResponse>} - Success response
2265
+ * @summary: Add items to a collection
2266
+ * @description: Adds items to a collection specified by its `id`. See `CollectionItemRequest` for the list of attributes needed to add items to an collection.
1569
2267
  */
1570
- getCollectionItems({ id, sortOn, pageId, pageSize } = {}) {
1571
- const { error } = CatalogValidator.getCollectionItems().validate(
2268
+ async addCollectionItems({ id, body } = {}) {
2269
+ const { error } = CatalogValidator.addCollectionItems().validate(
1572
2270
  {
1573
2271
  id,
1574
- sortOn,
1575
- pageId,
1576
- pageSize,
2272
+ body,
1577
2273
  },
1578
2274
  { abortEarly: false, allowUnknown: true }
1579
2275
  );
@@ -1582,46 +2278,69 @@ class Catalog {
1582
2278
  }
1583
2279
 
1584
2280
  // Showing warrnings if extra unknown parameters are found
1585
- const { error: warrning } = CatalogValidator.getCollectionItems().validate(
2281
+ const { error: warrning } = CatalogValidator.addCollectionItems().validate(
1586
2282
  {
1587
2283
  id,
1588
- sortOn,
1589
- pageId,
1590
- pageSize,
2284
+ body,
1591
2285
  },
1592
2286
  { abortEarly: false, allowUnknown: false }
1593
2287
  );
1594
2288
  if (warrning) {
1595
- console.log("Parameter Validation warrnings for getCollectionItems");
1596
- console.log(warrning);
2289
+ Logger({
2290
+ level: "WARN",
2291
+ message: "Parameter Validation warrnings for addCollectionItems",
2292
+ });
2293
+ Logger({ level: "WARN", message: warrning });
1597
2294
  }
1598
2295
 
1599
2296
  const query_params = {};
1600
- query_params["sort_on"] = sortOn;
1601
- query_params["page_id"] = pageId;
1602
- query_params["page_size"] = pageSize;
1603
2297
 
1604
- return PlatformAPIClient.execute(
2298
+ const response = await PlatformAPIClient.execute(
1605
2299
  this.config,
1606
- "get",
2300
+ "post",
1607
2301
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/items/`,
1608
2302
  query_params,
1609
- undefined
2303
+ body
1610
2304
  );
2305
+
2306
+ const {
2307
+ error: res_error,
2308
+ } = CatalogModel.UpdatedResponse().validate(response, {
2309
+ abortEarly: false,
2310
+ allowUnknown: false,
2311
+ });
2312
+
2313
+ if (res_error) {
2314
+ Logger({
2315
+ level: "WARN",
2316
+ message: "Response Validation Warnnings for addCollectionItems",
2317
+ });
2318
+ Logger({ level: "WARN", message: res_error });
2319
+ }
2320
+
2321
+ return response;
1611
2322
  }
1612
2323
 
1613
2324
  /**
1614
2325
  * @param {Object} arg - Arg object.
1615
2326
  * @param {string} arg.id - A `id` is a unique identifier of a collection.
1616
- * @param {CollectionItemRequest} arg.body
1617
- * @summary: Add items to a collection
1618
- * @description: Adds items to a collection specified by its `id`. See `CollectionItemRequest` for the list of attributes needed to add items to an collection.
2327
+ * @param {string} [arg.sortOn] - Each response will contain sort_on param,
2328
+ * which should be sent back to make pagination work.
2329
+ * @param {string} [arg.pageId] - Each response will contain next_id param,
2330
+ * which should be sent back to make pagination work.
2331
+ * @param {number} [arg.pageSize] - Number of items to retrieve in each
2332
+ * page. Default is 12.
2333
+ * @returns {Promise<GetCollectionItemsResponse>} - Success response
2334
+ * @summary: Get the items for a collection
2335
+ * @description: Get items from a collection specified by its `id`.
1619
2336
  */
1620
- addCollectionItems({ id, body } = {}) {
1621
- const { error } = CatalogValidator.addCollectionItems().validate(
2337
+ async getCollectionItems({ id, sortOn, pageId, pageSize } = {}) {
2338
+ const { error } = CatalogValidator.getCollectionItems().validate(
1622
2339
  {
1623
2340
  id,
1624
- body,
2341
+ sortOn,
2342
+ pageId,
2343
+ pageSize,
1625
2344
  },
1626
2345
  { abortEarly: false, allowUnknown: true }
1627
2346
  );
@@ -1630,36 +2349,62 @@ class Catalog {
1630
2349
  }
1631
2350
 
1632
2351
  // Showing warrnings if extra unknown parameters are found
1633
- const { error: warrning } = CatalogValidator.addCollectionItems().validate(
2352
+ const { error: warrning } = CatalogValidator.getCollectionItems().validate(
1634
2353
  {
1635
2354
  id,
1636
- body,
2355
+ sortOn,
2356
+ pageId,
2357
+ pageSize,
1637
2358
  },
1638
2359
  { abortEarly: false, allowUnknown: false }
1639
2360
  );
1640
2361
  if (warrning) {
1641
- console.log("Parameter Validation warrnings for addCollectionItems");
1642
- console.log(warrning);
2362
+ Logger({
2363
+ level: "WARN",
2364
+ message: "Parameter Validation warrnings for getCollectionItems",
2365
+ });
2366
+ Logger({ level: "WARN", message: warrning });
1643
2367
  }
1644
2368
 
1645
2369
  const query_params = {};
2370
+ query_params["sort_on"] = sortOn;
2371
+ query_params["page_id"] = pageId;
2372
+ query_params["page_size"] = pageSize;
1646
2373
 
1647
- return PlatformAPIClient.execute(
2374
+ const response = await PlatformAPIClient.execute(
1648
2375
  this.config,
1649
- "post",
2376
+ "get",
1650
2377
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/items/`,
1651
2378
  query_params,
1652
- body
2379
+ undefined
1653
2380
  );
2381
+
2382
+ const {
2383
+ error: res_error,
2384
+ } = CatalogModel.GetCollectionItemsResponse().validate(response, {
2385
+ abortEarly: false,
2386
+ allowUnknown: false,
2387
+ });
2388
+
2389
+ if (res_error) {
2390
+ Logger({
2391
+ level: "WARN",
2392
+ message: "Response Validation Warnnings for getCollectionItems",
2393
+ });
2394
+ Logger({ level: "WARN", message: res_error });
2395
+ }
2396
+
2397
+ return response;
1654
2398
  }
1655
2399
 
1656
2400
  /**
1657
2401
  * @param {Object} arg - Arg object.
1658
2402
  * @param {string} [arg.brand] - Brand slug
2403
+ * @returns {Promise<CatalogInsightResponse>} - Success response
1659
2404
  * @summary: Analytics data of catalog and inventory.
1660
2405
  * @description: Catalog Insights api returns the count of catalog related data like products, brands, departments and categories that have been made live as per configuration of the app.
1661
2406
  */
1662
- getCatalogInsights({ brand } = {}) {
2407
+ async getCatalogInsights({ brand } = {}) {
1663
2408
  const { error } = CatalogValidator.getCatalogInsights().validate(
1664
2409
  {
1665
2410
  brand,
@@ -1678,20 +2423,40 @@ class Catalog {
1678
2423
  { abortEarly: false, allowUnknown: false }
1679
2424
  );
1680
2425
  if (warrning) {
1681
- console.log("Parameter Validation warrnings for getCatalogInsights");
1682
- console.log(warrning);
2426
+ Logger({
2427
+ level: "WARN",
2428
+ message: "Parameter Validation warrnings for getCatalogInsights",
2429
+ });
2430
+ Logger({ level: "WARN", message: warrning });
1683
2431
  }
1684
2432
 
1685
2433
  const query_params = {};
1686
2434
  query_params["brand"] = brand;
1687
2435
 
1688
- return PlatformAPIClient.execute(
2436
+ const response = await PlatformAPIClient.execute(
1689
2437
  this.config,
1690
2438
  "get",
1691
2439
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/analytics/insights/`,
1692
2440
  query_params,
1693
2441
  undefined
1694
2442
  );
2443
+
2444
+ const {
2445
+ error: res_error,
2446
+ } = CatalogModel.CatalogInsightResponse().validate(response, {
2447
+ abortEarly: false,
2448
+ allowUnknown: false,
2449
+ });
2450
+
2451
+ if (res_error) {
2452
+ Logger({
2453
+ level: "WARN",
2454
+ message: "Response Validation Warnnings for getCatalogInsights",
2455
+ });
2456
+ Logger({ level: "WARN", message: res_error });
2457
+ }
2458
+
2459
+ return response;
1695
2460
  }
1696
2461
 
1697
2462
  /**
@@ -1705,10 +2470,11 @@ class Catalog {
1705
2470
  * page. Default is 12.
1706
2471
  * @param {string} [arg.q] - Search with help of store code.
1707
2472
  * @param {number[]} [arg.locationIds] - Search by store ids.
2473
+ * @returns {Promise<InventorySellerIdentifierResponsePaginated>} - Success response
1708
2474
  * @summary: Get Inventory for company
1709
2475
  * @description: This API allows get Inventory data for particular company grouped by size and store.
1710
2476
  */
1711
- getDiscountedInventoryBySizeIdentifier({
2477
+ async getDiscountedInventoryBySizeIdentifier({
1712
2478
  itemId,
1713
2479
  sizeIdentifier,
1714
2480
  pageNo,
@@ -1748,10 +2514,12 @@ class Catalog {
1748
2514
  { abortEarly: false, allowUnknown: false }
1749
2515
  );
1750
2516
  if (warrning) {
1751
- console.log(
1752
- "Parameter Validation warrnings for getDiscountedInventoryBySizeIdentifier"
1753
- );
1754
- console.log(warrning);
2517
+ Logger({
2518
+ level: "WARN",
2519
+ message:
2520
+ "Parameter Validation warrnings for getDiscountedInventoryBySizeIdentifier",
2521
+ });
2522
+ Logger({ level: "WARN", message: warrning });
1755
2523
  }
1756
2524
 
1757
2525
  const query_params = {};
@@ -1760,13 +2528,31 @@ class Catalog {
1760
2528
  query_params["q"] = q;
1761
2529
  query_params["location_ids"] = locationIds;
1762
2530
 
1763
- return PlatformAPIClient.execute(
2531
+ const response = await PlatformAPIClient.execute(
1764
2532
  this.config,
1765
2533
  "get",
1766
2534
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/products/${itemId}/inventory/${sizeIdentifier}`,
1767
2535
  query_params,
1768
2536
  undefined
1769
2537
  );
2538
+
2539
+ const {
2540
+ error: res_error,
2541
+ } = CatalogModel.InventorySellerIdentifierResponsePaginated().validate(
2542
+ response,
2543
+ { abortEarly: false, allowUnknown: false }
2544
+ );
2545
+
2546
+ if (res_error) {
2547
+ Logger({
2548
+ level: "WARN",
2549
+ message:
2550
+ "Response Validation Warnnings for getDiscountedInventoryBySizeIdentifier",
2551
+ });
2552
+ Logger({ level: "WARN", message: res_error });
2553
+ }
2554
+
2555
+ return response;
1770
2556
  }
1771
2557
 
1772
2558
  /**
@@ -1783,10 +2569,17 @@ class Catalog {
1783
2569
  * to search brands by brand name.
1784
2570
  * @param {number[]} [arg.brandId] - Helps to sort the brands list on the
1785
2571
  * basis of uid list.
2572
+ * @returns {Promise<BrandListingResponse>} - Success response
1786
2573
  * @summary: List all the brands
1787
2574
  * @description: A brand is the name under which a product is being sold. Use this API to list all the brands. You can pass optionally filter the brands by the department. If successful, returns a paginated list of brands specified in `BrandListingResponse`
1788
2575
  */
1789
- getApplicationBrands({ department, pageNo, pageSize, q, brandId } = {}) {
2576
+ async getApplicationBrands({
2577
+ department,
2578
+ pageNo,
2579
+ pageSize,
2580
+ q,
2581
+ brandId,
2582
+ } = {}) {
1790
2583
  const { error } = CatalogValidator.getApplicationBrands().validate(
1791
2584
  {
1792
2585
  department,
@@ -1815,8 +2608,11 @@ class Catalog {
1815
2608
  { abortEarly: false, allowUnknown: false }
1816
2609
  );
1817
2610
  if (warrning) {
1818
- console.log("Parameter Validation warrnings for getApplicationBrands");
1819
- console.log(warrning);
2611
+ Logger({
2612
+ level: "WARN",
2613
+ message: "Parameter Validation warrnings for getApplicationBrands",
2614
+ });
2615
+ Logger({ level: "WARN", message: warrning });
1820
2616
  }
1821
2617
 
1822
2618
  const query_params = {};
@@ -1826,13 +2622,30 @@ class Catalog {
1826
2622
  query_params["q"] = q;
1827
2623
  query_params["brand_id"] = brandId;
1828
2624
 
1829
- return PlatformAPIClient.execute(
2625
+ const response = await PlatformAPIClient.execute(
1830
2626
  this.config,
1831
2627
  "get",
1832
2628
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/brands`,
1833
2629
  query_params,
1834
2630
  undefined
1835
2631
  );
2632
+
2633
+ const {
2634
+ error: res_error,
2635
+ } = CatalogModel.BrandListingResponse().validate(response, {
2636
+ abortEarly: false,
2637
+ allowUnknown: false,
2638
+ });
2639
+
2640
+ if (res_error) {
2641
+ Logger({
2642
+ level: "WARN",
2643
+ message: "Response Validation Warnnings for getApplicationBrands",
2644
+ });
2645
+ Logger({ level: "WARN", message: res_error });
2646
+ }
2647
+
2648
+ return response;
1836
2649
  }
1837
2650
 
1838
2651
  /**
@@ -1888,10 +2701,11 @@ class Catalog {
1888
2701
 
1889
2702
  /**
1890
2703
  * @param {Object} arg - Arg object.
2704
+ * @returns {Promise<DepartmentResponse>} - Success response
1891
2705
  * @summary: List all the departments
1892
2706
  * @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the departments. If successful, returns the list of departments specified in `DepartmentResponse`
1893
2707
  */
1894
- getDepartments({} = {}) {
2708
+ async getDepartments({} = {}) {
1895
2709
  const { error } = CatalogValidator.getDepartments().validate(
1896
2710
  {},
1897
2711
  { abortEarly: false, allowUnknown: true }
@@ -1906,19 +2720,39 @@ class Catalog {
1906
2720
  { abortEarly: false, allowUnknown: false }
1907
2721
  );
1908
2722
  if (warrning) {
1909
- console.log("Parameter Validation warrnings for getDepartments");
1910
- console.log(warrning);
2723
+ Logger({
2724
+ level: "WARN",
2725
+ message: "Parameter Validation warrnings for getDepartments",
2726
+ });
2727
+ Logger({ level: "WARN", message: warrning });
1911
2728
  }
1912
2729
 
1913
2730
  const query_params = {};
1914
2731
 
1915
- return PlatformAPIClient.execute(
2732
+ const response = await PlatformAPIClient.execute(
1916
2733
  this.config,
1917
2734
  "get",
1918
2735
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/departments`,
1919
2736
  query_params,
1920
2737
  undefined
1921
2738
  );
2739
+
2740
+ const {
2741
+ error: res_error,
2742
+ } = CatalogModel.DepartmentResponse().validate(response, {
2743
+ abortEarly: false,
2744
+ allowUnknown: false,
2745
+ });
2746
+
2747
+ if (res_error) {
2748
+ Logger({
2749
+ level: "WARN",
2750
+ message: "Response Validation Warnnings for getDepartments",
2751
+ });
2752
+ Logger({ level: "WARN", message: res_error });
2753
+ }
2754
+
2755
+ return response;
1922
2756
  }
1923
2757
 
1924
2758
  /**
@@ -1927,10 +2761,11 @@ class Catalog {
1927
2761
  * parameter to filter products by a particular department. See below the
1928
2762
  * list of available departments. You can retrieve available departments
1929
2763
  * from the **v1.0/departments/** API
2764
+ * @returns {Promise<CategoryListingResponse>} - Success response
1930
2765
  * @summary: List all the categories
1931
2766
  * @description: List all the categories. You can optionally pass filter the brands by the department. If successful, returns a paginated list of brands specified in `CategoryListingResponse`
1932
2767
  */
1933
- getCategories({ department } = {}) {
2768
+ async getCategories({ department } = {}) {
1934
2769
  const { error } = CatalogValidator.getCategories().validate(
1935
2770
  {
1936
2771
  department,
@@ -1949,20 +2784,40 @@ class Catalog {
1949
2784
  { abortEarly: false, allowUnknown: false }
1950
2785
  );
1951
2786
  if (warrning) {
1952
- console.log("Parameter Validation warrnings for getCategories");
1953
- console.log(warrning);
2787
+ Logger({
2788
+ level: "WARN",
2789
+ message: "Parameter Validation warrnings for getCategories",
2790
+ });
2791
+ Logger({ level: "WARN", message: warrning });
1954
2792
  }
1955
2793
 
1956
2794
  const query_params = {};
1957
2795
  query_params["department"] = department;
1958
2796
 
1959
- return PlatformAPIClient.execute(
2797
+ const response = await PlatformAPIClient.execute(
1960
2798
  this.config,
1961
2799
  "get",
1962
2800
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/categories`,
1963
2801
  query_params,
1964
2802
  undefined
1965
2803
  );
2804
+
2805
+ const {
2806
+ error: res_error,
2807
+ } = CatalogModel.CategoryListingResponse().validate(response, {
2808
+ abortEarly: false,
2809
+ allowUnknown: false,
2810
+ });
2811
+
2812
+ if (res_error) {
2813
+ Logger({
2814
+ level: "WARN",
2815
+ message: "Response Validation Warnnings for getCategories",
2816
+ });
2817
+ Logger({ level: "WARN", message: res_error });
2818
+ }
2819
+
2820
+ return response;
1966
2821
  }
1967
2822
 
1968
2823
  /**
@@ -1991,10 +2846,11 @@ class Catalog {
1991
2846
  * @param {string} [arg.pageType] - For pagination type should be cursor or
1992
2847
  * number. Default is cursor.
1993
2848
  * @param {number[]} [arg.itemIds] - Item Ids of product
2849
+ * @returns {Promise<ApplicationProductListingResponse>} - Success response
1994
2850
  * @summary: List the products
1995
2851
  * @description: List all the products associated with a brand, collection or category in a requested sort order. The API additionally supports arbitrary search queries that may refer the name of any product, brand, category or collection. If successful, returns a paginated list of products specified in `ApplicationProductListingResponse`
1996
2852
  */
1997
- getAppicationProducts({
2853
+ async getAppicationProducts({
1998
2854
  q,
1999
2855
  f,
2000
2856
  c,
@@ -2044,8 +2900,11 @@ class Catalog {
2044
2900
  { abortEarly: false, allowUnknown: false }
2045
2901
  );
2046
2902
  if (warrning) {
2047
- console.log("Parameter Validation warrnings for getAppicationProducts");
2048
- console.log(warrning);
2903
+ Logger({
2904
+ level: "WARN",
2905
+ message: "Parameter Validation warrnings for getAppicationProducts",
2906
+ });
2907
+ Logger({ level: "WARN", message: warrning });
2049
2908
  }
2050
2909
 
2051
2910
  const query_params = {};
@@ -2060,13 +2919,30 @@ class Catalog {
2060
2919
  query_params["page_type"] = pageType;
2061
2920
  query_params["item_ids"] = itemIds;
2062
2921
 
2063
- return PlatformAPIClient.execute(
2922
+ const response = await PlatformAPIClient.execute(
2064
2923
  this.config,
2065
2924
  "get",
2066
2925
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/products`,
2067
2926
  query_params,
2068
2927
  undefined
2069
2928
  );
2929
+
2930
+ const {
2931
+ error: res_error,
2932
+ } = CatalogModel.ApplicationProductListingResponse().validate(response, {
2933
+ abortEarly: false,
2934
+ allowUnknown: false,
2935
+ });
2936
+
2937
+ if (res_error) {
2938
+ Logger({
2939
+ level: "WARN",
2940
+ message: "Response Validation Warnnings for getAppicationProducts",
2941
+ });
2942
+ Logger({ level: "WARN", message: res_error });
2943
+ }
2944
+
2945
+ return response;
2070
2946
  }
2071
2947
 
2072
2948
  /**
@@ -2141,10 +3017,11 @@ class Catalog {
2141
3017
  * @param {string} arg.slug - The unique identifier of a product. i.e;
2142
3018
  * `slug` of a product. You can retrieve these from the APIs that list
2143
3019
  * products like **v1.0/products/**
3020
+ * @returns {Promise<ProductDetail>} - Success response
2144
3021
  * @summary: Get a product
2145
3022
  * @description: Products are the core resource of an application. Products can be associated by categories, collections, brands and more. This API retrieves the product specified by the given **slug**. If successful, returns a Product resource in the response body specified in `ProductDetail`
2146
3023
  */
2147
- getProductDetailBySlug({ slug } = {}) {
3024
+ async getProductDetailBySlug({ slug } = {}) {
2148
3025
  const { error } = CatalogValidator.getProductDetailBySlug().validate(
2149
3026
  {
2150
3027
  slug,
@@ -2165,19 +3042,37 @@ class Catalog {
2165
3042
  { abortEarly: false, allowUnknown: false }
2166
3043
  );
2167
3044
  if (warrning) {
2168
- console.log("Parameter Validation warrnings for getProductDetailBySlug");
2169
- console.log(warrning);
3045
+ Logger({
3046
+ level: "WARN",
3047
+ message: "Parameter Validation warrnings for getProductDetailBySlug",
3048
+ });
3049
+ Logger({ level: "WARN", message: warrning });
2170
3050
  }
2171
3051
 
2172
3052
  const query_params = {};
2173
3053
 
2174
- return PlatformAPIClient.execute(
3054
+ const response = await PlatformAPIClient.execute(
2175
3055
  this.config,
2176
3056
  "get",
2177
3057
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/products/${slug}`,
2178
3058
  query_params,
2179
3059
  undefined
2180
3060
  );
3061
+
3062
+ const { error: res_error } = CatalogModel.ProductDetail().validate(
3063
+ response,
3064
+ { abortEarly: false, allowUnknown: false }
3065
+ );
3066
+
3067
+ if (res_error) {
3068
+ Logger({
3069
+ level: "WARN",
3070
+ message: "Response Validation Warnnings for getProductDetailBySlug",
3071
+ });
3072
+ Logger({ level: "WARN", message: res_error });
3073
+ }
3074
+
3075
+ return response;
2181
3076
  }
2182
3077
 
2183
3078
  /**
@@ -2193,10 +3088,11 @@ class Catalog {
2193
3088
  * @param {number} [arg.pageSize] - Number of items to retrieve in each
2194
3089
  * page. Default is 10.
2195
3090
  * @param {string} [arg.q] - Search with Item Code, Name, Slug or Identifier.
3091
+ * @returns {Promise<ProductListingResponse>} - Success response
2196
3092
  * @summary: Get applicationwise products
2197
3093
  * @description: Products are the core resource of an application. Products can be associated by categories, collections, brands and more. If successful, returns a Product resource in the response body specified in `ApplicationProductListingResponseDatabasePowered`
2198
3094
  */
2199
- getAppProducts({
3095
+ async getAppProducts({
2200
3096
  brandIds,
2201
3097
  categoryIds,
2202
3098
  departmentIds,
@@ -2235,8 +3131,11 @@ class Catalog {
2235
3131
  { abortEarly: false, allowUnknown: false }
2236
3132
  );
2237
3133
  if (warrning) {
2238
- console.log("Parameter Validation warrnings for getAppProducts");
2239
- console.log(warrning);
3134
+ Logger({
3135
+ level: "WARN",
3136
+ message: "Parameter Validation warrnings for getAppProducts",
3137
+ });
3138
+ Logger({ level: "WARN", message: warrning });
2240
3139
  }
2241
3140
 
2242
3141
  const query_params = {};
@@ -2248,13 +3147,30 @@ class Catalog {
2248
3147
  query_params["page_size"] = pageSize;
2249
3148
  query_params["q"] = q;
2250
3149
 
2251
- return PlatformAPIClient.execute(
3150
+ const response = await PlatformAPIClient.execute(
2252
3151
  this.config,
2253
3152
  "get",
2254
3153
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/raw-products/`,
2255
3154
  query_params,
2256
3155
  undefined
2257
3156
  );
3157
+
3158
+ const {
3159
+ error: res_error,
3160
+ } = CatalogModel.ProductListingResponse().validate(response, {
3161
+ abortEarly: false,
3162
+ allowUnknown: false,
3163
+ });
3164
+
3165
+ if (res_error) {
3166
+ Logger({
3167
+ level: "WARN",
3168
+ message: "Response Validation Warnnings for getAppProducts",
3169
+ });
3170
+ Logger({ level: "WARN", message: res_error });
3171
+ }
3172
+
3173
+ return response;
2258
3174
  }
2259
3175
 
2260
3176
  /**
@@ -2267,10 +3183,11 @@ class Catalog {
2267
3183
  * @param {string} [arg.timestamp] - Timestamp in UTC format (2020-07-23T10:27:50Z)
2268
3184
  * @param {number} [arg.pageSize] - The number of items to retrieve in each page.
2269
3185
  * @param {string} [arg.pageId] - Page ID to retrieve next set of results.
3186
+ * @returns {Promise<InventoryStockResponse>} - Success response
2270
3187
  * @summary: Get the stock of a product
2271
3188
  * @description: Retrieve the available Inventory of the products. Use this API to get the Inventory status of products with the filters of timestamp, store_ids, brand_ids, item_id - Items - Pagination
2272
3189
  */
2273
- getAppInventory({
3190
+ async getAppInventory({
2274
3191
  itemIds,
2275
3192
  storeIds,
2276
3193
  brandIds,
@@ -2309,8 +3226,11 @@ class Catalog {
2309
3226
  { abortEarly: false, allowUnknown: false }
2310
3227
  );
2311
3228
  if (warrning) {
2312
- console.log("Parameter Validation warrnings for getAppInventory");
2313
- console.log(warrning);
3229
+ Logger({
3230
+ level: "WARN",
3231
+ message: "Parameter Validation warrnings for getAppInventory",
3232
+ });
3233
+ Logger({ level: "WARN", message: warrning });
2314
3234
  }
2315
3235
 
2316
3236
  const query_params = {};
@@ -2322,13 +3242,30 @@ class Catalog {
2322
3242
  query_params["page_size"] = pageSize;
2323
3243
  query_params["page_id"] = pageId;
2324
3244
 
2325
- return PlatformAPIClient.execute(
3245
+ const response = await PlatformAPIClient.execute(
2326
3246
  this.config,
2327
3247
  "get",
2328
3248
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/inventory/`,
2329
3249
  query_params,
2330
3250
  undefined
2331
3251
  );
3252
+
3253
+ const {
3254
+ error: res_error,
3255
+ } = CatalogModel.InventoryStockResponse().validate(response, {
3256
+ abortEarly: false,
3257
+ allowUnknown: false,
3258
+ });
3259
+
3260
+ if (res_error) {
3261
+ Logger({
3262
+ level: "WARN",
3263
+ message: "Response Validation Warnnings for getAppInventory",
3264
+ });
3265
+ Logger({ level: "WARN", message: res_error });
3266
+ }
3267
+
3268
+ return response;
2332
3269
  }
2333
3270
 
2334
3271
  /**
@@ -2344,10 +3281,11 @@ class Catalog {
2344
3281
  * given set of results
2345
3282
  * @param {number} [arg.pageSize] - Number of items to retrieve in each
2346
3283
  * page. Default is 20.
3284
+ * @returns {Promise<LocationListSerializer>} - Success response
2347
3285
  * @summary: Get list of locations
2348
3286
  * @description: This API allows to view all the locations asscoiated to a application.
2349
3287
  */
2350
- getAppLocations({ storeType, uid, q, stage, pageNo, pageSize } = {}) {
3288
+ async getAppLocations({ storeType, uid, q, stage, pageNo, pageSize } = {}) {
2351
3289
  const { error } = CatalogValidator.getAppLocations().validate(
2352
3290
  {
2353
3291
  storeType,
@@ -2376,8 +3314,11 @@ class Catalog {
2376
3314
  { abortEarly: false, allowUnknown: false }
2377
3315
  );
2378
3316
  if (warrning) {
2379
- console.log("Parameter Validation warrnings for getAppLocations");
2380
- console.log(warrning);
3317
+ Logger({
3318
+ level: "WARN",
3319
+ message: "Parameter Validation warrnings for getAppLocations",
3320
+ });
3321
+ Logger({ level: "WARN", message: warrning });
2381
3322
  }
2382
3323
 
2383
3324
  const query_params = {};
@@ -2388,13 +3329,30 @@ class Catalog {
2388
3329
  query_params["page_no"] = pageNo;
2389
3330
  query_params["page_size"] = pageSize;
2390
3331
 
2391
- return PlatformAPIClient.execute(
3332
+ const response = await PlatformAPIClient.execute(
2392
3333
  this.config,
2393
3334
  "get",
2394
3335
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/locations`,
2395
3336
  query_params,
2396
3337
  undefined
2397
3338
  );
3339
+
3340
+ const {
3341
+ error: res_error,
3342
+ } = CatalogModel.LocationListSerializer().validate(response, {
3343
+ abortEarly: false,
3344
+ allowUnknown: false,
3345
+ });
3346
+
3347
+ if (res_error) {
3348
+ Logger({
3349
+ level: "WARN",
3350
+ message: "Response Validation Warnnings for getAppLocations",
3351
+ });
3352
+ Logger({ level: "WARN", message: res_error });
3353
+ }
3354
+
3355
+ return response;
2398
3356
  }
2399
3357
 
2400
3358
  /**
@@ -2456,10 +3414,11 @@ class Catalog {
2456
3414
  * page. Default is 12.
2457
3415
  * @param {string} [arg.q] - Search query with brand name.Use this parameter
2458
3416
  * to search brands by brand name.
3417
+ * @returns {Promise<BrandListingResponse>} - Success response
2459
3418
  * @summary: List all the brands for the application
2460
3419
  * @description: A brand is the name under which a product is being sold. Use this API to list all the brands. You can pass optionally filter the brands by the department. If successful, returns a paginated list of brands specified in `BrandListingResponse`
2461
3420
  */
2462
- getApplicationBrandListing({ pageNo, pageSize, q } = {}) {
3421
+ async getApplicationBrandListing({ pageNo, pageSize, q } = {}) {
2463
3422
  const { error } = CatalogValidator.getApplicationBrandListing().validate(
2464
3423
  {
2465
3424
  pageNo,
@@ -2484,10 +3443,12 @@ class Catalog {
2484
3443
  { abortEarly: false, allowUnknown: false }
2485
3444
  );
2486
3445
  if (warrning) {
2487
- console.log(
2488
- "Parameter Validation warrnings for getApplicationBrandListing"
2489
- );
2490
- console.log(warrning);
3446
+ Logger({
3447
+ level: "WARN",
3448
+ message:
3449
+ "Parameter Validation warrnings for getApplicationBrandListing",
3450
+ });
3451
+ Logger({ level: "WARN", message: warrning });
2491
3452
  }
2492
3453
 
2493
3454
  const query_params = {};
@@ -2495,13 +3456,30 @@ class Catalog {
2495
3456
  query_params["page_size"] = pageSize;
2496
3457
  query_params["q"] = q;
2497
3458
 
2498
- return PlatformAPIClient.execute(
3459
+ const response = await PlatformAPIClient.execute(
2499
3460
  this.config,
2500
3461
  "get",
2501
3462
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/brand`,
2502
3463
  query_params,
2503
3464
  undefined
2504
3465
  );
3466
+
3467
+ const {
3468
+ error: res_error,
3469
+ } = CatalogModel.BrandListingResponse().validate(response, {
3470
+ abortEarly: false,
3471
+ allowUnknown: false,
3472
+ });
3473
+
3474
+ if (res_error) {
3475
+ Logger({
3476
+ level: "WARN",
3477
+ message: "Response Validation Warnnings for getApplicationBrandListing",
3478
+ });
3479
+ Logger({ level: "WARN", message: res_error });
3480
+ }
3481
+
3482
+ return response;
2505
3483
  }
2506
3484
 
2507
3485
  /**
@@ -2549,10 +3527,11 @@ class Catalog {
2549
3527
  * @param {Object} arg - Arg object.
2550
3528
  * @param {string} arg.brandUid - Brand id for which the custom_json is associated.
2551
3529
  * @param {ApplicationBrandJson} arg.body
3530
+ * @returns {Promise<SuccessResponse1>} - Success response
2552
3531
  * @summary: Update a single custom json.
2553
3532
  * @description: This API helps to update data associated to a item custom meta.
2554
3533
  */
2555
- updateAppBrand({ brandUid, body } = {}) {
3534
+ async updateAppBrand({ brandUid, body } = {}) {
2556
3535
  const { error } = CatalogValidator.updateAppBrand().validate(
2557
3536
  {
2558
3537
  brandUid,
@@ -2573,19 +3552,39 @@ class Catalog {
2573
3552
  { abortEarly: false, allowUnknown: false }
2574
3553
  );
2575
3554
  if (warrning) {
2576
- console.log("Parameter Validation warrnings for updateAppBrand");
2577
- console.log(warrning);
3555
+ Logger({
3556
+ level: "WARN",
3557
+ message: "Parameter Validation warrnings for updateAppBrand",
3558
+ });
3559
+ Logger({ level: "WARN", message: warrning });
2578
3560
  }
2579
3561
 
2580
3562
  const query_params = {};
2581
3563
 
2582
- return PlatformAPIClient.execute(
3564
+ const response = await PlatformAPIClient.execute(
2583
3565
  this.config,
2584
3566
  "patch",
2585
3567
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/brand/${brandUid}`,
2586
3568
  query_params,
2587
3569
  body
2588
3570
  );
3571
+
3572
+ const {
3573
+ error: res_error,
3574
+ } = CatalogModel.SuccessResponse1().validate(response, {
3575
+ abortEarly: false,
3576
+ allowUnknown: false,
3577
+ });
3578
+
3579
+ if (res_error) {
3580
+ Logger({
3581
+ level: "WARN",
3582
+ message: "Response Validation Warnnings for updateAppBrand",
3583
+ });
3584
+ Logger({ level: "WARN", message: res_error });
3585
+ }
3586
+
3587
+ return response;
2589
3588
  }
2590
3589
 
2591
3590
  /**
@@ -2598,10 +3597,16 @@ class Catalog {
2598
3597
  * page. Default is 12.
2599
3598
  * @param {string} [arg.q] - Search query with brand name.Use this parameter
2600
3599
  * to search brands by brand name.
3600
+ * @returns {Promise<BrandListingResponse>} - Success response
2601
3601
  * @summary: List all the brands for the application
2602
3602
  * @description: A brand is the name under which a product is being sold. Use this API to list all the brands. You can pass optionally filter the brands by the department. If successful, returns a paginated list of brands specified in `BrandListingResponse`
2603
3603
  */
2604
- getApplicationCategoryListing({ departmentId, pageNo, pageSize, q } = {}) {
3604
+ async getApplicationCategoryListing({
3605
+ departmentId,
3606
+ pageNo,
3607
+ pageSize,
3608
+ q,
3609
+ } = {}) {
2605
3610
  const { error } = CatalogValidator.getApplicationCategoryListing().validate(
2606
3611
  {
2607
3612
  departmentId,
@@ -2628,10 +3633,12 @@ class Catalog {
2628
3633
  { abortEarly: false, allowUnknown: false }
2629
3634
  );
2630
3635
  if (warrning) {
2631
- console.log(
2632
- "Parameter Validation warrnings for getApplicationCategoryListing"
2633
- );
2634
- console.log(warrning);
3636
+ Logger({
3637
+ level: "WARN",
3638
+ message:
3639
+ "Parameter Validation warrnings for getApplicationCategoryListing",
3640
+ });
3641
+ Logger({ level: "WARN", message: warrning });
2635
3642
  }
2636
3643
 
2637
3644
  const query_params = {};
@@ -2640,13 +3647,31 @@ class Catalog {
2640
3647
  query_params["page_size"] = pageSize;
2641
3648
  query_params["q"] = q;
2642
3649
 
2643
- return PlatformAPIClient.execute(
3650
+ const response = await PlatformAPIClient.execute(
2644
3651
  this.config,
2645
3652
  "get",
2646
3653
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/category`,
2647
3654
  query_params,
2648
3655
  undefined
2649
3656
  );
3657
+
3658
+ const {
3659
+ error: res_error,
3660
+ } = CatalogModel.BrandListingResponse().validate(response, {
3661
+ abortEarly: false,
3662
+ allowUnknown: false,
3663
+ });
3664
+
3665
+ if (res_error) {
3666
+ Logger({
3667
+ level: "WARN",
3668
+ message:
3669
+ "Response Validation Warnnings for getApplicationCategoryListing",
3670
+ });
3671
+ Logger({ level: "WARN", message: res_error });
3672
+ }
3673
+
3674
+ return response;
2650
3675
  }
2651
3676
 
2652
3677
  /**
@@ -2699,10 +3724,11 @@ class Catalog {
2699
3724
  * @param {string} arg.categoryUid - Category id for which the custom_json
2700
3725
  * is associated.
2701
3726
  * @param {ApplicationCategoryJson} arg.body
3727
+ * @returns {Promise<SuccessResponse1>} - Success response
2702
3728
  * @summary: Update a single custom json.
2703
3729
  * @description: This API helps to update data associated to a item custom meta.
2704
3730
  */
2705
- updateAppCategory({ categoryUid, body } = {}) {
3731
+ async updateAppCategory({ categoryUid, body } = {}) {
2706
3732
  const { error } = CatalogValidator.updateAppCategory().validate(
2707
3733
  {
2708
3734
  categoryUid,
@@ -2723,19 +3749,39 @@ class Catalog {
2723
3749
  { abortEarly: false, allowUnknown: false }
2724
3750
  );
2725
3751
  if (warrning) {
2726
- console.log("Parameter Validation warrnings for updateAppCategory");
2727
- console.log(warrning);
3752
+ Logger({
3753
+ level: "WARN",
3754
+ message: "Parameter Validation warrnings for updateAppCategory",
3755
+ });
3756
+ Logger({ level: "WARN", message: warrning });
2728
3757
  }
2729
3758
 
2730
3759
  const query_params = {};
2731
3760
 
2732
- return PlatformAPIClient.execute(
3761
+ const response = await PlatformAPIClient.execute(
2733
3762
  this.config,
2734
3763
  "patch",
2735
3764
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/category/${categoryUid}`,
2736
3765
  query_params,
2737
3766
  body
2738
3767
  );
3768
+
3769
+ const {
3770
+ error: res_error,
3771
+ } = CatalogModel.SuccessResponse1().validate(response, {
3772
+ abortEarly: false,
3773
+ allowUnknown: false,
3774
+ });
3775
+
3776
+ if (res_error) {
3777
+ Logger({
3778
+ level: "WARN",
3779
+ message: "Response Validation Warnnings for updateAppCategory",
3780
+ });
3781
+ Logger({ level: "WARN", message: res_error });
3782
+ }
3783
+
3784
+ return response;
2739
3785
  }
2740
3786
 
2741
3787
  /**
@@ -2746,10 +3792,11 @@ class Catalog {
2746
3792
  * page. Default is 12.
2747
3793
  * @param {string} [arg.q] - Search query with brand name.Use this parameter
2748
3794
  * to search department by name.
3795
+ * @returns {Promise<ApplicationDepartmentListingResponse>} - Success response
2749
3796
  * @summary: List all the departments for the application
2750
3797
  * @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the application departments. If successful, returns the list of departments specified in `ApplicationDepartmentListingResponse`
2751
3798
  */
2752
- getApplicationDepartmentListing({ pageNo, pageSize, q } = {}) {
3799
+ async getApplicationDepartmentListing({ pageNo, pageSize, q } = {}) {
2753
3800
  const {
2754
3801
  error,
2755
3802
  } = CatalogValidator.getApplicationDepartmentListing().validate(
@@ -2776,10 +3823,12 @@ class Catalog {
2776
3823
  { abortEarly: false, allowUnknown: false }
2777
3824
  );
2778
3825
  if (warrning) {
2779
- console.log(
2780
- "Parameter Validation warrnings for getApplicationDepartmentListing"
2781
- );
2782
- console.log(warrning);
3826
+ Logger({
3827
+ level: "WARN",
3828
+ message:
3829
+ "Parameter Validation warrnings for getApplicationDepartmentListing",
3830
+ });
3831
+ Logger({ level: "WARN", message: warrning });
2783
3832
  }
2784
3833
 
2785
3834
  const query_params = {};
@@ -2787,13 +3836,31 @@ class Catalog {
2787
3836
  query_params["page_size"] = pageSize;
2788
3837
  query_params["q"] = q;
2789
3838
 
2790
- return PlatformAPIClient.execute(
3839
+ const response = await PlatformAPIClient.execute(
2791
3840
  this.config,
2792
3841
  "get",
2793
3842
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/department`,
2794
3843
  query_params,
2795
3844
  undefined
2796
3845
  );
3846
+
3847
+ const {
3848
+ error: res_error,
3849
+ } = CatalogModel.ApplicationDepartmentListingResponse().validate(response, {
3850
+ abortEarly: false,
3851
+ allowUnknown: false,
3852
+ });
3853
+
3854
+ if (res_error) {
3855
+ Logger({
3856
+ level: "WARN",
3857
+ message:
3858
+ "Response Validation Warnnings for getApplicationDepartmentListing",
3859
+ });
3860
+ Logger({ level: "WARN", message: res_error });
3861
+ }
3862
+
3863
+ return response;
2797
3864
  }
2798
3865
 
2799
3866
  /**
@@ -2842,10 +3909,11 @@ class Catalog {
2842
3909
  * @param {string} arg.departmentUid - Department id for which the
2843
3910
  * custom_json is associated.
2844
3911
  * @param {ApplicationDepartmentJson} arg.body
3912
+ * @returns {Promise<SuccessResponse1>} - Success response
2845
3913
  * @summary: Update a single custom json.
2846
3914
  * @description: This API helps to update data associated to a item custom meta.
2847
3915
  */
2848
- updateAppDepartment({ departmentUid, body } = {}) {
3916
+ async updateAppDepartment({ departmentUid, body } = {}) {
2849
3917
  const { error } = CatalogValidator.updateAppDepartment().validate(
2850
3918
  {
2851
3919
  departmentUid,
@@ -2866,29 +3934,50 @@ class Catalog {
2866
3934
  { abortEarly: false, allowUnknown: false }
2867
3935
  );
2868
3936
  if (warrning) {
2869
- console.log("Parameter Validation warrnings for updateAppDepartment");
2870
- console.log(warrning);
3937
+ Logger({
3938
+ level: "WARN",
3939
+ message: "Parameter Validation warrnings for updateAppDepartment",
3940
+ });
3941
+ Logger({ level: "WARN", message: warrning });
2871
3942
  }
2872
3943
 
2873
3944
  const query_params = {};
2874
3945
 
2875
- return PlatformAPIClient.execute(
3946
+ const response = await PlatformAPIClient.execute(
2876
3947
  this.config,
2877
3948
  "patch",
2878
3949
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/department/${departmentUid}`,
2879
3950
  query_params,
2880
3951
  body
2881
3952
  );
3953
+
3954
+ const {
3955
+ error: res_error,
3956
+ } = CatalogModel.SuccessResponse1().validate(response, {
3957
+ abortEarly: false,
3958
+ allowUnknown: false,
3959
+ });
3960
+
3961
+ if (res_error) {
3962
+ Logger({
3963
+ level: "WARN",
3964
+ message: "Response Validation Warnnings for updateAppDepartment",
3965
+ });
3966
+ Logger({ level: "WARN", message: res_error });
3967
+ }
3968
+
3969
+ return response;
2882
3970
  }
2883
3971
 
2884
3972
  /**
2885
3973
  * @param {Object} arg - Arg object.
2886
3974
  * @param {string} arg.storeUid - Store id for which the custom_json is associated.
2887
3975
  * @param {ApplicationStoreJson} arg.body
3976
+ * @returns {Promise<SuccessResponse1>} - Success response
2888
3977
  * @summary: Update a single custom json.
2889
3978
  * @description: This API helps to update data associated to a item custom meta.
2890
3979
  */
2891
- updateAppLocation({ storeUid, body } = {}) {
3980
+ async updateAppLocation({ storeUid, body } = {}) {
2892
3981
  const { error } = CatalogValidator.updateAppLocation().validate(
2893
3982
  {
2894
3983
  storeUid,
@@ -2909,19 +3998,39 @@ class Catalog {
2909
3998
  { abortEarly: false, allowUnknown: false }
2910
3999
  );
2911
4000
  if (warrning) {
2912
- console.log("Parameter Validation warrnings for updateAppLocation");
2913
- console.log(warrning);
4001
+ Logger({
4002
+ level: "WARN",
4003
+ message: "Parameter Validation warrnings for updateAppLocation",
4004
+ });
4005
+ Logger({ level: "WARN", message: warrning });
2914
4006
  }
2915
4007
 
2916
4008
  const query_params = {};
2917
4009
 
2918
- return PlatformAPIClient.execute(
4010
+ const response = await PlatformAPIClient.execute(
2919
4011
  this.config,
2920
4012
  "patch",
2921
4013
  `/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/store/${storeUid}`,
2922
4014
  query_params,
2923
4015
  body
2924
4016
  );
4017
+
4018
+ const {
4019
+ error: res_error,
4020
+ } = CatalogModel.SuccessResponse1().validate(response, {
4021
+ abortEarly: false,
4022
+ allowUnknown: false,
4023
+ });
4024
+
4025
+ if (res_error) {
4026
+ Logger({
4027
+ level: "WARN",
4028
+ message: "Response Validation Warnnings for updateAppLocation",
4029
+ });
4030
+ Logger({ level: "WARN", message: res_error });
4031
+ }
4032
+
4033
+ return response;
2925
4034
  }
2926
4035
  }
2927
4036
  module.exports = Catalog;