@gofynd/fdk-client-javascript 1.4.15-beta.1 → 1.4.15-beta.11

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 (150) hide show
  1. package/README.md +2 -2
  2. package/application.d.ts +1 -2
  3. package/application.js +2 -3
  4. package/index.d.ts +1 -2
  5. package/index.js +7 -1
  6. package/package.json +3 -4
  7. package/sdk/application/ApplicationClient.js +0 -18
  8. package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
  9. package/sdk/application/Cart/CartApplicationClient.js +60 -1185
  10. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +90 -142
  11. package/sdk/application/Catalog/CatalogApplicationClient.js +187 -1293
  12. package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
  13. package/sdk/application/Common/CommonApplicationClient.js +5 -89
  14. package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
  15. package/sdk/application/Communication/CommunicationApplicationClient.js +6 -145
  16. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
  17. package/sdk/application/Configuration/ConfigurationApplicationClient.js +31 -718
  18. package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
  19. package/sdk/application/Content/ContentApplicationClient.js +77 -914
  20. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
  21. package/sdk/application/FileStorage/FileStorageApplicationClient.js +19 -125
  22. package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
  23. package/sdk/application/Lead/LeadApplicationClient.js +32 -202
  24. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
  25. package/sdk/application/Logistic/LogisticApplicationClient.js +50 -478
  26. package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
  27. package/sdk/application/Order/OrderApplicationClient.js +86 -472
  28. package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
  29. package/sdk/application/Payment/PaymentApplicationClient.js +57 -2102
  30. package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
  31. package/sdk/application/Rewards/RewardsApplicationClient.js +16 -305
  32. package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
  33. package/sdk/application/Share/ShareApplicationClient.js +34 -294
  34. package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
  35. package/sdk/application/Theme/ThemeApplicationClient.js +28 -162
  36. package/sdk/application/User/UserApplicationClient.d.ts +85 -136
  37. package/sdk/application/User/UserApplicationClient.js +45 -1815
  38. package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
  39. package/sdk/application/Webhook/WebhookApplicationClient.js +4 -47
  40. package/sdk/application/index.d.ts +0 -18
  41. package/sdk/application/index.js +0 -33
  42. package/sdk/common/Utility.d.ts +1 -1
  43. package/sdk/common/Utility.js +10 -7
  44. package/sdk/common/Validator.d.ts +1 -0
  45. package/sdk/common/Validator.js +20 -0
  46. package/sdk/common/utils.d.ts +0 -1
  47. package/sdk/common/utils.js +0 -14
  48. package/sdk/partner/OAuthClient.js +1 -0
  49. package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -40
  50. package/sdk/partner/Theme/ThemePartnerModel.js +2 -24
  51. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +39 -1
  52. package/sdk/platform/Cart/CartPlatformApplicationClient.js +247 -1
  53. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +33 -1
  54. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +37 -0
  55. package/sdk/platform/Cart/CartPlatformModel.d.ts +193 -1
  56. package/sdk/platform/Cart/CartPlatformModel.js +132 -0
  57. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
  58. package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -4
  59. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +14 -0
  60. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +6 -0
  61. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
  62. package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
  63. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
  64. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
  65. package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
  66. package/sdk/platform/Order/OrderPlatformClient.js +99 -0
  67. package/sdk/platform/Order/OrderPlatformModel.d.ts +7 -0
  68. package/sdk/platform/Order/OrderPlatformModel.js +3 -0
  69. package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
  70. package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
  71. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +1 -1
  72. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +4 -4
  73. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +56 -19
  74. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +42 -18
  75. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +3 -3
  76. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +2 -2
  77. package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -40
  78. package/sdk/platform/Theme/ThemePlatformModel.js +2 -24
  79. package/sdk/public/Configuration/ConfigurationPublicClient.js +5 -2
  80. package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
  81. package/sdk/public/Content/ContentPublicClient.js +14 -2
  82. package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
  83. package/sdk/public/Partner/PartnerPublicClient.js +14 -2
  84. package/sdk/public/Webhook/WebhookPublicClient.js +5 -2
  85. package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
  86. package/sdk/application/Cart/CartApplicationModel.js +0 -2497
  87. package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
  88. package/sdk/application/Cart/CartApplicationValidator.js +0 -530
  89. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
  90. package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
  91. package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
  92. package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
  93. package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
  94. package/sdk/application/Common/CommonApplicationModel.js +0 -308
  95. package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
  96. package/sdk/application/Common/CommonApplicationValidator.js +0 -38
  97. package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
  98. package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
  99. package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
  100. package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
  101. package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
  102. package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
  103. package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
  104. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
  105. package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
  106. package/sdk/application/Content/ContentApplicationModel.js +0 -1589
  107. package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
  108. package/sdk/application/Content/ContentApplicationValidator.js +0 -264
  109. package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
  110. package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
  111. package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
  112. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
  113. package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
  114. package/sdk/application/Lead/LeadApplicationModel.js +0 -480
  115. package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
  116. package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
  117. package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
  118. package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
  119. package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
  120. package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
  121. package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
  122. package/sdk/application/Order/OrderApplicationModel.js +0 -1471
  123. package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
  124. package/sdk/application/Order/OrderApplicationValidator.js +0 -197
  125. package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
  126. package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
  127. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
  128. package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
  129. package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
  130. package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
  131. package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
  132. package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
  133. package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
  134. package/sdk/application/Share/ShareApplicationModel.js +0 -234
  135. package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
  136. package/sdk/application/Share/ShareApplicationValidator.js +0 -91
  137. package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
  138. package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
  139. package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
  140. package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
  141. package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
  142. package/sdk/application/User/UserApplicationModel.js +0 -1382
  143. package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
  144. package/sdk/application/User/UserApplicationValidator.js +0 -573
  145. package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
  146. package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
  147. package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
  148. package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
  149. package/sdk/common/Clickstream.d.ts +0 -1
  150. package/sdk/common/Clickstream.js +0 -464
@@ -1,14 +1,12 @@
1
- const ApplicationAPIClient = require("../ApplicationAPIClient");
2
1
  const {
3
2
  FDKClientValidationError,
4
3
  FDKResponseValidationError,
5
4
  } = require("../../common/FDKError");
5
+
6
+ const ApplicationAPIClient = require("../ApplicationAPIClient");
6
7
  const constructUrl = require("../constructUrl");
7
8
  const Paginator = require("../../common/Paginator");
8
- const LogisticApplicationValidator = require("./LogisticApplicationValidator");
9
- const LogisticApplicationModel = require("./LogisticApplicationModel");
10
- const { Logger } = require("./../../common/Logger");
11
- const Joi = require("joi");
9
+ const { validateRequiredParams } = require("../../common/Validator");
12
10
 
13
11
  class Logistic {
14
12
  constructor(_conf) {
@@ -48,10 +46,9 @@ class Logistic {
48
46
  }
49
47
 
50
48
  /**
51
- * @param {LogisticApplicationValidator.GetAllCountriesParam} arg - Arg object.
52
49
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
53
50
  * @param {import("../ApplicationAPIClient").Options} - Options
54
- * @returns {Promise<LogisticApplicationModel.CountryListResponse>} - Success response
51
+ * @returns {Promise<CountryListResponse>} - Success response
55
52
  * @name getAllCountries
56
53
  * @summary: Get deliverable countries
57
54
  * @description: Get a list of countries within the specified delivery zones for that application. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getAllCountries/).
@@ -60,28 +57,6 @@ class Logistic {
60
57
  { requestHeaders } = { requestHeaders: {} },
61
58
  { responseHeaders } = { responseHeaders: false }
62
59
  ) {
63
- const { error } = LogisticApplicationValidator.getAllCountries().validate(
64
- {},
65
- { abortEarly: false, allowUnknown: true }
66
- );
67
- if (error) {
68
- return Promise.reject(new FDKClientValidationError(error));
69
- }
70
-
71
- // Showing warrnings if extra unknown parameters are found
72
- const {
73
- error: warrning,
74
- } = LogisticApplicationValidator.getAllCountries().validate(
75
- {},
76
- { abortEarly: false, allowUnknown: false }
77
- );
78
- if (warrning) {
79
- Logger({
80
- level: "WARN",
81
- message: `Parameter Validation warrnings for application > Logistic > getAllCountries \n ${warrning}`,
82
- });
83
- }
84
-
85
60
  const query_params = {};
86
61
 
87
62
  const xHeaders = {};
@@ -104,32 +79,13 @@ class Logistic {
104
79
  responseData = response[0];
105
80
  }
106
81
 
107
- const {
108
- error: res_error,
109
- } = LogisticApplicationModel.CountryListResponse().validate(responseData, {
110
- abortEarly: false,
111
- allowUnknown: true,
112
- });
113
-
114
- if (res_error) {
115
- if (this._conf.options.strictResponseCheck === true) {
116
- return Promise.reject(new FDKResponseValidationError(res_error));
117
- } else {
118
- Logger({
119
- level: "WARN",
120
- message: `Response Validation Warnings for application > Logistic > getAllCountries \n ${res_error}`,
121
- });
122
- }
123
- }
124
-
125
82
  return response;
126
83
  }
127
84
 
128
85
  /**
129
- * @param {LogisticApplicationValidator.GetCountriesParam} arg - Arg object.
130
86
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
131
87
  * @param {import("../ApplicationAPIClient").Options} - Options
132
- * @returns {Promise<LogisticApplicationModel.GetCountries>} - Success response
88
+ * @returns {Promise<GetCountries>} - Success response
133
89
  * @name getCountries
134
90
  * @summary: Get countries
135
91
  * @description: List of supported countries. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getCountries/).
@@ -140,28 +96,6 @@ class Logistic {
140
96
  },
141
97
  { responseHeaders } = { responseHeaders: false }
142
98
  ) {
143
- const { error } = LogisticApplicationValidator.getCountries().validate(
144
- { onboarding, pageNo, pageSize, q },
145
- { abortEarly: false, allowUnknown: true }
146
- );
147
- if (error) {
148
- return Promise.reject(new FDKClientValidationError(error));
149
- }
150
-
151
- // Showing warrnings if extra unknown parameters are found
152
- const {
153
- error: warrning,
154
- } = LogisticApplicationValidator.getCountries().validate(
155
- { onboarding, pageNo, pageSize, q },
156
- { abortEarly: false, allowUnknown: false }
157
- );
158
- if (warrning) {
159
- Logger({
160
- level: "WARN",
161
- message: `Parameter Validation warrnings for application > Logistic > getCountries \n ${warrning}`,
162
- });
163
- }
164
-
165
99
  const query_params = {};
166
100
  query_params["onboarding"] = onboarding;
167
101
  query_params["page_no"] = pageNo;
@@ -188,32 +122,13 @@ class Logistic {
188
122
  responseData = response[0];
189
123
  }
190
124
 
191
- const {
192
- error: res_error,
193
- } = LogisticApplicationModel.GetCountries().validate(responseData, {
194
- abortEarly: false,
195
- allowUnknown: true,
196
- });
197
-
198
- if (res_error) {
199
- if (this._conf.options.strictResponseCheck === true) {
200
- return Promise.reject(new FDKResponseValidationError(res_error));
201
- } else {
202
- Logger({
203
- level: "WARN",
204
- message: `Response Validation Warnings for application > Logistic > getCountries \n ${res_error}`,
205
- });
206
- }
207
- }
208
-
209
125
  return response;
210
126
  }
211
127
 
212
128
  /**
213
- * @param {LogisticApplicationValidator.GetCountryParam} arg - Arg object.
214
129
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
215
130
  * @param {import("../ApplicationAPIClient").Options} - Options
216
- * @returns {Promise<LogisticApplicationModel.GetCountry>} - Success response
131
+ * @returns {Promise<GetCountry>} - Success response
217
132
  * @name getCountry
218
133
  * @summary: Get country details
219
134
  * @description: Get details about a particular country and its address format customized for different business scenarios. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getCountry/).
@@ -222,26 +137,13 @@ class Logistic {
222
137
  { countryIsoCode, requestHeaders } = { requestHeaders: {} },
223
138
  { responseHeaders } = { responseHeaders: false }
224
139
  ) {
225
- const { error } = LogisticApplicationValidator.getCountry().validate(
226
- { countryIsoCode },
227
- { abortEarly: false, allowUnknown: true }
228
- );
229
- if (error) {
230
- return Promise.reject(new FDKClientValidationError(error));
231
- }
232
-
233
- // Showing warrnings if extra unknown parameters are found
234
- const {
235
- error: warrning,
236
- } = LogisticApplicationValidator.getCountry().validate(
237
- { countryIsoCode },
238
- { abortEarly: false, allowUnknown: false }
239
- );
240
- if (warrning) {
241
- Logger({
242
- level: "WARN",
243
- message: `Parameter Validation warrnings for application > Logistic > getCountry \n ${warrning}`,
140
+ const errors = validateRequiredParams(arguments[0], ["countryIsoCode"]);
141
+ if (errors.length > 0) {
142
+ const error = new FDKClientValidationError({
143
+ message: "Missing required field",
144
+ details: errors,
244
145
  });
146
+ return Promise.reject(new FDKClientValidationError(error));
245
147
  }
246
148
 
247
149
  const query_params = {};
@@ -266,32 +168,13 @@ class Logistic {
266
168
  responseData = response[0];
267
169
  }
268
170
 
269
- const {
270
- error: res_error,
271
- } = LogisticApplicationModel.GetCountry().validate(responseData, {
272
- abortEarly: false,
273
- allowUnknown: true,
274
- });
275
-
276
- if (res_error) {
277
- if (this._conf.options.strictResponseCheck === true) {
278
- return Promise.reject(new FDKResponseValidationError(res_error));
279
- } else {
280
- Logger({
281
- level: "WARN",
282
- message: `Response Validation Warnings for application > Logistic > getCountry \n ${res_error}`,
283
- });
284
- }
285
- }
286
-
287
171
  return response;
288
172
  }
289
173
 
290
174
  /**
291
- * @param {LogisticApplicationValidator.GetLocalitiesParam} arg - Arg object.
292
175
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
293
176
  * @param {import("../ApplicationAPIClient").Options} - Options
294
- * @returns {Promise<LogisticApplicationModel.GetLocalities>} - Success response
177
+ * @returns {Promise<GetLocalities>} - Success response
295
178
  * @name getLocalities
296
179
  * @summary: Get localities
297
180
  * @description: Get geographical data for a specific type of locality based on the provided filters. For instance, obtain a list of cities for a given country and state. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getLocalities/).
@@ -309,26 +192,13 @@ class Logistic {
309
192
  } = { requestHeaders: {} },
310
193
  { responseHeaders } = { responseHeaders: false }
311
194
  ) {
312
- const { error } = LogisticApplicationValidator.getLocalities().validate(
313
- { localityType, country, state, city, pageNo, pageSize, q },
314
- { abortEarly: false, allowUnknown: true }
315
- );
316
- if (error) {
317
- return Promise.reject(new FDKClientValidationError(error));
318
- }
319
-
320
- // Showing warrnings if extra unknown parameters are found
321
- const {
322
- error: warrning,
323
- } = LogisticApplicationValidator.getLocalities().validate(
324
- { localityType, country, state, city, pageNo, pageSize, q },
325
- { abortEarly: false, allowUnknown: false }
326
- );
327
- if (warrning) {
328
- Logger({
329
- level: "WARN",
330
- message: `Parameter Validation warrnings for application > Logistic > getLocalities \n ${warrning}`,
195
+ const errors = validateRequiredParams(arguments[0], ["localityType"]);
196
+ if (errors.length > 0) {
197
+ const error = new FDKClientValidationError({
198
+ message: "Missing required field",
199
+ details: errors,
331
200
  });
201
+ return Promise.reject(new FDKClientValidationError(error));
332
202
  }
333
203
 
334
204
  const query_params = {};
@@ -359,32 +229,13 @@ class Logistic {
359
229
  responseData = response[0];
360
230
  }
361
231
 
362
- const {
363
- error: res_error,
364
- } = LogisticApplicationModel.GetLocalities().validate(responseData, {
365
- abortEarly: false,
366
- allowUnknown: true,
367
- });
368
-
369
- if (res_error) {
370
- if (this._conf.options.strictResponseCheck === true) {
371
- return Promise.reject(new FDKResponseValidationError(res_error));
372
- } else {
373
- Logger({
374
- level: "WARN",
375
- message: `Response Validation Warnings for application > Logistic > getLocalities \n ${res_error}`,
376
- });
377
- }
378
- }
379
-
380
232
  return response;
381
233
  }
382
234
 
383
235
  /**
384
- * @param {LogisticApplicationValidator.GetLocalityParam} arg - Arg object.
385
236
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
386
237
  * @param {import("../ApplicationAPIClient").Options} - Options
387
- * @returns {Promise<LogisticApplicationModel.GetLocality>} - Success response
238
+ * @returns {Promise<GetLocality>} - Success response
388
239
  * @name getLocality
389
240
  * @summary: Get locality detail
390
241
  * @description: Get detailed geographical data for a specific locality, such as a pincode. For example, for a pincode value of 400603, the service returns its parent locations, including city, state, and country details. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getLocality/).
@@ -395,26 +246,16 @@ class Logistic {
395
246
  },
396
247
  { responseHeaders } = { responseHeaders: false }
397
248
  ) {
398
- const { error } = LogisticApplicationValidator.getLocality().validate(
399
- { localityType, localityValue, country, state, city },
400
- { abortEarly: false, allowUnknown: true }
401
- );
402
- if (error) {
403
- return Promise.reject(new FDKClientValidationError(error));
404
- }
405
-
406
- // Showing warrnings if extra unknown parameters are found
407
- const {
408
- error: warrning,
409
- } = LogisticApplicationValidator.getLocality().validate(
410
- { localityType, localityValue, country, state, city },
411
- { abortEarly: false, allowUnknown: false }
412
- );
413
- if (warrning) {
414
- Logger({
415
- level: "WARN",
416
- message: `Parameter Validation warrnings for application > Logistic > getLocality \n ${warrning}`,
249
+ const errors = validateRequiredParams(arguments[0], [
250
+ "localityType",
251
+ "localityValue",
252
+ ]);
253
+ if (errors.length > 0) {
254
+ const error = new FDKClientValidationError({
255
+ message: "Missing required field",
256
+ details: errors,
417
257
  });
258
+ return Promise.reject(new FDKClientValidationError(error));
418
259
  }
419
260
 
420
261
  const query_params = {};
@@ -442,32 +283,13 @@ class Logistic {
442
283
  responseData = response[0];
443
284
  }
444
285
 
445
- const {
446
- error: res_error,
447
- } = LogisticApplicationModel.GetLocality().validate(responseData, {
448
- abortEarly: false,
449
- allowUnknown: true,
450
- });
451
-
452
- if (res_error) {
453
- if (this._conf.options.strictResponseCheck === true) {
454
- return Promise.reject(new FDKResponseValidationError(res_error));
455
- } else {
456
- Logger({
457
- level: "WARN",
458
- message: `Response Validation Warnings for application > Logistic > getLocality \n ${res_error}`,
459
- });
460
- }
461
- }
462
-
463
286
  return response;
464
287
  }
465
288
 
466
289
  /**
467
- * @param {LogisticApplicationValidator.GetLocationsParam} arg - Arg object.
468
290
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
469
291
  * @param {import("../ApplicationAPIClient").Options} - Options
470
- * @returns {Promise<LogisticApplicationModel.GetStoreResponse>} - Success response
292
+ * @returns {Promise<GetStoreResponse>} - Success response
471
293
  * @name getLocations
472
294
  * @summary: Get available selling locations
473
295
  * @description: Get stores available for the application based on Delivery Zones and Order Orchestration rules. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getLocations/).
@@ -487,48 +309,6 @@ class Logistic {
487
309
  } = { requestHeaders: {} },
488
310
  { responseHeaders } = { responseHeaders: false }
489
311
  ) {
490
- const { error } = LogisticApplicationValidator.getLocations().validate(
491
- {
492
- xApplicationId,
493
- xApplicationData,
494
- country,
495
- state,
496
- city,
497
- pincode,
498
- sector,
499
- pageNo,
500
- pageSize,
501
- },
502
- { abortEarly: false, allowUnknown: true }
503
- );
504
- if (error) {
505
- return Promise.reject(new FDKClientValidationError(error));
506
- }
507
-
508
- // Showing warrnings if extra unknown parameters are found
509
- const {
510
- error: warrning,
511
- } = LogisticApplicationValidator.getLocations().validate(
512
- {
513
- xApplicationId,
514
- xApplicationData,
515
- country,
516
- state,
517
- city,
518
- pincode,
519
- sector,
520
- pageNo,
521
- pageSize,
522
- },
523
- { abortEarly: false, allowUnknown: false }
524
- );
525
- if (warrning) {
526
- Logger({
527
- level: "WARN",
528
- message: `Parameter Validation warrnings for application > Logistic > getLocations \n ${warrning}`,
529
- });
530
- }
531
-
532
312
  const query_params = {};
533
313
  query_params["x-application-id"] = xApplicationId;
534
314
  query_params["x-application-data"] = xApplicationData;
@@ -560,33 +340,13 @@ class Logistic {
560
340
  responseData = response[0];
561
341
  }
562
342
 
563
- const {
564
- error: res_error,
565
- } = LogisticApplicationModel.GetStoreResponse().validate(responseData, {
566
- abortEarly: false,
567
- allowUnknown: true,
568
- });
569
-
570
- if (res_error) {
571
- if (this._conf.options.strictResponseCheck === true) {
572
- return Promise.reject(new FDKResponseValidationError(res_error));
573
- } else {
574
- Logger({
575
- level: "WARN",
576
- message: `Response Validation Warnings for application > Logistic > getLocations \n ${res_error}`,
577
- });
578
- }
579
- }
580
-
581
343
  return response;
582
344
  }
583
345
 
584
346
  /**
585
- * @param {LogisticApplicationValidator.GetOptimalLocationsParam} arg - Arg object.
586
347
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
587
348
  * @param {import("../ApplicationAPIClient").Options} - Options
588
- * @returns {Promise<LogisticApplicationModel.ReAssignStoreResponse>} -
589
- * Success response
349
+ * @returns {Promise<ReAssignStoreResponse>} - Success response
590
350
  * @name getOptimalLocations
591
351
  * @summary: Get selling locations
592
352
  * @description: Get optimal fulfillment centre for customers by analyzing their location, product availability, and inventory levels. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getOptimalLocations/).
@@ -595,30 +355,6 @@ class Logistic {
595
355
  { body, requestHeaders } = { requestHeaders: {} },
596
356
  { responseHeaders } = { responseHeaders: false }
597
357
  ) {
598
- const {
599
- error,
600
- } = LogisticApplicationValidator.getOptimalLocations().validate(
601
- { body },
602
- { abortEarly: false, allowUnknown: true }
603
- );
604
- if (error) {
605
- return Promise.reject(new FDKClientValidationError(error));
606
- }
607
-
608
- // Showing warrnings if extra unknown parameters are found
609
- const {
610
- error: warrning,
611
- } = LogisticApplicationValidator.getOptimalLocations().validate(
612
- { body },
613
- { abortEarly: false, allowUnknown: false }
614
- );
615
- if (warrning) {
616
- Logger({
617
- level: "WARN",
618
- message: `Parameter Validation warrnings for application > Logistic > getOptimalLocations \n ${warrning}`,
619
- });
620
- }
621
-
622
358
  const query_params = {};
623
359
 
624
360
  const xHeaders = {};
@@ -641,32 +377,13 @@ class Logistic {
641
377
  responseData = response[0];
642
378
  }
643
379
 
644
- const {
645
- error: res_error,
646
- } = LogisticApplicationModel.ReAssignStoreResponse().validate(
647
- responseData,
648
- { abortEarly: false, allowUnknown: true }
649
- );
650
-
651
- if (res_error) {
652
- if (this._conf.options.strictResponseCheck === true) {
653
- return Promise.reject(new FDKResponseValidationError(res_error));
654
- } else {
655
- Logger({
656
- level: "WARN",
657
- message: `Response Validation Warnings for application > Logistic > getOptimalLocations \n ${res_error}`,
658
- });
659
- }
660
- }
661
-
662
380
  return response;
663
381
  }
664
382
 
665
383
  /**
666
- * @param {LogisticApplicationValidator.GetPincodeCityParam} arg - Arg object.
667
384
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
668
385
  * @param {import("../ApplicationAPIClient").Options} - Options
669
- * @returns {Promise<LogisticApplicationModel.PincodeApiResponse>} - Success response
386
+ * @returns {Promise<PincodeApiResponse>} - Success response
670
387
  * @name getPincodeCity
671
388
  * @summary: Get pincode details
672
389
  * @description: Get details of a specific pincode, such as obtaining its city and state information. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getPincodeCity/).
@@ -675,26 +392,13 @@ class Logistic {
675
392
  { pincode, requestHeaders } = { requestHeaders: {} },
676
393
  { responseHeaders } = { responseHeaders: false }
677
394
  ) {
678
- const { error } = LogisticApplicationValidator.getPincodeCity().validate(
679
- { pincode },
680
- { abortEarly: false, allowUnknown: true }
681
- );
682
- if (error) {
683
- return Promise.reject(new FDKClientValidationError(error));
684
- }
685
-
686
- // Showing warrnings if extra unknown parameters are found
687
- const {
688
- error: warrning,
689
- } = LogisticApplicationValidator.getPincodeCity().validate(
690
- { pincode },
691
- { abortEarly: false, allowUnknown: false }
692
- );
693
- if (warrning) {
694
- Logger({
695
- level: "WARN",
696
- message: `Parameter Validation warrnings for application > Logistic > getPincodeCity \n ${warrning}`,
395
+ const errors = validateRequiredParams(arguments[0], ["pincode"]);
396
+ if (errors.length > 0) {
397
+ const error = new FDKClientValidationError({
398
+ message: "Missing required field",
399
+ details: errors,
697
400
  });
401
+ return Promise.reject(new FDKClientValidationError(error));
698
402
  }
699
403
 
700
404
  const query_params = {};
@@ -719,34 +423,13 @@ class Logistic {
719
423
  responseData = response[0];
720
424
  }
721
425
 
722
- const {
723
- error: res_error,
724
- } = LogisticApplicationModel.PincodeApiResponse().validate(responseData, {
725
- abortEarly: false,
726
- allowUnknown: true,
727
- });
728
-
729
- if (res_error) {
730
- if (this._conf.options.strictResponseCheck === true) {
731
- return Promise.reject(new FDKResponseValidationError(res_error));
732
- } else {
733
- Logger({
734
- level: "WARN",
735
- message: `Response Validation Warnings for application > Logistic > getPincodeCity \n ${res_error}`,
736
- });
737
- }
738
- }
739
-
740
426
  return response;
741
427
  }
742
428
 
743
429
  /**
744
- * @param {LogisticApplicationValidator.GetPincodeZonesParam} arg - Arg object.
745
430
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
746
431
  * @param {import("../ApplicationAPIClient").Options} - Options
747
- * @returns {Promise<LogisticApplicationModel.GetZoneFromPincodeViewResponse>}
748
- * - Success response
749
- *
432
+ * @returns {Promise<GetZoneFromPincodeViewResponse>} - Success response
750
433
  * @name getPincodeZones
751
434
  * @summary: Get zones
752
435
  * @description: Get the delivery zone associated with a given pincode. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getPincodeZones/).
@@ -755,28 +438,6 @@ class Logistic {
755
438
  { body, requestHeaders } = { requestHeaders: {} },
756
439
  { responseHeaders } = { responseHeaders: false }
757
440
  ) {
758
- const { error } = LogisticApplicationValidator.getPincodeZones().validate(
759
- { body },
760
- { abortEarly: false, allowUnknown: true }
761
- );
762
- if (error) {
763
- return Promise.reject(new FDKClientValidationError(error));
764
- }
765
-
766
- // Showing warrnings if extra unknown parameters are found
767
- const {
768
- error: warrning,
769
- } = LogisticApplicationValidator.getPincodeZones().validate(
770
- { body },
771
- { abortEarly: false, allowUnknown: false }
772
- );
773
- if (warrning) {
774
- Logger({
775
- level: "WARN",
776
- message: `Parameter Validation warrnings for application > Logistic > getPincodeZones \n ${warrning}`,
777
- });
778
- }
779
-
780
441
  const query_params = {};
781
442
 
782
443
  const xHeaders = {};
@@ -799,32 +460,13 @@ class Logistic {
799
460
  responseData = response[0];
800
461
  }
801
462
 
802
- const {
803
- error: res_error,
804
- } = LogisticApplicationModel.GetZoneFromPincodeViewResponse().validate(
805
- responseData,
806
- { abortEarly: false, allowUnknown: true }
807
- );
808
-
809
- if (res_error) {
810
- if (this._conf.options.strictResponseCheck === true) {
811
- return Promise.reject(new FDKResponseValidationError(res_error));
812
- } else {
813
- Logger({
814
- level: "WARN",
815
- message: `Response Validation Warnings for application > Logistic > getPincodeZones \n ${res_error}`,
816
- });
817
- }
818
- }
819
-
820
463
  return response;
821
464
  }
822
465
 
823
466
  /**
824
- * @param {LogisticApplicationValidator.GetTatProductParam} arg - Arg object.
825
467
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
826
468
  * @param {import("../ApplicationAPIClient").Options} - Options
827
- * @returns {Promise<LogisticApplicationModel.TATViewResponse>} - Success response
469
+ * @returns {Promise<TATViewResponse>} - Success response
828
470
  * @name getTatProduct
829
471
  * @summary: Get product's turnaround time
830
472
  * @description: Get the estimated delivery time frame for a specific product from a designated store. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/getTatProduct/).
@@ -833,28 +475,6 @@ class Logistic {
833
475
  { body, requestHeaders } = { requestHeaders: {} },
834
476
  { responseHeaders } = { responseHeaders: false }
835
477
  ) {
836
- const { error } = LogisticApplicationValidator.getTatProduct().validate(
837
- { body },
838
- { abortEarly: false, allowUnknown: true }
839
- );
840
- if (error) {
841
- return Promise.reject(new FDKClientValidationError(error));
842
- }
843
-
844
- // Showing warrnings if extra unknown parameters are found
845
- const {
846
- error: warrning,
847
- } = LogisticApplicationValidator.getTatProduct().validate(
848
- { body },
849
- { abortEarly: false, allowUnknown: false }
850
- );
851
- if (warrning) {
852
- Logger({
853
- level: "WARN",
854
- message: `Parameter Validation warrnings for application > Logistic > getTatProduct \n ${warrning}`,
855
- });
856
- }
857
-
858
478
  const query_params = {};
859
479
 
860
480
  const xHeaders = {};
@@ -877,33 +497,13 @@ class Logistic {
877
497
  responseData = response[0];
878
498
  }
879
499
 
880
- const {
881
- error: res_error,
882
- } = LogisticApplicationModel.TATViewResponse().validate(responseData, {
883
- abortEarly: false,
884
- allowUnknown: true,
885
- });
886
-
887
- if (res_error) {
888
- if (this._conf.options.strictResponseCheck === true) {
889
- return Promise.reject(new FDKResponseValidationError(res_error));
890
- } else {
891
- Logger({
892
- level: "WARN",
893
- message: `Response Validation Warnings for application > Logistic > getTatProduct \n ${res_error}`,
894
- });
895
- }
896
- }
897
-
898
500
  return response;
899
501
  }
900
502
 
901
503
  /**
902
- * @param {LogisticApplicationValidator.ValidateAddressParam} arg - Arg object.
903
504
  * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
904
505
  * @param {import("../ApplicationAPIClient").Options} - Options
905
- * @returns {Promise<LogisticApplicationModel.ValidateAddressRequest>} -
906
- * Success response
506
+ * @returns {Promise<ValidateAddressRequest>} - Success response
907
507
  * @name validateAddress
908
508
  * @summary: Validate address
909
509
  * @description: Validate addresses using specific templates customized for each country and tailored to various business scenarios. This validation ensures that the data conforms to the information currently stored in the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/logistic/validateAddress/).
@@ -914,26 +514,16 @@ class Logistic {
914
514
  },
915
515
  { responseHeaders } = { responseHeaders: false }
916
516
  ) {
917
- const { error } = LogisticApplicationValidator.validateAddress().validate(
918
- { countryIsoCode, templateName, body },
919
- { abortEarly: false, allowUnknown: true }
920
- );
921
- if (error) {
922
- return Promise.reject(new FDKClientValidationError(error));
923
- }
924
-
925
- // Showing warrnings if extra unknown parameters are found
926
- const {
927
- error: warrning,
928
- } = LogisticApplicationValidator.validateAddress().validate(
929
- { countryIsoCode, templateName, body },
930
- { abortEarly: false, allowUnknown: false }
931
- );
932
- if (warrning) {
933
- Logger({
934
- level: "WARN",
935
- message: `Parameter Validation warrnings for application > Logistic > validateAddress \n ${warrning}`,
517
+ const errors = validateRequiredParams(arguments[0], [
518
+ "countryIsoCode",
519
+ "templateName",
520
+ ]);
521
+ if (errors.length > 0) {
522
+ const error = new FDKClientValidationError({
523
+ message: "Missing required field",
524
+ details: errors,
936
525
  });
526
+ return Promise.reject(new FDKClientValidationError(error));
937
527
  }
938
528
 
939
529
  const query_params = {};
@@ -958,24 +548,6 @@ class Logistic {
958
548
  responseData = response[0];
959
549
  }
960
550
 
961
- const {
962
- error: res_error,
963
- } = LogisticApplicationModel.ValidateAddressRequest().validate(
964
- responseData,
965
- { abortEarly: false, allowUnknown: true }
966
- );
967
-
968
- if (res_error) {
969
- if (this._conf.options.strictResponseCheck === true) {
970
- return Promise.reject(new FDKResponseValidationError(res_error));
971
- } else {
972
- Logger({
973
- level: "WARN",
974
- message: `Response Validation Warnings for application > Logistic > validateAddress \n ${res_error}`,
975
- });
976
- }
977
- }
978
-
979
551
  return response;
980
552
  }
981
553
  }