@gofynd/fdk-client-javascript 1.4.15-beta.1 → 1.4.15-beta.10
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 +2 -3
- 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 +80 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +148 -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 +9 -12
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +22 -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/FileStorage/FileStoragePartnerModel.d.ts +2 -0
- package/sdk/partner/FileStorage/FileStoragePartnerModel.js +2 -0
- 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/CartPlatformModel.d.ts +28 -0
- package/sdk/platform/Cart/CartPlatformModel.js +12 -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/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +3 -0
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +3 -0
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +16 -1
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +20 -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) {
|
|
@@ -82,10 +80,9 @@ class Catalog {
|
|
|
82
80
|
}
|
|
83
81
|
|
|
84
82
|
/**
|
|
85
|
-
* @param {CatalogApplicationValidator.FollowByIdParam} arg - Arg object.
|
|
86
83
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
87
84
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
88
|
-
* @returns {Promise<
|
|
85
|
+
* @returns {Promise<FollowPostResponse>} - Success response
|
|
89
86
|
* @name followById
|
|
90
87
|
* @summary: Create item, brand, product
|
|
91
88
|
* @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 +91,16 @@ class Catalog {
|
|
|
94
91
|
{ collectionType, collectionId, requestHeaders } = { requestHeaders: {} },
|
|
95
92
|
{ responseHeaders } = { responseHeaders: false }
|
|
96
93
|
) {
|
|
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}`,
|
|
94
|
+
const errors = validateRequiredParams(arguments[0], [
|
|
95
|
+
"collectionType",
|
|
96
|
+
"collectionId",
|
|
97
|
+
]);
|
|
98
|
+
if (errors.length > 0) {
|
|
99
|
+
const error = new FDKClientValidationError({
|
|
100
|
+
message: "Missing required field",
|
|
101
|
+
details: errors,
|
|
116
102
|
});
|
|
103
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
117
104
|
}
|
|
118
105
|
|
|
119
106
|
const query_params = {};
|
|
@@ -138,32 +125,13 @@ class Catalog {
|
|
|
138
125
|
responseData = response[0];
|
|
139
126
|
}
|
|
140
127
|
|
|
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
128
|
return response;
|
|
160
129
|
}
|
|
161
130
|
|
|
162
131
|
/**
|
|
163
|
-
* @param {CatalogApplicationValidator.GetBrandDetailBySlugParam} arg - Arg object.
|
|
164
132
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
165
133
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
166
|
-
* @returns {Promise<
|
|
134
|
+
* @returns {Promise<BrandDetailResponse>} - Success response
|
|
167
135
|
* @name getBrandDetailBySlug
|
|
168
136
|
* @summary: Get a brand
|
|
169
137
|
* @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 +140,13 @@ class Catalog {
|
|
|
172
140
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
173
141
|
{ responseHeaders } = { responseHeaders: false }
|
|
174
142
|
) {
|
|
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}`,
|
|
143
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
144
|
+
if (errors.length > 0) {
|
|
145
|
+
const error = new FDKClientValidationError({
|
|
146
|
+
message: "Missing required field",
|
|
147
|
+
details: errors,
|
|
196
148
|
});
|
|
149
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
197
150
|
}
|
|
198
151
|
|
|
199
152
|
const query_params = {};
|
|
@@ -218,32 +171,13 @@ class Catalog {
|
|
|
218
171
|
responseData = response[0];
|
|
219
172
|
}
|
|
220
173
|
|
|
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
174
|
return response;
|
|
240
175
|
}
|
|
241
176
|
|
|
242
177
|
/**
|
|
243
|
-
* @param {CatalogApplicationValidator.GetBrandsParam} arg - Arg object.
|
|
244
178
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
245
179
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
246
|
-
* @returns {Promise<
|
|
180
|
+
* @returns {Promise<BrandListingResponse>} - Success response
|
|
247
181
|
* @name getBrands
|
|
248
182
|
* @summary: List brands
|
|
249
183
|
* @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 +186,6 @@ class Catalog {
|
|
|
252
186
|
{ department, pageNo, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
253
187
|
{ responseHeaders } = { responseHeaders: false }
|
|
254
188
|
) {
|
|
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
189
|
const query_params = {};
|
|
278
190
|
query_params["department"] = department;
|
|
279
191
|
query_params["page_no"] = pageNo;
|
|
@@ -299,24 +211,6 @@ class Catalog {
|
|
|
299
211
|
responseData = response[0];
|
|
300
212
|
}
|
|
301
213
|
|
|
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
214
|
return response;
|
|
321
215
|
}
|
|
322
216
|
|
|
@@ -327,7 +221,7 @@ class Catalog {
|
|
|
327
221
|
* of available departments below. Also, you can get available departments
|
|
328
222
|
* from the endpoint /service/application/catalog/v1.0/departments/.
|
|
329
223
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
330
|
-
* @returns {Paginator<
|
|
224
|
+
* @returns {Paginator<BrandListingResponse>}
|
|
331
225
|
* @summary: List brands
|
|
332
226
|
* @description: Get a list of all the available brands. Filtering can be applied to the department.
|
|
333
227
|
*/
|
|
@@ -353,11 +247,9 @@ class Catalog {
|
|
|
353
247
|
}
|
|
354
248
|
|
|
355
249
|
/**
|
|
356
|
-
* @param {CatalogApplicationValidator.GetCategoriesParam} arg - Arg object.
|
|
357
250
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
358
251
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
359
|
-
* @returns {Promise<
|
|
360
|
-
* Success response
|
|
252
|
+
* @returns {Promise<CategoryListingResponse>} - Success response
|
|
361
253
|
* @name getCategories
|
|
362
254
|
* @summary: List product categories
|
|
363
255
|
* @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 +258,6 @@ class Catalog {
|
|
|
366
258
|
{ department, requestHeaders } = { requestHeaders: {} },
|
|
367
259
|
{ responseHeaders } = { responseHeaders: false }
|
|
368
260
|
) {
|
|
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
261
|
const query_params = {};
|
|
392
262
|
query_params["department"] = department;
|
|
393
263
|
|
|
@@ -411,32 +281,13 @@ class Catalog {
|
|
|
411
281
|
responseData = response[0];
|
|
412
282
|
}
|
|
413
283
|
|
|
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
284
|
return response;
|
|
433
285
|
}
|
|
434
286
|
|
|
435
287
|
/**
|
|
436
|
-
* @param {CatalogApplicationValidator.GetCategoryDetailBySlugParam} arg - Arg object.
|
|
437
288
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
438
289
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
439
|
-
* @returns {Promise<
|
|
290
|
+
* @returns {Promise<CategoryMetaResponse>} - Success response
|
|
440
291
|
* @name getCategoryDetailBySlug
|
|
441
292
|
* @summary: Get category by slug
|
|
442
293
|
* @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 +296,13 @@ class Catalog {
|
|
|
445
296
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
446
297
|
{ responseHeaders } = { responseHeaders: false }
|
|
447
298
|
) {
|
|
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}`,
|
|
299
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
300
|
+
if (errors.length > 0) {
|
|
301
|
+
const error = new FDKClientValidationError({
|
|
302
|
+
message: "Missing required field",
|
|
303
|
+
details: errors,
|
|
469
304
|
});
|
|
305
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
470
306
|
}
|
|
471
307
|
|
|
472
308
|
const query_params = {};
|
|
@@ -491,35 +327,13 @@ class Catalog {
|
|
|
491
327
|
responseData = response[0];
|
|
492
328
|
}
|
|
493
329
|
|
|
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
330
|
return response;
|
|
513
331
|
}
|
|
514
332
|
|
|
515
333
|
/**
|
|
516
|
-
* @param {CatalogApplicationValidator.GetCollectionDetailBySlugParam} arg
|
|
517
|
-
* - Arg object.
|
|
518
|
-
*
|
|
519
334
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
520
335
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
521
|
-
* @returns {Promise<
|
|
522
|
-
* Success response
|
|
336
|
+
* @returns {Promise<CollectionDetailResponse>} - Success response
|
|
523
337
|
* @name getCollectionDetailBySlug
|
|
524
338
|
* @summary: Get a collection
|
|
525
339
|
* @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 +342,13 @@ class Catalog {
|
|
|
528
342
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
529
343
|
{ responseHeaders } = { responseHeaders: false }
|
|
530
344
|
) {
|
|
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}`,
|
|
345
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
346
|
+
if (errors.length > 0) {
|
|
347
|
+
const error = new FDKClientValidationError({
|
|
348
|
+
message: "Missing required field",
|
|
349
|
+
details: errors,
|
|
552
350
|
});
|
|
351
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
553
352
|
}
|
|
554
353
|
|
|
555
354
|
const query_params = {};
|
|
@@ -574,34 +373,13 @@ class Catalog {
|
|
|
574
373
|
responseData = response[0];
|
|
575
374
|
}
|
|
576
375
|
|
|
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
376
|
return response;
|
|
596
377
|
}
|
|
597
378
|
|
|
598
379
|
/**
|
|
599
|
-
* @param {CatalogApplicationValidator.GetCollectionItemsBySlugParam} arg -
|
|
600
|
-
* Arg object.
|
|
601
380
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
602
381
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
603
|
-
* @returns {Promise<
|
|
604
|
-
* Success response
|
|
382
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
605
383
|
* @name getCollectionItemsBySlug
|
|
606
384
|
* @summary: Lists items of collection
|
|
607
385
|
* @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 +399,13 @@ class Catalog {
|
|
|
621
399
|
} = { requestHeaders: {} },
|
|
622
400
|
{ responseHeaders } = { responseHeaders: false }
|
|
623
401
|
) {
|
|
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}`,
|
|
402
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
403
|
+
if (errors.length > 0) {
|
|
404
|
+
const error = new FDKClientValidationError({
|
|
405
|
+
message: "Missing required field",
|
|
406
|
+
details: errors,
|
|
645
407
|
});
|
|
408
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
646
409
|
}
|
|
647
410
|
|
|
648
411
|
const query_params = {};
|
|
@@ -675,24 +438,6 @@ class Catalog {
|
|
|
675
438
|
responseData = response[0];
|
|
676
439
|
}
|
|
677
440
|
|
|
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
441
|
return response;
|
|
697
442
|
}
|
|
698
443
|
|
|
@@ -713,7 +458,7 @@ class Catalog {
|
|
|
713
458
|
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
714
459
|
* either ascending or descending order. See the supported values below.
|
|
715
460
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
716
|
-
* @returns {Paginator<
|
|
461
|
+
* @returns {Paginator<ProductListingResponse>}
|
|
717
462
|
* @summary: Lists items of collection
|
|
718
463
|
* @description: Fetch items within a particular collection identified by its slug.
|
|
719
464
|
*/
|
|
@@ -752,12 +497,9 @@ class Catalog {
|
|
|
752
497
|
}
|
|
753
498
|
|
|
754
499
|
/**
|
|
755
|
-
* @param {CatalogApplicationValidator.GetCollectionsParam} arg - Arg object.
|
|
756
500
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
757
501
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
758
|
-
* @returns {Promise<
|
|
759
|
-
* - Success response
|
|
760
|
-
*
|
|
502
|
+
* @returns {Promise<GetCollectionListingResponse>} - Success response
|
|
761
503
|
* @name getCollections
|
|
762
504
|
* @summary: List collections
|
|
763
505
|
* @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 +508,6 @@ class Catalog {
|
|
|
766
508
|
{ pageNo, pageSize, tag, q, requestHeaders } = { requestHeaders: {} },
|
|
767
509
|
{ responseHeaders } = { responseHeaders: false }
|
|
768
510
|
) {
|
|
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
511
|
const query_params = {};
|
|
792
512
|
query_params["page_no"] = pageNo;
|
|
793
513
|
query_params["page_size"] = pageSize;
|
|
@@ -814,24 +534,6 @@ class Catalog {
|
|
|
814
534
|
responseData = response[0];
|
|
815
535
|
}
|
|
816
536
|
|
|
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
537
|
return response;
|
|
836
538
|
}
|
|
837
539
|
|
|
@@ -840,7 +542,7 @@ class Catalog {
|
|
|
840
542
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
841
543
|
* @param {string[]} [arg.tag] - List of tags to filter collections.
|
|
842
544
|
* @param {string} [arg.q] - Name of the collection to filter collection.
|
|
843
|
-
* @returns {Paginator<
|
|
545
|
+
* @returns {Paginator<GetCollectionListingResponse>}
|
|
844
546
|
* @summary: List collections
|
|
845
547
|
* @description: List of curated product collections with filtering options based on tags and collection names.
|
|
846
548
|
*/
|
|
@@ -867,14 +569,9 @@ class Catalog {
|
|
|
867
569
|
}
|
|
868
570
|
|
|
869
571
|
/**
|
|
870
|
-
* @param {CatalogApplicationValidator.GetComparedFrequentlyProductBySlugParam} arg
|
|
871
|
-
* - Arg object.
|
|
872
|
-
*
|
|
873
572
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
874
573
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
875
|
-
* @returns {Promise<
|
|
876
|
-
* - Success response
|
|
877
|
-
*
|
|
574
|
+
* @returns {Promise<ProductFrequentlyComparedSimilarResponse>} - Success response
|
|
878
575
|
* @name getComparedFrequentlyProductBySlug
|
|
879
576
|
* @summary: List frequent products
|
|
880
577
|
* @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 +580,13 @@ class Catalog {
|
|
|
883
580
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
884
581
|
{ responseHeaders } = { responseHeaders: false }
|
|
885
582
|
) {
|
|
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}`,
|
|
583
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
584
|
+
if (errors.length > 0) {
|
|
585
|
+
const error = new FDKClientValidationError({
|
|
586
|
+
message: "Missing required field",
|
|
587
|
+
details: errors,
|
|
907
588
|
});
|
|
589
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
908
590
|
}
|
|
909
591
|
|
|
910
592
|
const query_params = {};
|
|
@@ -929,32 +611,13 @@ class Catalog {
|
|
|
929
611
|
responseData = response[0];
|
|
930
612
|
}
|
|
931
613
|
|
|
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
614
|
return response;
|
|
951
615
|
}
|
|
952
616
|
|
|
953
617
|
/**
|
|
954
|
-
* @param {CatalogApplicationValidator.GetDepartmentsParam} arg - Arg object.
|
|
955
618
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
956
619
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
957
|
-
* @returns {Promise<
|
|
620
|
+
* @returns {Promise<DepartmentResponse>} - Success response
|
|
958
621
|
* @name getDepartments
|
|
959
622
|
* @summary: List departments
|
|
960
623
|
* @description: List all departments associated with available products. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/catalog/getDepartments/).
|
|
@@ -963,28 +626,6 @@ class Catalog {
|
|
|
963
626
|
{ requestHeaders } = { requestHeaders: {} },
|
|
964
627
|
{ responseHeaders } = { responseHeaders: false }
|
|
965
628
|
) {
|
|
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
629
|
const query_params = {};
|
|
989
630
|
|
|
990
631
|
const xHeaders = {};
|
|
@@ -1007,32 +648,13 @@ class Catalog {
|
|
|
1007
648
|
responseData = response[0];
|
|
1008
649
|
}
|
|
1009
650
|
|
|
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
651
|
return response;
|
|
1029
652
|
}
|
|
1030
653
|
|
|
1031
654
|
/**
|
|
1032
|
-
* @param {CatalogApplicationValidator.GetFollowIdsParam} arg - Arg object.
|
|
1033
655
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1034
656
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1035
|
-
* @returns {Promise<
|
|
657
|
+
* @returns {Promise<FollowIdsResponse>} - Success response
|
|
1036
658
|
* @name getFollowIds
|
|
1037
659
|
* @summary: List Ids of followed item, brand, product
|
|
1038
660
|
* @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 +663,6 @@ class Catalog {
|
|
|
1041
663
|
{ collectionType, requestHeaders } = { requestHeaders: {} },
|
|
1042
664
|
{ responseHeaders } = { responseHeaders: false }
|
|
1043
665
|
) {
|
|
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
666
|
const query_params = {};
|
|
1067
667
|
query_params["collection_type"] = collectionType;
|
|
1068
668
|
|
|
@@ -1086,33 +686,13 @@ class Catalog {
|
|
|
1086
686
|
responseData = response[0];
|
|
1087
687
|
}
|
|
1088
688
|
|
|
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
689
|
return response;
|
|
1108
690
|
}
|
|
1109
691
|
|
|
1110
692
|
/**
|
|
1111
|
-
* @param {CatalogApplicationValidator.GetFollowedListingParam} arg - Arg object.
|
|
1112
693
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1113
694
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1114
|
-
* @returns {Promise<
|
|
1115
|
-
* Success response
|
|
695
|
+
* @returns {Promise<GetFollowListingResponse>} - Success response
|
|
1116
696
|
* @name getFollowedListing
|
|
1117
697
|
* @summary: List followed products, brands
|
|
1118
698
|
* @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 +703,13 @@ class Catalog {
|
|
|
1123
703
|
},
|
|
1124
704
|
{ responseHeaders } = { responseHeaders: false }
|
|
1125
705
|
) {
|
|
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}`,
|
|
706
|
+
const errors = validateRequiredParams(arguments[0], ["collectionType"]);
|
|
707
|
+
if (errors.length > 0) {
|
|
708
|
+
const error = new FDKClientValidationError({
|
|
709
|
+
message: "Missing required field",
|
|
710
|
+
details: errors,
|
|
1145
711
|
});
|
|
712
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1146
713
|
}
|
|
1147
714
|
|
|
1148
715
|
const query_params = {};
|
|
@@ -1169,24 +736,6 @@ class Catalog {
|
|
|
1169
736
|
responseData = response[0];
|
|
1170
737
|
}
|
|
1171
738
|
|
|
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
739
|
return response;
|
|
1191
740
|
}
|
|
1192
741
|
|
|
@@ -1195,7 +744,7 @@ class Catalog {
|
|
|
1195
744
|
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
1196
745
|
* products, brands, or collections.
|
|
1197
746
|
* @param {number} [arg.pageSize] - Page ID to retrieve next set of results.
|
|
1198
|
-
* @returns {Paginator<
|
|
747
|
+
* @returns {Paginator<GetFollowListingResponse>}
|
|
1199
748
|
* @summary: List followed products, brands
|
|
1200
749
|
* @description: Get a list of products or brands the user is following.
|
|
1201
750
|
*/
|
|
@@ -1221,11 +770,9 @@ class Catalog {
|
|
|
1221
770
|
}
|
|
1222
771
|
|
|
1223
772
|
/**
|
|
1224
|
-
* @param {CatalogApplicationValidator.GetFollowerCountByIdParam} arg - Arg object.
|
|
1225
773
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1226
774
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1227
|
-
* @returns {Promise<
|
|
1228
|
-
* Success response
|
|
775
|
+
* @returns {Promise<FollowerCountResponse>} - Success response
|
|
1229
776
|
* @name getFollowerCountById
|
|
1230
777
|
* @summary: Get follower count
|
|
1231
778
|
* @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 +781,16 @@ class Catalog {
|
|
|
1234
781
|
{ collectionType, collectionId, requestHeaders } = { requestHeaders: {} },
|
|
1235
782
|
{ responseHeaders } = { responseHeaders: false }
|
|
1236
783
|
) {
|
|
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}`,
|
|
784
|
+
const errors = validateRequiredParams(arguments[0], [
|
|
785
|
+
"collectionType",
|
|
786
|
+
"collectionId",
|
|
787
|
+
]);
|
|
788
|
+
if (errors.length > 0) {
|
|
789
|
+
const error = new FDKClientValidationError({
|
|
790
|
+
message: "Missing required field",
|
|
791
|
+
details: errors,
|
|
1258
792
|
});
|
|
793
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1259
794
|
}
|
|
1260
795
|
|
|
1261
796
|
const query_params = {};
|
|
@@ -1280,32 +815,13 @@ class Catalog {
|
|
|
1280
815
|
responseData = response[0];
|
|
1281
816
|
}
|
|
1282
817
|
|
|
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
818
|
return response;
|
|
1302
819
|
}
|
|
1303
820
|
|
|
1304
821
|
/**
|
|
1305
|
-
* @param {CatalogApplicationValidator.GetHomeProductsParam} arg - Arg object.
|
|
1306
822
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1307
823
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1308
|
-
* @returns {Promise<
|
|
824
|
+
* @returns {Promise<HomeListingResponse>} - Success response
|
|
1309
825
|
* @name getHomeProducts
|
|
1310
826
|
* @summary: List homepage-featured products
|
|
1311
827
|
* @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 +830,6 @@ class Catalog {
|
|
|
1314
830
|
{ sortOn, pageId, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
1315
831
|
{ responseHeaders } = { responseHeaders: false }
|
|
1316
832
|
) {
|
|
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
833
|
const query_params = {};
|
|
1340
834
|
query_params["sort_on"] = sortOn;
|
|
1341
835
|
query_params["page_id"] = pageId;
|
|
@@ -1361,24 +855,6 @@ class Catalog {
|
|
|
1361
855
|
responseData = response[0];
|
|
1362
856
|
}
|
|
1363
857
|
|
|
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
858
|
return response;
|
|
1383
859
|
}
|
|
1384
860
|
|
|
@@ -1388,7 +864,7 @@ class Catalog {
|
|
|
1388
864
|
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
1389
865
|
* either ascending or descending order.
|
|
1390
866
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1391
|
-
* @returns {Paginator<
|
|
867
|
+
* @returns {Paginator<HomeListingResponse>}
|
|
1392
868
|
* @summary: List homepage-featured products
|
|
1393
869
|
* @description: List all the products associated with a brand, collection or category in a random order.
|
|
1394
870
|
*/
|
|
@@ -1414,11 +890,9 @@ class Catalog {
|
|
|
1414
890
|
}
|
|
1415
891
|
|
|
1416
892
|
/**
|
|
1417
|
-
* @param {CatalogApplicationValidator.GetInStockLocationsParam} arg - Arg object.
|
|
1418
893
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1419
894
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1420
|
-
* @returns {Promise<
|
|
1421
|
-
* Success response
|
|
895
|
+
* @returns {Promise<ApplicationStoreListing>} - Success response
|
|
1422
896
|
* @name getInStockLocations
|
|
1423
897
|
* @summary: List stores with inventory
|
|
1424
898
|
* @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 +910,6 @@ class Catalog {
|
|
|
1436
910
|
} = { requestHeaders: {} },
|
|
1437
911
|
{ responseHeaders } = { responseHeaders: false }
|
|
1438
912
|
) {
|
|
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
913
|
const query_params = {};
|
|
1464
914
|
query_params["page_no"] = pageNo;
|
|
1465
915
|
query_params["page_size"] = pageSize;
|
|
@@ -1489,24 +939,6 @@ class Catalog {
|
|
|
1489
939
|
responseData = response[0];
|
|
1490
940
|
}
|
|
1491
941
|
|
|
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
942
|
return response;
|
|
1511
943
|
}
|
|
1512
944
|
|
|
@@ -1521,7 +953,7 @@ class Catalog {
|
|
|
1521
953
|
* wants to retrieve the nearest stores, e.g. 72.8691788.
|
|
1522
954
|
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
1523
955
|
* one wants to retrieve the nearest stores, e.g. 19.1174114.
|
|
1524
|
-
* @returns {Paginator<
|
|
956
|
+
* @returns {Paginator<ApplicationStoreListing>}
|
|
1525
957
|
* @summary: List stores with inventory
|
|
1526
958
|
* @description: List stores where specified products are currently in stock.
|
|
1527
959
|
*/
|
|
@@ -1558,10 +990,9 @@ class Catalog {
|
|
|
1558
990
|
}
|
|
1559
991
|
|
|
1560
992
|
/**
|
|
1561
|
-
* @param {CatalogApplicationValidator.GetLocationDetailsByIdParam} arg - Arg object.
|
|
1562
993
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1563
994
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1564
|
-
* @returns {Promise<
|
|
995
|
+
* @returns {Promise<StoreDetails>} - Success response
|
|
1565
996
|
* @name getLocationDetailsById
|
|
1566
997
|
* @summary: Get selling location
|
|
1567
998
|
* @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 +1001,13 @@ class Catalog {
|
|
|
1570
1001
|
{ locationId, requestHeaders } = { requestHeaders: {} },
|
|
1571
1002
|
{ responseHeaders } = { responseHeaders: false }
|
|
1572
1003
|
) {
|
|
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}`,
|
|
1004
|
+
const errors = validateRequiredParams(arguments[0], ["locationId"]);
|
|
1005
|
+
if (errors.length > 0) {
|
|
1006
|
+
const error = new FDKClientValidationError({
|
|
1007
|
+
message: "Missing required field",
|
|
1008
|
+
details: errors,
|
|
1594
1009
|
});
|
|
1010
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1595
1011
|
}
|
|
1596
1012
|
|
|
1597
1013
|
const query_params = {};
|
|
@@ -1616,32 +1032,13 @@ class Catalog {
|
|
|
1616
1032
|
responseData = response[0];
|
|
1617
1033
|
}
|
|
1618
1034
|
|
|
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
1035
|
return response;
|
|
1638
1036
|
}
|
|
1639
1037
|
|
|
1640
1038
|
/**
|
|
1641
|
-
* @param {CatalogApplicationValidator.GetProductBundlesBySlugParam} arg - Arg object.
|
|
1642
1039
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1643
1040
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1644
|
-
* @returns {Promise<
|
|
1041
|
+
* @returns {Promise<ProductBundle>} - Success response
|
|
1645
1042
|
* @name getProductBundlesBySlug
|
|
1646
1043
|
* @summary: List product bundles
|
|
1647
1044
|
* @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 +1047,6 @@ class Catalog {
|
|
|
1650
1047
|
{ slug, id, requestHeaders } = { requestHeaders: {} },
|
|
1651
1048
|
{ responseHeaders } = { responseHeaders: false }
|
|
1652
1049
|
) {
|
|
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
1050
|
const query_params = {};
|
|
1678
1051
|
query_params["slug"] = slug;
|
|
1679
1052
|
query_params["id"] = id;
|
|
@@ -1698,35 +1071,13 @@ class Catalog {
|
|
|
1698
1071
|
responseData = response[0];
|
|
1699
1072
|
}
|
|
1700
1073
|
|
|
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
1074
|
return response;
|
|
1720
1075
|
}
|
|
1721
1076
|
|
|
1722
1077
|
/**
|
|
1723
|
-
* @param {CatalogApplicationValidator.GetProductComparisonBySlugsParam} arg
|
|
1724
|
-
* - Arg object.
|
|
1725
|
-
*
|
|
1726
1078
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1727
1079
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1728
|
-
* @returns {Promise<
|
|
1729
|
-
* Success response
|
|
1080
|
+
* @returns {Promise<ProductsComparisonResponse>} - Success response
|
|
1730
1081
|
* @name getProductComparisonBySlugs
|
|
1731
1082
|
* @summary: List products for comparison
|
|
1732
1083
|
* @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 +1086,6 @@ class Catalog {
|
|
|
1735
1086
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
1736
1087
|
{ responseHeaders } = { responseHeaders: false }
|
|
1737
1088
|
) {
|
|
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
1089
|
const query_params = {};
|
|
1763
1090
|
query_params["slug"] = slug;
|
|
1764
1091
|
|
|
@@ -1782,32 +1109,13 @@ class Catalog {
|
|
|
1782
1109
|
responseData = response[0];
|
|
1783
1110
|
}
|
|
1784
1111
|
|
|
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
1112
|
return response;
|
|
1804
1113
|
}
|
|
1805
1114
|
|
|
1806
1115
|
/**
|
|
1807
|
-
* @param {CatalogApplicationValidator.GetProductDetailBySlugParam} arg - Arg object.
|
|
1808
1116
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1809
1117
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1810
|
-
* @returns {Promise<
|
|
1118
|
+
* @returns {Promise<ProductDetail>} - Success response
|
|
1811
1119
|
* @name getProductDetailBySlug
|
|
1812
1120
|
* @summary: Get a product
|
|
1813
1121
|
* @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 +1124,13 @@ class Catalog {
|
|
|
1816
1124
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
1817
1125
|
{ responseHeaders } = { responseHeaders: false }
|
|
1818
1126
|
) {
|
|
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}`,
|
|
1127
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1128
|
+
if (errors.length > 0) {
|
|
1129
|
+
const error = new FDKClientValidationError({
|
|
1130
|
+
message: "Missing required field",
|
|
1131
|
+
details: errors,
|
|
1840
1132
|
});
|
|
1133
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1841
1134
|
}
|
|
1842
1135
|
|
|
1843
1136
|
const query_params = {};
|
|
@@ -1862,33 +1155,13 @@ class Catalog {
|
|
|
1862
1155
|
responseData = response[0];
|
|
1863
1156
|
}
|
|
1864
1157
|
|
|
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
1158
|
return response;
|
|
1884
1159
|
}
|
|
1885
1160
|
|
|
1886
1161
|
/**
|
|
1887
|
-
* @param {CatalogApplicationValidator.GetProductPriceBySlugParam} arg - Arg object.
|
|
1888
1162
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1889
1163
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1890
|
-
* @returns {Promise<
|
|
1891
|
-
* Success response
|
|
1164
|
+
* @returns {Promise<ProductSizePriceResponseV3>} - Success response
|
|
1892
1165
|
* @name getProductPriceBySlug
|
|
1893
1166
|
* @summary: Get product price
|
|
1894
1167
|
* @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 +1170,13 @@ class Catalog {
|
|
|
1897
1170
|
{ slug, size, storeId, moq, requestHeaders } = { requestHeaders: {} },
|
|
1898
1171
|
{ responseHeaders } = { responseHeaders: false }
|
|
1899
1172
|
) {
|
|
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}`,
|
|
1173
|
+
const errors = validateRequiredParams(arguments[0], ["slug", "size"]);
|
|
1174
|
+
if (errors.length > 0) {
|
|
1175
|
+
const error = new FDKClientValidationError({
|
|
1176
|
+
message: "Missing required field",
|
|
1177
|
+
details: errors,
|
|
1921
1178
|
});
|
|
1179
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1922
1180
|
}
|
|
1923
1181
|
|
|
1924
1182
|
const query_params = {};
|
|
@@ -1945,34 +1203,13 @@ class Catalog {
|
|
|
1945
1203
|
responseData = response[0];
|
|
1946
1204
|
}
|
|
1947
1205
|
|
|
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
1206
|
return response;
|
|
1967
1207
|
}
|
|
1968
1208
|
|
|
1969
1209
|
/**
|
|
1970
|
-
* @param {CatalogApplicationValidator.GetProductSellersBySlugParam} arg - Arg object.
|
|
1971
1210
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1972
1211
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
1973
|
-
* @returns {Promise<
|
|
1974
|
-
* - Success response
|
|
1975
|
-
*
|
|
1212
|
+
* @returns {Promise<ProductSizeSellersResponseV3>} - Success response
|
|
1976
1213
|
* @name getProductSellersBySlug
|
|
1977
1214
|
* @summary: List sellers
|
|
1978
1215
|
* @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 +1220,13 @@ class Catalog {
|
|
|
1983
1220
|
},
|
|
1984
1221
|
{ responseHeaders } = { responseHeaders: false }
|
|
1985
1222
|
) {
|
|
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}`,
|
|
1223
|
+
const errors = validateRequiredParams(arguments[0], ["slug", "size"]);
|
|
1224
|
+
if (errors.length > 0) {
|
|
1225
|
+
const error = new FDKClientValidationError({
|
|
1226
|
+
message: "Missing required field",
|
|
1227
|
+
details: errors,
|
|
2007
1228
|
});
|
|
1229
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2008
1230
|
}
|
|
2009
1231
|
|
|
2010
1232
|
const query_params = {};
|
|
@@ -2032,24 +1254,6 @@ class Catalog {
|
|
|
2032
1254
|
responseData = response[0];
|
|
2033
1255
|
}
|
|
2034
1256
|
|
|
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
1257
|
return response;
|
|
2054
1258
|
}
|
|
2055
1259
|
|
|
@@ -2064,7 +1268,7 @@ class Catalog {
|
|
|
2064
1268
|
* @param {string} [arg.strategy] - Sort stores on the basis of strategy.
|
|
2065
1269
|
* eg, fast-delivery, low-price, optimal.
|
|
2066
1270
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2067
|
-
* @returns {Paginator<
|
|
1271
|
+
* @returns {Paginator<ProductSizeSellersResponseV3>}
|
|
2068
1272
|
* @summary: List sellers
|
|
2069
1273
|
* @description: List all sellers offering a specific product identified by its slug and size.
|
|
2070
1274
|
*/
|
|
@@ -2092,10 +1296,9 @@ class Catalog {
|
|
|
2092
1296
|
}
|
|
2093
1297
|
|
|
2094
1298
|
/**
|
|
2095
|
-
* @param {CatalogApplicationValidator.GetProductSizesBySlugParam} arg - Arg object.
|
|
2096
1299
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2097
1300
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2098
|
-
* @returns {Promise<
|
|
1301
|
+
* @returns {Promise<ProductSizes>} - Success response
|
|
2099
1302
|
* @name getProductSizesBySlug
|
|
2100
1303
|
* @summary: List sizes
|
|
2101
1304
|
* @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 +1307,13 @@ class Catalog {
|
|
|
2104
1307
|
{ slug, storeId, requestHeaders } = { requestHeaders: {} },
|
|
2105
1308
|
{ responseHeaders } = { responseHeaders: false }
|
|
2106
1309
|
) {
|
|
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}`,
|
|
1310
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1311
|
+
if (errors.length > 0) {
|
|
1312
|
+
const error = new FDKClientValidationError({
|
|
1313
|
+
message: "Missing required field",
|
|
1314
|
+
details: errors,
|
|
2128
1315
|
});
|
|
1316
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2129
1317
|
}
|
|
2130
1318
|
|
|
2131
1319
|
const query_params = {};
|
|
@@ -2151,33 +1339,13 @@ class Catalog {
|
|
|
2151
1339
|
responseData = response[0];
|
|
2152
1340
|
}
|
|
2153
1341
|
|
|
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
1342
|
return response;
|
|
2173
1343
|
}
|
|
2174
1344
|
|
|
2175
1345
|
/**
|
|
2176
|
-
* @param {CatalogApplicationValidator.GetProductStockByIdsParam} arg - Arg object.
|
|
2177
1346
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2178
1347
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2179
|
-
* @returns {Promise<
|
|
2180
|
-
* Success response
|
|
1348
|
+
* @returns {Promise<ProductStockStatusResponse>} - Success response
|
|
2181
1349
|
* @name getProductStockByIds
|
|
2182
1350
|
* @summary: Get product stocks
|
|
2183
1351
|
* @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 +1354,6 @@ class Catalog {
|
|
|
2186
1354
|
{ itemId, alu, skuCode, ean, upc, requestHeaders } = { requestHeaders: {} },
|
|
2187
1355
|
{ responseHeaders } = { responseHeaders: false }
|
|
2188
1356
|
) {
|
|
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
1357
|
const query_params = {};
|
|
2214
1358
|
query_params["item_id"] = itemId;
|
|
2215
1359
|
query_params["alu"] = alu;
|
|
@@ -2237,34 +1381,13 @@ class Catalog {
|
|
|
2237
1381
|
responseData = response[0];
|
|
2238
1382
|
}
|
|
2239
1383
|
|
|
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
1384
|
return response;
|
|
2259
1385
|
}
|
|
2260
1386
|
|
|
2261
1387
|
/**
|
|
2262
|
-
* @param {CatalogApplicationValidator.GetProductStockForTimeByIdsParam} arg
|
|
2263
|
-
* - Arg object.
|
|
2264
|
-
*
|
|
2265
1388
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2266
1389
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2267
|
-
* @returns {Promise<
|
|
1390
|
+
* @returns {Promise<ProductStockPolling>} - Success response
|
|
2268
1391
|
* @name getProductStockForTimeByIds
|
|
2269
1392
|
* @summary: List future stock
|
|
2270
1393
|
* @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 +1396,6 @@ class Catalog {
|
|
|
2273
1396
|
{ timestamp, pageSize, pageId, requestHeaders } = { requestHeaders: {} },
|
|
2274
1397
|
{ responseHeaders } = { responseHeaders: false }
|
|
2275
1398
|
) {
|
|
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
1399
|
const query_params = {};
|
|
2301
1400
|
query_params["timestamp"] = timestamp;
|
|
2302
1401
|
query_params["page_size"] = pageSize;
|
|
@@ -2322,24 +1421,6 @@ class Catalog {
|
|
|
2322
1421
|
responseData = response[0];
|
|
2323
1422
|
}
|
|
2324
1423
|
|
|
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
1424
|
return response;
|
|
2344
1425
|
}
|
|
2345
1426
|
|
|
@@ -2347,7 +1428,7 @@ class Catalog {
|
|
|
2347
1428
|
* @param {Object} arg - Arg object.
|
|
2348
1429
|
* @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z).
|
|
2349
1430
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2350
|
-
* @returns {Paginator<
|
|
1431
|
+
* @returns {Paginator<ProductStockPolling>}
|
|
2351
1432
|
* @summary: List future stock
|
|
2352
1433
|
* @description: Get the available stock levels for all products associated with a particular sales channel at a specified future time.
|
|
2353
1434
|
*/
|
|
@@ -2373,12 +1454,9 @@ class Catalog {
|
|
|
2373
1454
|
}
|
|
2374
1455
|
|
|
2375
1456
|
/**
|
|
2376
|
-
* @param {CatalogApplicationValidator.GetProductVariantsBySlugParam} arg -
|
|
2377
|
-
* Arg object.
|
|
2378
1457
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2379
1458
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2380
|
-
* @returns {Promise<
|
|
2381
|
-
* Success response
|
|
1459
|
+
* @returns {Promise<ProductVariantsResponse>} - Success response
|
|
2382
1460
|
* @name getProductVariantsBySlug
|
|
2383
1461
|
* @summary: List product variants
|
|
2384
1462
|
* @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 +1465,13 @@ class Catalog {
|
|
|
2387
1465
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
2388
1466
|
{ responseHeaders } = { responseHeaders: false }
|
|
2389
1467
|
) {
|
|
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}`,
|
|
1468
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1469
|
+
if (errors.length > 0) {
|
|
1470
|
+
const error = new FDKClientValidationError({
|
|
1471
|
+
message: "Missing required field",
|
|
1472
|
+
details: errors,
|
|
2411
1473
|
});
|
|
1474
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2412
1475
|
}
|
|
2413
1476
|
|
|
2414
1477
|
const query_params = {};
|
|
@@ -2433,33 +1496,13 @@ class Catalog {
|
|
|
2433
1496
|
responseData = response[0];
|
|
2434
1497
|
}
|
|
2435
1498
|
|
|
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
1499
|
return response;
|
|
2455
1500
|
}
|
|
2456
1501
|
|
|
2457
1502
|
/**
|
|
2458
|
-
* @param {CatalogApplicationValidator.GetProductsParam} arg - Arg object.
|
|
2459
1503
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2460
1504
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2461
|
-
* @returns {Promise<
|
|
2462
|
-
* Success response
|
|
1505
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
2463
1506
|
* @name getProducts
|
|
2464
1507
|
* @summary: List products
|
|
2465
1508
|
* @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 +1521,6 @@ class Catalog {
|
|
|
2478
1521
|
} = { requestHeaders: {} },
|
|
2479
1522
|
{ responseHeaders } = { responseHeaders: false }
|
|
2480
1523
|
) {
|
|
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
1524
|
const query_params = {};
|
|
2504
1525
|
query_params["q"] = q;
|
|
2505
1526
|
query_params["f"] = f;
|
|
@@ -2530,24 +1551,6 @@ class Catalog {
|
|
|
2530
1551
|
responseData = response[0];
|
|
2531
1552
|
}
|
|
2532
1553
|
|
|
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
1554
|
return response;
|
|
2552
1555
|
}
|
|
2553
1556
|
|
|
@@ -2565,7 +1568,7 @@ class Catalog {
|
|
|
2565
1568
|
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
2566
1569
|
* either ascending or descending order. See the supported values below.
|
|
2567
1570
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2568
|
-
* @returns {Paginator<
|
|
1571
|
+
* @returns {Paginator<ProductListingResponse>}
|
|
2569
1572
|
* @summary: List products
|
|
2570
1573
|
* @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
1574
|
*/
|
|
@@ -2596,10 +1599,9 @@ class Catalog {
|
|
|
2596
1599
|
}
|
|
2597
1600
|
|
|
2598
1601
|
/**
|
|
2599
|
-
* @param {CatalogApplicationValidator.GetSearchResultsParam} arg - Arg object.
|
|
2600
1602
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2601
1603
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2602
|
-
* @returns {Promise<
|
|
1604
|
+
* @returns {Promise<AutoCompleteResponse>} - Success response
|
|
2603
1605
|
* @name getSearchResults
|
|
2604
1606
|
* @summary: List product, brand, category
|
|
2605
1607
|
* @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 +1610,6 @@ class Catalog {
|
|
|
2608
1610
|
{ q, requestHeaders } = { requestHeaders: {} },
|
|
2609
1611
|
{ responseHeaders } = { responseHeaders: false }
|
|
2610
1612
|
) {
|
|
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
1613
|
const query_params = {};
|
|
2634
1614
|
query_params["q"] = q;
|
|
2635
1615
|
|
|
@@ -2653,35 +1633,13 @@ class Catalog {
|
|
|
2653
1633
|
responseData = response[0];
|
|
2654
1634
|
}
|
|
2655
1635
|
|
|
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
1636
|
return response;
|
|
2675
1637
|
}
|
|
2676
1638
|
|
|
2677
1639
|
/**
|
|
2678
|
-
* @param {CatalogApplicationValidator.GetSimilarComparisonProductBySlugParam} arg
|
|
2679
|
-
* - Arg object.
|
|
2680
|
-
*
|
|
2681
1640
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2682
1641
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2683
|
-
* @returns {Promise<
|
|
2684
|
-
* Success response
|
|
1642
|
+
* @returns {Promise<ProductCompareResponse>} - Success response
|
|
2685
1643
|
* @name getSimilarComparisonProductBySlug
|
|
2686
1644
|
* @summary: List similar products
|
|
2687
1645
|
* @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 +1648,13 @@ class Catalog {
|
|
|
2690
1648
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
2691
1649
|
{ responseHeaders } = { responseHeaders: false }
|
|
2692
1650
|
) {
|
|
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}`,
|
|
1651
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
1652
|
+
if (errors.length > 0) {
|
|
1653
|
+
const error = new FDKClientValidationError({
|
|
1654
|
+
message: "Missing required field",
|
|
1655
|
+
details: errors,
|
|
2714
1656
|
});
|
|
1657
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2715
1658
|
}
|
|
2716
1659
|
|
|
2717
1660
|
const query_params = {};
|
|
@@ -2736,32 +1679,13 @@ class Catalog {
|
|
|
2736
1679
|
responseData = response[0];
|
|
2737
1680
|
}
|
|
2738
1681
|
|
|
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
1682
|
return response;
|
|
2758
1683
|
}
|
|
2759
1684
|
|
|
2760
1685
|
/**
|
|
2761
|
-
* @param {CatalogApplicationValidator.GetStoresParam} arg - Arg object.
|
|
2762
1686
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2763
1687
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2764
|
-
* @returns {Promise<
|
|
1688
|
+
* @returns {Promise<StoreListingResponse>} - Success response
|
|
2765
1689
|
* @name getStores
|
|
2766
1690
|
* @summary: List available stores
|
|
2767
1691
|
* @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 +1704,6 @@ class Catalog {
|
|
|
2780
1704
|
} = { requestHeaders: {} },
|
|
2781
1705
|
{ responseHeaders } = { responseHeaders: false }
|
|
2782
1706
|
) {
|
|
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
1707
|
const query_params = {};
|
|
2806
1708
|
query_params["page_no"] = pageNo;
|
|
2807
1709
|
query_params["page_size"] = pageSize;
|
|
@@ -2832,24 +1734,6 @@ class Catalog {
|
|
|
2832
1734
|
responseData = response[0];
|
|
2833
1735
|
}
|
|
2834
1736
|
|
|
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
1737
|
return response;
|
|
2854
1738
|
}
|
|
2855
1739
|
|
|
@@ -2865,7 +1749,7 @@ class Catalog {
|
|
|
2865
1749
|
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2866
1750
|
* one wants to retrieve the nearest stores, e.g. 19.1174114.
|
|
2867
1751
|
* @param {string} [arg.tags] - Search stores based on tags.
|
|
2868
|
-
* @returns {Paginator<
|
|
1752
|
+
* @returns {Paginator<StoreListingResponse>}
|
|
2869
1753
|
* @summary: List available stores
|
|
2870
1754
|
* @description: List all stores associated with the sales channel.
|
|
2871
1755
|
*/
|
|
@@ -2904,10 +1788,9 @@ class Catalog {
|
|
|
2904
1788
|
}
|
|
2905
1789
|
|
|
2906
1790
|
/**
|
|
2907
|
-
* @param {CatalogApplicationValidator.UnfollowByIdParam} arg - Arg object.
|
|
2908
1791
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2909
1792
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
2910
|
-
* @returns {Promise<
|
|
1793
|
+
* @returns {Promise<FollowPostResponse>} - Success response
|
|
2911
1794
|
* @name unfollowById
|
|
2912
1795
|
* @summary: Delete item, brand, product
|
|
2913
1796
|
* @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 +1799,16 @@ class Catalog {
|
|
|
2916
1799
|
{ collectionType, collectionId, requestHeaders } = { requestHeaders: {} },
|
|
2917
1800
|
{ responseHeaders } = { responseHeaders: false }
|
|
2918
1801
|
) {
|
|
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}`,
|
|
1802
|
+
const errors = validateRequiredParams(arguments[0], [
|
|
1803
|
+
"collectionType",
|
|
1804
|
+
"collectionId",
|
|
1805
|
+
]);
|
|
1806
|
+
if (errors.length > 0) {
|
|
1807
|
+
const error = new FDKClientValidationError({
|
|
1808
|
+
message: "Missing required field",
|
|
1809
|
+
details: errors,
|
|
2938
1810
|
});
|
|
1811
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2939
1812
|
}
|
|
2940
1813
|
|
|
2941
1814
|
const query_params = {};
|
|
@@ -2960,24 +1833,6 @@ class Catalog {
|
|
|
2960
1833
|
responseData = response[0];
|
|
2961
1834
|
}
|
|
2962
1835
|
|
|
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
1836
|
return response;
|
|
2982
1837
|
}
|
|
2983
1838
|
}
|