@gofynd/fdk-client-javascript 1.3.6-beta.1 → 1.3.6

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 (76) hide show
  1. package/README.md +1 -1
  2. package/package.json +2 -2
  3. package/sdk/application/ApplicationConfig.d.ts +11 -3
  4. package/sdk/application/ApplicationConfig.js +21 -3
  5. package/sdk/application/Cart/CartApplicationClient.js +228 -113
  6. package/sdk/application/Catalog/CatalogApplicationClient.js +244 -121
  7. package/sdk/application/Common/CommonApplicationClient.js +20 -9
  8. package/sdk/application/Communication/CommunicationApplicationClient.js +28 -13
  9. package/sdk/application/Configuration/ConfigurationApplicationClient.js +132 -65
  10. package/sdk/application/Content/ContentApplicationClient.js +156 -77
  11. package/sdk/application/FileStorage/FileStorageApplicationClient.js +28 -13
  12. package/sdk/application/Lead/LeadApplicationClient.js +60 -29
  13. package/sdk/application/Logistic/LogisticApplicationClient.js +44 -21
  14. package/sdk/application/Order/OrderApplicationClient.js +100 -49
  15. package/sdk/application/Payment/PaymentApplicationClient.js +340 -169
  16. package/sdk/application/PosCart/PosCartApplicationClient.js +220 -109
  17. package/sdk/application/Rewards/RewardsApplicationClient.js +60 -29
  18. package/sdk/application/Share/ShareApplicationClient.js +60 -29
  19. package/sdk/application/Theme/ThemeApplicationClient.js +36 -17
  20. package/sdk/application/User/UserApplicationClient.js +324 -161
  21. package/sdk/common/AxiosHelper.js +3 -3
  22. package/sdk/common/FDKError.d.ts +4 -0
  23. package/sdk/common/FDKError.js +9 -0
  24. package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +16 -40
  25. package/sdk/partner/FileStorage/FileStoragePartnerClient.js +160 -38
  26. package/sdk/partner/PartnerConfig.d.ts +10 -0
  27. package/sdk/partner/PartnerConfig.js +10 -1
  28. package/sdk/partner/Theme/ThemePartnerClient.d.ts +96 -199
  29. package/sdk/partner/Theme/ThemePartnerClient.js +935 -170
  30. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +36 -17
  31. package/sdk/platform/Billing/BillingPlatformClient.js +140 -69
  32. package/sdk/platform/Cart/CartPlatformApplicationClient.js +456 -228
  33. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +512 -256
  34. package/sdk/platform/Catalog/CatalogPlatformClient.js +620 -309
  35. package/sdk/platform/Common/CommonPlatformClient.js +20 -9
  36. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +472 -236
  37. package/sdk/platform/Communication/CommunicationPlatformClient.js +12 -5
  38. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +14 -1
  39. package/sdk/platform/Communication/CommunicationPlatformModel.js +16 -0
  40. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +116 -57
  41. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +256 -128
  42. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +148 -73
  43. package/sdk/platform/Content/ContentPlatformApplicationClient.js +552 -276
  44. package/sdk/platform/Discount/DiscountPlatformClient.js +92 -45
  45. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +88 -44
  46. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +52 -25
  47. package/sdk/platform/Finance/FinancePlatformClient.js +196 -97
  48. package/sdk/platform/Inventory/InventoryPlatformClient.js +100 -49
  49. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +104 -52
  50. package/sdk/platform/Lead/LeadPlatformClient.js +92 -45
  51. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +26 -0
  52. package/sdk/platform/Order/OrderPlatformApplicationClient.js +239 -5
  53. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +57 -1
  54. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +55 -0
  55. package/sdk/platform/Order/OrderPlatformClient.js +356 -177
  56. package/sdk/platform/Order/OrderPlatformModel.d.ts +44 -5
  57. package/sdk/platform/Order/OrderPlatformModel.js +52 -4
  58. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +16 -8
  59. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +336 -168
  60. package/sdk/platform/Payment/PaymentPlatformClient.js +84 -41
  61. package/sdk/platform/PlatformConfig.d.ts +10 -0
  62. package/sdk/platform/PlatformConfig.js +10 -1
  63. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +96 -48
  64. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +112 -56
  65. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +148 -73
  66. package/sdk/platform/Share/SharePlatformApplicationClient.js +40 -20
  67. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +224 -112
  68. package/sdk/platform/Theme/ThemePlatformClient.js +28 -13
  69. package/sdk/platform/User/UserPlatformApplicationClient.js +144 -72
  70. package/sdk/platform/Webhook/WebhookPlatformClient.js +132 -65
  71. package/sdk/public/Configuration/ConfigurationPublicClient.js +20 -9
  72. package/sdk/public/Inventory/InventoryPublicClient.js +52 -25
  73. package/sdk/public/Partner/PartnerPublicClient.js +12 -5
  74. package/sdk/public/PublicConfig.d.ts +11 -1
  75. package/sdk/public/PublicConfig.js +10 -1
  76. package/sdk/public/Webhook/WebhookPublicClient.js +20 -9
@@ -1,9 +1,13 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PartnerAPIClient = require("../PartnerAPIClient");
4
- const ThemeValidator = require("./ThemePartnerValidator");
5
- const ThemeModel = require("./ThemePartnerModel");
2
+ const {
3
+ FDKClientValidationError,
4
+ FDKResponseValidationError,
5
+ } = require("../../common/FDKError");
6
+ const Paginator = require("../../common/Paginator");
7
+ const ThemePartnerValidator = require("./ThemePartnerValidator");
8
+ const ThemePartnerModel = require("./ThemePartnerModel");
6
9
  const { Logger } = require("./../../common/Logger");
10
+ const Joi = require("joi");
7
11
 
8
12
  class Theme {
9
13
  constructor(config) {
@@ -11,36 +15,47 @@ class Theme {
11
15
  }
12
16
 
13
17
  /**
14
- * @param {Object} arg - Arg object.
15
- * @param {number} arg.companyId - Company ID
16
- * @param {string} arg.applicationId - Application ID
17
- * @param {string} arg.themeId - ID of the theme to be retrieved
18
+ * @param {ThemePartnerValidator.GetAllPagesParam} arg - Arg object.
18
19
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
19
20
  * @param {import("../PartnerAPIClient").Options} - Options
21
+ * @returns {Promise<ThemePartnerModel.AllAvailablePageSchema>} - Success response
22
+ * @name getAllPages
20
23
  * @summary: Get all pages of a theme
21
- * @description: Use this API to retrieve all the available pages of a theme by its ID.
24
+ * @description: Use this API to retrieve all the available pages of a theme by its ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getAllPages/).
22
25
  */
23
- getAllPages(
26
+ async getAllPages(
24
27
  { companyId, applicationId, themeId, requestHeaders } = {
25
28
  requestHeaders: {},
26
29
  },
27
30
  { responseHeaders } = { responseHeaders: false }
28
31
  ) {
29
- const { error } = ThemeValidator.getAllPages().validate(
32
+ const { error } = ThemePartnerValidator.getAllPages().validate(
30
33
  {
31
34
  companyId,
32
35
  applicationId,
33
36
  themeId,
34
37
  },
35
- { abortEarly: false }
38
+ { abortEarly: false, allowUnknown: true }
36
39
  );
37
40
  if (error) {
38
41
  return Promise.reject(new FDKClientValidationError(error));
39
42
  }
40
43
 
44
+ // Showing warrnings if extra unknown parameters are found
45
+ const { error: warrning } = ThemePartnerValidator.getAllPages().validate(
46
+ { companyId, applicationId, themeId },
47
+ { abortEarly: false, allowUnknown: false }
48
+ );
49
+ if (warrning) {
50
+ Logger({
51
+ level: "WARN",
52
+ message: `Parameter Validation warrnings for partner > Theme > getAllPages \n ${warrning}`,
53
+ });
54
+ }
55
+
41
56
  const query_params = {};
42
57
 
43
- return PartnerAPIClient.execute(
58
+ const response = await PartnerAPIClient.execute(
44
59
  this.config,
45
60
  "get",
46
61
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}/page`,
@@ -49,41 +64,82 @@ class Theme {
49
64
  requestHeaders,
50
65
  { responseHeaders }
51
66
  );
67
+
68
+ let responseData = response;
69
+ if (responseHeaders) {
70
+ responseData = response[0];
71
+ }
72
+
73
+ const {
74
+ error: res_error,
75
+ } = ThemePartnerModel.AllAvailablePageSchema().validate(responseData, {
76
+ abortEarly: false,
77
+ allowUnknown: false,
78
+ });
79
+
80
+ if (res_error) {
81
+ if (this.config.options.strictResponseCheck === true) {
82
+ return Promise.reject(new FDKResponseValidationError(res_error));
83
+ } else {
84
+ Logger({
85
+ level: "WARN",
86
+ message: `Response Validation Warnings for partner > Theme > getAllPages \n ${res_error}`,
87
+ });
88
+ }
89
+ }
90
+
91
+ return response;
52
92
  }
53
93
 
54
94
  /**
55
- * @param {Object} arg - Arg object.
56
- * @param {number} arg.companyId - Company ID
57
- * @param {string} arg.applicationId - Application ID
58
- * @param {string} arg.themeId - ID of the theme
59
- * @param {AvailablePageSchema} arg.body
95
+ * @param {ThemePartnerValidator.CreatePageParam} arg - Arg object.
60
96
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
61
97
  * @param {import("../PartnerAPIClient").Options} - Options
98
+ * @returns {Promise<ThemePartnerModel.AvailablePageSchema>} - Success response
99
+ * @name createPage
62
100
  * @summary: Create a page
63
- * @description: Use this API to create a page for a theme by its ID.
101
+ * @description: Use this API to create a page for a theme by its ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/createPage/).
64
102
  */
65
- createPage(
103
+ async createPage(
66
104
  { companyId, applicationId, themeId, body, requestHeaders } = {
67
105
  requestHeaders: {},
68
106
  },
69
107
  { responseHeaders } = { responseHeaders: false }
70
108
  ) {
71
- const { error } = ThemeValidator.createPage().validate(
109
+ const { error } = ThemePartnerValidator.createPage().validate(
72
110
  {
73
111
  companyId,
74
112
  applicationId,
75
113
  themeId,
76
114
  body,
77
115
  },
78
- { abortEarly: false }
116
+ { abortEarly: false, allowUnknown: true }
79
117
  );
80
118
  if (error) {
81
119
  return Promise.reject(new FDKClientValidationError(error));
82
120
  }
83
121
 
122
+ // Showing warrnings if extra unknown parameters are found
123
+ const { error: warrning } = ThemePartnerValidator.createPage().validate(
124
+ {
125
+ companyId,
126
+ applicationId,
127
+ themeId,
128
+
129
+ body,
130
+ },
131
+ { abortEarly: false, allowUnknown: false }
132
+ );
133
+ if (warrning) {
134
+ Logger({
135
+ level: "WARN",
136
+ message: `Parameter Validation warrnings for partner > Theme > createPage \n ${warrning}`,
137
+ });
138
+ }
139
+
84
140
  const query_params = {};
85
141
 
86
- return PartnerAPIClient.execute(
142
+ const response = await PartnerAPIClient.execute(
87
143
  this.config,
88
144
  "post",
89
145
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}/page`,
@@ -92,41 +148,84 @@ class Theme {
92
148
  requestHeaders,
93
149
  { responseHeaders }
94
150
  );
151
+
152
+ let responseData = response;
153
+ if (responseHeaders) {
154
+ responseData = response[0];
155
+ }
156
+
157
+ const {
158
+ error: res_error,
159
+ } = ThemePartnerModel.AvailablePageSchema().validate(responseData, {
160
+ abortEarly: false,
161
+ allowUnknown: false,
162
+ });
163
+
164
+ if (res_error) {
165
+ if (this.config.options.strictResponseCheck === true) {
166
+ return Promise.reject(new FDKResponseValidationError(res_error));
167
+ } else {
168
+ Logger({
169
+ level: "WARN",
170
+ message: `Response Validation Warnings for partner > Theme > createPage \n ${res_error}`,
171
+ });
172
+ }
173
+ }
174
+
175
+ return response;
95
176
  }
96
177
 
97
178
  /**
98
- * @param {Object} arg - Arg object.
99
- * @param {number} arg.companyId - Company ID
100
- * @param {string} arg.applicationId - Application ID
101
- * @param {string} arg.themeId - ID of the theme to be retrieved
102
- * @param {AllAvailablePageSchema} arg.body
179
+ * @param {ThemePartnerValidator.UpdateMultiplePagesParam} arg - Arg object.
103
180
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
104
181
  * @param {import("../PartnerAPIClient").Options} - Options
182
+ * @returns {Promise<ThemePartnerModel.AllAvailablePageSchema>} - Success response
183
+ * @name updateMultiplePages
105
184
  * @summary: Update multiple pages of a theme
106
- * @description: Use this API to update multiple pages of a theme by its ID.
185
+ * @description: Use this API to update multiple pages of a theme by its ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/updateMultiplePages/).
107
186
  */
108
- updateMultiplePages(
187
+ async updateMultiplePages(
109
188
  { companyId, applicationId, themeId, body, requestHeaders } = {
110
189
  requestHeaders: {},
111
190
  },
112
191
  { responseHeaders } = { responseHeaders: false }
113
192
  ) {
114
- const { error } = ThemeValidator.updateMultiplePages().validate(
193
+ const { error } = ThemePartnerValidator.updateMultiplePages().validate(
115
194
  {
116
195
  companyId,
117
196
  applicationId,
118
197
  themeId,
119
198
  body,
120
199
  },
121
- { abortEarly: false }
200
+ { abortEarly: false, allowUnknown: true }
122
201
  );
123
202
  if (error) {
124
203
  return Promise.reject(new FDKClientValidationError(error));
125
204
  }
126
205
 
206
+ // Showing warrnings if extra unknown parameters are found
207
+ const {
208
+ error: warrning,
209
+ } = ThemePartnerValidator.updateMultiplePages().validate(
210
+ {
211
+ companyId,
212
+ applicationId,
213
+ themeId,
214
+
215
+ body,
216
+ },
217
+ { abortEarly: false, allowUnknown: false }
218
+ );
219
+ if (warrning) {
220
+ Logger({
221
+ level: "WARN",
222
+ message: `Parameter Validation warrnings for partner > Theme > updateMultiplePages \n ${warrning}`,
223
+ });
224
+ }
225
+
127
226
  const query_params = {};
128
227
 
129
- return PartnerAPIClient.execute(
228
+ const response = await PartnerAPIClient.execute(
130
229
  this.config,
131
230
  "put",
132
231
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}/page`,
@@ -135,41 +234,76 @@ class Theme {
135
234
  requestHeaders,
136
235
  { responseHeaders }
137
236
  );
237
+
238
+ let responseData = response;
239
+ if (responseHeaders) {
240
+ responseData = response[0];
241
+ }
242
+
243
+ const {
244
+ error: res_error,
245
+ } = ThemePartnerModel.AllAvailablePageSchema().validate(responseData, {
246
+ abortEarly: false,
247
+ allowUnknown: false,
248
+ });
249
+
250
+ if (res_error) {
251
+ if (this.config.options.strictResponseCheck === true) {
252
+ return Promise.reject(new FDKResponseValidationError(res_error));
253
+ } else {
254
+ Logger({
255
+ level: "WARN",
256
+ message: `Response Validation Warnings for partner > Theme > updateMultiplePages \n ${res_error}`,
257
+ });
258
+ }
259
+ }
260
+
261
+ return response;
138
262
  }
139
263
 
140
264
  /**
141
- * @param {Object} arg - Arg object.
142
- * @param {number} arg.companyId - Company ID
143
- * @param {string} arg.applicationId - Application ID
144
- * @param {string} arg.themeId - ID of the theme to be retrieved
145
- * @param {string} arg.pageValue - Value of the page to be retrieved
265
+ * @param {ThemePartnerValidator.GetPageParam} arg - Arg object.
146
266
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
147
267
  * @param {import("../PartnerAPIClient").Options} - Options
268
+ * @returns {Promise<ThemePartnerModel.AvailablePageSchema>} - Success response
269
+ * @name getPage
148
270
  * @summary: Get page of a theme
149
- * @description: Use this API to retrieve a page of a theme.
271
+ * @description: Use this API to retrieve a page of a theme. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getPage/).
150
272
  */
151
- getPage(
273
+ async getPage(
152
274
  { companyId, applicationId, themeId, pageValue, requestHeaders } = {
153
275
  requestHeaders: {},
154
276
  },
155
277
  { responseHeaders } = { responseHeaders: false }
156
278
  ) {
157
- const { error } = ThemeValidator.getPage().validate(
279
+ const { error } = ThemePartnerValidator.getPage().validate(
158
280
  {
159
281
  companyId,
160
282
  applicationId,
161
283
  themeId,
162
284
  pageValue,
163
285
  },
164
- { abortEarly: false }
286
+ { abortEarly: false, allowUnknown: true }
165
287
  );
166
288
  if (error) {
167
289
  return Promise.reject(new FDKClientValidationError(error));
168
290
  }
169
291
 
292
+ // Showing warrnings if extra unknown parameters are found
293
+ const { error: warrning } = ThemePartnerValidator.getPage().validate(
294
+ { companyId, applicationId, themeId, pageValue },
295
+ { abortEarly: false, allowUnknown: false }
296
+ );
297
+ if (warrning) {
298
+ Logger({
299
+ level: "WARN",
300
+ message: `Parameter Validation warrnings for partner > Theme > getPage \n ${warrning}`,
301
+ });
302
+ }
303
+
170
304
  const query_params = {};
171
305
 
172
- return PartnerAPIClient.execute(
306
+ const response = await PartnerAPIClient.execute(
173
307
  this.config,
174
308
  "get",
175
309
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}/${pageValue}`,
@@ -178,27 +312,49 @@ class Theme {
178
312
  requestHeaders,
179
313
  { responseHeaders }
180
314
  );
315
+
316
+ let responseData = response;
317
+ if (responseHeaders) {
318
+ responseData = response[0];
319
+ }
320
+
321
+ const {
322
+ error: res_error,
323
+ } = ThemePartnerModel.AvailablePageSchema().validate(responseData, {
324
+ abortEarly: false,
325
+ allowUnknown: false,
326
+ });
327
+
328
+ if (res_error) {
329
+ if (this.config.options.strictResponseCheck === true) {
330
+ return Promise.reject(new FDKResponseValidationError(res_error));
331
+ } else {
332
+ Logger({
333
+ level: "WARN",
334
+ message: `Response Validation Warnings for partner > Theme > getPage \n ${res_error}`,
335
+ });
336
+ }
337
+ }
338
+
339
+ return response;
181
340
  }
182
341
 
183
342
  /**
184
- * @param {Object} arg - Arg object.
185
- * @param {number} arg.companyId - Company ID
186
- * @param {string} arg.applicationId - Application ID
187
- * @param {string} arg.themeId - ID of the theme
188
- * @param {string} arg.pageValue - Value of the page to be updated
189
- * @param {AvailablePageSchema} arg.body
343
+ * @param {ThemePartnerValidator.UpdatePageParam} arg - Arg object.
190
344
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
191
345
  * @param {import("../PartnerAPIClient").Options} - Options
346
+ * @returns {Promise<ThemePartnerModel.AvailablePageSchema>} - Success response
347
+ * @name updatePage
192
348
  * @summary: Updates a page
193
- * @description: Use this API to update a page for a theme by its ID.
349
+ * @description: Use this API to update a page for a theme by its ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/updatePage/).
194
350
  */
195
- updatePage(
351
+ async updatePage(
196
352
  { companyId, applicationId, themeId, pageValue, body, requestHeaders } = {
197
353
  requestHeaders: {},
198
354
  },
199
355
  { responseHeaders } = { responseHeaders: false }
200
356
  ) {
201
- const { error } = ThemeValidator.updatePage().validate(
357
+ const { error } = ThemePartnerValidator.updatePage().validate(
202
358
  {
203
359
  companyId,
204
360
  applicationId,
@@ -206,15 +362,34 @@ class Theme {
206
362
  pageValue,
207
363
  body,
208
364
  },
209
- { abortEarly: false }
365
+ { abortEarly: false, allowUnknown: true }
210
366
  );
211
367
  if (error) {
212
368
  return Promise.reject(new FDKClientValidationError(error));
213
369
  }
214
370
 
371
+ // Showing warrnings if extra unknown parameters are found
372
+ const { error: warrning } = ThemePartnerValidator.updatePage().validate(
373
+ {
374
+ companyId,
375
+ applicationId,
376
+ themeId,
377
+ pageValue,
378
+
379
+ body,
380
+ },
381
+ { abortEarly: false, allowUnknown: false }
382
+ );
383
+ if (warrning) {
384
+ Logger({
385
+ level: "WARN",
386
+ message: `Parameter Validation warrnings for partner > Theme > updatePage \n ${warrning}`,
387
+ });
388
+ }
389
+
215
390
  const query_params = {};
216
391
 
217
- return PartnerAPIClient.execute(
392
+ const response = await PartnerAPIClient.execute(
218
393
  this.config,
219
394
  "put",
220
395
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}/${pageValue}`,
@@ -223,41 +398,76 @@ class Theme {
223
398
  requestHeaders,
224
399
  { responseHeaders }
225
400
  );
401
+
402
+ let responseData = response;
403
+ if (responseHeaders) {
404
+ responseData = response[0];
405
+ }
406
+
407
+ const {
408
+ error: res_error,
409
+ } = ThemePartnerModel.AvailablePageSchema().validate(responseData, {
410
+ abortEarly: false,
411
+ allowUnknown: false,
412
+ });
413
+
414
+ if (res_error) {
415
+ if (this.config.options.strictResponseCheck === true) {
416
+ return Promise.reject(new FDKResponseValidationError(res_error));
417
+ } else {
418
+ Logger({
419
+ level: "WARN",
420
+ message: `Response Validation Warnings for partner > Theme > updatePage \n ${res_error}`,
421
+ });
422
+ }
423
+ }
424
+
425
+ return response;
226
426
  }
227
427
 
228
428
  /**
229
- * @param {Object} arg - Arg object.
230
- * @param {number} arg.companyId - Company ID
231
- * @param {string} arg.applicationId - Application ID
232
- * @param {string} arg.themeId - ID of the theme
233
- * @param {string} arg.pageValue - Value of the page to be updated
429
+ * @param {ThemePartnerValidator.DeletePageParam} arg - Arg object.
234
430
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
235
431
  * @param {import("../PartnerAPIClient").Options} - Options
432
+ * @returns {Promise<ThemePartnerModel.AvailablePageSchema>} - Success response
433
+ * @name deletePage
236
434
  * @summary: Deletes a page
237
- * @description: Use this API to delete a page for a theme by its ID and page_value.
435
+ * @description: Use this API to delete a page for a theme by its ID and page_value. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/deletePage/).
238
436
  */
239
- deletePage(
437
+ async deletePage(
240
438
  { companyId, applicationId, themeId, pageValue, requestHeaders } = {
241
439
  requestHeaders: {},
242
440
  },
243
441
  { responseHeaders } = { responseHeaders: false }
244
442
  ) {
245
- const { error } = ThemeValidator.deletePage().validate(
443
+ const { error } = ThemePartnerValidator.deletePage().validate(
246
444
  {
247
445
  companyId,
248
446
  applicationId,
249
447
  themeId,
250
448
  pageValue,
251
449
  },
252
- { abortEarly: false }
450
+ { abortEarly: false, allowUnknown: true }
253
451
  );
254
452
  if (error) {
255
453
  return Promise.reject(new FDKClientValidationError(error));
256
454
  }
257
455
 
456
+ // Showing warrnings if extra unknown parameters are found
457
+ const { error: warrning } = ThemePartnerValidator.deletePage().validate(
458
+ { companyId, applicationId, themeId, pageValue },
459
+ { abortEarly: false, allowUnknown: false }
460
+ );
461
+ if (warrning) {
462
+ Logger({
463
+ level: "WARN",
464
+ message: `Parameter Validation warrnings for partner > Theme > deletePage \n ${warrning}`,
465
+ });
466
+ }
467
+
258
468
  const query_params = {};
259
469
 
260
- return PartnerAPIClient.execute(
470
+ const response = await PartnerAPIClient.execute(
261
471
  this.config,
262
472
  "delete",
263
473
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}/${pageValue}`,
@@ -266,35 +476,74 @@ class Theme {
266
476
  requestHeaders,
267
477
  { responseHeaders }
268
478
  );
479
+
480
+ let responseData = response;
481
+ if (responseHeaders) {
482
+ responseData = response[0];
483
+ }
484
+
485
+ const {
486
+ error: res_error,
487
+ } = ThemePartnerModel.AvailablePageSchema().validate(responseData, {
488
+ abortEarly: false,
489
+ allowUnknown: false,
490
+ });
491
+
492
+ if (res_error) {
493
+ if (this.config.options.strictResponseCheck === true) {
494
+ return Promise.reject(new FDKResponseValidationError(res_error));
495
+ } else {
496
+ Logger({
497
+ level: "WARN",
498
+ message: `Response Validation Warnings for partner > Theme > deletePage \n ${res_error}`,
499
+ });
500
+ }
501
+ }
502
+
503
+ return response;
269
504
  }
270
505
 
271
506
  /**
272
- * @param {Object} arg - Arg object.
273
- * @param {number} arg.companyId - The ID of the company
274
- * @param {string} arg.applicationId - The ID of the application
507
+ * @param {ThemePartnerValidator.GetApplicationThemesParam} arg - Arg object.
275
508
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
276
509
  * @param {import("../PartnerAPIClient").Options} - Options
510
+ * @returns {Promise<ThemePartnerModel.ThemesSchema[]>} - Success response
511
+ * @name getApplicationThemes
277
512
  * @summary: Get all the themes for a specific application
278
- * @description: Use this API to get list of theme
513
+ * @description: Use this API to get list of theme - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getApplicationThemes/).
279
514
  */
280
- getApplicationThemes(
515
+ async getApplicationThemes(
281
516
  { companyId, applicationId, requestHeaders } = { requestHeaders: {} },
282
517
  { responseHeaders } = { responseHeaders: false }
283
518
  ) {
284
- const { error } = ThemeValidator.getApplicationThemes().validate(
519
+ const { error } = ThemePartnerValidator.getApplicationThemes().validate(
285
520
  {
286
521
  companyId,
287
522
  applicationId,
288
523
  },
289
- { abortEarly: false }
524
+ { abortEarly: false, allowUnknown: true }
290
525
  );
291
526
  if (error) {
292
527
  return Promise.reject(new FDKClientValidationError(error));
293
528
  }
294
529
 
530
+ // Showing warrnings if extra unknown parameters are found
531
+ const {
532
+ error: warrning,
533
+ } = ThemePartnerValidator.getApplicationThemes().validate(
534
+ { companyId, applicationId },
535
+ { abortEarly: false, allowUnknown: false }
536
+ );
537
+ if (warrning) {
538
+ Logger({
539
+ level: "WARN",
540
+ message: `Parameter Validation warrnings for partner > Theme > getApplicationThemes \n ${warrning}`,
541
+ });
542
+ }
543
+
295
544
  const query_params = {};
296
545
 
297
- return PartnerAPIClient.execute(
546
+ const response = await PartnerAPIClient.execute(
298
547
  this.config,
299
548
  "get",
300
549
  `/service/partner/theme/v2.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/themes`,
@@ -303,39 +552,72 @@ class Theme {
303
552
  requestHeaders,
304
553
  { responseHeaders }
305
554
  );
555
+
556
+ let responseData = response;
557
+ if (responseHeaders) {
558
+ responseData = response[0];
559
+ }
560
+
561
+ const { error: res_error } = Joi.array()
562
+ .items(ThemePartnerModel.ThemesSchema())
563
+ .validate(responseData, { abortEarly: false, allowUnknown: false });
564
+
565
+ if (res_error) {
566
+ if (this.config.options.strictResponseCheck === true) {
567
+ return Promise.reject(new FDKResponseValidationError(res_error));
568
+ } else {
569
+ Logger({
570
+ level: "WARN",
571
+ message: `Response Validation Warnings for partner > Theme > getApplicationThemes \n ${res_error}`,
572
+ });
573
+ }
574
+ }
575
+
576
+ return response;
306
577
  }
307
578
 
308
579
  /**
309
- * @param {Object} arg - Arg object.
310
- * @param {number} arg.companyId - The ID of the company
311
- * @param {string} arg.applicationId - The ID of the application
312
- * @param {string} arg.themeId - The ID of the theme
580
+ * @param {ThemePartnerValidator.GetThemeByIdParam} arg - Arg object.
313
581
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
314
582
  * @param {import("../PartnerAPIClient").Options} - Options
583
+ * @returns {Promise<ThemePartnerModel.ThemesSchema>} - Success response
584
+ * @name getThemeById
315
585
  * @summary: Get Theme By Theme Id
316
- * @description: Use this API to get theme details
586
+ * @description: Use this API to get theme details - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getThemeById/).
317
587
  */
318
- getThemeById(
588
+ async getThemeById(
319
589
  { companyId, applicationId, themeId, requestHeaders } = {
320
590
  requestHeaders: {},
321
591
  },
322
592
  { responseHeaders } = { responseHeaders: false }
323
593
  ) {
324
- const { error } = ThemeValidator.getThemeById().validate(
594
+ const { error } = ThemePartnerValidator.getThemeById().validate(
325
595
  {
326
596
  companyId,
327
597
  applicationId,
328
598
  themeId,
329
599
  },
330
- { abortEarly: false }
600
+ { abortEarly: false, allowUnknown: true }
331
601
  );
332
602
  if (error) {
333
603
  return Promise.reject(new FDKClientValidationError(error));
334
604
  }
335
605
 
606
+ // Showing warrnings if extra unknown parameters are found
607
+ const { error: warrning } = ThemePartnerValidator.getThemeById().validate(
608
+ { companyId, applicationId, themeId },
609
+ { abortEarly: false, allowUnknown: false }
610
+ );
611
+ if (warrning) {
612
+ Logger({
613
+ level: "WARN",
614
+ message: `Parameter Validation warrnings for partner > Theme > getThemeById \n ${warrning}`,
615
+ });
616
+ }
617
+
336
618
  const query_params = {};
337
619
 
338
- return PartnerAPIClient.execute(
620
+ const response = await PartnerAPIClient.execute(
339
621
  this.config,
340
622
  "get",
341
623
  `/service/partner/theme/v2.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}`,
@@ -344,41 +626,82 @@ class Theme {
344
626
  requestHeaders,
345
627
  { responseHeaders }
346
628
  );
629
+
630
+ let responseData = response;
631
+ if (responseHeaders) {
632
+ responseData = response[0];
633
+ }
634
+
635
+ const {
636
+ error: res_error,
637
+ } = ThemePartnerModel.ThemesSchema().validate(responseData, {
638
+ abortEarly: false,
639
+ allowUnknown: false,
640
+ });
641
+
642
+ if (res_error) {
643
+ if (this.config.options.strictResponseCheck === true) {
644
+ return Promise.reject(new FDKResponseValidationError(res_error));
645
+ } else {
646
+ Logger({
647
+ level: "WARN",
648
+ message: `Response Validation Warnings for partner > Theme > getThemeById \n ${res_error}`,
649
+ });
650
+ }
651
+ }
652
+
653
+ return response;
347
654
  }
348
655
 
349
656
  /**
350
- * @param {Object} arg - Arg object.
351
- * @param {number} arg.companyId - The ID of the company.
352
- * @param {string} arg.applicationId - The ID of the application.
353
- * @param {string} arg.themeId - The ID of the theme.
354
- * @param {UpdateThemeRequestBody} arg.body
657
+ * @param {ThemePartnerValidator.UpdateThemeParam} arg - Arg object.
355
658
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
356
659
  * @param {import("../PartnerAPIClient").Options} - Options
660
+ * @returns {Promise<ThemePartnerModel.ThemesSchema>} - Success response
661
+ * @name updateTheme
357
662
  * @summary: Update theme for a specific company and application
358
- * @description: Update theme for a specific company and application
663
+ * @description: Update theme for a specific company and application - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/updateTheme/).
359
664
  */
360
- updateTheme(
665
+ async updateTheme(
361
666
  { companyId, applicationId, themeId, body, requestHeaders } = {
362
667
  requestHeaders: {},
363
668
  },
364
669
  { responseHeaders } = { responseHeaders: false }
365
670
  ) {
366
- const { error } = ThemeValidator.updateTheme().validate(
671
+ const { error } = ThemePartnerValidator.updateTheme().validate(
367
672
  {
368
673
  companyId,
369
674
  applicationId,
370
675
  themeId,
371
676
  body,
372
677
  },
373
- { abortEarly: false }
678
+ { abortEarly: false, allowUnknown: true }
374
679
  );
375
680
  if (error) {
376
681
  return Promise.reject(new FDKClientValidationError(error));
377
682
  }
378
683
 
684
+ // Showing warrnings if extra unknown parameters are found
685
+ const { error: warrning } = ThemePartnerValidator.updateTheme().validate(
686
+ {
687
+ companyId,
688
+ applicationId,
689
+ themeId,
690
+
691
+ body,
692
+ },
693
+ { abortEarly: false, allowUnknown: false }
694
+ );
695
+ if (warrning) {
696
+ Logger({
697
+ level: "WARN",
698
+ message: `Parameter Validation warrnings for partner > Theme > updateTheme \n ${warrning}`,
699
+ });
700
+ }
701
+
379
702
  const query_params = {};
380
703
 
381
- return PartnerAPIClient.execute(
704
+ const response = await PartnerAPIClient.execute(
382
705
  this.config,
383
706
  "put",
384
707
  `/service/partner/theme/v2.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}`,
@@ -387,39 +710,75 @@ class Theme {
387
710
  requestHeaders,
388
711
  { responseHeaders }
389
712
  );
713
+
714
+ let responseData = response;
715
+ if (responseHeaders) {
716
+ responseData = response[0];
717
+ }
718
+
719
+ const {
720
+ error: res_error,
721
+ } = ThemePartnerModel.ThemesSchema().validate(responseData, {
722
+ abortEarly: false,
723
+ allowUnknown: false,
724
+ });
725
+
726
+ if (res_error) {
727
+ if (this.config.options.strictResponseCheck === true) {
728
+ return Promise.reject(new FDKResponseValidationError(res_error));
729
+ } else {
730
+ Logger({
731
+ level: "WARN",
732
+ message: `Response Validation Warnings for partner > Theme > updateTheme \n ${res_error}`,
733
+ });
734
+ }
735
+ }
736
+
737
+ return response;
390
738
  }
391
739
 
392
740
  /**
393
- * @param {Object} arg - Arg object.
394
- * @param {number} arg.companyId - The ID of the company.
395
- * @param {string} arg.applicationId - The ID of the application.
396
- * @param {string} arg.themeId - The ID of the theme to be deleted.
741
+ * @param {ThemePartnerValidator.DeleteThemeParam} arg - Arg object.
397
742
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
398
743
  * @param {import("../PartnerAPIClient").Options} - Options
744
+ * @returns {Promise<ThemePartnerModel.ThemesSchema>} - Success response
745
+ * @name deleteTheme
399
746
  * @summary: Delete a theme
400
- * @description: This endpoint is used to delete a theme from the specified company and application.
747
+ * @description: This endpoint is used to delete a theme from the specified company and application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/deleteTheme/).
401
748
  */
402
- deleteTheme(
749
+ async deleteTheme(
403
750
  { companyId, applicationId, themeId, requestHeaders } = {
404
751
  requestHeaders: {},
405
752
  },
406
753
  { responseHeaders } = { responseHeaders: false }
407
754
  ) {
408
- const { error } = ThemeValidator.deleteTheme().validate(
755
+ const { error } = ThemePartnerValidator.deleteTheme().validate(
409
756
  {
410
757
  companyId,
411
758
  applicationId,
412
759
  themeId,
413
760
  },
414
- { abortEarly: false }
761
+ { abortEarly: false, allowUnknown: true }
415
762
  );
416
763
  if (error) {
417
764
  return Promise.reject(new FDKClientValidationError(error));
418
765
  }
419
766
 
767
+ // Showing warrnings if extra unknown parameters are found
768
+ const { error: warrning } = ThemePartnerValidator.deleteTheme().validate(
769
+ { companyId, applicationId, themeId },
770
+ { abortEarly: false, allowUnknown: false }
771
+ );
772
+ if (warrning) {
773
+ Logger({
774
+ level: "WARN",
775
+ message: `Parameter Validation warrnings for partner > Theme > deleteTheme \n ${warrning}`,
776
+ });
777
+ }
778
+
420
779
  const query_params = {};
421
780
 
422
- return PartnerAPIClient.execute(
781
+ const response = await PartnerAPIClient.execute(
423
782
  this.config,
424
783
  "delete",
425
784
  `/service/partner/theme/v2.0/organization/${this.config.organizationId}/company/${companyId}/application/${applicationId}/${themeId}`,
@@ -428,40 +787,82 @@ class Theme {
428
787
  requestHeaders,
429
788
  { responseHeaders }
430
789
  );
790
+
791
+ let responseData = response;
792
+ if (responseHeaders) {
793
+ responseData = response[0];
794
+ }
795
+
796
+ const {
797
+ error: res_error,
798
+ } = ThemePartnerModel.ThemesSchema().validate(responseData, {
799
+ abortEarly: false,
800
+ allowUnknown: false,
801
+ });
802
+
803
+ if (res_error) {
804
+ if (this.config.options.strictResponseCheck === true) {
805
+ return Promise.reject(new FDKResponseValidationError(res_error));
806
+ } else {
807
+ Logger({
808
+ level: "WARN",
809
+ message: `Response Validation Warnings for partner > Theme > deleteTheme \n ${res_error}`,
810
+ });
811
+ }
812
+ }
813
+
814
+ return response;
431
815
  }
432
816
 
433
817
  /**
434
- * @param {Object} arg - Arg object.
435
- * @param {string} [arg.status] - The status of the theme
436
- * @param {number} [arg.pageSize] - Number of themes per page
437
- * @param {number} [arg.pageNo] - Page number to retrieve
818
+ * @param {ThemePartnerValidator.GetOrganizationThemesParam} arg - Arg object.
438
819
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
439
820
  * @param {import("../PartnerAPIClient").Options} - Options
821
+ * @returns {Promise<ThemePartnerModel.MarketplaceThemeSchema>} - Success response
822
+ * @name getOrganizationThemes
440
823
  * @summary: Get organization's themes
441
- * @description: Get organization's themes
824
+ * @description: Get organization's themes - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getOrganizationThemes/).
442
825
  */
443
- getOrganizationThemes(
826
+ async getOrganizationThemes(
444
827
  { status, pageSize, pageNo, requestHeaders } = { requestHeaders: {} },
445
828
  { responseHeaders } = { responseHeaders: false }
446
829
  ) {
447
- const { error } = ThemeValidator.getOrganizationThemes().validate(
830
+ const { error } = ThemePartnerValidator.getOrganizationThemes().validate(
448
831
  {
449
832
  status,
450
833
  pageSize,
451
834
  pageNo,
452
835
  },
453
- { abortEarly: false }
836
+ { abortEarly: false, allowUnknown: true }
454
837
  );
455
838
  if (error) {
456
839
  return Promise.reject(new FDKClientValidationError(error));
457
840
  }
458
841
 
842
+ // Showing warrnings if extra unknown parameters are found
843
+ const {
844
+ error: warrning,
845
+ } = ThemePartnerValidator.getOrganizationThemes().validate(
846
+ {
847
+ status,
848
+ pageSize,
849
+ pageNo,
850
+ },
851
+ { abortEarly: false, allowUnknown: false }
852
+ );
853
+ if (warrning) {
854
+ Logger({
855
+ level: "WARN",
856
+ message: `Parameter Validation warrnings for partner > Theme > getOrganizationThemes \n ${warrning}`,
857
+ });
858
+ }
859
+
459
860
  const query_params = {};
460
861
  query_params["status"] = status;
461
862
  query_params["page_size"] = pageSize;
462
863
  query_params["page_no"] = pageNo;
463
864
 
464
- return PartnerAPIClient.execute(
865
+ const response = await PartnerAPIClient.execute(
465
866
  this.config,
466
867
  "get",
467
868
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/themes`,
@@ -470,33 +871,77 @@ class Theme {
470
871
  requestHeaders,
471
872
  { responseHeaders }
472
873
  );
874
+
875
+ let responseData = response;
876
+ if (responseHeaders) {
877
+ responseData = response[0];
878
+ }
879
+
880
+ const {
881
+ error: res_error,
882
+ } = ThemePartnerModel.MarketplaceThemeSchema().validate(responseData, {
883
+ abortEarly: false,
884
+ allowUnknown: false,
885
+ });
886
+
887
+ if (res_error) {
888
+ if (this.config.options.strictResponseCheck === true) {
889
+ return Promise.reject(new FDKResponseValidationError(res_error));
890
+ } else {
891
+ Logger({
892
+ level: "WARN",
893
+ message: `Response Validation Warnings for partner > Theme > getOrganizationThemes \n ${res_error}`,
894
+ });
895
+ }
896
+ }
897
+
898
+ return response;
473
899
  }
474
900
 
475
901
  /**
476
- * @param {Object} arg - Arg object.
477
- * @param {string} arg.themeId - The ID of the theme
902
+ * @param {ThemePartnerValidator.GetOrganizationThemeDetailsParam} arg - Arg object.
478
903
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
479
904
  * @param {import("../PartnerAPIClient").Options} - Options
905
+ * @returns {Promise<ThemePartnerModel.MarketplaceTheme>} - Success response
906
+ * @name getOrganizationThemeDetails
480
907
  * @summary: Get theme details for an organization
481
- * @description: Fetches the theme details for a specific organization and theme ID
908
+ * @description: Fetches the theme details for a specific organization and theme ID - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getOrganizationThemeDetails/).
482
909
  */
483
- getOrganizationThemeDetails(
910
+ async getOrganizationThemeDetails(
484
911
  { themeId, requestHeaders } = { requestHeaders: {} },
485
912
  { responseHeaders } = { responseHeaders: false }
486
913
  ) {
487
- const { error } = ThemeValidator.getOrganizationThemeDetails().validate(
914
+ const {
915
+ error,
916
+ } = ThemePartnerValidator.getOrganizationThemeDetails().validate(
488
917
  {
489
918
  themeId,
490
919
  },
491
- { abortEarly: false }
920
+ { abortEarly: false, allowUnknown: true }
492
921
  );
493
922
  if (error) {
494
923
  return Promise.reject(new FDKClientValidationError(error));
495
924
  }
496
925
 
926
+ // Showing warrnings if extra unknown parameters are found
927
+ const {
928
+ error: warrning,
929
+ } = ThemePartnerValidator.getOrganizationThemeDetails().validate(
930
+ {
931
+ themeId,
932
+ },
933
+ { abortEarly: false, allowUnknown: false }
934
+ );
935
+ if (warrning) {
936
+ Logger({
937
+ level: "WARN",
938
+ message: `Parameter Validation warrnings for partner > Theme > getOrganizationThemeDetails \n ${warrning}`,
939
+ });
940
+ }
941
+
497
942
  const query_params = {};
498
943
 
499
- return PartnerAPIClient.execute(
944
+ const response = await PartnerAPIClient.execute(
500
945
  this.config,
501
946
  "get",
502
947
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme/${themeId}`,
@@ -505,35 +950,77 @@ class Theme {
505
950
  requestHeaders,
506
951
  { responseHeaders }
507
952
  );
953
+
954
+ let responseData = response;
955
+ if (responseHeaders) {
956
+ responseData = response[0];
957
+ }
958
+
959
+ const {
960
+ error: res_error,
961
+ } = ThemePartnerModel.MarketplaceTheme().validate(responseData, {
962
+ abortEarly: false,
963
+ allowUnknown: false,
964
+ });
965
+
966
+ if (res_error) {
967
+ if (this.config.options.strictResponseCheck === true) {
968
+ return Promise.reject(new FDKResponseValidationError(res_error));
969
+ } else {
970
+ Logger({
971
+ level: "WARN",
972
+ message: `Response Validation Warnings for partner > Theme > getOrganizationThemeDetails \n ${res_error}`,
973
+ });
974
+ }
975
+ }
976
+
977
+ return response;
508
978
  }
509
979
 
510
980
  /**
511
- * @param {Object} arg - Arg object.
512
- * @param {string} arg.themeId - The ID of the theme
513
- * @param {MarketplaceTheme} arg.body
981
+ * @param {ThemePartnerValidator.UpdateDraftThemeParam} arg - Arg object.
514
982
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
515
983
  * @param {import("../PartnerAPIClient").Options} - Options
984
+ * @returns {Promise<ThemePartnerModel.MarketplaceTheme>} - Success response
985
+ * @name updateDraftTheme
516
986
  * @summary: Update theme draft/submitted
517
- * @description: Update theme draft/submitted
987
+ * @description: Update theme draft/submitted - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/updateDraftTheme/).
518
988
  */
519
- updateDraftTheme(
989
+ async updateDraftTheme(
520
990
  { themeId, body, requestHeaders } = { requestHeaders: {} },
521
991
  { responseHeaders } = { responseHeaders: false }
522
992
  ) {
523
- const { error } = ThemeValidator.updateDraftTheme().validate(
993
+ const { error } = ThemePartnerValidator.updateDraftTheme().validate(
524
994
  {
525
995
  themeId,
526
996
  body,
527
997
  },
528
- { abortEarly: false }
998
+ { abortEarly: false, allowUnknown: true }
529
999
  );
530
1000
  if (error) {
531
1001
  return Promise.reject(new FDKClientValidationError(error));
532
1002
  }
533
1003
 
1004
+ // Showing warrnings if extra unknown parameters are found
1005
+ const {
1006
+ error: warrning,
1007
+ } = ThemePartnerValidator.updateDraftTheme().validate(
1008
+ {
1009
+ themeId,
1010
+ body,
1011
+ },
1012
+ { abortEarly: false, allowUnknown: false }
1013
+ );
1014
+ if (warrning) {
1015
+ Logger({
1016
+ level: "WARN",
1017
+ message: `Parameter Validation warrnings for partner > Theme > updateDraftTheme \n ${warrning}`,
1018
+ });
1019
+ }
1020
+
534
1021
  const query_params = {};
535
1022
 
536
- return PartnerAPIClient.execute(
1023
+ const response = await PartnerAPIClient.execute(
537
1024
  this.config,
538
1025
  "patch",
539
1026
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme/${themeId}`,
@@ -542,35 +1029,77 @@ class Theme {
542
1029
  requestHeaders,
543
1030
  { responseHeaders }
544
1031
  );
1032
+
1033
+ let responseData = response;
1034
+ if (responseHeaders) {
1035
+ responseData = response[0];
1036
+ }
1037
+
1038
+ const {
1039
+ error: res_error,
1040
+ } = ThemePartnerModel.MarketplaceTheme().validate(responseData, {
1041
+ abortEarly: false,
1042
+ allowUnknown: false,
1043
+ });
1044
+
1045
+ if (res_error) {
1046
+ if (this.config.options.strictResponseCheck === true) {
1047
+ return Promise.reject(new FDKResponseValidationError(res_error));
1048
+ } else {
1049
+ Logger({
1050
+ level: "WARN",
1051
+ message: `Response Validation Warnings for partner > Theme > updateDraftTheme \n ${res_error}`,
1052
+ });
1053
+ }
1054
+ }
1055
+
1056
+ return response;
545
1057
  }
546
1058
 
547
1059
  /**
548
- * @param {Object} arg - Arg object.
549
- * @param {string} arg.themeId - The ID of the theme
550
- * @param {MarketplaceTheme} arg.body
1060
+ * @param {ThemePartnerValidator.SubmitOrganizationThemeParam} arg - Arg object.
551
1061
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
552
1062
  * @param {import("../PartnerAPIClient").Options} - Options
1063
+ * @returns {Promise<ThemePartnerModel.MarketplaceTheme>} - Success response
1064
+ * @name submitOrganizationTheme
553
1065
  * @summary: Submit a theme
554
- * @description: Use this api to Submit a theme
1066
+ * @description: Use this api to Submit a theme - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/submitOrganizationTheme/).
555
1067
  */
556
- submitOrganizationTheme(
1068
+ async submitOrganizationTheme(
557
1069
  { themeId, body, requestHeaders } = { requestHeaders: {} },
558
1070
  { responseHeaders } = { responseHeaders: false }
559
1071
  ) {
560
- const { error } = ThemeValidator.submitOrganizationTheme().validate(
1072
+ const { error } = ThemePartnerValidator.submitOrganizationTheme().validate(
561
1073
  {
562
1074
  themeId,
563
1075
  body,
564
1076
  },
565
- { abortEarly: false }
1077
+ { abortEarly: false, allowUnknown: true }
566
1078
  );
567
1079
  if (error) {
568
1080
  return Promise.reject(new FDKClientValidationError(error));
569
1081
  }
570
1082
 
1083
+ // Showing warrnings if extra unknown parameters are found
1084
+ const {
1085
+ error: warrning,
1086
+ } = ThemePartnerValidator.submitOrganizationTheme().validate(
1087
+ {
1088
+ themeId,
1089
+ body,
1090
+ },
1091
+ { abortEarly: false, allowUnknown: false }
1092
+ );
1093
+ if (warrning) {
1094
+ Logger({
1095
+ level: "WARN",
1096
+ message: `Parameter Validation warrnings for partner > Theme > submitOrganizationTheme \n ${warrning}`,
1097
+ });
1098
+ }
1099
+
571
1100
  const query_params = {};
572
1101
 
573
- return PartnerAPIClient.execute(
1102
+ const response = await PartnerAPIClient.execute(
574
1103
  this.config,
575
1104
  "put",
576
1105
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme/${themeId}`,
@@ -579,33 +1108,75 @@ class Theme {
579
1108
  requestHeaders,
580
1109
  { responseHeaders }
581
1110
  );
1111
+
1112
+ let responseData = response;
1113
+ if (responseHeaders) {
1114
+ responseData = response[0];
1115
+ }
1116
+
1117
+ const {
1118
+ error: res_error,
1119
+ } = ThemePartnerModel.MarketplaceTheme().validate(responseData, {
1120
+ abortEarly: false,
1121
+ allowUnknown: false,
1122
+ });
1123
+
1124
+ if (res_error) {
1125
+ if (this.config.options.strictResponseCheck === true) {
1126
+ return Promise.reject(new FDKResponseValidationError(res_error));
1127
+ } else {
1128
+ Logger({
1129
+ level: "WARN",
1130
+ message: `Response Validation Warnings for partner > Theme > submitOrganizationTheme \n ${res_error}`,
1131
+ });
1132
+ }
1133
+ }
1134
+
1135
+ return response;
582
1136
  }
583
1137
 
584
1138
  /**
585
- * @param {Object} arg - Arg object.
586
- * @param {string} arg.themeId - The ID of the theme
1139
+ * @param {ThemePartnerValidator.DeleteOrganizationThemeParam} arg - Arg object.
587
1140
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
588
1141
  * @param {import("../PartnerAPIClient").Options} - Options
1142
+ * @returns {Promise<ThemePartnerModel.MarketplaceTheme>} - Success response
1143
+ * @name deleteOrganizationTheme
589
1144
  * @summary: Delete a theme
590
- * @description: This endpoint allows you to delete a theme by providing the organization and theme IDs.
1145
+ * @description: This endpoint allows you to delete a theme by providing the organization and theme IDs. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/deleteOrganizationTheme/).
591
1146
  */
592
- deleteOrganizationTheme(
1147
+ async deleteOrganizationTheme(
593
1148
  { themeId, requestHeaders } = { requestHeaders: {} },
594
1149
  { responseHeaders } = { responseHeaders: false }
595
1150
  ) {
596
- const { error } = ThemeValidator.deleteOrganizationTheme().validate(
1151
+ const { error } = ThemePartnerValidator.deleteOrganizationTheme().validate(
597
1152
  {
598
1153
  themeId,
599
1154
  },
600
- { abortEarly: false }
1155
+ { abortEarly: false, allowUnknown: true }
601
1156
  );
602
1157
  if (error) {
603
1158
  return Promise.reject(new FDKClientValidationError(error));
604
1159
  }
605
1160
 
1161
+ // Showing warrnings if extra unknown parameters are found
1162
+ const {
1163
+ error: warrning,
1164
+ } = ThemePartnerValidator.deleteOrganizationTheme().validate(
1165
+ {
1166
+ themeId,
1167
+ },
1168
+ { abortEarly: false, allowUnknown: false }
1169
+ );
1170
+ if (warrning) {
1171
+ Logger({
1172
+ level: "WARN",
1173
+ message: `Parameter Validation warrnings for partner > Theme > deleteOrganizationTheme \n ${warrning}`,
1174
+ });
1175
+ }
1176
+
606
1177
  const query_params = {};
607
1178
 
608
- return PartnerAPIClient.execute(
1179
+ const response = await PartnerAPIClient.execute(
609
1180
  this.config,
610
1181
  "delete",
611
1182
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme/${themeId}`,
@@ -614,33 +1185,77 @@ class Theme {
614
1185
  requestHeaders,
615
1186
  { responseHeaders }
616
1187
  );
1188
+
1189
+ let responseData = response;
1190
+ if (responseHeaders) {
1191
+ responseData = response[0];
1192
+ }
1193
+
1194
+ const {
1195
+ error: res_error,
1196
+ } = ThemePartnerModel.MarketplaceTheme().validate(responseData, {
1197
+ abortEarly: false,
1198
+ allowUnknown: false,
1199
+ });
1200
+
1201
+ if (res_error) {
1202
+ if (this.config.options.strictResponseCheck === true) {
1203
+ return Promise.reject(new FDKResponseValidationError(res_error));
1204
+ } else {
1205
+ Logger({
1206
+ level: "WARN",
1207
+ message: `Response Validation Warnings for partner > Theme > deleteOrganizationTheme \n ${res_error}`,
1208
+ });
1209
+ }
1210
+ }
1211
+
1212
+ return response;
617
1213
  }
618
1214
 
619
1215
  /**
620
- * @param {Object} arg - Arg object.
621
- * @param {string} arg.slugName - Slug of theme
1216
+ * @param {ThemePartnerValidator.GetLatestVersionOfThemeBySlugParam} arg - Arg object.
622
1217
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
623
1218
  * @param {import("../PartnerAPIClient").Options} - Options
1219
+ * @returns {Promise<ThemePartnerModel.MarketplaceTheme[]>} - Success response
1220
+ * @name getLatestVersionOfThemeBySlug
624
1221
  * @summary: Get latest version of specified theme
625
- * @description: Use this api to get latest version of specified theme
1222
+ * @description: Use this api to get latest version of specified theme - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getLatestVersionOfThemeBySlug/).
626
1223
  */
627
- getLatestVersionOfThemeBySlug(
1224
+ async getLatestVersionOfThemeBySlug(
628
1225
  { slugName, requestHeaders } = { requestHeaders: {} },
629
1226
  { responseHeaders } = { responseHeaders: false }
630
1227
  ) {
631
- const { error } = ThemeValidator.getLatestVersionOfThemeBySlug().validate(
1228
+ const {
1229
+ error,
1230
+ } = ThemePartnerValidator.getLatestVersionOfThemeBySlug().validate(
632
1231
  {
633
1232
  slugName,
634
1233
  },
635
- { abortEarly: false }
1234
+ { abortEarly: false, allowUnknown: true }
636
1235
  );
637
1236
  if (error) {
638
1237
  return Promise.reject(new FDKClientValidationError(error));
639
1238
  }
640
1239
 
1240
+ // Showing warrnings if extra unknown parameters are found
1241
+ const {
1242
+ error: warrning,
1243
+ } = ThemePartnerValidator.getLatestVersionOfThemeBySlug().validate(
1244
+ {
1245
+ slugName,
1246
+ },
1247
+ { abortEarly: false, allowUnknown: false }
1248
+ );
1249
+ if (warrning) {
1250
+ Logger({
1251
+ level: "WARN",
1252
+ message: `Parameter Validation warrnings for partner > Theme > getLatestVersionOfThemeBySlug \n ${warrning}`,
1253
+ });
1254
+ }
1255
+
641
1256
  const query_params = {};
642
1257
 
643
- return PartnerAPIClient.execute(
1258
+ const response = await PartnerAPIClient.execute(
644
1259
  this.config,
645
1260
  "get",
646
1261
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/${slugName}/latest`,
@@ -649,36 +1264,77 @@ class Theme {
649
1264
  requestHeaders,
650
1265
  { responseHeaders }
651
1266
  );
1267
+
1268
+ let responseData = response;
1269
+ if (responseHeaders) {
1270
+ responseData = response[0];
1271
+ }
1272
+
1273
+ const { error: res_error } = Joi.array()
1274
+ .items(ThemePartnerModel.MarketplaceTheme())
1275
+ .validate(responseData, { abortEarly: false, allowUnknown: false });
1276
+
1277
+ if (res_error) {
1278
+ if (this.config.options.strictResponseCheck === true) {
1279
+ return Promise.reject(new FDKResponseValidationError(res_error));
1280
+ } else {
1281
+ Logger({
1282
+ level: "WARN",
1283
+ message: `Response Validation Warnings for partner > Theme > getLatestVersionOfThemeBySlug \n ${res_error}`,
1284
+ });
1285
+ }
1286
+ }
1287
+
1288
+ return response;
652
1289
  }
653
1290
 
654
1291
  /**
655
- * @param {Object} arg - Arg object.
656
- * @param {string} [arg.slug] - The slug of the theme.
657
- * @param {MarketplaceTheme} arg.body
1292
+ * @param {ThemePartnerValidator.CreateNewThemeInOrganizationParam} arg - Arg object.
658
1293
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
659
1294
  * @param {import("../PartnerAPIClient").Options} - Options
1295
+ * @returns {Promise<ThemePartnerModel.MarketplaceTheme>} - Success response
1296
+ * @name createNewThemeInOrganization
660
1297
  * @summary: Create a new theme for the organization
661
- * @description: Use this api to create a new theme for the organization
1298
+ * @description: Use this api to create a new theme for the organization - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/createNewThemeInOrganization/).
662
1299
  */
663
- createNewThemeInOrganization(
1300
+ async createNewThemeInOrganization(
664
1301
  { body, slug, requestHeaders } = { requestHeaders: {} },
665
1302
  { responseHeaders } = { responseHeaders: false }
666
1303
  ) {
667
- const { error } = ThemeValidator.createNewThemeInOrganization().validate(
1304
+ const {
1305
+ error,
1306
+ } = ThemePartnerValidator.createNewThemeInOrganization().validate(
668
1307
  {
669
1308
  body,
670
1309
  slug,
671
1310
  },
672
- { abortEarly: false }
1311
+ { abortEarly: false, allowUnknown: true }
673
1312
  );
674
1313
  if (error) {
675
1314
  return Promise.reject(new FDKClientValidationError(error));
676
1315
  }
677
1316
 
1317
+ // Showing warrnings if extra unknown parameters are found
1318
+ const {
1319
+ error: warrning,
1320
+ } = ThemePartnerValidator.createNewThemeInOrganization().validate(
1321
+ {
1322
+ body,
1323
+ slug,
1324
+ },
1325
+ { abortEarly: false, allowUnknown: false }
1326
+ );
1327
+ if (warrning) {
1328
+ Logger({
1329
+ level: "WARN",
1330
+ message: `Parameter Validation warrnings for partner > Theme > createNewThemeInOrganization \n ${warrning}`,
1331
+ });
1332
+ }
1333
+
678
1334
  const query_params = {};
679
1335
  query_params["slug"] = slug;
680
1336
 
681
- return PartnerAPIClient.execute(
1337
+ const response = await PartnerAPIClient.execute(
682
1338
  this.config,
683
1339
  "post",
684
1340
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme`,
@@ -687,33 +1343,75 @@ class Theme {
687
1343
  requestHeaders,
688
1344
  { responseHeaders }
689
1345
  );
1346
+
1347
+ let responseData = response;
1348
+ if (responseHeaders) {
1349
+ responseData = response[0];
1350
+ }
1351
+
1352
+ const {
1353
+ error: res_error,
1354
+ } = ThemePartnerModel.MarketplaceTheme().validate(responseData, {
1355
+ abortEarly: false,
1356
+ allowUnknown: false,
1357
+ });
1358
+
1359
+ if (res_error) {
1360
+ if (this.config.options.strictResponseCheck === true) {
1361
+ return Promise.reject(new FDKResponseValidationError(res_error));
1362
+ } else {
1363
+ Logger({
1364
+ level: "WARN",
1365
+ message: `Response Validation Warnings for partner > Theme > createNewThemeInOrganization \n ${res_error}`,
1366
+ });
1367
+ }
1368
+ }
1369
+
1370
+ return response;
690
1371
  }
691
1372
 
692
1373
  /**
693
- * @param {Object} arg - Arg object.
694
- * @param {string} arg.themeId - The ID of the theme
1374
+ * @param {ThemePartnerValidator.GetThemeRejectionReasonsParam} arg - Arg object.
695
1375
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
696
1376
  * @param {import("../PartnerAPIClient").Options} - Options
1377
+ * @returns {Promise<ThemePartnerModel.ThemeRejectionReasons>} - Success response
1378
+ * @name getThemeRejectionReasons
697
1379
  * @summary: Get theme rejection reasons
698
- * @description: Use this api to get theme rejection reasons
1380
+ * @description: Use this api to get theme rejection reasons - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getThemeRejectionReasons/).
699
1381
  */
700
- getThemeRejectionReasons(
1382
+ async getThemeRejectionReasons(
701
1383
  { themeId, requestHeaders } = { requestHeaders: {} },
702
1384
  { responseHeaders } = { responseHeaders: false }
703
1385
  ) {
704
- const { error } = ThemeValidator.getThemeRejectionReasons().validate(
1386
+ const { error } = ThemePartnerValidator.getThemeRejectionReasons().validate(
705
1387
  {
706
1388
  themeId,
707
1389
  },
708
- { abortEarly: false }
1390
+ { abortEarly: false, allowUnknown: true }
709
1391
  );
710
1392
  if (error) {
711
1393
  return Promise.reject(new FDKClientValidationError(error));
712
1394
  }
713
1395
 
1396
+ // Showing warrnings if extra unknown parameters are found
1397
+ const {
1398
+ error: warrning,
1399
+ } = ThemePartnerValidator.getThemeRejectionReasons().validate(
1400
+ {
1401
+ themeId,
1402
+ },
1403
+ { abortEarly: false, allowUnknown: false }
1404
+ );
1405
+ if (warrning) {
1406
+ Logger({
1407
+ level: "WARN",
1408
+ message: `Parameter Validation warrnings for partner > Theme > getThemeRejectionReasons \n ${warrning}`,
1409
+ });
1410
+ }
1411
+
714
1412
  const query_params = {};
715
1413
 
716
- return PartnerAPIClient.execute(
1414
+ const response = await PartnerAPIClient.execute(
717
1415
  this.config,
718
1416
  "get",
719
1417
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme/${themeId}/reasons`,
@@ -722,39 +1420,81 @@ class Theme {
722
1420
  requestHeaders,
723
1421
  { responseHeaders }
724
1422
  );
1423
+
1424
+ let responseData = response;
1425
+ if (responseHeaders) {
1426
+ responseData = response[0];
1427
+ }
1428
+
1429
+ const {
1430
+ error: res_error,
1431
+ } = ThemePartnerModel.ThemeRejectionReasons().validate(responseData, {
1432
+ abortEarly: false,
1433
+ allowUnknown: false,
1434
+ });
1435
+
1436
+ if (res_error) {
1437
+ if (this.config.options.strictResponseCheck === true) {
1438
+ return Promise.reject(new FDKResponseValidationError(res_error));
1439
+ } else {
1440
+ Logger({
1441
+ level: "WARN",
1442
+ message: `Response Validation Warnings for partner > Theme > getThemeRejectionReasons \n ${res_error}`,
1443
+ });
1444
+ }
1445
+ }
1446
+
1447
+ return response;
725
1448
  }
726
1449
 
727
1450
  /**
728
- * @param {Object} arg - Arg object.
729
- * @param {string} arg.themeSlug - The slug of the theme.
730
- * @param {number} [arg.pageSize] - The number of items to return per page.
731
- * @param {number} [arg.pageNo] - The page number to return.
1451
+ * @param {ThemePartnerValidator.GetThemeVersionsParam} arg - Arg object.
732
1452
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
733
1453
  * @param {import("../PartnerAPIClient").Options} - Options
1454
+ * @returns {Promise<ThemePartnerModel.MarketplaceThemeSchema>} - Success response
1455
+ * @name getThemeVersions
734
1456
  * @summary: Get theme versions
735
- * @description: Retrieve a list of theme versions for a specific theme in an organization.
1457
+ * @description: Retrieve a list of theme versions for a specific theme in an organization. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/theme/getThemeVersions/).
736
1458
  */
737
- getThemeVersions(
1459
+ async getThemeVersions(
738
1460
  { themeSlug, pageSize, pageNo, requestHeaders } = { requestHeaders: {} },
739
1461
  { responseHeaders } = { responseHeaders: false }
740
1462
  ) {
741
- const { error } = ThemeValidator.getThemeVersions().validate(
1463
+ const { error } = ThemePartnerValidator.getThemeVersions().validate(
742
1464
  {
743
1465
  themeSlug,
744
1466
  pageSize,
745
1467
  pageNo,
746
1468
  },
747
- { abortEarly: false }
1469
+ { abortEarly: false, allowUnknown: true }
748
1470
  );
749
1471
  if (error) {
750
1472
  return Promise.reject(new FDKClientValidationError(error));
751
1473
  }
752
1474
 
1475
+ // Showing warrnings if extra unknown parameters are found
1476
+ const {
1477
+ error: warrning,
1478
+ } = ThemePartnerValidator.getThemeVersions().validate(
1479
+ {
1480
+ themeSlug,
1481
+ pageSize,
1482
+ pageNo,
1483
+ },
1484
+ { abortEarly: false, allowUnknown: false }
1485
+ );
1486
+ if (warrning) {
1487
+ Logger({
1488
+ level: "WARN",
1489
+ message: `Parameter Validation warrnings for partner > Theme > getThemeVersions \n ${warrning}`,
1490
+ });
1491
+ }
1492
+
753
1493
  const query_params = {};
754
1494
  query_params["page_size"] = pageSize;
755
1495
  query_params["page_no"] = pageNo;
756
1496
 
757
- return PartnerAPIClient.execute(
1497
+ const response = await PartnerAPIClient.execute(
758
1498
  this.config,
759
1499
  "get",
760
1500
  `/service/partner/theme/v1.0/organization/${this.config.organizationId}/theme/${themeSlug}/versions`,
@@ -763,6 +1503,31 @@ class Theme {
763
1503
  requestHeaders,
764
1504
  { responseHeaders }
765
1505
  );
1506
+
1507
+ let responseData = response;
1508
+ if (responseHeaders) {
1509
+ responseData = response[0];
1510
+ }
1511
+
1512
+ const {
1513
+ error: res_error,
1514
+ } = ThemePartnerModel.MarketplaceThemeSchema().validate(responseData, {
1515
+ abortEarly: false,
1516
+ allowUnknown: false,
1517
+ });
1518
+
1519
+ if (res_error) {
1520
+ if (this.config.options.strictResponseCheck === true) {
1521
+ return Promise.reject(new FDKResponseValidationError(res_error));
1522
+ } else {
1523
+ Logger({
1524
+ level: "WARN",
1525
+ message: `Response Validation Warnings for partner > Theme > getThemeVersions \n ${res_error}`,
1526
+ });
1527
+ }
1528
+ }
1529
+
1530
+ return response;
766
1531
  }
767
1532
  }
768
1533
  module.exports = Theme;