@gofynd/fdk-client-javascript 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
|
|
|
3
3
|
const Paginator = require("../../common/Paginator");
|
|
4
4
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
5
5
|
const CatalogValidator = require("./CatalogApplicationValidator");
|
|
6
|
+
const CatalogModel = require("./CatalogApplicationModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
6
8
|
|
|
7
9
|
class Catalog {
|
|
8
10
|
constructor(_conf) {
|
|
@@ -84,7 +86,7 @@ class Catalog {
|
|
|
84
86
|
* @summary: Get a product
|
|
85
87
|
* @description: Use this API to retrieve a product by its slug value.
|
|
86
88
|
*/
|
|
87
|
-
getProductDetailBySlug({ slug } = {}) {
|
|
89
|
+
async getProductDetailBySlug({ slug } = {}) {
|
|
88
90
|
const { error } = CatalogValidator.getProductDetailBySlug().validate(
|
|
89
91
|
{ slug },
|
|
90
92
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -92,11 +94,27 @@ class Catalog {
|
|
|
92
94
|
if (error) {
|
|
93
95
|
return Promise.reject(new FDKClientValidationError(error));
|
|
94
96
|
}
|
|
97
|
+
|
|
98
|
+
// Showing warrnings if extra unknown parameters are found
|
|
99
|
+
const {
|
|
100
|
+
error: warrning,
|
|
101
|
+
} = CatalogValidator.getProductDetailBySlug().validate(
|
|
102
|
+
{ slug },
|
|
103
|
+
{ abortEarly: false, allowUnknown: false }
|
|
104
|
+
);
|
|
105
|
+
if (warrning) {
|
|
106
|
+
Logger({
|
|
107
|
+
level: "WARN",
|
|
108
|
+
message: "Parameter Validation warrnings for getProductDetailBySlug",
|
|
109
|
+
});
|
|
110
|
+
Logger({ level: "WARN", message: warrning });
|
|
111
|
+
}
|
|
112
|
+
|
|
95
113
|
const query_params = {};
|
|
96
114
|
|
|
97
115
|
const xHeaders = {};
|
|
98
116
|
|
|
99
|
-
|
|
117
|
+
const response = await APIClient.execute(
|
|
100
118
|
this._conf,
|
|
101
119
|
"get",
|
|
102
120
|
constructUrl({
|
|
@@ -107,6 +125,21 @@ class Catalog {
|
|
|
107
125
|
undefined,
|
|
108
126
|
xHeaders
|
|
109
127
|
);
|
|
128
|
+
|
|
129
|
+
const { error: res_error } = CatalogModel.ProductDetail().validate(
|
|
130
|
+
response,
|
|
131
|
+
{ abortEarly: false, allowUnknown: false }
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
if (res_error) {
|
|
135
|
+
Logger({
|
|
136
|
+
level: "WARN",
|
|
137
|
+
message: "Response Validation Warnnings for getProductDetailBySlug",
|
|
138
|
+
});
|
|
139
|
+
Logger({ level: "WARN", message: res_error });
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
return response;
|
|
110
143
|
}
|
|
111
144
|
|
|
112
145
|
/**
|
|
@@ -120,7 +153,7 @@ class Catalog {
|
|
|
120
153
|
* @summary: Get the sizes of a product
|
|
121
154
|
* @description: A product can have multiple sizes. Use this API to fetch all the available sizes of a product.
|
|
122
155
|
*/
|
|
123
|
-
getProductSizesBySlug({ slug, storeId } = {}) {
|
|
156
|
+
async getProductSizesBySlug({ slug, storeId } = {}) {
|
|
124
157
|
const { error } = CatalogValidator.getProductSizesBySlug().validate(
|
|
125
158
|
{ slug, storeId },
|
|
126
159
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -128,12 +161,28 @@ class Catalog {
|
|
|
128
161
|
if (error) {
|
|
129
162
|
return Promise.reject(new FDKClientValidationError(error));
|
|
130
163
|
}
|
|
164
|
+
|
|
165
|
+
// Showing warrnings if extra unknown parameters are found
|
|
166
|
+
const {
|
|
167
|
+
error: warrning,
|
|
168
|
+
} = CatalogValidator.getProductSizesBySlug().validate(
|
|
169
|
+
{ slug, storeId },
|
|
170
|
+
{ abortEarly: false, allowUnknown: false }
|
|
171
|
+
);
|
|
172
|
+
if (warrning) {
|
|
173
|
+
Logger({
|
|
174
|
+
level: "WARN",
|
|
175
|
+
message: "Parameter Validation warrnings for getProductSizesBySlug",
|
|
176
|
+
});
|
|
177
|
+
Logger({ level: "WARN", message: warrning });
|
|
178
|
+
}
|
|
179
|
+
|
|
131
180
|
const query_params = {};
|
|
132
181
|
query_params["store_id"] = storeId;
|
|
133
182
|
|
|
134
183
|
const xHeaders = {};
|
|
135
184
|
|
|
136
|
-
|
|
185
|
+
const response = await APIClient.execute(
|
|
137
186
|
this._conf,
|
|
138
187
|
"get",
|
|
139
188
|
constructUrl({
|
|
@@ -144,6 +193,21 @@ class Catalog {
|
|
|
144
193
|
undefined,
|
|
145
194
|
xHeaders
|
|
146
195
|
);
|
|
196
|
+
|
|
197
|
+
const { error: res_error } = CatalogModel.ProductSizes().validate(
|
|
198
|
+
response,
|
|
199
|
+
{ abortEarly: false, allowUnknown: false }
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
if (res_error) {
|
|
203
|
+
Logger({
|
|
204
|
+
level: "WARN",
|
|
205
|
+
message: "Response Validation Warnnings for getProductSizesBySlug",
|
|
206
|
+
});
|
|
207
|
+
Logger({ level: "WARN", message: res_error });
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return response;
|
|
147
211
|
}
|
|
148
212
|
|
|
149
213
|
/**
|
|
@@ -155,7 +219,7 @@ class Catalog {
|
|
|
155
219
|
* @summary: Compare products
|
|
156
220
|
* @description: Use this API to compare the features of products belonging to the same category. Note that at least one slug is mandatory in the request query.
|
|
157
221
|
*/
|
|
158
|
-
getProductComparisonBySlugs({ slug } = {}) {
|
|
222
|
+
async getProductComparisonBySlugs({ slug } = {}) {
|
|
159
223
|
const { error } = CatalogValidator.getProductComparisonBySlugs().validate(
|
|
160
224
|
{ slug },
|
|
161
225
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -163,12 +227,29 @@ class Catalog {
|
|
|
163
227
|
if (error) {
|
|
164
228
|
return Promise.reject(new FDKClientValidationError(error));
|
|
165
229
|
}
|
|
230
|
+
|
|
231
|
+
// Showing warrnings if extra unknown parameters are found
|
|
232
|
+
const {
|
|
233
|
+
error: warrning,
|
|
234
|
+
} = CatalogValidator.getProductComparisonBySlugs().validate(
|
|
235
|
+
{ slug },
|
|
236
|
+
{ abortEarly: false, allowUnknown: false }
|
|
237
|
+
);
|
|
238
|
+
if (warrning) {
|
|
239
|
+
Logger({
|
|
240
|
+
level: "WARN",
|
|
241
|
+
message:
|
|
242
|
+
"Parameter Validation warrnings for getProductComparisonBySlugs",
|
|
243
|
+
});
|
|
244
|
+
Logger({ level: "WARN", message: warrning });
|
|
245
|
+
}
|
|
246
|
+
|
|
166
247
|
const query_params = {};
|
|
167
248
|
query_params["slug"] = slug;
|
|
168
249
|
|
|
169
250
|
const xHeaders = {};
|
|
170
251
|
|
|
171
|
-
|
|
252
|
+
const response = await APIClient.execute(
|
|
172
253
|
this._conf,
|
|
173
254
|
"get",
|
|
174
255
|
constructUrl({
|
|
@@ -179,6 +260,24 @@ class Catalog {
|
|
|
179
260
|
undefined,
|
|
180
261
|
xHeaders
|
|
181
262
|
);
|
|
263
|
+
|
|
264
|
+
const {
|
|
265
|
+
error: res_error,
|
|
266
|
+
} = CatalogModel.ProductsComparisonResponse().validate(response, {
|
|
267
|
+
abortEarly: false,
|
|
268
|
+
allowUnknown: false,
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
if (res_error) {
|
|
272
|
+
Logger({
|
|
273
|
+
level: "WARN",
|
|
274
|
+
message:
|
|
275
|
+
"Response Validation Warnnings for getProductComparisonBySlugs",
|
|
276
|
+
});
|
|
277
|
+
Logger({ level: "WARN", message: res_error });
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return response;
|
|
182
281
|
}
|
|
183
282
|
|
|
184
283
|
/**
|
|
@@ -190,7 +289,7 @@ class Catalog {
|
|
|
190
289
|
* @summary: Get comparison between similar products
|
|
191
290
|
* @description: Use this API to compare a given product automatically with similar products. Only one slug is needed.
|
|
192
291
|
*/
|
|
193
|
-
getSimilarComparisonProductBySlug({ slug } = {}) {
|
|
292
|
+
async getSimilarComparisonProductBySlug({ slug } = {}) {
|
|
194
293
|
const {
|
|
195
294
|
error,
|
|
196
295
|
} = CatalogValidator.getSimilarComparisonProductBySlug().validate(
|
|
@@ -200,11 +299,28 @@ class Catalog {
|
|
|
200
299
|
if (error) {
|
|
201
300
|
return Promise.reject(new FDKClientValidationError(error));
|
|
202
301
|
}
|
|
302
|
+
|
|
303
|
+
// Showing warrnings if extra unknown parameters are found
|
|
304
|
+
const {
|
|
305
|
+
error: warrning,
|
|
306
|
+
} = CatalogValidator.getSimilarComparisonProductBySlug().validate(
|
|
307
|
+
{ slug },
|
|
308
|
+
{ abortEarly: false, allowUnknown: false }
|
|
309
|
+
);
|
|
310
|
+
if (warrning) {
|
|
311
|
+
Logger({
|
|
312
|
+
level: "WARN",
|
|
313
|
+
message:
|
|
314
|
+
"Parameter Validation warrnings for getSimilarComparisonProductBySlug",
|
|
315
|
+
});
|
|
316
|
+
Logger({ level: "WARN", message: warrning });
|
|
317
|
+
}
|
|
318
|
+
|
|
203
319
|
const query_params = {};
|
|
204
320
|
|
|
205
321
|
const xHeaders = {};
|
|
206
322
|
|
|
207
|
-
|
|
323
|
+
const response = await APIClient.execute(
|
|
208
324
|
this._conf,
|
|
209
325
|
"get",
|
|
210
326
|
constructUrl({
|
|
@@ -215,6 +331,24 @@ class Catalog {
|
|
|
215
331
|
undefined,
|
|
216
332
|
xHeaders
|
|
217
333
|
);
|
|
334
|
+
|
|
335
|
+
const {
|
|
336
|
+
error: res_error,
|
|
337
|
+
} = CatalogModel.ProductCompareResponse().validate(response, {
|
|
338
|
+
abortEarly: false,
|
|
339
|
+
allowUnknown: false,
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
if (res_error) {
|
|
343
|
+
Logger({
|
|
344
|
+
level: "WARN",
|
|
345
|
+
message:
|
|
346
|
+
"Response Validation Warnnings for getSimilarComparisonProductBySlug",
|
|
347
|
+
});
|
|
348
|
+
Logger({ level: "WARN", message: res_error });
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
return response;
|
|
218
352
|
}
|
|
219
353
|
|
|
220
354
|
/**
|
|
@@ -226,7 +360,7 @@ class Catalog {
|
|
|
226
360
|
* @summary: Get comparison between frequently compared products with the given product
|
|
227
361
|
* @description: Use this API to compare a given product automatically with products that are frequently compared with it. Only one slug is needed.
|
|
228
362
|
*/
|
|
229
|
-
getComparedFrequentlyProductBySlug({ slug } = {}) {
|
|
363
|
+
async getComparedFrequentlyProductBySlug({ slug } = {}) {
|
|
230
364
|
const {
|
|
231
365
|
error,
|
|
232
366
|
} = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
|
|
@@ -236,11 +370,28 @@ class Catalog {
|
|
|
236
370
|
if (error) {
|
|
237
371
|
return Promise.reject(new FDKClientValidationError(error));
|
|
238
372
|
}
|
|
373
|
+
|
|
374
|
+
// Showing warrnings if extra unknown parameters are found
|
|
375
|
+
const {
|
|
376
|
+
error: warrning,
|
|
377
|
+
} = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
|
|
378
|
+
{ slug },
|
|
379
|
+
{ abortEarly: false, allowUnknown: false }
|
|
380
|
+
);
|
|
381
|
+
if (warrning) {
|
|
382
|
+
Logger({
|
|
383
|
+
level: "WARN",
|
|
384
|
+
message:
|
|
385
|
+
"Parameter Validation warrnings for getComparedFrequentlyProductBySlug",
|
|
386
|
+
});
|
|
387
|
+
Logger({ level: "WARN", message: warrning });
|
|
388
|
+
}
|
|
389
|
+
|
|
239
390
|
const query_params = {};
|
|
240
391
|
|
|
241
392
|
const xHeaders = {};
|
|
242
393
|
|
|
243
|
-
|
|
394
|
+
const response = await APIClient.execute(
|
|
244
395
|
this._conf,
|
|
245
396
|
"get",
|
|
246
397
|
constructUrl({
|
|
@@ -251,6 +402,24 @@ class Catalog {
|
|
|
251
402
|
undefined,
|
|
252
403
|
xHeaders
|
|
253
404
|
);
|
|
405
|
+
|
|
406
|
+
const {
|
|
407
|
+
error: res_error,
|
|
408
|
+
} = CatalogModel.ProductFrequentlyComparedSimilarResponse().validate(
|
|
409
|
+
response,
|
|
410
|
+
{ abortEarly: false, allowUnknown: false }
|
|
411
|
+
);
|
|
412
|
+
|
|
413
|
+
if (res_error) {
|
|
414
|
+
Logger({
|
|
415
|
+
level: "WARN",
|
|
416
|
+
message:
|
|
417
|
+
"Response Validation Warnnings for getComparedFrequentlyProductBySlug",
|
|
418
|
+
});
|
|
419
|
+
Logger({ level: "WARN", message: res_error });
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
return response;
|
|
254
423
|
}
|
|
255
424
|
|
|
256
425
|
/**
|
|
@@ -262,7 +431,7 @@ class Catalog {
|
|
|
262
431
|
* @summary: Get variant of a particular product
|
|
263
432
|
* @description: A product can have a different type of variants such as colour, shade, memory. Use this API to fetch all the available variants of a product using its slug.
|
|
264
433
|
*/
|
|
265
|
-
getProductVariantsBySlug({ slug } = {}) {
|
|
434
|
+
async getProductVariantsBySlug({ slug } = {}) {
|
|
266
435
|
const { error } = CatalogValidator.getProductVariantsBySlug().validate(
|
|
267
436
|
{ slug },
|
|
268
437
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -270,11 +439,27 @@ class Catalog {
|
|
|
270
439
|
if (error) {
|
|
271
440
|
return Promise.reject(new FDKClientValidationError(error));
|
|
272
441
|
}
|
|
442
|
+
|
|
443
|
+
// Showing warrnings if extra unknown parameters are found
|
|
444
|
+
const {
|
|
445
|
+
error: warrning,
|
|
446
|
+
} = CatalogValidator.getProductVariantsBySlug().validate(
|
|
447
|
+
{ slug },
|
|
448
|
+
{ abortEarly: false, allowUnknown: false }
|
|
449
|
+
);
|
|
450
|
+
if (warrning) {
|
|
451
|
+
Logger({
|
|
452
|
+
level: "WARN",
|
|
453
|
+
message: "Parameter Validation warrnings for getProductVariantsBySlug",
|
|
454
|
+
});
|
|
455
|
+
Logger({ level: "WARN", message: warrning });
|
|
456
|
+
}
|
|
457
|
+
|
|
273
458
|
const query_params = {};
|
|
274
459
|
|
|
275
460
|
const xHeaders = {};
|
|
276
461
|
|
|
277
|
-
|
|
462
|
+
const response = await APIClient.execute(
|
|
278
463
|
this._conf,
|
|
279
464
|
"get",
|
|
280
465
|
constructUrl({
|
|
@@ -285,6 +470,23 @@ class Catalog {
|
|
|
285
470
|
undefined,
|
|
286
471
|
xHeaders
|
|
287
472
|
);
|
|
473
|
+
|
|
474
|
+
const {
|
|
475
|
+
error: res_error,
|
|
476
|
+
} = CatalogModel.ProductVariantsResponse().validate(response, {
|
|
477
|
+
abortEarly: false,
|
|
478
|
+
allowUnknown: false,
|
|
479
|
+
});
|
|
480
|
+
|
|
481
|
+
if (res_error) {
|
|
482
|
+
Logger({
|
|
483
|
+
level: "WARN",
|
|
484
|
+
message: "Response Validation Warnnings for getProductVariantsBySlug",
|
|
485
|
+
});
|
|
486
|
+
Logger({ level: "WARN", message: res_error });
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
return response;
|
|
288
490
|
}
|
|
289
491
|
|
|
290
492
|
/**
|
|
@@ -302,7 +504,7 @@ class Catalog {
|
|
|
302
504
|
* @summary: Get the stock of a product
|
|
303
505
|
* @description: Retrieve the available stock of the products. Use this API to retrieve stock of multiple products (up to 50) at a time.
|
|
304
506
|
*/
|
|
305
|
-
getProductStockByIds({ itemId, alu, skuCode, ean, upc } = {}) {
|
|
507
|
+
async getProductStockByIds({ itemId, alu, skuCode, ean, upc } = {}) {
|
|
306
508
|
const { error } = CatalogValidator.getProductStockByIds().validate(
|
|
307
509
|
{ itemId, alu, skuCode, ean, upc },
|
|
308
510
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -310,6 +512,22 @@ class Catalog {
|
|
|
310
512
|
if (error) {
|
|
311
513
|
return Promise.reject(new FDKClientValidationError(error));
|
|
312
514
|
}
|
|
515
|
+
|
|
516
|
+
// Showing warrnings if extra unknown parameters are found
|
|
517
|
+
const {
|
|
518
|
+
error: warrning,
|
|
519
|
+
} = CatalogValidator.getProductStockByIds().validate(
|
|
520
|
+
{ itemId, alu, skuCode, ean, upc },
|
|
521
|
+
{ abortEarly: false, allowUnknown: false }
|
|
522
|
+
);
|
|
523
|
+
if (warrning) {
|
|
524
|
+
Logger({
|
|
525
|
+
level: "WARN",
|
|
526
|
+
message: "Parameter Validation warrnings for getProductStockByIds",
|
|
527
|
+
});
|
|
528
|
+
Logger({ level: "WARN", message: warrning });
|
|
529
|
+
}
|
|
530
|
+
|
|
313
531
|
const query_params = {};
|
|
314
532
|
query_params["item_id"] = itemId;
|
|
315
533
|
query_params["alu"] = alu;
|
|
@@ -319,7 +537,7 @@ class Catalog {
|
|
|
319
537
|
|
|
320
538
|
const xHeaders = {};
|
|
321
539
|
|
|
322
|
-
|
|
540
|
+
const response = await APIClient.execute(
|
|
323
541
|
this._conf,
|
|
324
542
|
"get",
|
|
325
543
|
constructUrl({
|
|
@@ -330,6 +548,23 @@ class Catalog {
|
|
|
330
548
|
undefined,
|
|
331
549
|
xHeaders
|
|
332
550
|
);
|
|
551
|
+
|
|
552
|
+
const {
|
|
553
|
+
error: res_error,
|
|
554
|
+
} = CatalogModel.ProductStockStatusResponse().validate(response, {
|
|
555
|
+
abortEarly: false,
|
|
556
|
+
allowUnknown: false,
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
if (res_error) {
|
|
560
|
+
Logger({
|
|
561
|
+
level: "WARN",
|
|
562
|
+
message: "Response Validation Warnnings for getProductStockByIds",
|
|
563
|
+
});
|
|
564
|
+
Logger({ level: "WARN", message: res_error });
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
return response;
|
|
333
568
|
}
|
|
334
569
|
|
|
335
570
|
/**
|
|
@@ -341,7 +576,7 @@ class Catalog {
|
|
|
341
576
|
* @summary: Get the stock of a product
|
|
342
577
|
* @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
|
|
343
578
|
*/
|
|
344
|
-
getProductStockForTimeByIds({ timestamp, pageSize, pageId } = {}) {
|
|
579
|
+
async getProductStockForTimeByIds({ timestamp, pageSize, pageId } = {}) {
|
|
345
580
|
const { error } = CatalogValidator.getProductStockForTimeByIds().validate(
|
|
346
581
|
{ timestamp, pageSize, pageId },
|
|
347
582
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -349,6 +584,23 @@ class Catalog {
|
|
|
349
584
|
if (error) {
|
|
350
585
|
return Promise.reject(new FDKClientValidationError(error));
|
|
351
586
|
}
|
|
587
|
+
|
|
588
|
+
// Showing warrnings if extra unknown parameters are found
|
|
589
|
+
const {
|
|
590
|
+
error: warrning,
|
|
591
|
+
} = CatalogValidator.getProductStockForTimeByIds().validate(
|
|
592
|
+
{ timestamp, pageSize, pageId },
|
|
593
|
+
{ abortEarly: false, allowUnknown: false }
|
|
594
|
+
);
|
|
595
|
+
if (warrning) {
|
|
596
|
+
Logger({
|
|
597
|
+
level: "WARN",
|
|
598
|
+
message:
|
|
599
|
+
"Parameter Validation warrnings for getProductStockForTimeByIds",
|
|
600
|
+
});
|
|
601
|
+
Logger({ level: "WARN", message: warrning });
|
|
602
|
+
}
|
|
603
|
+
|
|
352
604
|
const query_params = {};
|
|
353
605
|
query_params["timestamp"] = timestamp;
|
|
354
606
|
query_params["page_size"] = pageSize;
|
|
@@ -356,7 +608,7 @@ class Catalog {
|
|
|
356
608
|
|
|
357
609
|
const xHeaders = {};
|
|
358
610
|
|
|
359
|
-
|
|
611
|
+
const response = await APIClient.execute(
|
|
360
612
|
this._conf,
|
|
361
613
|
"get",
|
|
362
614
|
constructUrl({
|
|
@@ -367,6 +619,24 @@ class Catalog {
|
|
|
367
619
|
undefined,
|
|
368
620
|
xHeaders
|
|
369
621
|
);
|
|
622
|
+
|
|
623
|
+
const {
|
|
624
|
+
error: res_error,
|
|
625
|
+
} = CatalogModel.ProductStockPolling().validate(response, {
|
|
626
|
+
abortEarly: false,
|
|
627
|
+
allowUnknown: false,
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
if (res_error) {
|
|
631
|
+
Logger({
|
|
632
|
+
level: "WARN",
|
|
633
|
+
message:
|
|
634
|
+
"Response Validation Warnnings for getProductStockForTimeByIds",
|
|
635
|
+
});
|
|
636
|
+
Logger({ level: "WARN", message: res_error });
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
return response;
|
|
370
640
|
}
|
|
371
641
|
|
|
372
642
|
/**
|
|
@@ -419,7 +689,7 @@ class Catalog {
|
|
|
419
689
|
* @summary: Get all the products
|
|
420
690
|
* @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
|
|
421
691
|
*/
|
|
422
|
-
getProducts({
|
|
692
|
+
async getProducts({
|
|
423
693
|
q,
|
|
424
694
|
f,
|
|
425
695
|
filters,
|
|
@@ -436,6 +706,20 @@ class Catalog {
|
|
|
436
706
|
if (error) {
|
|
437
707
|
return Promise.reject(new FDKClientValidationError(error));
|
|
438
708
|
}
|
|
709
|
+
|
|
710
|
+
// Showing warrnings if extra unknown parameters are found
|
|
711
|
+
const { error: warrning } = CatalogValidator.getProducts().validate(
|
|
712
|
+
{ q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
713
|
+
{ abortEarly: false, allowUnknown: false }
|
|
714
|
+
);
|
|
715
|
+
if (warrning) {
|
|
716
|
+
Logger({
|
|
717
|
+
level: "WARN",
|
|
718
|
+
message: "Parameter Validation warrnings for getProducts",
|
|
719
|
+
});
|
|
720
|
+
Logger({ level: "WARN", message: warrning });
|
|
721
|
+
}
|
|
722
|
+
|
|
439
723
|
const query_params = {};
|
|
440
724
|
query_params["q"] = q;
|
|
441
725
|
query_params["f"] = f;
|
|
@@ -448,7 +732,7 @@ class Catalog {
|
|
|
448
732
|
|
|
449
733
|
const xHeaders = {};
|
|
450
734
|
|
|
451
|
-
|
|
735
|
+
const response = await APIClient.execute(
|
|
452
736
|
this._conf,
|
|
453
737
|
"get",
|
|
454
738
|
constructUrl({
|
|
@@ -459,6 +743,23 @@ class Catalog {
|
|
|
459
743
|
undefined,
|
|
460
744
|
xHeaders
|
|
461
745
|
);
|
|
746
|
+
|
|
747
|
+
const {
|
|
748
|
+
error: res_error,
|
|
749
|
+
} = CatalogModel.ProductListingResponse().validate(response, {
|
|
750
|
+
abortEarly: false,
|
|
751
|
+
allowUnknown: false,
|
|
752
|
+
});
|
|
753
|
+
|
|
754
|
+
if (res_error) {
|
|
755
|
+
Logger({
|
|
756
|
+
level: "WARN",
|
|
757
|
+
message: "Response Validation Warnnings for getProducts",
|
|
758
|
+
});
|
|
759
|
+
Logger({ level: "WARN", message: res_error });
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
return response;
|
|
462
763
|
}
|
|
463
764
|
|
|
464
765
|
/**
|
|
@@ -517,7 +818,7 @@ class Catalog {
|
|
|
517
818
|
* @summary: Get all the brands
|
|
518
819
|
* @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
|
|
519
820
|
*/
|
|
520
|
-
getBrands({ department, pageNo, pageSize } = {}) {
|
|
821
|
+
async getBrands({ department, pageNo, pageSize } = {}) {
|
|
521
822
|
const { error } = CatalogValidator.getBrands().validate(
|
|
522
823
|
{ department, pageNo, pageSize },
|
|
523
824
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -525,6 +826,20 @@ class Catalog {
|
|
|
525
826
|
if (error) {
|
|
526
827
|
return Promise.reject(new FDKClientValidationError(error));
|
|
527
828
|
}
|
|
829
|
+
|
|
830
|
+
// Showing warrnings if extra unknown parameters are found
|
|
831
|
+
const { error: warrning } = CatalogValidator.getBrands().validate(
|
|
832
|
+
{ department, pageNo, pageSize },
|
|
833
|
+
{ abortEarly: false, allowUnknown: false }
|
|
834
|
+
);
|
|
835
|
+
if (warrning) {
|
|
836
|
+
Logger({
|
|
837
|
+
level: "WARN",
|
|
838
|
+
message: "Parameter Validation warrnings for getBrands",
|
|
839
|
+
});
|
|
840
|
+
Logger({ level: "WARN", message: warrning });
|
|
841
|
+
}
|
|
842
|
+
|
|
528
843
|
const query_params = {};
|
|
529
844
|
query_params["department"] = department;
|
|
530
845
|
query_params["page_no"] = pageNo;
|
|
@@ -532,7 +847,7 @@ class Catalog {
|
|
|
532
847
|
|
|
533
848
|
const xHeaders = {};
|
|
534
849
|
|
|
535
|
-
|
|
850
|
+
const response = await APIClient.execute(
|
|
536
851
|
this._conf,
|
|
537
852
|
"get",
|
|
538
853
|
constructUrl({
|
|
@@ -543,6 +858,23 @@ class Catalog {
|
|
|
543
858
|
undefined,
|
|
544
859
|
xHeaders
|
|
545
860
|
);
|
|
861
|
+
|
|
862
|
+
const {
|
|
863
|
+
error: res_error,
|
|
864
|
+
} = CatalogModel.BrandListingResponse().validate(response, {
|
|
865
|
+
abortEarly: false,
|
|
866
|
+
allowUnknown: false,
|
|
867
|
+
});
|
|
868
|
+
|
|
869
|
+
if (res_error) {
|
|
870
|
+
Logger({
|
|
871
|
+
level: "WARN",
|
|
872
|
+
message: "Response Validation Warnnings for getBrands",
|
|
873
|
+
});
|
|
874
|
+
Logger({ level: "WARN", message: res_error });
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
return response;
|
|
546
878
|
}
|
|
547
879
|
|
|
548
880
|
/**
|
|
@@ -585,7 +917,7 @@ class Catalog {
|
|
|
585
917
|
* @summary: Get metadata of a brand
|
|
586
918
|
* @description: Fetch metadata of a brand such as name, information, logo, banner, etc.
|
|
587
919
|
*/
|
|
588
|
-
getBrandDetailBySlug({ slug } = {}) {
|
|
920
|
+
async getBrandDetailBySlug({ slug } = {}) {
|
|
589
921
|
const { error } = CatalogValidator.getBrandDetailBySlug().validate(
|
|
590
922
|
{ slug },
|
|
591
923
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -593,11 +925,27 @@ class Catalog {
|
|
|
593
925
|
if (error) {
|
|
594
926
|
return Promise.reject(new FDKClientValidationError(error));
|
|
595
927
|
}
|
|
928
|
+
|
|
929
|
+
// Showing warrnings if extra unknown parameters are found
|
|
930
|
+
const {
|
|
931
|
+
error: warrning,
|
|
932
|
+
} = CatalogValidator.getBrandDetailBySlug().validate(
|
|
933
|
+
{ slug },
|
|
934
|
+
{ abortEarly: false, allowUnknown: false }
|
|
935
|
+
);
|
|
936
|
+
if (warrning) {
|
|
937
|
+
Logger({
|
|
938
|
+
level: "WARN",
|
|
939
|
+
message: "Parameter Validation warrnings for getBrandDetailBySlug",
|
|
940
|
+
});
|
|
941
|
+
Logger({ level: "WARN", message: warrning });
|
|
942
|
+
}
|
|
943
|
+
|
|
596
944
|
const query_params = {};
|
|
597
945
|
|
|
598
946
|
const xHeaders = {};
|
|
599
947
|
|
|
600
|
-
|
|
948
|
+
const response = await APIClient.execute(
|
|
601
949
|
this._conf,
|
|
602
950
|
"get",
|
|
603
951
|
constructUrl({
|
|
@@ -608,6 +956,23 @@ class Catalog {
|
|
|
608
956
|
undefined,
|
|
609
957
|
xHeaders
|
|
610
958
|
);
|
|
959
|
+
|
|
960
|
+
const {
|
|
961
|
+
error: res_error,
|
|
962
|
+
} = CatalogModel.BrandDetailResponse().validate(response, {
|
|
963
|
+
abortEarly: false,
|
|
964
|
+
allowUnknown: false,
|
|
965
|
+
});
|
|
966
|
+
|
|
967
|
+
if (res_error) {
|
|
968
|
+
Logger({
|
|
969
|
+
level: "WARN",
|
|
970
|
+
message: "Response Validation Warnnings for getBrandDetailBySlug",
|
|
971
|
+
});
|
|
972
|
+
Logger({ level: "WARN", message: res_error });
|
|
973
|
+
}
|
|
974
|
+
|
|
975
|
+
return response;
|
|
611
976
|
}
|
|
612
977
|
|
|
613
978
|
/**
|
|
@@ -620,7 +985,7 @@ class Catalog {
|
|
|
620
985
|
* @summary: List all the categories
|
|
621
986
|
* @description: Use this API to list all the categories. You can also filter the categories by department.
|
|
622
987
|
*/
|
|
623
|
-
getCategories({ department } = {}) {
|
|
988
|
+
async getCategories({ department } = {}) {
|
|
624
989
|
const { error } = CatalogValidator.getCategories().validate(
|
|
625
990
|
{ department },
|
|
626
991
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -628,12 +993,26 @@ class Catalog {
|
|
|
628
993
|
if (error) {
|
|
629
994
|
return Promise.reject(new FDKClientValidationError(error));
|
|
630
995
|
}
|
|
996
|
+
|
|
997
|
+
// Showing warrnings if extra unknown parameters are found
|
|
998
|
+
const { error: warrning } = CatalogValidator.getCategories().validate(
|
|
999
|
+
{ department },
|
|
1000
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1001
|
+
);
|
|
1002
|
+
if (warrning) {
|
|
1003
|
+
Logger({
|
|
1004
|
+
level: "WARN",
|
|
1005
|
+
message: "Parameter Validation warrnings for getCategories",
|
|
1006
|
+
});
|
|
1007
|
+
Logger({ level: "WARN", message: warrning });
|
|
1008
|
+
}
|
|
1009
|
+
|
|
631
1010
|
const query_params = {};
|
|
632
1011
|
query_params["department"] = department;
|
|
633
1012
|
|
|
634
1013
|
const xHeaders = {};
|
|
635
1014
|
|
|
636
|
-
|
|
1015
|
+
const response = await APIClient.execute(
|
|
637
1016
|
this._conf,
|
|
638
1017
|
"get",
|
|
639
1018
|
constructUrl({
|
|
@@ -644,6 +1023,23 @@ class Catalog {
|
|
|
644
1023
|
undefined,
|
|
645
1024
|
xHeaders
|
|
646
1025
|
);
|
|
1026
|
+
|
|
1027
|
+
const {
|
|
1028
|
+
error: res_error,
|
|
1029
|
+
} = CatalogModel.CategoryListingResponse().validate(response, {
|
|
1030
|
+
abortEarly: false,
|
|
1031
|
+
allowUnknown: false,
|
|
1032
|
+
});
|
|
1033
|
+
|
|
1034
|
+
if (res_error) {
|
|
1035
|
+
Logger({
|
|
1036
|
+
level: "WARN",
|
|
1037
|
+
message: "Response Validation Warnnings for getCategories",
|
|
1038
|
+
});
|
|
1039
|
+
Logger({ level: "WARN", message: res_error });
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
return response;
|
|
647
1043
|
}
|
|
648
1044
|
|
|
649
1045
|
/**
|
|
@@ -655,7 +1051,7 @@ class Catalog {
|
|
|
655
1051
|
* @summary: Get metadata of a category
|
|
656
1052
|
* @description: Fetch metadata of a category such as name, information, logo, banner, etc.
|
|
657
1053
|
*/
|
|
658
|
-
getCategoryDetailBySlug({ slug } = {}) {
|
|
1054
|
+
async getCategoryDetailBySlug({ slug } = {}) {
|
|
659
1055
|
const { error } = CatalogValidator.getCategoryDetailBySlug().validate(
|
|
660
1056
|
{ slug },
|
|
661
1057
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -663,11 +1059,27 @@ class Catalog {
|
|
|
663
1059
|
if (error) {
|
|
664
1060
|
return Promise.reject(new FDKClientValidationError(error));
|
|
665
1061
|
}
|
|
1062
|
+
|
|
1063
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1064
|
+
const {
|
|
1065
|
+
error: warrning,
|
|
1066
|
+
} = CatalogValidator.getCategoryDetailBySlug().validate(
|
|
1067
|
+
{ slug },
|
|
1068
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1069
|
+
);
|
|
1070
|
+
if (warrning) {
|
|
1071
|
+
Logger({
|
|
1072
|
+
level: "WARN",
|
|
1073
|
+
message: "Parameter Validation warrnings for getCategoryDetailBySlug",
|
|
1074
|
+
});
|
|
1075
|
+
Logger({ level: "WARN", message: warrning });
|
|
1076
|
+
}
|
|
1077
|
+
|
|
666
1078
|
const query_params = {};
|
|
667
1079
|
|
|
668
1080
|
const xHeaders = {};
|
|
669
1081
|
|
|
670
|
-
|
|
1082
|
+
const response = await APIClient.execute(
|
|
671
1083
|
this._conf,
|
|
672
1084
|
"get",
|
|
673
1085
|
constructUrl({
|
|
@@ -678,6 +1090,23 @@ class Catalog {
|
|
|
678
1090
|
undefined,
|
|
679
1091
|
xHeaders
|
|
680
1092
|
);
|
|
1093
|
+
|
|
1094
|
+
const {
|
|
1095
|
+
error: res_error,
|
|
1096
|
+
} = CatalogModel.CategoryMetaResponse().validate(response, {
|
|
1097
|
+
abortEarly: false,
|
|
1098
|
+
allowUnknown: false,
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
if (res_error) {
|
|
1102
|
+
Logger({
|
|
1103
|
+
level: "WARN",
|
|
1104
|
+
message: "Response Validation Warnnings for getCategoryDetailBySlug",
|
|
1105
|
+
});
|
|
1106
|
+
Logger({ level: "WARN", message: res_error });
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
return response;
|
|
681
1110
|
}
|
|
682
1111
|
|
|
683
1112
|
/**
|
|
@@ -691,7 +1120,7 @@ class Catalog {
|
|
|
691
1120
|
* @summary: List the products
|
|
692
1121
|
* @description: List all the products associated with a brand, collection or category in a random order.
|
|
693
1122
|
*/
|
|
694
|
-
getHomeProducts({ sortOn, pageId, pageSize } = {}) {
|
|
1123
|
+
async getHomeProducts({ sortOn, pageId, pageSize } = {}) {
|
|
695
1124
|
const { error } = CatalogValidator.getHomeProducts().validate(
|
|
696
1125
|
{ sortOn, pageId, pageSize },
|
|
697
1126
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -699,6 +1128,20 @@ class Catalog {
|
|
|
699
1128
|
if (error) {
|
|
700
1129
|
return Promise.reject(new FDKClientValidationError(error));
|
|
701
1130
|
}
|
|
1131
|
+
|
|
1132
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1133
|
+
const { error: warrning } = CatalogValidator.getHomeProducts().validate(
|
|
1134
|
+
{ sortOn, pageId, pageSize },
|
|
1135
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1136
|
+
);
|
|
1137
|
+
if (warrning) {
|
|
1138
|
+
Logger({
|
|
1139
|
+
level: "WARN",
|
|
1140
|
+
message: "Parameter Validation warrnings for getHomeProducts",
|
|
1141
|
+
});
|
|
1142
|
+
Logger({ level: "WARN", message: warrning });
|
|
1143
|
+
}
|
|
1144
|
+
|
|
702
1145
|
const query_params = {};
|
|
703
1146
|
query_params["sort_on"] = sortOn;
|
|
704
1147
|
query_params["page_id"] = pageId;
|
|
@@ -706,7 +1149,7 @@ class Catalog {
|
|
|
706
1149
|
|
|
707
1150
|
const xHeaders = {};
|
|
708
1151
|
|
|
709
|
-
|
|
1152
|
+
const response = await APIClient.execute(
|
|
710
1153
|
this._conf,
|
|
711
1154
|
"get",
|
|
712
1155
|
constructUrl({
|
|
@@ -717,6 +1160,23 @@ class Catalog {
|
|
|
717
1160
|
undefined,
|
|
718
1161
|
xHeaders
|
|
719
1162
|
);
|
|
1163
|
+
|
|
1164
|
+
const {
|
|
1165
|
+
error: res_error,
|
|
1166
|
+
} = CatalogModel.HomeListingResponse().validate(response, {
|
|
1167
|
+
abortEarly: false,
|
|
1168
|
+
allowUnknown: false,
|
|
1169
|
+
});
|
|
1170
|
+
|
|
1171
|
+
if (res_error) {
|
|
1172
|
+
Logger({
|
|
1173
|
+
level: "WARN",
|
|
1174
|
+
message: "Response Validation Warnnings for getHomeProducts",
|
|
1175
|
+
});
|
|
1176
|
+
Logger({ level: "WARN", message: res_error });
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
return response;
|
|
720
1180
|
}
|
|
721
1181
|
|
|
722
1182
|
/**
|
|
@@ -755,7 +1215,7 @@ class Catalog {
|
|
|
755
1215
|
* @summary: List all the departments
|
|
756
1216
|
* @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the departments. If successful, returns the list of departments specified in `DepartmentResponse`
|
|
757
1217
|
*/
|
|
758
|
-
getDepartments({} = {}) {
|
|
1218
|
+
async getDepartments({} = {}) {
|
|
759
1219
|
const { error } = CatalogValidator.getDepartments().validate(
|
|
760
1220
|
{},
|
|
761
1221
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -763,11 +1223,25 @@ class Catalog {
|
|
|
763
1223
|
if (error) {
|
|
764
1224
|
return Promise.reject(new FDKClientValidationError(error));
|
|
765
1225
|
}
|
|
1226
|
+
|
|
1227
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1228
|
+
const { error: warrning } = CatalogValidator.getDepartments().validate(
|
|
1229
|
+
{},
|
|
1230
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1231
|
+
);
|
|
1232
|
+
if (warrning) {
|
|
1233
|
+
Logger({
|
|
1234
|
+
level: "WARN",
|
|
1235
|
+
message: "Parameter Validation warrnings for getDepartments",
|
|
1236
|
+
});
|
|
1237
|
+
Logger({ level: "WARN", message: warrning });
|
|
1238
|
+
}
|
|
1239
|
+
|
|
766
1240
|
const query_params = {};
|
|
767
1241
|
|
|
768
1242
|
const xHeaders = {};
|
|
769
1243
|
|
|
770
|
-
|
|
1244
|
+
const response = await APIClient.execute(
|
|
771
1245
|
this._conf,
|
|
772
1246
|
"get",
|
|
773
1247
|
constructUrl({
|
|
@@ -778,6 +1252,23 @@ class Catalog {
|
|
|
778
1252
|
undefined,
|
|
779
1253
|
xHeaders
|
|
780
1254
|
);
|
|
1255
|
+
|
|
1256
|
+
const {
|
|
1257
|
+
error: res_error,
|
|
1258
|
+
} = CatalogModel.DepartmentResponse().validate(response, {
|
|
1259
|
+
abortEarly: false,
|
|
1260
|
+
allowUnknown: false,
|
|
1261
|
+
});
|
|
1262
|
+
|
|
1263
|
+
if (res_error) {
|
|
1264
|
+
Logger({
|
|
1265
|
+
level: "WARN",
|
|
1266
|
+
message: "Response Validation Warnnings for getDepartments",
|
|
1267
|
+
});
|
|
1268
|
+
Logger({ level: "WARN", message: res_error });
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
return response;
|
|
781
1272
|
}
|
|
782
1273
|
|
|
783
1274
|
/**
|
|
@@ -790,7 +1281,7 @@ class Catalog {
|
|
|
790
1281
|
* @summary: Get relevant suggestions for a search query
|
|
791
1282
|
* @description: Retrieves a list of suggestions for a given search query. Each suggestion is a valid search term that's generated on the basis of query. This is particularly useful to enhance the user experience while using the search tool.
|
|
792
1283
|
*/
|
|
793
|
-
getSearchResults({ q } = {}) {
|
|
1284
|
+
async getSearchResults({ q } = {}) {
|
|
794
1285
|
const { error } = CatalogValidator.getSearchResults().validate(
|
|
795
1286
|
{ q },
|
|
796
1287
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -798,12 +1289,26 @@ class Catalog {
|
|
|
798
1289
|
if (error) {
|
|
799
1290
|
return Promise.reject(new FDKClientValidationError(error));
|
|
800
1291
|
}
|
|
1292
|
+
|
|
1293
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1294
|
+
const { error: warrning } = CatalogValidator.getSearchResults().validate(
|
|
1295
|
+
{ q },
|
|
1296
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1297
|
+
);
|
|
1298
|
+
if (warrning) {
|
|
1299
|
+
Logger({
|
|
1300
|
+
level: "WARN",
|
|
1301
|
+
message: "Parameter Validation warrnings for getSearchResults",
|
|
1302
|
+
});
|
|
1303
|
+
Logger({ level: "WARN", message: warrning });
|
|
1304
|
+
}
|
|
1305
|
+
|
|
801
1306
|
const query_params = {};
|
|
802
1307
|
query_params["q"] = q;
|
|
803
1308
|
|
|
804
1309
|
const xHeaders = {};
|
|
805
1310
|
|
|
806
|
-
|
|
1311
|
+
const response = await APIClient.execute(
|
|
807
1312
|
this._conf,
|
|
808
1313
|
"get",
|
|
809
1314
|
constructUrl({
|
|
@@ -814,6 +1319,23 @@ class Catalog {
|
|
|
814
1319
|
undefined,
|
|
815
1320
|
xHeaders
|
|
816
1321
|
);
|
|
1322
|
+
|
|
1323
|
+
const {
|
|
1324
|
+
error: res_error,
|
|
1325
|
+
} = CatalogModel.AutoCompleteResponse().validate(response, {
|
|
1326
|
+
abortEarly: false,
|
|
1327
|
+
allowUnknown: false,
|
|
1328
|
+
});
|
|
1329
|
+
|
|
1330
|
+
if (res_error) {
|
|
1331
|
+
Logger({
|
|
1332
|
+
level: "WARN",
|
|
1333
|
+
message: "Response Validation Warnnings for getSearchResults",
|
|
1334
|
+
});
|
|
1335
|
+
Logger({ level: "WARN", message: res_error });
|
|
1336
|
+
}
|
|
1337
|
+
|
|
1338
|
+
return response;
|
|
817
1339
|
}
|
|
818
1340
|
|
|
819
1341
|
/**
|
|
@@ -826,7 +1348,7 @@ class Catalog {
|
|
|
826
1348
|
* @summary: List all the collections
|
|
827
1349
|
* @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
|
|
828
1350
|
*/
|
|
829
|
-
getCollections({ pageNo, pageSize, tag } = {}) {
|
|
1351
|
+
async getCollections({ pageNo, pageSize, tag } = {}) {
|
|
830
1352
|
const { error } = CatalogValidator.getCollections().validate(
|
|
831
1353
|
{ pageNo, pageSize, tag },
|
|
832
1354
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -834,6 +1356,20 @@ class Catalog {
|
|
|
834
1356
|
if (error) {
|
|
835
1357
|
return Promise.reject(new FDKClientValidationError(error));
|
|
836
1358
|
}
|
|
1359
|
+
|
|
1360
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1361
|
+
const { error: warrning } = CatalogValidator.getCollections().validate(
|
|
1362
|
+
{ pageNo, pageSize, tag },
|
|
1363
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1364
|
+
);
|
|
1365
|
+
if (warrning) {
|
|
1366
|
+
Logger({
|
|
1367
|
+
level: "WARN",
|
|
1368
|
+
message: "Parameter Validation warrnings for getCollections",
|
|
1369
|
+
});
|
|
1370
|
+
Logger({ level: "WARN", message: warrning });
|
|
1371
|
+
}
|
|
1372
|
+
|
|
837
1373
|
const query_params = {};
|
|
838
1374
|
query_params["page_no"] = pageNo;
|
|
839
1375
|
query_params["page_size"] = pageSize;
|
|
@@ -841,7 +1377,7 @@ class Catalog {
|
|
|
841
1377
|
|
|
842
1378
|
const xHeaders = {};
|
|
843
1379
|
|
|
844
|
-
|
|
1380
|
+
const response = await APIClient.execute(
|
|
845
1381
|
this._conf,
|
|
846
1382
|
"get",
|
|
847
1383
|
constructUrl({
|
|
@@ -852,6 +1388,23 @@ class Catalog {
|
|
|
852
1388
|
undefined,
|
|
853
1389
|
xHeaders
|
|
854
1390
|
);
|
|
1391
|
+
|
|
1392
|
+
const {
|
|
1393
|
+
error: res_error,
|
|
1394
|
+
} = CatalogModel.GetCollectionListingResponse().validate(response, {
|
|
1395
|
+
abortEarly: false,
|
|
1396
|
+
allowUnknown: false,
|
|
1397
|
+
});
|
|
1398
|
+
|
|
1399
|
+
if (res_error) {
|
|
1400
|
+
Logger({
|
|
1401
|
+
level: "WARN",
|
|
1402
|
+
message: "Response Validation Warnnings for getCollections",
|
|
1403
|
+
});
|
|
1404
|
+
Logger({ level: "WARN", message: res_error });
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
return response;
|
|
855
1408
|
}
|
|
856
1409
|
|
|
857
1410
|
/**
|
|
@@ -902,7 +1455,7 @@ class Catalog {
|
|
|
902
1455
|
* @summary: Get the items in a collection
|
|
903
1456
|
* @description: Get items in a collection specified by its `slug`.
|
|
904
1457
|
*/
|
|
905
|
-
getCollectionItemsBySlug({
|
|
1458
|
+
async getCollectionItemsBySlug({
|
|
906
1459
|
slug,
|
|
907
1460
|
f,
|
|
908
1461
|
filters,
|
|
@@ -917,6 +1470,22 @@ class Catalog {
|
|
|
917
1470
|
if (error) {
|
|
918
1471
|
return Promise.reject(new FDKClientValidationError(error));
|
|
919
1472
|
}
|
|
1473
|
+
|
|
1474
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1475
|
+
const {
|
|
1476
|
+
error: warrning,
|
|
1477
|
+
} = CatalogValidator.getCollectionItemsBySlug().validate(
|
|
1478
|
+
{ slug, f, filters, sortOn, pageId, pageSize },
|
|
1479
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1480
|
+
);
|
|
1481
|
+
if (warrning) {
|
|
1482
|
+
Logger({
|
|
1483
|
+
level: "WARN",
|
|
1484
|
+
message: "Parameter Validation warrnings for getCollectionItemsBySlug",
|
|
1485
|
+
});
|
|
1486
|
+
Logger({ level: "WARN", message: warrning });
|
|
1487
|
+
}
|
|
1488
|
+
|
|
920
1489
|
const query_params = {};
|
|
921
1490
|
query_params["f"] = f;
|
|
922
1491
|
query_params["filters"] = filters;
|
|
@@ -926,7 +1495,7 @@ class Catalog {
|
|
|
926
1495
|
|
|
927
1496
|
const xHeaders = {};
|
|
928
1497
|
|
|
929
|
-
|
|
1498
|
+
const response = await APIClient.execute(
|
|
930
1499
|
this._conf,
|
|
931
1500
|
"get",
|
|
932
1501
|
constructUrl({
|
|
@@ -937,6 +1506,23 @@ class Catalog {
|
|
|
937
1506
|
undefined,
|
|
938
1507
|
xHeaders
|
|
939
1508
|
);
|
|
1509
|
+
|
|
1510
|
+
const {
|
|
1511
|
+
error: res_error,
|
|
1512
|
+
} = CatalogModel.ProductListingResponse().validate(response, {
|
|
1513
|
+
abortEarly: false,
|
|
1514
|
+
allowUnknown: false,
|
|
1515
|
+
});
|
|
1516
|
+
|
|
1517
|
+
if (res_error) {
|
|
1518
|
+
Logger({
|
|
1519
|
+
level: "WARN",
|
|
1520
|
+
message: "Response Validation Warnnings for getCollectionItemsBySlug",
|
|
1521
|
+
});
|
|
1522
|
+
Logger({ level: "WARN", message: res_error });
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
return response;
|
|
940
1526
|
}
|
|
941
1527
|
|
|
942
1528
|
/**
|
|
@@ -996,7 +1582,7 @@ class Catalog {
|
|
|
996
1582
|
* @summary: Get a particular collection
|
|
997
1583
|
* @description: Get the details of a collection by its `slug`.
|
|
998
1584
|
*/
|
|
999
|
-
getCollectionDetailBySlug({ slug } = {}) {
|
|
1585
|
+
async getCollectionDetailBySlug({ slug } = {}) {
|
|
1000
1586
|
const { error } = CatalogValidator.getCollectionDetailBySlug().validate(
|
|
1001
1587
|
{ slug },
|
|
1002
1588
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1004,11 +1590,27 @@ class Catalog {
|
|
|
1004
1590
|
if (error) {
|
|
1005
1591
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1006
1592
|
}
|
|
1593
|
+
|
|
1594
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1595
|
+
const {
|
|
1596
|
+
error: warrning,
|
|
1597
|
+
} = CatalogValidator.getCollectionDetailBySlug().validate(
|
|
1598
|
+
{ slug },
|
|
1599
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1600
|
+
);
|
|
1601
|
+
if (warrning) {
|
|
1602
|
+
Logger({
|
|
1603
|
+
level: "WARN",
|
|
1604
|
+
message: "Parameter Validation warrnings for getCollectionDetailBySlug",
|
|
1605
|
+
});
|
|
1606
|
+
Logger({ level: "WARN", message: warrning });
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1007
1609
|
const query_params = {};
|
|
1008
1610
|
|
|
1009
1611
|
const xHeaders = {};
|
|
1010
1612
|
|
|
1011
|
-
|
|
1613
|
+
const response = await APIClient.execute(
|
|
1012
1614
|
this._conf,
|
|
1013
1615
|
"get",
|
|
1014
1616
|
constructUrl({
|
|
@@ -1019,6 +1621,23 @@ class Catalog {
|
|
|
1019
1621
|
undefined,
|
|
1020
1622
|
xHeaders
|
|
1021
1623
|
);
|
|
1624
|
+
|
|
1625
|
+
const {
|
|
1626
|
+
error: res_error,
|
|
1627
|
+
} = CatalogModel.CollectionDetailResponse().validate(response, {
|
|
1628
|
+
abortEarly: false,
|
|
1629
|
+
allowUnknown: false,
|
|
1630
|
+
});
|
|
1631
|
+
|
|
1632
|
+
if (res_error) {
|
|
1633
|
+
Logger({
|
|
1634
|
+
level: "WARN",
|
|
1635
|
+
message: "Response Validation Warnnings for getCollectionDetailBySlug",
|
|
1636
|
+
});
|
|
1637
|
+
Logger({ level: "WARN", message: res_error });
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
return response;
|
|
1022
1641
|
}
|
|
1023
1642
|
|
|
1024
1643
|
/**
|
|
@@ -1031,7 +1650,7 @@ class Catalog {
|
|
|
1031
1650
|
* @summary: Get a list of followed Products, Brands, Collections
|
|
1032
1651
|
* @description: Users can follow a product they like. This API retrieves the products the user have followed.
|
|
1033
1652
|
*/
|
|
1034
|
-
getFollowedListing({ collectionType, pageId, pageSize } = {}) {
|
|
1653
|
+
async getFollowedListing({ collectionType, pageId, pageSize } = {}) {
|
|
1035
1654
|
const { error } = CatalogValidator.getFollowedListing().validate(
|
|
1036
1655
|
{ collectionType, pageId, pageSize },
|
|
1037
1656
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1039,13 +1658,27 @@ class Catalog {
|
|
|
1039
1658
|
if (error) {
|
|
1040
1659
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1041
1660
|
}
|
|
1661
|
+
|
|
1662
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1663
|
+
const { error: warrning } = CatalogValidator.getFollowedListing().validate(
|
|
1664
|
+
{ collectionType, pageId, pageSize },
|
|
1665
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1666
|
+
);
|
|
1667
|
+
if (warrning) {
|
|
1668
|
+
Logger({
|
|
1669
|
+
level: "WARN",
|
|
1670
|
+
message: "Parameter Validation warrnings for getFollowedListing",
|
|
1671
|
+
});
|
|
1672
|
+
Logger({ level: "WARN", message: warrning });
|
|
1673
|
+
}
|
|
1674
|
+
|
|
1042
1675
|
const query_params = {};
|
|
1043
1676
|
query_params["page_id"] = pageId;
|
|
1044
1677
|
query_params["page_size"] = pageSize;
|
|
1045
1678
|
|
|
1046
1679
|
const xHeaders = {};
|
|
1047
1680
|
|
|
1048
|
-
|
|
1681
|
+
const response = await APIClient.execute(
|
|
1049
1682
|
this._conf,
|
|
1050
1683
|
"get",
|
|
1051
1684
|
constructUrl({
|
|
@@ -1056,6 +1689,23 @@ class Catalog {
|
|
|
1056
1689
|
undefined,
|
|
1057
1690
|
xHeaders
|
|
1058
1691
|
);
|
|
1692
|
+
|
|
1693
|
+
const {
|
|
1694
|
+
error: res_error,
|
|
1695
|
+
} = CatalogModel.GetFollowListingResponse().validate(response, {
|
|
1696
|
+
abortEarly: false,
|
|
1697
|
+
allowUnknown: false,
|
|
1698
|
+
});
|
|
1699
|
+
|
|
1700
|
+
if (res_error) {
|
|
1701
|
+
Logger({
|
|
1702
|
+
level: "WARN",
|
|
1703
|
+
message: "Response Validation Warnnings for getFollowedListing",
|
|
1704
|
+
});
|
|
1705
|
+
Logger({ level: "WARN", message: res_error });
|
|
1706
|
+
}
|
|
1707
|
+
|
|
1708
|
+
return response;
|
|
1059
1709
|
}
|
|
1060
1710
|
|
|
1061
1711
|
/**
|
|
@@ -1096,7 +1746,7 @@ class Catalog {
|
|
|
1096
1746
|
* @summary: Follow an entity (product/brand/collection)
|
|
1097
1747
|
* @description: Follow a particular entity such as product, brand, collection specified by its ID.
|
|
1098
1748
|
*/
|
|
1099
|
-
followById({ collectionType, collectionId } = {}) {
|
|
1749
|
+
async followById({ collectionType, collectionId } = {}) {
|
|
1100
1750
|
const { error } = CatalogValidator.followById().validate(
|
|
1101
1751
|
{ collectionType, collectionId },
|
|
1102
1752
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1104,11 +1754,25 @@ class Catalog {
|
|
|
1104
1754
|
if (error) {
|
|
1105
1755
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1106
1756
|
}
|
|
1757
|
+
|
|
1758
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1759
|
+
const { error: warrning } = CatalogValidator.followById().validate(
|
|
1760
|
+
{ collectionType, collectionId },
|
|
1761
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1762
|
+
);
|
|
1763
|
+
if (warrning) {
|
|
1764
|
+
Logger({
|
|
1765
|
+
level: "WARN",
|
|
1766
|
+
message: "Parameter Validation warrnings for followById",
|
|
1767
|
+
});
|
|
1768
|
+
Logger({ level: "WARN", message: warrning });
|
|
1769
|
+
}
|
|
1770
|
+
|
|
1107
1771
|
const query_params = {};
|
|
1108
1772
|
|
|
1109
1773
|
const xHeaders = {};
|
|
1110
1774
|
|
|
1111
|
-
|
|
1775
|
+
const response = await APIClient.execute(
|
|
1112
1776
|
this._conf,
|
|
1113
1777
|
"post",
|
|
1114
1778
|
constructUrl({
|
|
@@ -1119,6 +1783,23 @@ class Catalog {
|
|
|
1119
1783
|
undefined,
|
|
1120
1784
|
xHeaders
|
|
1121
1785
|
);
|
|
1786
|
+
|
|
1787
|
+
const {
|
|
1788
|
+
error: res_error,
|
|
1789
|
+
} = CatalogModel.FollowPostResponse().validate(response, {
|
|
1790
|
+
abortEarly: false,
|
|
1791
|
+
allowUnknown: false,
|
|
1792
|
+
});
|
|
1793
|
+
|
|
1794
|
+
if (res_error) {
|
|
1795
|
+
Logger({
|
|
1796
|
+
level: "WARN",
|
|
1797
|
+
message: "Response Validation Warnnings for followById",
|
|
1798
|
+
});
|
|
1799
|
+
Logger({ level: "WARN", message: res_error });
|
|
1800
|
+
}
|
|
1801
|
+
|
|
1802
|
+
return response;
|
|
1122
1803
|
}
|
|
1123
1804
|
|
|
1124
1805
|
/**
|
|
@@ -1130,7 +1811,7 @@ class Catalog {
|
|
|
1130
1811
|
* @summary: Unfollow an entity (product/brand/collection)
|
|
1131
1812
|
* @description: You can undo a followed product, brand or collection by its ID. This action is referred as _unfollow_.
|
|
1132
1813
|
*/
|
|
1133
|
-
unfollowById({ collectionType, collectionId } = {}) {
|
|
1814
|
+
async unfollowById({ collectionType, collectionId } = {}) {
|
|
1134
1815
|
const { error } = CatalogValidator.unfollowById().validate(
|
|
1135
1816
|
{ collectionType, collectionId },
|
|
1136
1817
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1138,11 +1819,25 @@ class Catalog {
|
|
|
1138
1819
|
if (error) {
|
|
1139
1820
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1140
1821
|
}
|
|
1822
|
+
|
|
1823
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1824
|
+
const { error: warrning } = CatalogValidator.unfollowById().validate(
|
|
1825
|
+
{ collectionType, collectionId },
|
|
1826
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1827
|
+
);
|
|
1828
|
+
if (warrning) {
|
|
1829
|
+
Logger({
|
|
1830
|
+
level: "WARN",
|
|
1831
|
+
message: "Parameter Validation warrnings for unfollowById",
|
|
1832
|
+
});
|
|
1833
|
+
Logger({ level: "WARN", message: warrning });
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1141
1836
|
const query_params = {};
|
|
1142
1837
|
|
|
1143
1838
|
const xHeaders = {};
|
|
1144
1839
|
|
|
1145
|
-
|
|
1840
|
+
const response = await APIClient.execute(
|
|
1146
1841
|
this._conf,
|
|
1147
1842
|
"delete",
|
|
1148
1843
|
constructUrl({
|
|
@@ -1153,6 +1848,23 @@ class Catalog {
|
|
|
1153
1848
|
undefined,
|
|
1154
1849
|
xHeaders
|
|
1155
1850
|
);
|
|
1851
|
+
|
|
1852
|
+
const {
|
|
1853
|
+
error: res_error,
|
|
1854
|
+
} = CatalogModel.FollowPostResponse().validate(response, {
|
|
1855
|
+
abortEarly: false,
|
|
1856
|
+
allowUnknown: false,
|
|
1857
|
+
});
|
|
1858
|
+
|
|
1859
|
+
if (res_error) {
|
|
1860
|
+
Logger({
|
|
1861
|
+
level: "WARN",
|
|
1862
|
+
message: "Response Validation Warnnings for unfollowById",
|
|
1863
|
+
});
|
|
1864
|
+
Logger({ level: "WARN", message: res_error });
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
return response;
|
|
1156
1868
|
}
|
|
1157
1869
|
|
|
1158
1870
|
/**
|
|
@@ -1164,7 +1876,7 @@ class Catalog {
|
|
|
1164
1876
|
* @summary: Get Follow Count
|
|
1165
1877
|
* @description: Get the total count of followers for a given collection type and collection ID.
|
|
1166
1878
|
*/
|
|
1167
|
-
getFollowerCountById({ collectionType, collectionId } = {}) {
|
|
1879
|
+
async getFollowerCountById({ collectionType, collectionId } = {}) {
|
|
1168
1880
|
const { error } = CatalogValidator.getFollowerCountById().validate(
|
|
1169
1881
|
{ collectionType, collectionId },
|
|
1170
1882
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1172,11 +1884,27 @@ class Catalog {
|
|
|
1172
1884
|
if (error) {
|
|
1173
1885
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1174
1886
|
}
|
|
1887
|
+
|
|
1888
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1889
|
+
const {
|
|
1890
|
+
error: warrning,
|
|
1891
|
+
} = CatalogValidator.getFollowerCountById().validate(
|
|
1892
|
+
{ collectionType, collectionId },
|
|
1893
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1894
|
+
);
|
|
1895
|
+
if (warrning) {
|
|
1896
|
+
Logger({
|
|
1897
|
+
level: "WARN",
|
|
1898
|
+
message: "Parameter Validation warrnings for getFollowerCountById",
|
|
1899
|
+
});
|
|
1900
|
+
Logger({ level: "WARN", message: warrning });
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1175
1903
|
const query_params = {};
|
|
1176
1904
|
|
|
1177
1905
|
const xHeaders = {};
|
|
1178
1906
|
|
|
1179
|
-
|
|
1907
|
+
const response = await APIClient.execute(
|
|
1180
1908
|
this._conf,
|
|
1181
1909
|
"get",
|
|
1182
1910
|
constructUrl({
|
|
@@ -1187,6 +1915,23 @@ class Catalog {
|
|
|
1187
1915
|
undefined,
|
|
1188
1916
|
xHeaders
|
|
1189
1917
|
);
|
|
1918
|
+
|
|
1919
|
+
const {
|
|
1920
|
+
error: res_error,
|
|
1921
|
+
} = CatalogModel.FollowerCountResponse().validate(response, {
|
|
1922
|
+
abortEarly: false,
|
|
1923
|
+
allowUnknown: false,
|
|
1924
|
+
});
|
|
1925
|
+
|
|
1926
|
+
if (res_error) {
|
|
1927
|
+
Logger({
|
|
1928
|
+
level: "WARN",
|
|
1929
|
+
message: "Response Validation Warnnings for getFollowerCountById",
|
|
1930
|
+
});
|
|
1931
|
+
Logger({ level: "WARN", message: res_error });
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
return response;
|
|
1190
1935
|
}
|
|
1191
1936
|
|
|
1192
1937
|
/**
|
|
@@ -1197,7 +1942,7 @@ class Catalog {
|
|
|
1197
1942
|
* @summary: Get the IDs of followed products, brands and collections.
|
|
1198
1943
|
* @description: You can get the IDs of all the followed Products, Brands and Collections. Pass collection_type as query parameter to fetch specific Ids
|
|
1199
1944
|
*/
|
|
1200
|
-
getFollowIds({ collectionType } = {}) {
|
|
1945
|
+
async getFollowIds({ collectionType } = {}) {
|
|
1201
1946
|
const { error } = CatalogValidator.getFollowIds().validate(
|
|
1202
1947
|
{ collectionType },
|
|
1203
1948
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1205,12 +1950,26 @@ class Catalog {
|
|
|
1205
1950
|
if (error) {
|
|
1206
1951
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1207
1952
|
}
|
|
1953
|
+
|
|
1954
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1955
|
+
const { error: warrning } = CatalogValidator.getFollowIds().validate(
|
|
1956
|
+
{ collectionType },
|
|
1957
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1958
|
+
);
|
|
1959
|
+
if (warrning) {
|
|
1960
|
+
Logger({
|
|
1961
|
+
level: "WARN",
|
|
1962
|
+
message: "Parameter Validation warrnings for getFollowIds",
|
|
1963
|
+
});
|
|
1964
|
+
Logger({ level: "WARN", message: warrning });
|
|
1965
|
+
}
|
|
1966
|
+
|
|
1208
1967
|
const query_params = {};
|
|
1209
1968
|
query_params["collection_type"] = collectionType;
|
|
1210
1969
|
|
|
1211
1970
|
const xHeaders = {};
|
|
1212
1971
|
|
|
1213
|
-
|
|
1972
|
+
const response = await APIClient.execute(
|
|
1214
1973
|
this._conf,
|
|
1215
1974
|
"get",
|
|
1216
1975
|
constructUrl({
|
|
@@ -1221,6 +1980,23 @@ class Catalog {
|
|
|
1221
1980
|
undefined,
|
|
1222
1981
|
xHeaders
|
|
1223
1982
|
);
|
|
1983
|
+
|
|
1984
|
+
const {
|
|
1985
|
+
error: res_error,
|
|
1986
|
+
} = CatalogModel.FollowIdsResponse().validate(response, {
|
|
1987
|
+
abortEarly: false,
|
|
1988
|
+
allowUnknown: false,
|
|
1989
|
+
});
|
|
1990
|
+
|
|
1991
|
+
if (res_error) {
|
|
1992
|
+
Logger({
|
|
1993
|
+
level: "WARN",
|
|
1994
|
+
message: "Response Validation Warnnings for getFollowIds",
|
|
1995
|
+
});
|
|
1996
|
+
Logger({ level: "WARN", message: res_error });
|
|
1997
|
+
}
|
|
1998
|
+
|
|
1999
|
+
return response;
|
|
1224
2000
|
}
|
|
1225
2001
|
|
|
1226
2002
|
/**
|
|
@@ -1240,7 +2016,15 @@ class Catalog {
|
|
|
1240
2016
|
* @summary: Get store meta information.
|
|
1241
2017
|
* @description: Use this API to get a list of stores in a specific application.
|
|
1242
2018
|
*/
|
|
1243
|
-
getStores({
|
|
2019
|
+
async getStores({
|
|
2020
|
+
pageNo,
|
|
2021
|
+
pageSize,
|
|
2022
|
+
q,
|
|
2023
|
+
city,
|
|
2024
|
+
range,
|
|
2025
|
+
latitude,
|
|
2026
|
+
longitude,
|
|
2027
|
+
} = {}) {
|
|
1244
2028
|
const { error } = CatalogValidator.getStores().validate(
|
|
1245
2029
|
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
1246
2030
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1248,6 +2032,20 @@ class Catalog {
|
|
|
1248
2032
|
if (error) {
|
|
1249
2033
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1250
2034
|
}
|
|
2035
|
+
|
|
2036
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2037
|
+
const { error: warrning } = CatalogValidator.getStores().validate(
|
|
2038
|
+
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2039
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2040
|
+
);
|
|
2041
|
+
if (warrning) {
|
|
2042
|
+
Logger({
|
|
2043
|
+
level: "WARN",
|
|
2044
|
+
message: "Parameter Validation warrnings for getStores",
|
|
2045
|
+
});
|
|
2046
|
+
Logger({ level: "WARN", message: warrning });
|
|
2047
|
+
}
|
|
2048
|
+
|
|
1251
2049
|
const query_params = {};
|
|
1252
2050
|
query_params["page_no"] = pageNo;
|
|
1253
2051
|
query_params["page_size"] = pageSize;
|
|
@@ -1259,7 +2057,7 @@ class Catalog {
|
|
|
1259
2057
|
|
|
1260
2058
|
const xHeaders = {};
|
|
1261
2059
|
|
|
1262
|
-
|
|
2060
|
+
const response = await APIClient.execute(
|
|
1263
2061
|
this._conf,
|
|
1264
2062
|
"get",
|
|
1265
2063
|
constructUrl({
|
|
@@ -1270,6 +2068,23 @@ class Catalog {
|
|
|
1270
2068
|
undefined,
|
|
1271
2069
|
xHeaders
|
|
1272
2070
|
);
|
|
2071
|
+
|
|
2072
|
+
const {
|
|
2073
|
+
error: res_error,
|
|
2074
|
+
} = CatalogModel.StoreListingResponse().validate(response, {
|
|
2075
|
+
abortEarly: false,
|
|
2076
|
+
allowUnknown: false,
|
|
2077
|
+
});
|
|
2078
|
+
|
|
2079
|
+
if (res_error) {
|
|
2080
|
+
Logger({
|
|
2081
|
+
level: "WARN",
|
|
2082
|
+
message: "Response Validation Warnnings for getStores",
|
|
2083
|
+
});
|
|
2084
|
+
Logger({ level: "WARN", message: res_error });
|
|
2085
|
+
}
|
|
2086
|
+
|
|
2087
|
+
return response;
|
|
1273
2088
|
}
|
|
1274
2089
|
|
|
1275
2090
|
/**
|
|
@@ -1328,7 +2143,7 @@ class Catalog {
|
|
|
1328
2143
|
* @summary: Get store meta information.
|
|
1329
2144
|
* @description: Use this API to get a list of stores in a specific application.
|
|
1330
2145
|
*/
|
|
1331
|
-
getInStockLocations({
|
|
2146
|
+
async getInStockLocations({
|
|
1332
2147
|
pageNo,
|
|
1333
2148
|
pageSize,
|
|
1334
2149
|
q,
|
|
@@ -1344,6 +2159,20 @@ class Catalog {
|
|
|
1344
2159
|
if (error) {
|
|
1345
2160
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1346
2161
|
}
|
|
2162
|
+
|
|
2163
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2164
|
+
const { error: warrning } = CatalogValidator.getInStockLocations().validate(
|
|
2165
|
+
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2166
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2167
|
+
);
|
|
2168
|
+
if (warrning) {
|
|
2169
|
+
Logger({
|
|
2170
|
+
level: "WARN",
|
|
2171
|
+
message: "Parameter Validation warrnings for getInStockLocations",
|
|
2172
|
+
});
|
|
2173
|
+
Logger({ level: "WARN", message: warrning });
|
|
2174
|
+
}
|
|
2175
|
+
|
|
1347
2176
|
const query_params = {};
|
|
1348
2177
|
query_params["page_no"] = pageNo;
|
|
1349
2178
|
query_params["page_size"] = pageSize;
|
|
@@ -1355,7 +2184,7 @@ class Catalog {
|
|
|
1355
2184
|
|
|
1356
2185
|
const xHeaders = {};
|
|
1357
2186
|
|
|
1358
|
-
|
|
2187
|
+
const response = await APIClient.execute(
|
|
1359
2188
|
this._conf,
|
|
1360
2189
|
"get",
|
|
1361
2190
|
constructUrl({
|
|
@@ -1366,6 +2195,23 @@ class Catalog {
|
|
|
1366
2195
|
undefined,
|
|
1367
2196
|
xHeaders
|
|
1368
2197
|
);
|
|
2198
|
+
|
|
2199
|
+
const {
|
|
2200
|
+
error: res_error,
|
|
2201
|
+
} = CatalogModel.ApplicationStoreListing().validate(response, {
|
|
2202
|
+
abortEarly: false,
|
|
2203
|
+
allowUnknown: false,
|
|
2204
|
+
});
|
|
2205
|
+
|
|
2206
|
+
if (res_error) {
|
|
2207
|
+
Logger({
|
|
2208
|
+
level: "WARN",
|
|
2209
|
+
message: "Response Validation Warnnings for getInStockLocations",
|
|
2210
|
+
});
|
|
2211
|
+
Logger({ level: "WARN", message: res_error });
|
|
2212
|
+
}
|
|
2213
|
+
|
|
2214
|
+
return response;
|
|
1369
2215
|
}
|
|
1370
2216
|
|
|
1371
2217
|
/**
|
|
@@ -1421,7 +2267,7 @@ class Catalog {
|
|
|
1421
2267
|
* @summary: Get store meta information.
|
|
1422
2268
|
* @description: Use this API to get meta details for a store.
|
|
1423
2269
|
*/
|
|
1424
|
-
getLocationDetailsById({ locationId } = {}) {
|
|
2270
|
+
async getLocationDetailsById({ locationId } = {}) {
|
|
1425
2271
|
const { error } = CatalogValidator.getLocationDetailsById().validate(
|
|
1426
2272
|
{ locationId },
|
|
1427
2273
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1429,11 +2275,27 @@ class Catalog {
|
|
|
1429
2275
|
if (error) {
|
|
1430
2276
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1431
2277
|
}
|
|
2278
|
+
|
|
2279
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2280
|
+
const {
|
|
2281
|
+
error: warrning,
|
|
2282
|
+
} = CatalogValidator.getLocationDetailsById().validate(
|
|
2283
|
+
{ locationId },
|
|
2284
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2285
|
+
);
|
|
2286
|
+
if (warrning) {
|
|
2287
|
+
Logger({
|
|
2288
|
+
level: "WARN",
|
|
2289
|
+
message: "Parameter Validation warrnings for getLocationDetailsById",
|
|
2290
|
+
});
|
|
2291
|
+
Logger({ level: "WARN", message: warrning });
|
|
2292
|
+
}
|
|
2293
|
+
|
|
1432
2294
|
const query_params = {};
|
|
1433
2295
|
|
|
1434
2296
|
const xHeaders = {};
|
|
1435
2297
|
|
|
1436
|
-
|
|
2298
|
+
const response = await APIClient.execute(
|
|
1437
2299
|
this._conf,
|
|
1438
2300
|
"get",
|
|
1439
2301
|
constructUrl({
|
|
@@ -1444,6 +2306,21 @@ class Catalog {
|
|
|
1444
2306
|
undefined,
|
|
1445
2307
|
xHeaders
|
|
1446
2308
|
);
|
|
2309
|
+
|
|
2310
|
+
const { error: res_error } = CatalogModel.StoreDetails().validate(
|
|
2311
|
+
response,
|
|
2312
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2313
|
+
);
|
|
2314
|
+
|
|
2315
|
+
if (res_error) {
|
|
2316
|
+
Logger({
|
|
2317
|
+
level: "WARN",
|
|
2318
|
+
message: "Response Validation Warnnings for getLocationDetailsById",
|
|
2319
|
+
});
|
|
2320
|
+
Logger({ level: "WARN", message: res_error });
|
|
2321
|
+
}
|
|
2322
|
+
|
|
2323
|
+
return response;
|
|
1447
2324
|
}
|
|
1448
2325
|
|
|
1449
2326
|
/**
|
|
@@ -1454,7 +2331,7 @@ class Catalog {
|
|
|
1454
2331
|
* @summary: Get product bundles
|
|
1455
2332
|
* @description: Use this API to retrieve products bundles to the one specified by its slug.
|
|
1456
2333
|
*/
|
|
1457
|
-
getProductBundlesBySlug({ slug, id } = {}) {
|
|
2334
|
+
async getProductBundlesBySlug({ slug, id } = {}) {
|
|
1458
2335
|
const { error } = CatalogValidator.getProductBundlesBySlug().validate(
|
|
1459
2336
|
{ slug, id },
|
|
1460
2337
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1462,13 +2339,29 @@ class Catalog {
|
|
|
1462
2339
|
if (error) {
|
|
1463
2340
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1464
2341
|
}
|
|
2342
|
+
|
|
2343
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2344
|
+
const {
|
|
2345
|
+
error: warrning,
|
|
2346
|
+
} = CatalogValidator.getProductBundlesBySlug().validate(
|
|
2347
|
+
{ slug, id },
|
|
2348
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2349
|
+
);
|
|
2350
|
+
if (warrning) {
|
|
2351
|
+
Logger({
|
|
2352
|
+
level: "WARN",
|
|
2353
|
+
message: "Parameter Validation warrnings for getProductBundlesBySlug",
|
|
2354
|
+
});
|
|
2355
|
+
Logger({ level: "WARN", message: warrning });
|
|
2356
|
+
}
|
|
2357
|
+
|
|
1465
2358
|
const query_params = {};
|
|
1466
2359
|
query_params["slug"] = slug;
|
|
1467
2360
|
query_params["id"] = id;
|
|
1468
2361
|
|
|
1469
2362
|
const xHeaders = {};
|
|
1470
2363
|
|
|
1471
|
-
|
|
2364
|
+
const response = await APIClient.execute(
|
|
1472
2365
|
this._conf,
|
|
1473
2366
|
"get",
|
|
1474
2367
|
constructUrl({
|
|
@@ -1479,6 +2372,21 @@ class Catalog {
|
|
|
1479
2372
|
undefined,
|
|
1480
2373
|
xHeaders
|
|
1481
2374
|
);
|
|
2375
|
+
|
|
2376
|
+
const { error: res_error } = CatalogModel.ProductBundle().validate(
|
|
2377
|
+
response,
|
|
2378
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2379
|
+
);
|
|
2380
|
+
|
|
2381
|
+
if (res_error) {
|
|
2382
|
+
Logger({
|
|
2383
|
+
level: "WARN",
|
|
2384
|
+
message: "Response Validation Warnnings for getProductBundlesBySlug",
|
|
2385
|
+
});
|
|
2386
|
+
Logger({ level: "WARN", message: res_error });
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
return response;
|
|
1482
2390
|
}
|
|
1483
2391
|
|
|
1484
2392
|
/**
|
|
@@ -1499,7 +2407,7 @@ class Catalog {
|
|
|
1499
2407
|
* @summary: Get the price of a product size at a PIN Code
|
|
1500
2408
|
* @description: Prices may vary for different sizes of a product. Use this API to retrieve the price of a product size at all the selling locations near to a PIN Code.
|
|
1501
2409
|
*/
|
|
1502
|
-
getProductPriceBySlug({ slug, size, storeId, pincode, moq } = {}) {
|
|
2410
|
+
async getProductPriceBySlug({ slug, size, storeId, pincode, moq } = {}) {
|
|
1503
2411
|
const { error } = CatalogValidator.getProductPriceBySlug().validate(
|
|
1504
2412
|
{ slug, size, storeId, pincode, moq },
|
|
1505
2413
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1507,6 +2415,22 @@ class Catalog {
|
|
|
1507
2415
|
if (error) {
|
|
1508
2416
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1509
2417
|
}
|
|
2418
|
+
|
|
2419
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2420
|
+
const {
|
|
2421
|
+
error: warrning,
|
|
2422
|
+
} = CatalogValidator.getProductPriceBySlug().validate(
|
|
2423
|
+
{ slug, size, storeId, pincode, moq },
|
|
2424
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2425
|
+
);
|
|
2426
|
+
if (warrning) {
|
|
2427
|
+
Logger({
|
|
2428
|
+
level: "WARN",
|
|
2429
|
+
message: "Parameter Validation warrnings for getProductPriceBySlug",
|
|
2430
|
+
});
|
|
2431
|
+
Logger({ level: "WARN", message: warrning });
|
|
2432
|
+
}
|
|
2433
|
+
|
|
1510
2434
|
const query_params = {};
|
|
1511
2435
|
query_params["store_id"] = storeId;
|
|
1512
2436
|
query_params["pincode"] = pincode;
|
|
@@ -1514,7 +2438,7 @@ class Catalog {
|
|
|
1514
2438
|
|
|
1515
2439
|
const xHeaders = {};
|
|
1516
2440
|
|
|
1517
|
-
|
|
2441
|
+
const response = await APIClient.execute(
|
|
1518
2442
|
this._conf,
|
|
1519
2443
|
"get",
|
|
1520
2444
|
constructUrl({
|
|
@@ -1525,6 +2449,23 @@ class Catalog {
|
|
|
1525
2449
|
undefined,
|
|
1526
2450
|
xHeaders
|
|
1527
2451
|
);
|
|
2452
|
+
|
|
2453
|
+
const {
|
|
2454
|
+
error: res_error,
|
|
2455
|
+
} = CatalogModel.ProductSizePriceResponseV3().validate(response, {
|
|
2456
|
+
abortEarly: false,
|
|
2457
|
+
allowUnknown: false,
|
|
2458
|
+
});
|
|
2459
|
+
|
|
2460
|
+
if (res_error) {
|
|
2461
|
+
Logger({
|
|
2462
|
+
level: "WARN",
|
|
2463
|
+
message: "Response Validation Warnnings for getProductPriceBySlug",
|
|
2464
|
+
});
|
|
2465
|
+
Logger({ level: "WARN", message: res_error });
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
return response;
|
|
1528
2469
|
}
|
|
1529
2470
|
|
|
1530
2471
|
/**
|
|
@@ -1546,7 +2487,7 @@ class Catalog {
|
|
|
1546
2487
|
* @summary: Get the sellers of a product size at a PIN Code
|
|
1547
2488
|
* @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
|
|
1548
2489
|
*/
|
|
1549
|
-
getProductSellersBySlug({
|
|
2490
|
+
async getProductSellersBySlug({
|
|
1550
2491
|
slug,
|
|
1551
2492
|
size,
|
|
1552
2493
|
pincode,
|
|
@@ -1561,6 +2502,22 @@ class Catalog {
|
|
|
1561
2502
|
if (error) {
|
|
1562
2503
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1563
2504
|
}
|
|
2505
|
+
|
|
2506
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2507
|
+
const {
|
|
2508
|
+
error: warrning,
|
|
2509
|
+
} = CatalogValidator.getProductSellersBySlug().validate(
|
|
2510
|
+
{ slug, size, pincode, strategy, pageNo, pageSize },
|
|
2511
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2512
|
+
);
|
|
2513
|
+
if (warrning) {
|
|
2514
|
+
Logger({
|
|
2515
|
+
level: "WARN",
|
|
2516
|
+
message: "Parameter Validation warrnings for getProductSellersBySlug",
|
|
2517
|
+
});
|
|
2518
|
+
Logger({ level: "WARN", message: warrning });
|
|
2519
|
+
}
|
|
2520
|
+
|
|
1564
2521
|
const query_params = {};
|
|
1565
2522
|
query_params["pincode"] = pincode;
|
|
1566
2523
|
query_params["strategy"] = strategy;
|
|
@@ -1569,7 +2526,7 @@ class Catalog {
|
|
|
1569
2526
|
|
|
1570
2527
|
const xHeaders = {};
|
|
1571
2528
|
|
|
1572
|
-
|
|
2529
|
+
const response = await APIClient.execute(
|
|
1573
2530
|
this._conf,
|
|
1574
2531
|
"get",
|
|
1575
2532
|
constructUrl({
|
|
@@ -1580,6 +2537,23 @@ class Catalog {
|
|
|
1580
2537
|
undefined,
|
|
1581
2538
|
xHeaders
|
|
1582
2539
|
);
|
|
2540
|
+
|
|
2541
|
+
const {
|
|
2542
|
+
error: res_error,
|
|
2543
|
+
} = CatalogModel.ProductSizeSellersResponseV3().validate(response, {
|
|
2544
|
+
abortEarly: false,
|
|
2545
|
+
allowUnknown: false,
|
|
2546
|
+
});
|
|
2547
|
+
|
|
2548
|
+
if (res_error) {
|
|
2549
|
+
Logger({
|
|
2550
|
+
level: "WARN",
|
|
2551
|
+
message: "Response Validation Warnnings for getProductSellersBySlug",
|
|
2552
|
+
});
|
|
2553
|
+
Logger({ level: "WARN", message: res_error });
|
|
2554
|
+
}
|
|
2555
|
+
|
|
2556
|
+
return response;
|
|
1583
2557
|
}
|
|
1584
2558
|
|
|
1585
2559
|
/**
|