@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.
- package/README.md +2 -2
- package/application.d.ts +1 -2
- package/application.js +2 -3
- package/index.d.ts +1 -2
- package/index.js +7 -1
- package/package.json +3 -4
- package/sdk/application/ApplicationClient.js +0 -18
- package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
- package/sdk/application/Cart/CartApplicationClient.js +60 -1185
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +90 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +187 -1293
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
- package/sdk/application/Common/CommonApplicationClient.js +5 -89
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
- package/sdk/application/Communication/CommunicationApplicationClient.js +6 -145
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +31 -718
- package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
- package/sdk/application/Content/ContentApplicationClient.js +77 -914
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +19 -125
- package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
- package/sdk/application/Lead/LeadApplicationClient.js +32 -202
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
- package/sdk/application/Logistic/LogisticApplicationClient.js +50 -478
- package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
- package/sdk/application/Order/OrderApplicationClient.js +86 -472
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
- package/sdk/application/Payment/PaymentApplicationClient.js +57 -2102
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
- package/sdk/application/Rewards/RewardsApplicationClient.js +16 -305
- package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
- package/sdk/application/Share/ShareApplicationClient.js +34 -294
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
- package/sdk/application/Theme/ThemeApplicationClient.js +28 -162
- package/sdk/application/User/UserApplicationClient.d.ts +85 -136
- package/sdk/application/User/UserApplicationClient.js +45 -1815
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
- package/sdk/application/Webhook/WebhookApplicationClient.js +4 -47
- package/sdk/application/index.d.ts +0 -18
- package/sdk/application/index.js +0 -33
- package/sdk/common/Utility.d.ts +1 -1
- package/sdk/common/Utility.js +10 -7
- package/sdk/common/Validator.d.ts +1 -0
- package/sdk/common/Validator.js +20 -0
- package/sdk/common/utils.d.ts +0 -1
- package/sdk/common/utils.js +0 -14
- package/sdk/partner/OAuthClient.js +1 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -40
- package/sdk/partner/Theme/ThemePartnerModel.js +2 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +39 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +247 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +33 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +37 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +193 -1
- package/sdk/platform/Cart/CartPlatformModel.js +132 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -4
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +14 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +6 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
- package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
- package/sdk/platform/Order/OrderPlatformClient.js +99 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +7 -0
- package/sdk/platform/Order/OrderPlatformModel.js +3 -0
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +1 -1
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +4 -4
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +56 -19
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +42 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +3 -3
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +2 -2
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -40
- package/sdk/platform/Theme/ThemePlatformModel.js +2 -24
- package/sdk/public/Configuration/ConfigurationPublicClient.js +5 -2
- package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
- package/sdk/public/Content/ContentPublicClient.js +14 -2
- package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
- package/sdk/public/Partner/PartnerPublicClient.js +14 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +5 -2
- package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
- package/sdk/application/Cart/CartApplicationModel.js +0 -2497
- package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
- package/sdk/application/Cart/CartApplicationValidator.js +0 -530
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
- package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
- package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
- package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
- package/sdk/application/Common/CommonApplicationModel.js +0 -308
- package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
- package/sdk/application/Common/CommonApplicationValidator.js +0 -38
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
- package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
- package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
- package/sdk/application/Content/ContentApplicationModel.js +0 -1589
- package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
- package/sdk/application/Content/ContentApplicationValidator.js +0 -264
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
- package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
- package/sdk/application/Lead/LeadApplicationModel.js +0 -480
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
- package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
- package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
- package/sdk/application/Order/OrderApplicationModel.js +0 -1471
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
- package/sdk/application/Order/OrderApplicationValidator.js +0 -197
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
- package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
- package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
- package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
- package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
- package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
- package/sdk/application/Share/ShareApplicationModel.js +0 -234
- package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
- package/sdk/application/Share/ShareApplicationValidator.js +0 -91
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
- package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
- package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
- package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
- package/sdk/application/User/UserApplicationModel.js +0 -1382
- package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
- package/sdk/application/User/UserApplicationValidator.js +0 -573
- package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
- package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
- package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
- package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
- package/sdk/common/Clickstream.d.ts +0 -1
- 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
|
|
9
|
-
const CatalogApplicationModel = require("./CatalogApplicationModel");
|
|
10
|
-
const { Logger } = require("./../../common/Logger");
|
|
11
|
-
const Joi = require("joi");
|
|
9
|
+
const { validateRequiredParams } = require("../../common/Validator");
|
|
12
10
|
|
|
13
11
|
class Catalog {
|
|
14
12
|
constructor(_conf) {
|
|
@@ -58,6 +56,8 @@ class Catalog {
|
|
|
58
56
|
getProductVariantsBySlug:
|
|
59
57
|
"/service/application/catalog/v1.0/products/{slug}/variants/",
|
|
60
58
|
getProducts: "/service/application/catalog/v1.0/products/",
|
|
59
|
+
getProductsServiceability:
|
|
60
|
+
"/service/application/catalog/v1.0/products/serviceability",
|
|
61
61
|
getSearchResults: "/service/application/catalog/v1.0/auto-complete/",
|
|
62
62
|
getSimilarComparisonProductBySlug:
|
|
63
63
|
"/service/application/catalog/v1.0/products/{slug}/similar/compare/",
|
|
@@ -82,10 +82,9 @@ class Catalog {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
|
-
* @param {CatalogApplicationValidator.FollowByIdParam} arg - Arg object.
|
|
86
85
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
87
86
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
88
|
-
* @returns {Promise<
|
|
87
|
+
* @returns {Promise<FollowPostResponse>} - Success response
|
|
89
88
|
* @name followById
|
|
90
89
|
* @summary: Create item, brand, product
|
|
91
90
|
* @description: Add a product, brand, or item to the user's followed list by collection Id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/followById/).
|
|
@@ -94,26 +93,16 @@ class Catalog {
|
|
|
94
93
|
{ collectionType, collectionId, requestHeaders } = { requestHeaders: {} },
|
|
95
94
|
{ responseHeaders } = { responseHeaders: false }
|
|
96
95
|
) {
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
);
|
|
101
|
-
if (
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
// Showing warrnings if extra unknown parameters are found
|
|
106
|
-
const {
|
|
107
|
-
error: warrning,
|
|
108
|
-
} = CatalogApplicationValidator.followById().validate(
|
|
109
|
-
{ collectionType, collectionId },
|
|
110
|
-
{ abortEarly: false, allowUnknown: false }
|
|
111
|
-
);
|
|
112
|
-
if (warrning) {
|
|
113
|
-
Logger({
|
|
114
|
-
level: "WARN",
|
|
115
|
-
message: `Parameter Validation warrnings for application > Catalog > followById \n ${warrning}`,
|
|
96
|
+
const errors = validateRequiredParams(arguments[0], [
|
|
97
|
+
"collectionType",
|
|
98
|
+
"collectionId",
|
|
99
|
+
]);
|
|
100
|
+
if (errors.length > 0) {
|
|
101
|
+
const error = new FDKClientValidationError({
|
|
102
|
+
message: "Missing required field",
|
|
103
|
+
details: errors,
|
|
116
104
|
});
|
|
105
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
117
106
|
}
|
|
118
107
|
|
|
119
108
|
const query_params = {};
|
|
@@ -138,32 +127,13 @@ class Catalog {
|
|
|
138
127
|
responseData = response[0];
|
|
139
128
|
}
|
|
140
129
|
|
|
141
|
-
const {
|
|
142
|
-
error: res_error,
|
|
143
|
-
} = CatalogApplicationModel.FollowPostResponse().validate(responseData, {
|
|
144
|
-
abortEarly: false,
|
|
145
|
-
allowUnknown: true,
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
if (res_error) {
|
|
149
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
150
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
151
|
-
} else {
|
|
152
|
-
Logger({
|
|
153
|
-
level: "WARN",
|
|
154
|
-
message: `Response Validation Warnings for application > Catalog > followById \n ${res_error}`,
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
|
|
159
130
|
return response;
|
|
160
131
|
}
|
|
161
132
|
|
|
162
133
|
/**
|
|
163
|
-
* @param {CatalogApplicationValidator.GetBrandDetailBySlugParam} arg - Arg object.
|
|
164
134
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
165
135
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
166
|
-
* @returns {Promise<
|
|
136
|
+
* @returns {Promise<BrandDetailResponse>} - Success response
|
|
167
137
|
* @name getBrandDetailBySlug
|
|
168
138
|
* @summary: Get a brand
|
|
169
139
|
* @description: Get metadata of a brand such as name, information, logo, banner, etc. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getBrandDetailBySlug/).
|
|
@@ -172,28 +142,13 @@ class Catalog {
|
|
|
172
142
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
173
143
|
{ responseHeaders } = { responseHeaders: false }
|
|
174
144
|
) {
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
);
|
|
181
|
-
if (error) {
|
|
182
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
// Showing warrnings if extra unknown parameters are found
|
|
186
|
-
const {
|
|
187
|
-
error: warrning,
|
|
188
|
-
} = CatalogApplicationValidator.getBrandDetailBySlug().validate(
|
|
189
|
-
{ slug },
|
|
190
|
-
{ abortEarly: false, allowUnknown: false }
|
|
191
|
-
);
|
|
192
|
-
if (warrning) {
|
|
193
|
-
Logger({
|
|
194
|
-
level: "WARN",
|
|
195
|
-
message: `Parameter Validation warrnings for application > Catalog > getBrandDetailBySlug \n ${warrning}`,
|
|
145
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
146
|
+
if (errors.length > 0) {
|
|
147
|
+
const error = new FDKClientValidationError({
|
|
148
|
+
message: "Missing required field",
|
|
149
|
+
details: errors,
|
|
196
150
|
});
|
|
151
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
197
152
|
}
|
|
198
153
|
|
|
199
154
|
const query_params = {};
|
|
@@ -218,32 +173,13 @@ class Catalog {
|
|
|
218
173
|
responseData = response[0];
|
|
219
174
|
}
|
|
220
175
|
|
|
221
|
-
const {
|
|
222
|
-
error: res_error,
|
|
223
|
-
} = CatalogApplicationModel.BrandDetailResponse().validate(responseData, {
|
|
224
|
-
abortEarly: false,
|
|
225
|
-
allowUnknown: true,
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
if (res_error) {
|
|
229
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
230
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
231
|
-
} else {
|
|
232
|
-
Logger({
|
|
233
|
-
level: "WARN",
|
|
234
|
-
message: `Response Validation Warnings for application > Catalog > getBrandDetailBySlug \n ${res_error}`,
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
176
|
return response;
|
|
240
177
|
}
|
|
241
178
|
|
|
242
179
|
/**
|
|
243
|
-
* @param {CatalogApplicationValidator.GetBrandsParam} arg - Arg object.
|
|
244
180
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
245
181
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
246
|
-
* @returns {Promise<
|
|
182
|
+
* @returns {Promise<BrandListingResponse>} - Success response
|
|
247
183
|
* @name getBrands
|
|
248
184
|
* @summary: List brands
|
|
249
185
|
* @description: Get a list of all the available brands. Filtering can be applied to the department. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getBrands/).
|
|
@@ -252,28 +188,6 @@ class Catalog {
|
|
|
252
188
|
{ department, pageNo, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
253
189
|
{ responseHeaders } = { responseHeaders: false }
|
|
254
190
|
) {
|
|
255
|
-
const { error } = CatalogApplicationValidator.getBrands().validate(
|
|
256
|
-
{ department, pageNo, pageSize },
|
|
257
|
-
{ abortEarly: false, allowUnknown: true }
|
|
258
|
-
);
|
|
259
|
-
if (error) {
|
|
260
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
// Showing warrnings if extra unknown parameters are found
|
|
264
|
-
const {
|
|
265
|
-
error: warrning,
|
|
266
|
-
} = CatalogApplicationValidator.getBrands().validate(
|
|
267
|
-
{ department, pageNo, pageSize },
|
|
268
|
-
{ abortEarly: false, allowUnknown: false }
|
|
269
|
-
);
|
|
270
|
-
if (warrning) {
|
|
271
|
-
Logger({
|
|
272
|
-
level: "WARN",
|
|
273
|
-
message: `Parameter Validation warrnings for application > Catalog > getBrands \n ${warrning}`,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
|
|
277
191
|
const query_params = {};
|
|
278
192
|
query_params["department"] = department;
|
|
279
193
|
query_params["page_no"] = pageNo;
|
|
@@ -299,24 +213,6 @@ class Catalog {
|
|
|
299
213
|
responseData = response[0];
|
|
300
214
|
}
|
|
301
215
|
|
|
302
|
-
const {
|
|
303
|
-
error: res_error,
|
|
304
|
-
} = CatalogApplicationModel.BrandListingResponse().validate(responseData, {
|
|
305
|
-
abortEarly: false,
|
|
306
|
-
allowUnknown: true,
|
|
307
|
-
});
|
|
308
|
-
|
|
309
|
-
if (res_error) {
|
|
310
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
311
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
312
|
-
} else {
|
|
313
|
-
Logger({
|
|
314
|
-
level: "WARN",
|
|
315
|
-
message: `Response Validation Warnings for application > Catalog > getBrands \n ${res_error}`,
|
|
316
|
-
});
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
|
|
320
216
|
return response;
|
|
321
217
|
}
|
|
322
218
|
|
|
@@ -327,7 +223,7 @@ class Catalog {
|
|
|
327
223
|
* of available departments below. Also, you can get available departments
|
|
328
224
|
* from the endpoint /service/application/catalog/v1.0/departments/.
|
|
329
225
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
330
|
-
* @returns {Paginator<
|
|
226
|
+
* @returns {Paginator<BrandListingResponse>}
|
|
331
227
|
* @summary: List brands
|
|
332
228
|
* @description: Get a list of all the available brands. Filtering can be applied to the department.
|
|
333
229
|
*/
|
|
@@ -353,11 +249,9 @@ class Catalog {
|
|
|
353
249
|
}
|
|
354
250
|
|
|
355
251
|
/**
|
|
356
|
-
* @param {CatalogApplicationValidator.GetCategoriesParam} arg - Arg object.
|
|
357
252
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
358
253
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
359
|
-
* @returns {Promise<
|
|
360
|
-
* Success response
|
|
254
|
+
* @returns {Promise<CategoryListingResponse>} - Success response
|
|
361
255
|
* @name getCategories
|
|
362
256
|
* @summary: List product categories
|
|
363
257
|
* @description: List all available product categories. Also, users can filter the categories by department. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getCategories/).
|
|
@@ -366,28 +260,6 @@ class Catalog {
|
|
|
366
260
|
{ department, requestHeaders } = { requestHeaders: {} },
|
|
367
261
|
{ responseHeaders } = { responseHeaders: false }
|
|
368
262
|
) {
|
|
369
|
-
const { error } = CatalogApplicationValidator.getCategories().validate(
|
|
370
|
-
{ department },
|
|
371
|
-
{ abortEarly: false, allowUnknown: true }
|
|
372
|
-
);
|
|
373
|
-
if (error) {
|
|
374
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
// Showing warrnings if extra unknown parameters are found
|
|
378
|
-
const {
|
|
379
|
-
error: warrning,
|
|
380
|
-
} = CatalogApplicationValidator.getCategories().validate(
|
|
381
|
-
{ department },
|
|
382
|
-
{ abortEarly: false, allowUnknown: false }
|
|
383
|
-
);
|
|
384
|
-
if (warrning) {
|
|
385
|
-
Logger({
|
|
386
|
-
level: "WARN",
|
|
387
|
-
message: `Parameter Validation warrnings for application > Catalog > getCategories \n ${warrning}`,
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
|
|
391
263
|
const query_params = {};
|
|
392
264
|
query_params["department"] = department;
|
|
393
265
|
|
|
@@ -411,32 +283,13 @@ class Catalog {
|
|
|
411
283
|
responseData = response[0];
|
|
412
284
|
}
|
|
413
285
|
|
|
414
|
-
const {
|
|
415
|
-
error: res_error,
|
|
416
|
-
} = CatalogApplicationModel.CategoryListingResponse().validate(
|
|
417
|
-
responseData,
|
|
418
|
-
{ abortEarly: false, allowUnknown: true }
|
|
419
|
-
);
|
|
420
|
-
|
|
421
|
-
if (res_error) {
|
|
422
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
423
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
424
|
-
} else {
|
|
425
|
-
Logger({
|
|
426
|
-
level: "WARN",
|
|
427
|
-
message: `Response Validation Warnings for application > Catalog > getCategories \n ${res_error}`,
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
286
|
return response;
|
|
433
287
|
}
|
|
434
288
|
|
|
435
289
|
/**
|
|
436
|
-
* @param {CatalogApplicationValidator.GetCategoryDetailBySlugParam} arg - Arg object.
|
|
437
290
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
438
291
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
439
|
-
* @returns {Promise<
|
|
292
|
+
* @returns {Promise<CategoryMetaResponse>} - Success response
|
|
440
293
|
* @name getCategoryDetailBySlug
|
|
441
294
|
* @summary: Get category by slug
|
|
442
295
|
* @description: Get detailed information about a specific product category using its slug and get metadata of a category such as name, information, logo, banner, etc. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getCategoryDetailBySlug/).
|
|
@@ -445,28 +298,13 @@ class Catalog {
|
|
|
445
298
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
446
299
|
{ responseHeaders } = { responseHeaders: false }
|
|
447
300
|
) {
|
|
448
|
-
const
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
);
|
|
454
|
-
if (error) {
|
|
455
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// Showing warrnings if extra unknown parameters are found
|
|
459
|
-
const {
|
|
460
|
-
error: warrning,
|
|
461
|
-
} = CatalogApplicationValidator.getCategoryDetailBySlug().validate(
|
|
462
|
-
{ slug },
|
|
463
|
-
{ abortEarly: false, allowUnknown: false }
|
|
464
|
-
);
|
|
465
|
-
if (warrning) {
|
|
466
|
-
Logger({
|
|
467
|
-
level: "WARN",
|
|
468
|
-
message: `Parameter Validation warrnings for application > Catalog > getCategoryDetailBySlug \n ${warrning}`,
|
|
301
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
302
|
+
if (errors.length > 0) {
|
|
303
|
+
const error = new FDKClientValidationError({
|
|
304
|
+
message: "Missing required field",
|
|
305
|
+
details: errors,
|
|
469
306
|
});
|
|
307
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
470
308
|
}
|
|
471
309
|
|
|
472
310
|
const query_params = {};
|
|
@@ -491,35 +329,13 @@ class Catalog {
|
|
|
491
329
|
responseData = response[0];
|
|
492
330
|
}
|
|
493
331
|
|
|
494
|
-
const {
|
|
495
|
-
error: res_error,
|
|
496
|
-
} = CatalogApplicationModel.CategoryMetaResponse().validate(responseData, {
|
|
497
|
-
abortEarly: false,
|
|
498
|
-
allowUnknown: true,
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
if (res_error) {
|
|
502
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
503
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
504
|
-
} else {
|
|
505
|
-
Logger({
|
|
506
|
-
level: "WARN",
|
|
507
|
-
message: `Response Validation Warnings for application > Catalog > getCategoryDetailBySlug \n ${res_error}`,
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
332
|
return response;
|
|
513
333
|
}
|
|
514
334
|
|
|
515
335
|
/**
|
|
516
|
-
* @param {CatalogApplicationValidator.GetCollectionDetailBySlugParam} arg
|
|
517
|
-
* - Arg object.
|
|
518
|
-
*
|
|
519
336
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
520
337
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
521
|
-
* @returns {Promise<
|
|
522
|
-
* Success response
|
|
338
|
+
* @returns {Promise<CollectionDetailResponse>} - Success response
|
|
523
339
|
* @name getCollectionDetailBySlug
|
|
524
340
|
* @summary: Get a collection
|
|
525
341
|
* @description: Get detailed information about a specific collection using its slug. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getCollectionDetailBySlug/).
|
|
@@ -528,28 +344,13 @@ class Catalog {
|
|
|
528
344
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
529
345
|
{ responseHeaders } = { responseHeaders: false }
|
|
530
346
|
) {
|
|
531
|
-
const
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
);
|
|
537
|
-
if (error) {
|
|
538
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
// Showing warrnings if extra unknown parameters are found
|
|
542
|
-
const {
|
|
543
|
-
error: warrning,
|
|
544
|
-
} = CatalogApplicationValidator.getCollectionDetailBySlug().validate(
|
|
545
|
-
{ slug },
|
|
546
|
-
{ abortEarly: false, allowUnknown: false }
|
|
547
|
-
);
|
|
548
|
-
if (warrning) {
|
|
549
|
-
Logger({
|
|
550
|
-
level: "WARN",
|
|
551
|
-
message: `Parameter Validation warrnings for application > Catalog > getCollectionDetailBySlug \n ${warrning}`,
|
|
347
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
348
|
+
if (errors.length > 0) {
|
|
349
|
+
const error = new FDKClientValidationError({
|
|
350
|
+
message: "Missing required field",
|
|
351
|
+
details: errors,
|
|
552
352
|
});
|
|
353
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
553
354
|
}
|
|
554
355
|
|
|
555
356
|
const query_params = {};
|
|
@@ -574,34 +375,13 @@ class Catalog {
|
|
|
574
375
|
responseData = response[0];
|
|
575
376
|
}
|
|
576
377
|
|
|
577
|
-
const {
|
|
578
|
-
error: res_error,
|
|
579
|
-
} = CatalogApplicationModel.CollectionDetailResponse().validate(
|
|
580
|
-
responseData,
|
|
581
|
-
{ abortEarly: false, allowUnknown: true }
|
|
582
|
-
);
|
|
583
|
-
|
|
584
|
-
if (res_error) {
|
|
585
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
586
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
587
|
-
} else {
|
|
588
|
-
Logger({
|
|
589
|
-
level: "WARN",
|
|
590
|
-
message: `Response Validation Warnings for application > Catalog > getCollectionDetailBySlug \n ${res_error}`,
|
|
591
|
-
});
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
|
|
595
378
|
return response;
|
|
596
379
|
}
|
|
597
380
|
|
|
598
381
|
/**
|
|
599
|
-
* @param {CatalogApplicationValidator.GetCollectionItemsBySlugParam} arg -
|
|
600
|
-
* Arg object.
|
|
601
382
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
602
383
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
603
|
-
* @returns {Promise<
|
|
604
|
-
* Success response
|
|
384
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
605
385
|
* @name getCollectionItemsBySlug
|
|
606
386
|
* @summary: Lists items of collection
|
|
607
387
|
* @description: Fetch items within a particular collection identified by its slug. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getCollectionItemsBySlug/).
|
|
@@ -621,28 +401,13 @@ class Catalog {
|
|
|
621
401
|
} = { requestHeaders: {} },
|
|
622
402
|
{ responseHeaders } = { responseHeaders: false }
|
|
623
403
|
) {
|
|
624
|
-
const
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
);
|
|
630
|
-
if (error) {
|
|
631
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
// Showing warrnings if extra unknown parameters are found
|
|
635
|
-
const {
|
|
636
|
-
error: warrning,
|
|
637
|
-
} = CatalogApplicationValidator.getCollectionItemsBySlug().validate(
|
|
638
|
-
{ slug, f, q, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
639
|
-
{ abortEarly: false, allowUnknown: false }
|
|
640
|
-
);
|
|
641
|
-
if (warrning) {
|
|
642
|
-
Logger({
|
|
643
|
-
level: "WARN",
|
|
644
|
-
message: `Parameter Validation warrnings for application > Catalog > getCollectionItemsBySlug \n ${warrning}`,
|
|
404
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
405
|
+
if (errors.length > 0) {
|
|
406
|
+
const error = new FDKClientValidationError({
|
|
407
|
+
message: "Missing required field",
|
|
408
|
+
details: errors,
|
|
645
409
|
});
|
|
410
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
646
411
|
}
|
|
647
412
|
|
|
648
413
|
const query_params = {};
|
|
@@ -675,24 +440,6 @@ class Catalog {
|
|
|
675
440
|
responseData = response[0];
|
|
676
441
|
}
|
|
677
442
|
|
|
678
|
-
const {
|
|
679
|
-
error: res_error,
|
|
680
|
-
} = CatalogApplicationModel.ProductListingResponse().validate(
|
|
681
|
-
responseData,
|
|
682
|
-
{ abortEarly: false, allowUnknown: true }
|
|
683
|
-
);
|
|
684
|
-
|
|
685
|
-
if (res_error) {
|
|
686
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
687
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
688
|
-
} else {
|
|
689
|
-
Logger({
|
|
690
|
-
level: "WARN",
|
|
691
|
-
message: `Response Validation Warnings for application > Catalog > getCollectionItemsBySlug \n ${res_error}`,
|
|
692
|
-
});
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
|
|
696
443
|
return response;
|
|
697
444
|
}
|
|
698
445
|
|
|
@@ -713,7 +460,7 @@ class Catalog {
|
|
|
713
460
|
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
714
461
|
* either ascending or descending order. See the supported values below.
|
|
715
462
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
716
|
-
* @returns {Paginator<
|
|
463
|
+
* @returns {Paginator<ProductListingResponse>}
|
|
717
464
|
* @summary: Lists items of collection
|
|
718
465
|
* @description: Fetch items within a particular collection identified by its slug.
|
|
719
466
|
*/
|
|
@@ -752,12 +499,9 @@ class Catalog {
|
|
|
752
499
|
}
|
|
753
500
|
|
|
754
501
|
/**
|
|
755
|
-
* @param {CatalogApplicationValidator.GetCollectionsParam} arg - Arg object.
|
|
756
502
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
757
503
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
758
|
-
* @returns {Promise<
|
|
759
|
-
* - Success response
|
|
760
|
-
*
|
|
504
|
+
* @returns {Promise<GetCollectionListingResponse>} - Success response
|
|
761
505
|
* @name getCollections
|
|
762
506
|
* @summary: List collections
|
|
763
507
|
* @description: List of curated product collections with filtering options based on tags and collection names. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getCollections/).
|
|
@@ -766,28 +510,6 @@ class Catalog {
|
|
|
766
510
|
{ pageNo, pageSize, tag, q, requestHeaders } = { requestHeaders: {} },
|
|
767
511
|
{ responseHeaders } = { responseHeaders: false }
|
|
768
512
|
) {
|
|
769
|
-
const { error } = CatalogApplicationValidator.getCollections().validate(
|
|
770
|
-
{ pageNo, pageSize, tag, q },
|
|
771
|
-
{ abortEarly: false, allowUnknown: true }
|
|
772
|
-
);
|
|
773
|
-
if (error) {
|
|
774
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
// Showing warrnings if extra unknown parameters are found
|
|
778
|
-
const {
|
|
779
|
-
error: warrning,
|
|
780
|
-
} = CatalogApplicationValidator.getCollections().validate(
|
|
781
|
-
{ pageNo, pageSize, tag, q },
|
|
782
|
-
{ abortEarly: false, allowUnknown: false }
|
|
783
|
-
);
|
|
784
|
-
if (warrning) {
|
|
785
|
-
Logger({
|
|
786
|
-
level: "WARN",
|
|
787
|
-
message: `Parameter Validation warrnings for application > Catalog > getCollections \n ${warrning}`,
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
|
|
791
513
|
const query_params = {};
|
|
792
514
|
query_params["page_no"] = pageNo;
|
|
793
515
|
query_params["page_size"] = pageSize;
|
|
@@ -814,24 +536,6 @@ class Catalog {
|
|
|
814
536
|
responseData = response[0];
|
|
815
537
|
}
|
|
816
538
|
|
|
817
|
-
const {
|
|
818
|
-
error: res_error,
|
|
819
|
-
} = CatalogApplicationModel.GetCollectionListingResponse().validate(
|
|
820
|
-
responseData,
|
|
821
|
-
{ abortEarly: false, allowUnknown: true }
|
|
822
|
-
);
|
|
823
|
-
|
|
824
|
-
if (res_error) {
|
|
825
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
826
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
827
|
-
} else {
|
|
828
|
-
Logger({
|
|
829
|
-
level: "WARN",
|
|
830
|
-
message: `Response Validation Warnings for application > Catalog > getCollections \n ${res_error}`,
|
|
831
|
-
});
|
|
832
|
-
}
|
|
833
|
-
}
|
|
834
|
-
|
|
835
539
|
return response;
|
|
836
540
|
}
|
|
837
541
|
|
|
@@ -840,7 +544,7 @@ class Catalog {
|
|
|
840
544
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
841
545
|
* @param {string[]} [arg.tag] - List of tags to filter collections.
|
|
842
546
|
* @param {string} [arg.q] - Name of the collection to filter collection.
|
|
843
|
-
* @returns {Paginator<
|
|
547
|
+
* @returns {Paginator<GetCollectionListingResponse>}
|
|
844
548
|
* @summary: List collections
|
|
845
549
|
* @description: List of curated product collections with filtering options based on tags and collection names.
|
|
846
550
|
*/
|
|
@@ -867,14 +571,9 @@ class Catalog {
|
|
|
867
571
|
}
|
|
868
572
|
|
|
869
573
|
/**
|
|
870
|
-
* @param {CatalogApplicationValidator.GetComparedFrequentlyProductBySlugParam} arg
|
|
871
|
-
* - Arg object.
|
|
872
|
-
*
|
|
873
574
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
874
575
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
875
|
-
* @returns {Promise<
|
|
876
|
-
* - Success response
|
|
877
|
-
*
|
|
576
|
+
* @returns {Promise<ProductFrequentlyComparedSimilarResponse>} - Success response
|
|
878
577
|
* @name getComparedFrequentlyProductBySlug
|
|
879
578
|
* @summary: List frequent products
|
|
880
579
|
* @description: Get products that are often compared to the product specified by its slug. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getComparedFrequentlyProductBySlug/).
|
|
@@ -883,28 +582,13 @@ class Catalog {
|
|
|
883
582
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
884
583
|
{ responseHeaders } = { responseHeaders: false }
|
|
885
584
|
) {
|
|
886
|
-
const
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
);
|
|
892
|
-
if (error) {
|
|
893
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
894
|
-
}
|
|
895
|
-
|
|
896
|
-
// Showing warrnings if extra unknown parameters are found
|
|
897
|
-
const {
|
|
898
|
-
error: warrning,
|
|
899
|
-
} = CatalogApplicationValidator.getComparedFrequentlyProductBySlug().validate(
|
|
900
|
-
{ slug },
|
|
901
|
-
{ abortEarly: false, allowUnknown: false }
|
|
902
|
-
);
|
|
903
|
-
if (warrning) {
|
|
904
|
-
Logger({
|
|
905
|
-
level: "WARN",
|
|
906
|
-
message: `Parameter Validation warrnings for application > Catalog > getComparedFrequentlyProductBySlug \n ${warrning}`,
|
|
585
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
586
|
+
if (errors.length > 0) {
|
|
587
|
+
const error = new FDKClientValidationError({
|
|
588
|
+
message: "Missing required field",
|
|
589
|
+
details: errors,
|
|
907
590
|
});
|
|
591
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
908
592
|
}
|
|
909
593
|
|
|
910
594
|
const query_params = {};
|
|
@@ -929,32 +613,13 @@ class Catalog {
|
|
|
929
613
|
responseData = response[0];
|
|
930
614
|
}
|
|
931
615
|
|
|
932
|
-
const {
|
|
933
|
-
error: res_error,
|
|
934
|
-
} = CatalogApplicationModel.ProductFrequentlyComparedSimilarResponse().validate(
|
|
935
|
-
responseData,
|
|
936
|
-
{ abortEarly: false, allowUnknown: true }
|
|
937
|
-
);
|
|
938
|
-
|
|
939
|
-
if (res_error) {
|
|
940
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
941
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
942
|
-
} else {
|
|
943
|
-
Logger({
|
|
944
|
-
level: "WARN",
|
|
945
|
-
message: `Response Validation Warnings for application > Catalog > getComparedFrequentlyProductBySlug \n ${res_error}`,
|
|
946
|
-
});
|
|
947
|
-
}
|
|
948
|
-
}
|
|
949
|
-
|
|
950
616
|
return response;
|
|
951
617
|
}
|
|
952
618
|
|
|
953
619
|
/**
|
|
954
|
-
* @param {CatalogApplicationValidator.GetDepartmentsParam} arg - Arg object.
|
|
955
620
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
956
621
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
957
|
-
* @returns {Promise<
|
|
622
|
+
* @returns {Promise<DepartmentResponse>} - Success response
|
|
958
623
|
* @name getDepartments
|
|
959
624
|
* @summary: List departments
|
|
960
625
|
* @description: List all departments associated with available products. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getDepartments/).
|
|
@@ -963,28 +628,6 @@ class Catalog {
|
|
|
963
628
|
{ requestHeaders } = { requestHeaders: {} },
|
|
964
629
|
{ responseHeaders } = { responseHeaders: false }
|
|
965
630
|
) {
|
|
966
|
-
const { error } = CatalogApplicationValidator.getDepartments().validate(
|
|
967
|
-
{},
|
|
968
|
-
{ abortEarly: false, allowUnknown: true }
|
|
969
|
-
);
|
|
970
|
-
if (error) {
|
|
971
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
// Showing warrnings if extra unknown parameters are found
|
|
975
|
-
const {
|
|
976
|
-
error: warrning,
|
|
977
|
-
} = CatalogApplicationValidator.getDepartments().validate(
|
|
978
|
-
{},
|
|
979
|
-
{ abortEarly: false, allowUnknown: false }
|
|
980
|
-
);
|
|
981
|
-
if (warrning) {
|
|
982
|
-
Logger({
|
|
983
|
-
level: "WARN",
|
|
984
|
-
message: `Parameter Validation warrnings for application > Catalog > getDepartments \n ${warrning}`,
|
|
985
|
-
});
|
|
986
|
-
}
|
|
987
|
-
|
|
988
631
|
const query_params = {};
|
|
989
632
|
|
|
990
633
|
const xHeaders = {};
|
|
@@ -1007,32 +650,13 @@ class Catalog {
|
|
|
1007
650
|
responseData = response[0];
|
|
1008
651
|
}
|
|
1009
652
|
|
|
1010
|
-
const {
|
|
1011
|
-
error: res_error,
|
|
1012
|
-
} = CatalogApplicationModel.DepartmentResponse().validate(responseData, {
|
|
1013
|
-
abortEarly: false,
|
|
1014
|
-
allowUnknown: true,
|
|
1015
|
-
});
|
|
1016
|
-
|
|
1017
|
-
if (res_error) {
|
|
1018
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1019
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1020
|
-
} else {
|
|
1021
|
-
Logger({
|
|
1022
|
-
level: "WARN",
|
|
1023
|
-
message: `Response Validation Warnings for application > Catalog > getDepartments \n ${res_error}`,
|
|
1024
|
-
});
|
|
1025
|
-
}
|
|
1026
|
-
}
|
|
1027
|
-
|
|
1028
653
|
return response;
|
|
1029
654
|
}
|
|
1030
655
|
|
|
1031
656
|
/**
|
|
1032
|
-
* @param {CatalogApplicationValidator.GetFollowIdsParam} arg - Arg object.
|
|
1033
657
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1034
658
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1035
|
-
* @returns {Promise<
|
|
659
|
+
* @returns {Promise<FollowIdsResponse>} - Success response
|
|
1036
660
|
* @name getFollowIds
|
|
1037
661
|
* @summary: List Ids of followed item, brand, product
|
|
1038
662
|
* @description: Get the IDs of all items the user is currently following, such as Products, Brands, and Collections. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getFollowIds/).
|
|
@@ -1041,28 +665,6 @@ class Catalog {
|
|
|
1041
665
|
{ collectionType, requestHeaders } = { requestHeaders: {} },
|
|
1042
666
|
{ responseHeaders } = { responseHeaders: false }
|
|
1043
667
|
) {
|
|
1044
|
-
const { error } = CatalogApplicationValidator.getFollowIds().validate(
|
|
1045
|
-
{ collectionType },
|
|
1046
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1047
|
-
);
|
|
1048
|
-
if (error) {
|
|
1049
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1053
|
-
const {
|
|
1054
|
-
error: warrning,
|
|
1055
|
-
} = CatalogApplicationValidator.getFollowIds().validate(
|
|
1056
|
-
{ collectionType },
|
|
1057
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1058
|
-
);
|
|
1059
|
-
if (warrning) {
|
|
1060
|
-
Logger({
|
|
1061
|
-
level: "WARN",
|
|
1062
|
-
message: `Parameter Validation warrnings for application > Catalog > getFollowIds \n ${warrning}`,
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
|
|
1066
668
|
const query_params = {};
|
|
1067
669
|
query_params["collection_type"] = collectionType;
|
|
1068
670
|
|
|
@@ -1086,33 +688,13 @@ class Catalog {
|
|
|
1086
688
|
responseData = response[0];
|
|
1087
689
|
}
|
|
1088
690
|
|
|
1089
|
-
const {
|
|
1090
|
-
error: res_error,
|
|
1091
|
-
} = CatalogApplicationModel.FollowIdsResponse().validate(responseData, {
|
|
1092
|
-
abortEarly: false,
|
|
1093
|
-
allowUnknown: true,
|
|
1094
|
-
});
|
|
1095
|
-
|
|
1096
|
-
if (res_error) {
|
|
1097
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1098
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1099
|
-
} else {
|
|
1100
|
-
Logger({
|
|
1101
|
-
level: "WARN",
|
|
1102
|
-
message: `Response Validation Warnings for application > Catalog > getFollowIds \n ${res_error}`,
|
|
1103
|
-
});
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
691
|
return response;
|
|
1108
692
|
}
|
|
1109
693
|
|
|
1110
694
|
/**
|
|
1111
|
-
* @param {CatalogApplicationValidator.GetFollowedListingParam} arg - Arg object.
|
|
1112
695
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1113
696
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1114
|
-
* @returns {Promise<
|
|
1115
|
-
* Success response
|
|
697
|
+
* @returns {Promise<GetFollowListingResponse>} - Success response
|
|
1116
698
|
* @name getFollowedListing
|
|
1117
699
|
* @summary: List followed products, brands
|
|
1118
700
|
* @description: Get a list of products or brands the user is following. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getFollowedListing/).
|
|
@@ -1123,26 +705,13 @@ class Catalog {
|
|
|
1123
705
|
},
|
|
1124
706
|
{ responseHeaders } = { responseHeaders: false }
|
|
1125
707
|
) {
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1132
|
-
}
|
|
1133
|
-
|
|
1134
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1135
|
-
const {
|
|
1136
|
-
error: warrning,
|
|
1137
|
-
} = CatalogApplicationValidator.getFollowedListing().validate(
|
|
1138
|
-
{ collectionType, pageId, pageSize },
|
|
1139
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1140
|
-
);
|
|
1141
|
-
if (warrning) {
|
|
1142
|
-
Logger({
|
|
1143
|
-
level: "WARN",
|
|
1144
|
-
message: `Parameter Validation warrnings for application > Catalog > getFollowedListing \n ${warrning}`,
|
|
708
|
+
const errors = validateRequiredParams(arguments[0], ["collectionType"]);
|
|
709
|
+
if (errors.length > 0) {
|
|
710
|
+
const error = new FDKClientValidationError({
|
|
711
|
+
message: "Missing required field",
|
|
712
|
+
details: errors,
|
|
1145
713
|
});
|
|
714
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1146
715
|
}
|
|
1147
716
|
|
|
1148
717
|
const query_params = {};
|
|
@@ -1169,24 +738,6 @@ class Catalog {
|
|
|
1169
738
|
responseData = response[0];
|
|
1170
739
|
}
|
|
1171
740
|
|
|
1172
|
-
const {
|
|
1173
|
-
error: res_error,
|
|
1174
|
-
} = CatalogApplicationModel.GetFollowListingResponse().validate(
|
|
1175
|
-
responseData,
|
|
1176
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1177
|
-
);
|
|
1178
|
-
|
|
1179
|
-
if (res_error) {
|
|
1180
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1181
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1182
|
-
} else {
|
|
1183
|
-
Logger({
|
|
1184
|
-
level: "WARN",
|
|
1185
|
-
message: `Response Validation Warnings for application > Catalog > getFollowedListing \n ${res_error}`,
|
|
1186
|
-
});
|
|
1187
|
-
}
|
|
1188
|
-
}
|
|
1189
|
-
|
|
1190
741
|
return response;
|
|
1191
742
|
}
|
|
1192
743
|
|
|
@@ -1195,7 +746,7 @@ class Catalog {
|
|
|
1195
746
|
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
1196
747
|
* products, brands, or collections.
|
|
1197
748
|
* @param {number} [arg.pageSize] - Page ID to retrieve next set of results.
|
|
1198
|
-
* @returns {Paginator<
|
|
749
|
+
* @returns {Paginator<GetFollowListingResponse>}
|
|
1199
750
|
* @summary: List followed products, brands
|
|
1200
751
|
* @description: Get a list of products or brands the user is following.
|
|
1201
752
|
*/
|
|
@@ -1221,11 +772,9 @@ class Catalog {
|
|
|
1221
772
|
}
|
|
1222
773
|
|
|
1223
774
|
/**
|
|
1224
|
-
* @param {CatalogApplicationValidator.GetFollowerCountByIdParam} arg - Arg object.
|
|
1225
775
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1226
776
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1227
|
-
* @returns {Promise<
|
|
1228
|
-
* Success response
|
|
777
|
+
* @returns {Promise<FollowerCountResponse>} - Success response
|
|
1229
778
|
* @name getFollowerCountById
|
|
1230
779
|
* @summary: Get follower count
|
|
1231
780
|
* @description: Get the total number of followers for a specific item by its ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getFollowerCountById/).
|
|
@@ -1234,28 +783,16 @@ class Catalog {
|
|
|
1234
783
|
{ collectionType, collectionId, requestHeaders } = { requestHeaders: {} },
|
|
1235
784
|
{ responseHeaders } = { responseHeaders: false }
|
|
1236
785
|
) {
|
|
1237
|
-
const
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
}
|
|
1246
|
-
|
|
1247
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1248
|
-
const {
|
|
1249
|
-
error: warrning,
|
|
1250
|
-
} = CatalogApplicationValidator.getFollowerCountById().validate(
|
|
1251
|
-
{ collectionType, collectionId },
|
|
1252
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1253
|
-
);
|
|
1254
|
-
if (warrning) {
|
|
1255
|
-
Logger({
|
|
1256
|
-
level: "WARN",
|
|
1257
|
-
message: `Parameter Validation warrnings for application > Catalog > getFollowerCountById \n ${warrning}`,
|
|
786
|
+
const errors = validateRequiredParams(arguments[0], [
|
|
787
|
+
"collectionType",
|
|
788
|
+
"collectionId",
|
|
789
|
+
]);
|
|
790
|
+
if (errors.length > 0) {
|
|
791
|
+
const error = new FDKClientValidationError({
|
|
792
|
+
message: "Missing required field",
|
|
793
|
+
details: errors,
|
|
1258
794
|
});
|
|
795
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1259
796
|
}
|
|
1260
797
|
|
|
1261
798
|
const query_params = {};
|
|
@@ -1280,32 +817,13 @@ class Catalog {
|
|
|
1280
817
|
responseData = response[0];
|
|
1281
818
|
}
|
|
1282
819
|
|
|
1283
|
-
const {
|
|
1284
|
-
error: res_error,
|
|
1285
|
-
} = CatalogApplicationModel.FollowerCountResponse().validate(responseData, {
|
|
1286
|
-
abortEarly: false,
|
|
1287
|
-
allowUnknown: true,
|
|
1288
|
-
});
|
|
1289
|
-
|
|
1290
|
-
if (res_error) {
|
|
1291
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1292
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1293
|
-
} else {
|
|
1294
|
-
Logger({
|
|
1295
|
-
level: "WARN",
|
|
1296
|
-
message: `Response Validation Warnings for application > Catalog > getFollowerCountById \n ${res_error}`,
|
|
1297
|
-
});
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
|
|
1301
820
|
return response;
|
|
1302
821
|
}
|
|
1303
822
|
|
|
1304
823
|
/**
|
|
1305
|
-
* @param {CatalogApplicationValidator.GetHomeProductsParam} arg - Arg object.
|
|
1306
824
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1307
825
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1308
|
-
* @returns {Promise<
|
|
826
|
+
* @returns {Promise<HomeListingResponse>} - Success response
|
|
1309
827
|
* @name getHomeProducts
|
|
1310
828
|
* @summary: List homepage-featured products
|
|
1311
829
|
* @description: List all the products associated with a brand, collection or category in a random order. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getHomeProducts/).
|
|
@@ -1314,28 +832,6 @@ class Catalog {
|
|
|
1314
832
|
{ sortOn, pageId, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
1315
833
|
{ responseHeaders } = { responseHeaders: false }
|
|
1316
834
|
) {
|
|
1317
|
-
const { error } = CatalogApplicationValidator.getHomeProducts().validate(
|
|
1318
|
-
{ sortOn, pageId, pageSize },
|
|
1319
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1320
|
-
);
|
|
1321
|
-
if (error) {
|
|
1322
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1323
|
-
}
|
|
1324
|
-
|
|
1325
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1326
|
-
const {
|
|
1327
|
-
error: warrning,
|
|
1328
|
-
} = CatalogApplicationValidator.getHomeProducts().validate(
|
|
1329
|
-
{ sortOn, pageId, pageSize },
|
|
1330
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1331
|
-
);
|
|
1332
|
-
if (warrning) {
|
|
1333
|
-
Logger({
|
|
1334
|
-
level: "WARN",
|
|
1335
|
-
message: `Parameter Validation warrnings for application > Catalog > getHomeProducts \n ${warrning}`,
|
|
1336
|
-
});
|
|
1337
|
-
}
|
|
1338
|
-
|
|
1339
835
|
const query_params = {};
|
|
1340
836
|
query_params["sort_on"] = sortOn;
|
|
1341
837
|
query_params["page_id"] = pageId;
|
|
@@ -1361,24 +857,6 @@ class Catalog {
|
|
|
1361
857
|
responseData = response[0];
|
|
1362
858
|
}
|
|
1363
859
|
|
|
1364
|
-
const {
|
|
1365
|
-
error: res_error,
|
|
1366
|
-
} = CatalogApplicationModel.HomeListingResponse().validate(responseData, {
|
|
1367
|
-
abortEarly: false,
|
|
1368
|
-
allowUnknown: true,
|
|
1369
|
-
});
|
|
1370
|
-
|
|
1371
|
-
if (res_error) {
|
|
1372
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1373
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1374
|
-
} else {
|
|
1375
|
-
Logger({
|
|
1376
|
-
level: "WARN",
|
|
1377
|
-
message: `Response Validation Warnings for application > Catalog > getHomeProducts \n ${res_error}`,
|
|
1378
|
-
});
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
|
|
1382
860
|
return response;
|
|
1383
861
|
}
|
|
1384
862
|
|
|
@@ -1388,7 +866,7 @@ class Catalog {
|
|
|
1388
866
|
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
1389
867
|
* either ascending or descending order.
|
|
1390
868
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1391
|
-
* @returns {Paginator<
|
|
869
|
+
* @returns {Paginator<HomeListingResponse>}
|
|
1392
870
|
* @summary: List homepage-featured products
|
|
1393
871
|
* @description: List all the products associated with a brand, collection or category in a random order.
|
|
1394
872
|
*/
|
|
@@ -1414,11 +892,9 @@ class Catalog {
|
|
|
1414
892
|
}
|
|
1415
893
|
|
|
1416
894
|
/**
|
|
1417
|
-
* @param {CatalogApplicationValidator.GetInStockLocationsParam} arg - Arg object.
|
|
1418
895
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1419
896
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1420
|
-
* @returns {Promise<
|
|
1421
|
-
* Success response
|
|
897
|
+
* @returns {Promise<ApplicationStoreListing>} - Success response
|
|
1422
898
|
* @name getInStockLocations
|
|
1423
899
|
* @summary: List stores with inventory
|
|
1424
900
|
* @description: List stores where specified products are currently in stock. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getInStockLocations/).
|
|
@@ -1436,30 +912,6 @@ class Catalog {
|
|
|
1436
912
|
} = { requestHeaders: {} },
|
|
1437
913
|
{ responseHeaders } = { responseHeaders: false }
|
|
1438
914
|
) {
|
|
1439
|
-
const {
|
|
1440
|
-
error,
|
|
1441
|
-
} = CatalogApplicationValidator.getInStockLocations().validate(
|
|
1442
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
1443
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1444
|
-
);
|
|
1445
|
-
if (error) {
|
|
1446
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1447
|
-
}
|
|
1448
|
-
|
|
1449
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1450
|
-
const {
|
|
1451
|
-
error: warrning,
|
|
1452
|
-
} = CatalogApplicationValidator.getInStockLocations().validate(
|
|
1453
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
1454
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1455
|
-
);
|
|
1456
|
-
if (warrning) {
|
|
1457
|
-
Logger({
|
|
1458
|
-
level: "WARN",
|
|
1459
|
-
message: `Parameter Validation warrnings for application > Catalog > getInStockLocations \n ${warrning}`,
|
|
1460
|
-
});
|
|
1461
|
-
}
|
|
1462
|
-
|
|
1463
915
|
const query_params = {};
|
|
1464
916
|
query_params["page_no"] = pageNo;
|
|
1465
917
|
query_params["page_size"] = pageSize;
|
|
@@ -1489,24 +941,6 @@ class Catalog {
|
|
|
1489
941
|
responseData = response[0];
|
|
1490
942
|
}
|
|
1491
943
|
|
|
1492
|
-
const {
|
|
1493
|
-
error: res_error,
|
|
1494
|
-
} = CatalogApplicationModel.ApplicationStoreListing().validate(
|
|
1495
|
-
responseData,
|
|
1496
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1497
|
-
);
|
|
1498
|
-
|
|
1499
|
-
if (res_error) {
|
|
1500
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1501
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1502
|
-
} else {
|
|
1503
|
-
Logger({
|
|
1504
|
-
level: "WARN",
|
|
1505
|
-
message: `Response Validation Warnings for application > Catalog > getInStockLocations \n ${res_error}`,
|
|
1506
|
-
});
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
944
|
return response;
|
|
1511
945
|
}
|
|
1512
946
|
|
|
@@ -1521,7 +955,7 @@ class Catalog {
|
|
|
1521
955
|
* wants to retrieve the nearest stores, e.g. 72.8691788.
|
|
1522
956
|
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
1523
957
|
* one wants to retrieve the nearest stores, e.g. 19.1174114.
|
|
1524
|
-
* @returns {Paginator<
|
|
958
|
+
* @returns {Paginator<ApplicationStoreListing>}
|
|
1525
959
|
* @summary: List stores with inventory
|
|
1526
960
|
* @description: List stores where specified products are currently in stock.
|
|
1527
961
|
*/
|
|
@@ -1558,10 +992,9 @@ class Catalog {
|
|
|
1558
992
|
}
|
|
1559
993
|
|
|
1560
994
|
/**
|
|
1561
|
-
* @param {CatalogApplicationValidator.GetLocationDetailsByIdParam} arg - Arg object.
|
|
1562
995
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1563
996
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1564
|
-
* @returns {Promise<
|
|
997
|
+
* @returns {Promise<StoreDetails>} - Success response
|
|
1565
998
|
* @name getLocationDetailsById
|
|
1566
999
|
* @summary: Get selling location
|
|
1567
1000
|
* @description: Get details about a store based on its location Id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getLocationDetailsById/).
|
|
@@ -1570,28 +1003,13 @@ class Catalog {
|
|
|
1570
1003
|
{ locationId, requestHeaders } = { requestHeaders: {} },
|
|
1571
1004
|
{ responseHeaders } = { responseHeaders: false }
|
|
1572
1005
|
) {
|
|
1573
|
-
const
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
);
|
|
1579
|
-
if (error) {
|
|
1580
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1581
|
-
}
|
|
1582
|
-
|
|
1583
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1584
|
-
const {
|
|
1585
|
-
error: warrning,
|
|
1586
|
-
} = CatalogApplicationValidator.getLocationDetailsById().validate(
|
|
1587
|
-
{ locationId },
|
|
1588
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1589
|
-
);
|
|
1590
|
-
if (warrning) {
|
|
1591
|
-
Logger({
|
|
1592
|
-
level: "WARN",
|
|
1593
|
-
message: `Parameter Validation warrnings for application > Catalog > getLocationDetailsById \n ${warrning}`,
|
|
1006
|
+
const errors = validateRequiredParams(arguments[0], ["locationId"]);
|
|
1007
|
+
if (errors.length > 0) {
|
|
1008
|
+
const error = new FDKClientValidationError({
|
|
1009
|
+
message: "Missing required field",
|
|
1010
|
+
details: errors,
|
|
1594
1011
|
});
|
|
1012
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1595
1013
|
}
|
|
1596
1014
|
|
|
1597
1015
|
const query_params = {};
|
|
@@ -1616,32 +1034,13 @@ class Catalog {
|
|
|
1616
1034
|
responseData = response[0];
|
|
1617
1035
|
}
|
|
1618
1036
|
|
|
1619
|
-
const {
|
|
1620
|
-
error: res_error,
|
|
1621
|
-
} = CatalogApplicationModel.StoreDetails().validate(responseData, {
|
|
1622
|
-
abortEarly: false,
|
|
1623
|
-
allowUnknown: true,
|
|
1624
|
-
});
|
|
1625
|
-
|
|
1626
|
-
if (res_error) {
|
|
1627
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1628
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1629
|
-
} else {
|
|
1630
|
-
Logger({
|
|
1631
|
-
level: "WARN",
|
|
1632
|
-
message: `Response Validation Warnings for application > Catalog > getLocationDetailsById \n ${res_error}`,
|
|
1633
|
-
});
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
1037
|
return response;
|
|
1638
1038
|
}
|
|
1639
1039
|
|
|
1640
1040
|
/**
|
|
1641
|
-
* @param {CatalogApplicationValidator.GetProductBundlesBySlugParam} arg - Arg object.
|
|
1642
1041
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1643
1042
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1644
|
-
* @returns {Promise<
|
|
1043
|
+
* @returns {Promise<ProductBundle>} - Success response
|
|
1645
1044
|
* @name getProductBundlesBySlug
|
|
1646
1045
|
* @summary: List product bundles
|
|
1647
1046
|
* @description: Get products bundles to the one specified by its slug. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductBundlesBySlug/).
|
|
@@ -1650,30 +1049,6 @@ class Catalog {
|
|
|
1650
1049
|
{ slug, id, requestHeaders } = { requestHeaders: {} },
|
|
1651
1050
|
{ responseHeaders } = { responseHeaders: false }
|
|
1652
1051
|
) {
|
|
1653
|
-
const {
|
|
1654
|
-
error,
|
|
1655
|
-
} = CatalogApplicationValidator.getProductBundlesBySlug().validate(
|
|
1656
|
-
{ slug, id },
|
|
1657
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1658
|
-
);
|
|
1659
|
-
if (error) {
|
|
1660
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1661
|
-
}
|
|
1662
|
-
|
|
1663
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1664
|
-
const {
|
|
1665
|
-
error: warrning,
|
|
1666
|
-
} = CatalogApplicationValidator.getProductBundlesBySlug().validate(
|
|
1667
|
-
{ slug, id },
|
|
1668
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1669
|
-
);
|
|
1670
|
-
if (warrning) {
|
|
1671
|
-
Logger({
|
|
1672
|
-
level: "WARN",
|
|
1673
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductBundlesBySlug \n ${warrning}`,
|
|
1674
|
-
});
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
1052
|
const query_params = {};
|
|
1678
1053
|
query_params["slug"] = slug;
|
|
1679
1054
|
query_params["id"] = id;
|
|
@@ -1698,35 +1073,13 @@ class Catalog {
|
|
|
1698
1073
|
responseData = response[0];
|
|
1699
1074
|
}
|
|
1700
1075
|
|
|
1701
|
-
const {
|
|
1702
|
-
error: res_error,
|
|
1703
|
-
} = CatalogApplicationModel.ProductBundle().validate(responseData, {
|
|
1704
|
-
abortEarly: false,
|
|
1705
|
-
allowUnknown: true,
|
|
1706
|
-
});
|
|
1707
|
-
|
|
1708
|
-
if (res_error) {
|
|
1709
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1710
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1711
|
-
} else {
|
|
1712
|
-
Logger({
|
|
1713
|
-
level: "WARN",
|
|
1714
|
-
message: `Response Validation Warnings for application > Catalog > getProductBundlesBySlug \n ${res_error}`,
|
|
1715
|
-
});
|
|
1716
|
-
}
|
|
1717
|
-
}
|
|
1718
|
-
|
|
1719
1076
|
return response;
|
|
1720
1077
|
}
|
|
1721
1078
|
|
|
1722
1079
|
/**
|
|
1723
|
-
* @param {CatalogApplicationValidator.GetProductComparisonBySlugsParam} arg
|
|
1724
|
-
* - Arg object.
|
|
1725
|
-
*
|
|
1726
1080
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1727
1081
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1728
|
-
* @returns {Promise<
|
|
1729
|
-
* Success response
|
|
1082
|
+
* @returns {Promise<ProductsComparisonResponse>} - Success response
|
|
1730
1083
|
* @name getProductComparisonBySlugs
|
|
1731
1084
|
* @summary: List products for comparison
|
|
1732
1085
|
* @description: Get all the products that have the same category. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductComparisonBySlugs/).
|
|
@@ -1735,30 +1088,6 @@ class Catalog {
|
|
|
1735
1088
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
1736
1089
|
{ responseHeaders } = { responseHeaders: false }
|
|
1737
1090
|
) {
|
|
1738
|
-
const {
|
|
1739
|
-
error,
|
|
1740
|
-
} = CatalogApplicationValidator.getProductComparisonBySlugs().validate(
|
|
1741
|
-
{ slug },
|
|
1742
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1743
|
-
);
|
|
1744
|
-
if (error) {
|
|
1745
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1746
|
-
}
|
|
1747
|
-
|
|
1748
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1749
|
-
const {
|
|
1750
|
-
error: warrning,
|
|
1751
|
-
} = CatalogApplicationValidator.getProductComparisonBySlugs().validate(
|
|
1752
|
-
{ slug },
|
|
1753
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1754
|
-
);
|
|
1755
|
-
if (warrning) {
|
|
1756
|
-
Logger({
|
|
1757
|
-
level: "WARN",
|
|
1758
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductComparisonBySlugs \n ${warrning}`,
|
|
1759
|
-
});
|
|
1760
|
-
}
|
|
1761
|
-
|
|
1762
1091
|
const query_params = {};
|
|
1763
1092
|
query_params["slug"] = slug;
|
|
1764
1093
|
|
|
@@ -1782,32 +1111,13 @@ class Catalog {
|
|
|
1782
1111
|
responseData = response[0];
|
|
1783
1112
|
}
|
|
1784
1113
|
|
|
1785
|
-
const {
|
|
1786
|
-
error: res_error,
|
|
1787
|
-
} = CatalogApplicationModel.ProductsComparisonResponse().validate(
|
|
1788
|
-
responseData,
|
|
1789
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1790
|
-
);
|
|
1791
|
-
|
|
1792
|
-
if (res_error) {
|
|
1793
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1794
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1795
|
-
} else {
|
|
1796
|
-
Logger({
|
|
1797
|
-
level: "WARN",
|
|
1798
|
-
message: `Response Validation Warnings for application > Catalog > getProductComparisonBySlugs \n ${res_error}`,
|
|
1799
|
-
});
|
|
1800
|
-
}
|
|
1801
|
-
}
|
|
1802
|
-
|
|
1803
1114
|
return response;
|
|
1804
1115
|
}
|
|
1805
1116
|
|
|
1806
1117
|
/**
|
|
1807
|
-
* @param {CatalogApplicationValidator.GetProductDetailBySlugParam} arg - Arg object.
|
|
1808
1118
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1809
1119
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1810
|
-
* @returns {Promise<
|
|
1120
|
+
* @returns {Promise<ProductDetail>} - Success response
|
|
1811
1121
|
* @name getProductDetailBySlug
|
|
1812
1122
|
* @summary: Get a product
|
|
1813
1123
|
* @description: Get product details such as price, attributes, HSN code, SKU code, etc. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductDetailBySlug/).
|
|
@@ -1816,28 +1126,13 @@ class Catalog {
|
|
|
1816
1126
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
1817
1127
|
{ responseHeaders } = { responseHeaders: false }
|
|
1818
1128
|
) {
|
|
1819
|
-
const
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
|
|
1823
|
-
|
|
1824
|
-
);
|
|
1825
|
-
if (error) {
|
|
1826
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1827
|
-
}
|
|
1828
|
-
|
|
1829
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1830
|
-
const {
|
|
1831
|
-
error: warrning,
|
|
1832
|
-
} = CatalogApplicationValidator.getProductDetailBySlug().validate(
|
|
1833
|
-
{ slug },
|
|
1834
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1835
|
-
);
|
|
1836
|
-
if (warrning) {
|
|
1837
|
-
Logger({
|
|
1838
|
-
level: "WARN",
|
|
1839
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductDetailBySlug \n ${warrning}`,
|
|
1129
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1130
|
+
if (errors.length > 0) {
|
|
1131
|
+
const error = new FDKClientValidationError({
|
|
1132
|
+
message: "Missing required field",
|
|
1133
|
+
details: errors,
|
|
1840
1134
|
});
|
|
1135
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1841
1136
|
}
|
|
1842
1137
|
|
|
1843
1138
|
const query_params = {};
|
|
@@ -1862,33 +1157,13 @@ class Catalog {
|
|
|
1862
1157
|
responseData = response[0];
|
|
1863
1158
|
}
|
|
1864
1159
|
|
|
1865
|
-
const {
|
|
1866
|
-
error: res_error,
|
|
1867
|
-
} = CatalogApplicationModel.ProductDetail().validate(responseData, {
|
|
1868
|
-
abortEarly: false,
|
|
1869
|
-
allowUnknown: true,
|
|
1870
|
-
});
|
|
1871
|
-
|
|
1872
|
-
if (res_error) {
|
|
1873
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1874
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1875
|
-
} else {
|
|
1876
|
-
Logger({
|
|
1877
|
-
level: "WARN",
|
|
1878
|
-
message: `Response Validation Warnings for application > Catalog > getProductDetailBySlug \n ${res_error}`,
|
|
1879
|
-
});
|
|
1880
|
-
}
|
|
1881
|
-
}
|
|
1882
|
-
|
|
1883
1160
|
return response;
|
|
1884
1161
|
}
|
|
1885
1162
|
|
|
1886
1163
|
/**
|
|
1887
|
-
* @param {CatalogApplicationValidator.GetProductPriceBySlugParam} arg - Arg object.
|
|
1888
1164
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1889
1165
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1890
|
-
* @returns {Promise<
|
|
1891
|
-
* Success response
|
|
1166
|
+
* @returns {Promise<ProductSizePriceResponseV3>} - Success response
|
|
1892
1167
|
* @name getProductPriceBySlug
|
|
1893
1168
|
* @summary: Get product price
|
|
1894
1169
|
* @description: Get the price of a product size at all the selling locations near to a PIN Code. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductPriceBySlug/).
|
|
@@ -1897,28 +1172,13 @@ class Catalog {
|
|
|
1897
1172
|
{ slug, size, storeId, moq, requestHeaders } = { requestHeaders: {} },
|
|
1898
1173
|
{ responseHeaders } = { responseHeaders: false }
|
|
1899
1174
|
) {
|
|
1900
|
-
const
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
);
|
|
1906
|
-
if (error) {
|
|
1907
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1908
|
-
}
|
|
1909
|
-
|
|
1910
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1911
|
-
const {
|
|
1912
|
-
error: warrning,
|
|
1913
|
-
} = CatalogApplicationValidator.getProductPriceBySlug().validate(
|
|
1914
|
-
{ slug, size, storeId, moq },
|
|
1915
|
-
{ abortEarly: false, allowUnknown: false }
|
|
1916
|
-
);
|
|
1917
|
-
if (warrning) {
|
|
1918
|
-
Logger({
|
|
1919
|
-
level: "WARN",
|
|
1920
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductPriceBySlug \n ${warrning}`,
|
|
1175
|
+
const errors = validateRequiredParams(arguments[0], ["slug", "size"]);
|
|
1176
|
+
if (errors.length > 0) {
|
|
1177
|
+
const error = new FDKClientValidationError({
|
|
1178
|
+
message: "Missing required field",
|
|
1179
|
+
details: errors,
|
|
1921
1180
|
});
|
|
1181
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1922
1182
|
}
|
|
1923
1183
|
|
|
1924
1184
|
const query_params = {};
|
|
@@ -1945,34 +1205,13 @@ class Catalog {
|
|
|
1945
1205
|
responseData = response[0];
|
|
1946
1206
|
}
|
|
1947
1207
|
|
|
1948
|
-
const {
|
|
1949
|
-
error: res_error,
|
|
1950
|
-
} = CatalogApplicationModel.ProductSizePriceResponseV3().validate(
|
|
1951
|
-
responseData,
|
|
1952
|
-
{ abortEarly: false, allowUnknown: true }
|
|
1953
|
-
);
|
|
1954
|
-
|
|
1955
|
-
if (res_error) {
|
|
1956
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
1957
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1958
|
-
} else {
|
|
1959
|
-
Logger({
|
|
1960
|
-
level: "WARN",
|
|
1961
|
-
message: `Response Validation Warnings for application > Catalog > getProductPriceBySlug \n ${res_error}`,
|
|
1962
|
-
});
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
|
|
1966
1208
|
return response;
|
|
1967
1209
|
}
|
|
1968
1210
|
|
|
1969
1211
|
/**
|
|
1970
|
-
* @param {CatalogApplicationValidator.GetProductSellersBySlugParam} arg - Arg object.
|
|
1971
1212
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1972
1213
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1973
|
-
* @returns {Promise<
|
|
1974
|
-
* - Success response
|
|
1975
|
-
*
|
|
1214
|
+
* @returns {Promise<ProductSizeSellersResponseV3>} - Success response
|
|
1976
1215
|
* @name getProductSellersBySlug
|
|
1977
1216
|
* @summary: List sellers
|
|
1978
1217
|
* @description: List all sellers offering a specific product identified by its slug and size. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductSellersBySlug/).
|
|
@@ -1983,28 +1222,13 @@ class Catalog {
|
|
|
1983
1222
|
},
|
|
1984
1223
|
{ responseHeaders } = { responseHeaders: false }
|
|
1985
1224
|
) {
|
|
1986
|
-
const
|
|
1987
|
-
|
|
1988
|
-
|
|
1989
|
-
|
|
1990
|
-
|
|
1991
|
-
);
|
|
1992
|
-
if (error) {
|
|
1993
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1994
|
-
}
|
|
1995
|
-
|
|
1996
|
-
// Showing warrnings if extra unknown parameters are found
|
|
1997
|
-
const {
|
|
1998
|
-
error: warrning,
|
|
1999
|
-
} = CatalogApplicationValidator.getProductSellersBySlug().validate(
|
|
2000
|
-
{ slug, size, strategy, pageNo, pageSize },
|
|
2001
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2002
|
-
);
|
|
2003
|
-
if (warrning) {
|
|
2004
|
-
Logger({
|
|
2005
|
-
level: "WARN",
|
|
2006
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductSellersBySlug \n ${warrning}`,
|
|
1225
|
+
const errors = validateRequiredParams(arguments[0], ["slug", "size"]);
|
|
1226
|
+
if (errors.length > 0) {
|
|
1227
|
+
const error = new FDKClientValidationError({
|
|
1228
|
+
message: "Missing required field",
|
|
1229
|
+
details: errors,
|
|
2007
1230
|
});
|
|
1231
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2008
1232
|
}
|
|
2009
1233
|
|
|
2010
1234
|
const query_params = {};
|
|
@@ -2032,24 +1256,6 @@ class Catalog {
|
|
|
2032
1256
|
responseData = response[0];
|
|
2033
1257
|
}
|
|
2034
1258
|
|
|
2035
|
-
const {
|
|
2036
|
-
error: res_error,
|
|
2037
|
-
} = CatalogApplicationModel.ProductSizeSellersResponseV3().validate(
|
|
2038
|
-
responseData,
|
|
2039
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2040
|
-
);
|
|
2041
|
-
|
|
2042
|
-
if (res_error) {
|
|
2043
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2044
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2045
|
-
} else {
|
|
2046
|
-
Logger({
|
|
2047
|
-
level: "WARN",
|
|
2048
|
-
message: `Response Validation Warnings for application > Catalog > getProductSellersBySlug \n ${res_error}`,
|
|
2049
|
-
});
|
|
2050
|
-
}
|
|
2051
|
-
}
|
|
2052
|
-
|
|
2053
1259
|
return response;
|
|
2054
1260
|
}
|
|
2055
1261
|
|
|
@@ -2064,7 +1270,7 @@ class Catalog {
|
|
|
2064
1270
|
* @param {string} [arg.strategy] - Sort stores on the basis of strategy.
|
|
2065
1271
|
* eg, fast-delivery, low-price, optimal.
|
|
2066
1272
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2067
|
-
* @returns {Paginator<
|
|
1273
|
+
* @returns {Paginator<ProductSizeSellersResponseV3>}
|
|
2068
1274
|
* @summary: List sellers
|
|
2069
1275
|
* @description: List all sellers offering a specific product identified by its slug and size.
|
|
2070
1276
|
*/
|
|
@@ -2092,10 +1298,9 @@ class Catalog {
|
|
|
2092
1298
|
}
|
|
2093
1299
|
|
|
2094
1300
|
/**
|
|
2095
|
-
* @param {CatalogApplicationValidator.GetProductSizesBySlugParam} arg - Arg object.
|
|
2096
1301
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2097
1302
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2098
|
-
* @returns {Promise<
|
|
1303
|
+
* @returns {Promise<ProductSizes>} - Success response
|
|
2099
1304
|
* @name getProductSizesBySlug
|
|
2100
1305
|
* @summary: List sizes
|
|
2101
1306
|
* @description: Provides detailed information about a product, including its availability (sellable), available sizes with quantities, dimensions, weight, availability status, price details (marked, effective, selling), minimum order quantity (MOQ). - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductSizesBySlug/).
|
|
@@ -2104,28 +1309,13 @@ class Catalog {
|
|
|
2104
1309
|
{ slug, storeId, requestHeaders } = { requestHeaders: {} },
|
|
2105
1310
|
{ responseHeaders } = { responseHeaders: false }
|
|
2106
1311
|
) {
|
|
2107
|
-
const
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
);
|
|
2113
|
-
if (error) {
|
|
2114
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2115
|
-
}
|
|
2116
|
-
|
|
2117
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2118
|
-
const {
|
|
2119
|
-
error: warrning,
|
|
2120
|
-
} = CatalogApplicationValidator.getProductSizesBySlug().validate(
|
|
2121
|
-
{ slug, storeId },
|
|
2122
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2123
|
-
);
|
|
2124
|
-
if (warrning) {
|
|
2125
|
-
Logger({
|
|
2126
|
-
level: "WARN",
|
|
2127
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductSizesBySlug \n ${warrning}`,
|
|
1312
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1313
|
+
if (errors.length > 0) {
|
|
1314
|
+
const error = new FDKClientValidationError({
|
|
1315
|
+
message: "Missing required field",
|
|
1316
|
+
details: errors,
|
|
2128
1317
|
});
|
|
1318
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2129
1319
|
}
|
|
2130
1320
|
|
|
2131
1321
|
const query_params = {};
|
|
@@ -2151,33 +1341,13 @@ class Catalog {
|
|
|
2151
1341
|
responseData = response[0];
|
|
2152
1342
|
}
|
|
2153
1343
|
|
|
2154
|
-
const {
|
|
2155
|
-
error: res_error,
|
|
2156
|
-
} = CatalogApplicationModel.ProductSizes().validate(responseData, {
|
|
2157
|
-
abortEarly: false,
|
|
2158
|
-
allowUnknown: true,
|
|
2159
|
-
});
|
|
2160
|
-
|
|
2161
|
-
if (res_error) {
|
|
2162
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2163
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2164
|
-
} else {
|
|
2165
|
-
Logger({
|
|
2166
|
-
level: "WARN",
|
|
2167
|
-
message: `Response Validation Warnings for application > Catalog > getProductSizesBySlug \n ${res_error}`,
|
|
2168
|
-
});
|
|
2169
|
-
}
|
|
2170
|
-
}
|
|
2171
|
-
|
|
2172
1344
|
return response;
|
|
2173
1345
|
}
|
|
2174
1346
|
|
|
2175
1347
|
/**
|
|
2176
|
-
* @param {CatalogApplicationValidator.GetProductStockByIdsParam} arg - Arg object.
|
|
2177
1348
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2178
1349
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2179
|
-
* @returns {Promise<
|
|
2180
|
-
* Success response
|
|
1350
|
+
* @returns {Promise<ProductStockStatusResponse>} - Success response
|
|
2181
1351
|
* @name getProductStockByIds
|
|
2182
1352
|
* @summary: Get product stocks
|
|
2183
1353
|
* @description: Get the current stock status for products identified by their IDs, such as SKU, ALU, EAN, etc. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductStockByIds/).
|
|
@@ -2186,30 +1356,6 @@ class Catalog {
|
|
|
2186
1356
|
{ itemId, alu, skuCode, ean, upc, requestHeaders } = { requestHeaders: {} },
|
|
2187
1357
|
{ responseHeaders } = { responseHeaders: false }
|
|
2188
1358
|
) {
|
|
2189
|
-
const {
|
|
2190
|
-
error,
|
|
2191
|
-
} = CatalogApplicationValidator.getProductStockByIds().validate(
|
|
2192
|
-
{ itemId, alu, skuCode, ean, upc },
|
|
2193
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2194
|
-
);
|
|
2195
|
-
if (error) {
|
|
2196
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2197
|
-
}
|
|
2198
|
-
|
|
2199
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2200
|
-
const {
|
|
2201
|
-
error: warrning,
|
|
2202
|
-
} = CatalogApplicationValidator.getProductStockByIds().validate(
|
|
2203
|
-
{ itemId, alu, skuCode, ean, upc },
|
|
2204
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2205
|
-
);
|
|
2206
|
-
if (warrning) {
|
|
2207
|
-
Logger({
|
|
2208
|
-
level: "WARN",
|
|
2209
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductStockByIds \n ${warrning}`,
|
|
2210
|
-
});
|
|
2211
|
-
}
|
|
2212
|
-
|
|
2213
1359
|
const query_params = {};
|
|
2214
1360
|
query_params["item_id"] = itemId;
|
|
2215
1361
|
query_params["alu"] = alu;
|
|
@@ -2237,34 +1383,13 @@ class Catalog {
|
|
|
2237
1383
|
responseData = response[0];
|
|
2238
1384
|
}
|
|
2239
1385
|
|
|
2240
|
-
const {
|
|
2241
|
-
error: res_error,
|
|
2242
|
-
} = CatalogApplicationModel.ProductStockStatusResponse().validate(
|
|
2243
|
-
responseData,
|
|
2244
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2245
|
-
);
|
|
2246
|
-
|
|
2247
|
-
if (res_error) {
|
|
2248
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2249
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2250
|
-
} else {
|
|
2251
|
-
Logger({
|
|
2252
|
-
level: "WARN",
|
|
2253
|
-
message: `Response Validation Warnings for application > Catalog > getProductStockByIds \n ${res_error}`,
|
|
2254
|
-
});
|
|
2255
|
-
}
|
|
2256
|
-
}
|
|
2257
|
-
|
|
2258
1386
|
return response;
|
|
2259
1387
|
}
|
|
2260
1388
|
|
|
2261
1389
|
/**
|
|
2262
|
-
* @param {CatalogApplicationValidator.GetProductStockForTimeByIdsParam} arg
|
|
2263
|
-
* - Arg object.
|
|
2264
|
-
*
|
|
2265
1390
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2266
1391
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2267
|
-
* @returns {Promise<
|
|
1392
|
+
* @returns {Promise<ProductStockPolling>} - Success response
|
|
2268
1393
|
* @name getProductStockForTimeByIds
|
|
2269
1394
|
* @summary: List future stock
|
|
2270
1395
|
* @description: Get the available stock levels for all products associated with a particular sales channel at a specified future time. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductStockForTimeByIds/).
|
|
@@ -2273,30 +1398,6 @@ class Catalog {
|
|
|
2273
1398
|
{ timestamp, pageSize, pageId, requestHeaders } = { requestHeaders: {} },
|
|
2274
1399
|
{ responseHeaders } = { responseHeaders: false }
|
|
2275
1400
|
) {
|
|
2276
|
-
const {
|
|
2277
|
-
error,
|
|
2278
|
-
} = CatalogApplicationValidator.getProductStockForTimeByIds().validate(
|
|
2279
|
-
{ timestamp, pageSize, pageId },
|
|
2280
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2281
|
-
);
|
|
2282
|
-
if (error) {
|
|
2283
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2284
|
-
}
|
|
2285
|
-
|
|
2286
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2287
|
-
const {
|
|
2288
|
-
error: warrning,
|
|
2289
|
-
} = CatalogApplicationValidator.getProductStockForTimeByIds().validate(
|
|
2290
|
-
{ timestamp, pageSize, pageId },
|
|
2291
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2292
|
-
);
|
|
2293
|
-
if (warrning) {
|
|
2294
|
-
Logger({
|
|
2295
|
-
level: "WARN",
|
|
2296
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductStockForTimeByIds \n ${warrning}`,
|
|
2297
|
-
});
|
|
2298
|
-
}
|
|
2299
|
-
|
|
2300
1401
|
const query_params = {};
|
|
2301
1402
|
query_params["timestamp"] = timestamp;
|
|
2302
1403
|
query_params["page_size"] = pageSize;
|
|
@@ -2322,24 +1423,6 @@ class Catalog {
|
|
|
2322
1423
|
responseData = response[0];
|
|
2323
1424
|
}
|
|
2324
1425
|
|
|
2325
|
-
const {
|
|
2326
|
-
error: res_error,
|
|
2327
|
-
} = CatalogApplicationModel.ProductStockPolling().validate(responseData, {
|
|
2328
|
-
abortEarly: false,
|
|
2329
|
-
allowUnknown: true,
|
|
2330
|
-
});
|
|
2331
|
-
|
|
2332
|
-
if (res_error) {
|
|
2333
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2334
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2335
|
-
} else {
|
|
2336
|
-
Logger({
|
|
2337
|
-
level: "WARN",
|
|
2338
|
-
message: `Response Validation Warnings for application > Catalog > getProductStockForTimeByIds \n ${res_error}`,
|
|
2339
|
-
});
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
1426
|
return response;
|
|
2344
1427
|
}
|
|
2345
1428
|
|
|
@@ -2347,7 +1430,7 @@ class Catalog {
|
|
|
2347
1430
|
* @param {Object} arg - Arg object.
|
|
2348
1431
|
* @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z).
|
|
2349
1432
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2350
|
-
* @returns {Paginator<
|
|
1433
|
+
* @returns {Paginator<ProductStockPolling>}
|
|
2351
1434
|
* @summary: List future stock
|
|
2352
1435
|
* @description: Get the available stock levels for all products associated with a particular sales channel at a specified future time.
|
|
2353
1436
|
*/
|
|
@@ -2373,12 +1456,9 @@ class Catalog {
|
|
|
2373
1456
|
}
|
|
2374
1457
|
|
|
2375
1458
|
/**
|
|
2376
|
-
* @param {CatalogApplicationValidator.GetProductVariantsBySlugParam} arg -
|
|
2377
|
-
* Arg object.
|
|
2378
1459
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2379
1460
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2380
|
-
* @returns {Promise<
|
|
2381
|
-
* Success response
|
|
1461
|
+
* @returns {Promise<ProductVariantsResponse>} - Success response
|
|
2382
1462
|
* @name getProductVariantsBySlug
|
|
2383
1463
|
* @summary: List product variants
|
|
2384
1464
|
* @description: Get all available variants of a specific product identified by its slug. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductVariantsBySlug/).
|
|
@@ -2387,28 +1467,13 @@ class Catalog {
|
|
|
2387
1467
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
2388
1468
|
{ responseHeaders } = { responseHeaders: false }
|
|
2389
1469
|
) {
|
|
2390
|
-
const
|
|
2391
|
-
|
|
2392
|
-
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
);
|
|
2396
|
-
if (error) {
|
|
2397
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2398
|
-
}
|
|
2399
|
-
|
|
2400
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2401
|
-
const {
|
|
2402
|
-
error: warrning,
|
|
2403
|
-
} = CatalogApplicationValidator.getProductVariantsBySlug().validate(
|
|
2404
|
-
{ slug },
|
|
2405
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2406
|
-
);
|
|
2407
|
-
if (warrning) {
|
|
2408
|
-
Logger({
|
|
2409
|
-
level: "WARN",
|
|
2410
|
-
message: `Parameter Validation warrnings for application > Catalog > getProductVariantsBySlug \n ${warrning}`,
|
|
1470
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1471
|
+
if (errors.length > 0) {
|
|
1472
|
+
const error = new FDKClientValidationError({
|
|
1473
|
+
message: "Missing required field",
|
|
1474
|
+
details: errors,
|
|
2411
1475
|
});
|
|
1476
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2412
1477
|
}
|
|
2413
1478
|
|
|
2414
1479
|
const query_params = {};
|
|
@@ -2433,33 +1498,13 @@ class Catalog {
|
|
|
2433
1498
|
responseData = response[0];
|
|
2434
1499
|
}
|
|
2435
1500
|
|
|
2436
|
-
const {
|
|
2437
|
-
error: res_error,
|
|
2438
|
-
} = CatalogApplicationModel.ProductVariantsResponse().validate(
|
|
2439
|
-
responseData,
|
|
2440
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2441
|
-
);
|
|
2442
|
-
|
|
2443
|
-
if (res_error) {
|
|
2444
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2445
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2446
|
-
} else {
|
|
2447
|
-
Logger({
|
|
2448
|
-
level: "WARN",
|
|
2449
|
-
message: `Response Validation Warnings for application > Catalog > getProductVariantsBySlug \n ${res_error}`,
|
|
2450
|
-
});
|
|
2451
|
-
}
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
1501
|
return response;
|
|
2455
1502
|
}
|
|
2456
1503
|
|
|
2457
1504
|
/**
|
|
2458
|
-
* @param {CatalogApplicationValidator.GetProductsParam} arg - Arg object.
|
|
2459
1505
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2460
1506
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2461
|
-
* @returns {Promise<
|
|
2462
|
-
* Success response
|
|
1507
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
2463
1508
|
* @name getProducts
|
|
2464
1509
|
* @summary: List products
|
|
2465
1510
|
* @description: List all products available in the catalog. It supports filtering based on product name, brand, department, category, collection, and more, while also offering sorting options based on factors like price, ratings, discounts, and other relevant criteria. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProducts/).
|
|
@@ -2478,28 +1523,6 @@ class Catalog {
|
|
|
2478
1523
|
} = { requestHeaders: {} },
|
|
2479
1524
|
{ responseHeaders } = { responseHeaders: false }
|
|
2480
1525
|
) {
|
|
2481
|
-
const { error } = CatalogApplicationValidator.getProducts().validate(
|
|
2482
|
-
{ q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
2483
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2484
|
-
);
|
|
2485
|
-
if (error) {
|
|
2486
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2487
|
-
}
|
|
2488
|
-
|
|
2489
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2490
|
-
const {
|
|
2491
|
-
error: warrning,
|
|
2492
|
-
} = CatalogApplicationValidator.getProducts().validate(
|
|
2493
|
-
{ q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
2494
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2495
|
-
);
|
|
2496
|
-
if (warrning) {
|
|
2497
|
-
Logger({
|
|
2498
|
-
level: "WARN",
|
|
2499
|
-
message: `Parameter Validation warrnings for application > Catalog > getProducts \n ${warrning}`,
|
|
2500
|
-
});
|
|
2501
|
-
}
|
|
2502
|
-
|
|
2503
1526
|
const query_params = {};
|
|
2504
1527
|
query_params["q"] = q;
|
|
2505
1528
|
query_params["f"] = f;
|
|
@@ -2530,24 +1553,6 @@ class Catalog {
|
|
|
2530
1553
|
responseData = response[0];
|
|
2531
1554
|
}
|
|
2532
1555
|
|
|
2533
|
-
const {
|
|
2534
|
-
error: res_error,
|
|
2535
|
-
} = CatalogApplicationModel.ProductListingResponse().validate(
|
|
2536
|
-
responseData,
|
|
2537
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2538
|
-
);
|
|
2539
|
-
|
|
2540
|
-
if (res_error) {
|
|
2541
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2542
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2543
|
-
} else {
|
|
2544
|
-
Logger({
|
|
2545
|
-
level: "WARN",
|
|
2546
|
-
message: `Response Validation Warnings for application > Catalog > getProducts \n ${res_error}`,
|
|
2547
|
-
});
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
|
|
2551
1556
|
return response;
|
|
2552
1557
|
}
|
|
2553
1558
|
|
|
@@ -2565,7 +1570,7 @@ class Catalog {
|
|
|
2565
1570
|
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
2566
1571
|
* either ascending or descending order. See the supported values below.
|
|
2567
1572
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2568
|
-
* @returns {Paginator<
|
|
1573
|
+
* @returns {Paginator<ProductListingResponse>}
|
|
2569
1574
|
* @summary: List products
|
|
2570
1575
|
* @description: List all products available in the catalog. It supports filtering based on product name, brand, department, category, collection, and more, while also offering sorting options based on factors like price, ratings, discounts, and other relevant criteria.
|
|
2571
1576
|
*/
|
|
@@ -2596,10 +1601,46 @@ class Catalog {
|
|
|
2596
1601
|
}
|
|
2597
1602
|
|
|
2598
1603
|
/**
|
|
2599
|
-
* @param {CatalogApplicationValidator.GetSearchResultsParam} arg - Arg object.
|
|
2600
1604
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2601
1605
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2602
|
-
* @returns {Promise<
|
|
1606
|
+
* @returns {Promise<ProductSizePriceServiceabilityResponse>} - Success response
|
|
1607
|
+
* @name getProductsServiceability
|
|
1608
|
+
* @summary: get size price for multiple products,For serviceability
|
|
1609
|
+
* @description: Get size price for multiple products, For serviceability, with reduced size of response - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getProductsServiceability/).
|
|
1610
|
+
*/
|
|
1611
|
+
async getProductsServiceability(
|
|
1612
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
1613
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1614
|
+
) {
|
|
1615
|
+
const query_params = {};
|
|
1616
|
+
|
|
1617
|
+
const xHeaders = {};
|
|
1618
|
+
|
|
1619
|
+
const response = await ApplicationAPIClient.execute(
|
|
1620
|
+
this._conf,
|
|
1621
|
+
"post",
|
|
1622
|
+
constructUrl({
|
|
1623
|
+
url: this._urls["getProductsServiceability"],
|
|
1624
|
+
params: {},
|
|
1625
|
+
}),
|
|
1626
|
+
query_params,
|
|
1627
|
+
body,
|
|
1628
|
+
{ ...xHeaders, ...requestHeaders },
|
|
1629
|
+
{ responseHeaders }
|
|
1630
|
+
);
|
|
1631
|
+
|
|
1632
|
+
let responseData = response;
|
|
1633
|
+
if (responseHeaders) {
|
|
1634
|
+
responseData = response[0];
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
return response;
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1642
|
+
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1643
|
+
* @returns {Promise<AutoCompleteResponse>} - Success response
|
|
2603
1644
|
* @name getSearchResults
|
|
2604
1645
|
* @summary: List product, brand, category
|
|
2605
1646
|
* @description: Get products, brands, or categories based on a search query, which can be a partial or full name match. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getSearchResults/).
|
|
@@ -2608,28 +1649,6 @@ class Catalog {
|
|
|
2608
1649
|
{ q, requestHeaders } = { requestHeaders: {} },
|
|
2609
1650
|
{ responseHeaders } = { responseHeaders: false }
|
|
2610
1651
|
) {
|
|
2611
|
-
const { error } = CatalogApplicationValidator.getSearchResults().validate(
|
|
2612
|
-
{ q },
|
|
2613
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2614
|
-
);
|
|
2615
|
-
if (error) {
|
|
2616
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2617
|
-
}
|
|
2618
|
-
|
|
2619
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2620
|
-
const {
|
|
2621
|
-
error: warrning,
|
|
2622
|
-
} = CatalogApplicationValidator.getSearchResults().validate(
|
|
2623
|
-
{ q },
|
|
2624
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2625
|
-
);
|
|
2626
|
-
if (warrning) {
|
|
2627
|
-
Logger({
|
|
2628
|
-
level: "WARN",
|
|
2629
|
-
message: `Parameter Validation warrnings for application > Catalog > getSearchResults \n ${warrning}`,
|
|
2630
|
-
});
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
1652
|
const query_params = {};
|
|
2634
1653
|
query_params["q"] = q;
|
|
2635
1654
|
|
|
@@ -2653,35 +1672,13 @@ class Catalog {
|
|
|
2653
1672
|
responseData = response[0];
|
|
2654
1673
|
}
|
|
2655
1674
|
|
|
2656
|
-
const {
|
|
2657
|
-
error: res_error,
|
|
2658
|
-
} = CatalogApplicationModel.AutoCompleteResponse().validate(responseData, {
|
|
2659
|
-
abortEarly: false,
|
|
2660
|
-
allowUnknown: true,
|
|
2661
|
-
});
|
|
2662
|
-
|
|
2663
|
-
if (res_error) {
|
|
2664
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2665
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2666
|
-
} else {
|
|
2667
|
-
Logger({
|
|
2668
|
-
level: "WARN",
|
|
2669
|
-
message: `Response Validation Warnings for application > Catalog > getSearchResults \n ${res_error}`,
|
|
2670
|
-
});
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
1675
|
return response;
|
|
2675
1676
|
}
|
|
2676
1677
|
|
|
2677
1678
|
/**
|
|
2678
|
-
* @param {CatalogApplicationValidator.GetSimilarComparisonProductBySlugParam} arg
|
|
2679
|
-
* - Arg object.
|
|
2680
|
-
*
|
|
2681
1679
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2682
1680
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2683
|
-
* @returns {Promise<
|
|
2684
|
-
* Success response
|
|
1681
|
+
* @returns {Promise<ProductCompareResponse>} - Success response
|
|
2685
1682
|
* @name getSimilarComparisonProductBySlug
|
|
2686
1683
|
* @summary: List similar products
|
|
2687
1684
|
* @description: Get all products within the same category as the one specified by the provided slug. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getSimilarComparisonProductBySlug/).
|
|
@@ -2690,28 +1687,13 @@ class Catalog {
|
|
|
2690
1687
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
2691
1688
|
{ responseHeaders } = { responseHeaders: false }
|
|
2692
1689
|
) {
|
|
2693
|
-
const
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
);
|
|
2699
|
-
if (error) {
|
|
2700
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2701
|
-
}
|
|
2702
|
-
|
|
2703
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2704
|
-
const {
|
|
2705
|
-
error: warrning,
|
|
2706
|
-
} = CatalogApplicationValidator.getSimilarComparisonProductBySlug().validate(
|
|
2707
|
-
{ slug },
|
|
2708
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2709
|
-
);
|
|
2710
|
-
if (warrning) {
|
|
2711
|
-
Logger({
|
|
2712
|
-
level: "WARN",
|
|
2713
|
-
message: `Parameter Validation warrnings for application > Catalog > getSimilarComparisonProductBySlug \n ${warrning}`,
|
|
1690
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1691
|
+
if (errors.length > 0) {
|
|
1692
|
+
const error = new FDKClientValidationError({
|
|
1693
|
+
message: "Missing required field",
|
|
1694
|
+
details: errors,
|
|
2714
1695
|
});
|
|
1696
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2715
1697
|
}
|
|
2716
1698
|
|
|
2717
1699
|
const query_params = {};
|
|
@@ -2736,32 +1718,13 @@ class Catalog {
|
|
|
2736
1718
|
responseData = response[0];
|
|
2737
1719
|
}
|
|
2738
1720
|
|
|
2739
|
-
const {
|
|
2740
|
-
error: res_error,
|
|
2741
|
-
} = CatalogApplicationModel.ProductCompareResponse().validate(
|
|
2742
|
-
responseData,
|
|
2743
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2744
|
-
);
|
|
2745
|
-
|
|
2746
|
-
if (res_error) {
|
|
2747
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2748
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2749
|
-
} else {
|
|
2750
|
-
Logger({
|
|
2751
|
-
level: "WARN",
|
|
2752
|
-
message: `Response Validation Warnings for application > Catalog > getSimilarComparisonProductBySlug \n ${res_error}`,
|
|
2753
|
-
});
|
|
2754
|
-
}
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
1721
|
return response;
|
|
2758
1722
|
}
|
|
2759
1723
|
|
|
2760
1724
|
/**
|
|
2761
|
-
* @param {CatalogApplicationValidator.GetStoresParam} arg - Arg object.
|
|
2762
1725
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2763
1726
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2764
|
-
* @returns {Promise<
|
|
1727
|
+
* @returns {Promise<StoreListingResponse>} - Success response
|
|
2765
1728
|
* @name getStores
|
|
2766
1729
|
* @summary: List available stores
|
|
2767
1730
|
* @description: List all stores associated with the sales channel. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getStores/).
|
|
@@ -2780,28 +1743,6 @@ class Catalog {
|
|
|
2780
1743
|
} = { requestHeaders: {} },
|
|
2781
1744
|
{ responseHeaders } = { responseHeaders: false }
|
|
2782
1745
|
) {
|
|
2783
|
-
const { error } = CatalogApplicationValidator.getStores().validate(
|
|
2784
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude, tags },
|
|
2785
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2786
|
-
);
|
|
2787
|
-
if (error) {
|
|
2788
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2792
|
-
const {
|
|
2793
|
-
error: warrning,
|
|
2794
|
-
} = CatalogApplicationValidator.getStores().validate(
|
|
2795
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude, tags },
|
|
2796
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2797
|
-
);
|
|
2798
|
-
if (warrning) {
|
|
2799
|
-
Logger({
|
|
2800
|
-
level: "WARN",
|
|
2801
|
-
message: `Parameter Validation warrnings for application > Catalog > getStores \n ${warrning}`,
|
|
2802
|
-
});
|
|
2803
|
-
}
|
|
2804
|
-
|
|
2805
1746
|
const query_params = {};
|
|
2806
1747
|
query_params["page_no"] = pageNo;
|
|
2807
1748
|
query_params["page_size"] = pageSize;
|
|
@@ -2832,24 +1773,6 @@ class Catalog {
|
|
|
2832
1773
|
responseData = response[0];
|
|
2833
1774
|
}
|
|
2834
1775
|
|
|
2835
|
-
const {
|
|
2836
|
-
error: res_error,
|
|
2837
|
-
} = CatalogApplicationModel.StoreListingResponse().validate(responseData, {
|
|
2838
|
-
abortEarly: false,
|
|
2839
|
-
allowUnknown: true,
|
|
2840
|
-
});
|
|
2841
|
-
|
|
2842
|
-
if (res_error) {
|
|
2843
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2844
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2845
|
-
} else {
|
|
2846
|
-
Logger({
|
|
2847
|
-
level: "WARN",
|
|
2848
|
-
message: `Response Validation Warnings for application > Catalog > getStores \n ${res_error}`,
|
|
2849
|
-
});
|
|
2850
|
-
}
|
|
2851
|
-
}
|
|
2852
|
-
|
|
2853
1776
|
return response;
|
|
2854
1777
|
}
|
|
2855
1778
|
|
|
@@ -2865,7 +1788,7 @@ class Catalog {
|
|
|
2865
1788
|
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2866
1789
|
* one wants to retrieve the nearest stores, e.g. 19.1174114.
|
|
2867
1790
|
* @param {string} [arg.tags] - Search stores based on tags.
|
|
2868
|
-
* @returns {Paginator<
|
|
1791
|
+
* @returns {Paginator<StoreListingResponse>}
|
|
2869
1792
|
* @summary: List available stores
|
|
2870
1793
|
* @description: List all stores associated with the sales channel.
|
|
2871
1794
|
*/
|
|
@@ -2904,10 +1827,9 @@ class Catalog {
|
|
|
2904
1827
|
}
|
|
2905
1828
|
|
|
2906
1829
|
/**
|
|
2907
|
-
* @param {CatalogApplicationValidator.UnfollowByIdParam} arg - Arg object.
|
|
2908
1830
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2909
1831
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2910
|
-
* @returns {Promise<
|
|
1832
|
+
* @returns {Promise<FollowPostResponse>} - Success response
|
|
2911
1833
|
* @name unfollowById
|
|
2912
1834
|
* @summary: Delete item, brand, product
|
|
2913
1835
|
* @description: Remove a followed item, brand, or product using its collection ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/unfollowById/).
|
|
@@ -2916,26 +1838,16 @@ class Catalog {
|
|
|
2916
1838
|
{ collectionType, collectionId, requestHeaders } = { requestHeaders: {} },
|
|
2917
1839
|
{ responseHeaders } = { responseHeaders: false }
|
|
2918
1840
|
) {
|
|
2919
|
-
const
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
);
|
|
2923
|
-
if (
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2928
|
-
const {
|
|
2929
|
-
error: warrning,
|
|
2930
|
-
} = CatalogApplicationValidator.unfollowById().validate(
|
|
2931
|
-
{ collectionType, collectionId },
|
|
2932
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2933
|
-
);
|
|
2934
|
-
if (warrning) {
|
|
2935
|
-
Logger({
|
|
2936
|
-
level: "WARN",
|
|
2937
|
-
message: `Parameter Validation warrnings for application > Catalog > unfollowById \n ${warrning}`,
|
|
1841
|
+
const errors = validateRequiredParams(arguments[0], [
|
|
1842
|
+
"collectionType",
|
|
1843
|
+
"collectionId",
|
|
1844
|
+
]);
|
|
1845
|
+
if (errors.length > 0) {
|
|
1846
|
+
const error = new FDKClientValidationError({
|
|
1847
|
+
message: "Missing required field",
|
|
1848
|
+
details: errors,
|
|
2938
1849
|
});
|
|
1850
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2939
1851
|
}
|
|
2940
1852
|
|
|
2941
1853
|
const query_params = {};
|
|
@@ -2960,24 +1872,6 @@ class Catalog {
|
|
|
2960
1872
|
responseData = response[0];
|
|
2961
1873
|
}
|
|
2962
1874
|
|
|
2963
|
-
const {
|
|
2964
|
-
error: res_error,
|
|
2965
|
-
} = CatalogApplicationModel.FollowPostResponse().validate(responseData, {
|
|
2966
|
-
abortEarly: false,
|
|
2967
|
-
allowUnknown: true,
|
|
2968
|
-
});
|
|
2969
|
-
|
|
2970
|
-
if (res_error) {
|
|
2971
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
2972
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2973
|
-
} else {
|
|
2974
|
-
Logger({
|
|
2975
|
-
level: "WARN",
|
|
2976
|
-
message: `Response Validation Warnings for application > Catalog > unfollowById \n ${res_error}`,
|
|
2977
|
-
});
|
|
2978
|
-
}
|
|
2979
|
-
}
|
|
2980
|
-
|
|
2981
1875
|
return response;
|
|
2982
1876
|
}
|
|
2983
1877
|
}
|