@gofynd/fdk-client-javascript 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const CatalogValidator = require("./CatalogPlatformApplicationValidator");
|
|
5
|
+
const CatalogModel = require("./CatalogPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Catalog {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -12,16 +14,15 @@ class Catalog {
|
|
|
12
14
|
/**
|
|
13
15
|
* @param {Object} arg - Arg object.
|
|
14
16
|
* @param {string} arg.id - A `id` is a unique identifier for a particular
|
|
15
|
-
* detail. Pass the `id` of the keywords which you want to
|
|
16
|
-
* @
|
|
17
|
-
* @summary:
|
|
18
|
-
* @description:
|
|
17
|
+
* detail. Pass the `id` of the keywords which you want to retrieve.
|
|
18
|
+
* @returns {Promise<GetSearchWordsDetailResponse>} - Success response
|
|
19
|
+
* @summary: Get a Search Keywords Details
|
|
20
|
+
* @description: Get the details of a words by its `id`. If successful, returns a Collection resource in the response body specified in `GetSearchWordsDetailResponseSchema`
|
|
19
21
|
*/
|
|
20
|
-
|
|
21
|
-
const { error } = CatalogValidator.
|
|
22
|
+
async getSearchKeywords({ id } = {}) {
|
|
23
|
+
const { error } = CatalogValidator.getSearchKeywords().validate(
|
|
22
24
|
{
|
|
23
25
|
id,
|
|
24
|
-
body,
|
|
25
26
|
},
|
|
26
27
|
{ abortEarly: false, allowUnknown: true }
|
|
27
28
|
);
|
|
@@ -29,28 +30,63 @@ class Catalog {
|
|
|
29
30
|
return Promise.reject(new FDKClientValidationError(error));
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
// Showing warrnings if extra unknown parameters are found
|
|
34
|
+
const { error: warrning } = CatalogValidator.getSearchKeywords().validate(
|
|
35
|
+
{
|
|
36
|
+
id,
|
|
37
|
+
},
|
|
38
|
+
{ abortEarly: false, allowUnknown: false }
|
|
39
|
+
);
|
|
40
|
+
if (warrning) {
|
|
41
|
+
Logger({
|
|
42
|
+
level: "WARN",
|
|
43
|
+
message: "Parameter Validation warrnings for getSearchKeywords",
|
|
44
|
+
});
|
|
45
|
+
Logger({ level: "WARN", message: warrning });
|
|
46
|
+
}
|
|
47
|
+
|
|
32
48
|
const query_params = {};
|
|
33
49
|
|
|
34
|
-
|
|
50
|
+
const response = await PlatformAPIClient.execute(
|
|
35
51
|
this.config,
|
|
36
|
-
"
|
|
52
|
+
"get",
|
|
37
53
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/${id}/`,
|
|
38
54
|
query_params,
|
|
39
|
-
|
|
55
|
+
undefined
|
|
40
56
|
);
|
|
57
|
+
|
|
58
|
+
const {
|
|
59
|
+
error: res_error,
|
|
60
|
+
} = CatalogModel.GetSearchWordsDetailResponse().validate(response, {
|
|
61
|
+
abortEarly: false,
|
|
62
|
+
allowUnknown: false,
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
if (res_error) {
|
|
66
|
+
Logger({
|
|
67
|
+
level: "WARN",
|
|
68
|
+
message: "Response Validation Warnnings for getSearchKeywords",
|
|
69
|
+
});
|
|
70
|
+
Logger({ level: "WARN", message: res_error });
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return response;
|
|
41
74
|
}
|
|
42
75
|
|
|
43
76
|
/**
|
|
44
77
|
* @param {Object} arg - Arg object.
|
|
45
78
|
* @param {string} arg.id - A `id` is a unique identifier for a particular
|
|
46
|
-
* detail. Pass the `id` of the keywords which you want to
|
|
47
|
-
* @
|
|
48
|
-
* @
|
|
79
|
+
* detail. Pass the `id` of the keywords which you want to delete.
|
|
80
|
+
* @param {CreateSearchKeyword} arg.body
|
|
81
|
+
* @returns {Promise<GetSearchWordsData>} - Success response
|
|
82
|
+
* @summary: Update Search Keyword
|
|
83
|
+
* @description: Update Search Keyword by its id. On successful request, returns the updated collection
|
|
49
84
|
*/
|
|
50
|
-
|
|
51
|
-
const { error } = CatalogValidator.
|
|
85
|
+
async updateSearchKeywords({ id, body } = {}) {
|
|
86
|
+
const { error } = CatalogValidator.updateSearchKeywords().validate(
|
|
52
87
|
{
|
|
53
88
|
id,
|
|
89
|
+
body,
|
|
54
90
|
},
|
|
55
91
|
{ abortEarly: false, allowUnknown: true }
|
|
56
92
|
);
|
|
@@ -58,25 +94,61 @@ class Catalog {
|
|
|
58
94
|
return Promise.reject(new FDKClientValidationError(error));
|
|
59
95
|
}
|
|
60
96
|
|
|
97
|
+
// Showing warrnings if extra unknown parameters are found
|
|
98
|
+
const {
|
|
99
|
+
error: warrning,
|
|
100
|
+
} = CatalogValidator.updateSearchKeywords().validate(
|
|
101
|
+
{
|
|
102
|
+
id,
|
|
103
|
+
body,
|
|
104
|
+
},
|
|
105
|
+
{ abortEarly: false, allowUnknown: false }
|
|
106
|
+
);
|
|
107
|
+
if (warrning) {
|
|
108
|
+
Logger({
|
|
109
|
+
level: "WARN",
|
|
110
|
+
message: "Parameter Validation warrnings for updateSearchKeywords",
|
|
111
|
+
});
|
|
112
|
+
Logger({ level: "WARN", message: warrning });
|
|
113
|
+
}
|
|
114
|
+
|
|
61
115
|
const query_params = {};
|
|
62
116
|
|
|
63
|
-
|
|
117
|
+
const response = await PlatformAPIClient.execute(
|
|
64
118
|
this.config,
|
|
65
|
-
"
|
|
119
|
+
"put",
|
|
66
120
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/${id}/`,
|
|
67
121
|
query_params,
|
|
68
|
-
|
|
122
|
+
body
|
|
69
123
|
);
|
|
124
|
+
|
|
125
|
+
const {
|
|
126
|
+
error: res_error,
|
|
127
|
+
} = CatalogModel.GetSearchWordsData().validate(response, {
|
|
128
|
+
abortEarly: false,
|
|
129
|
+
allowUnknown: false,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
if (res_error) {
|
|
133
|
+
Logger({
|
|
134
|
+
level: "WARN",
|
|
135
|
+
message: "Response Validation Warnnings for updateSearchKeywords",
|
|
136
|
+
});
|
|
137
|
+
Logger({ level: "WARN", message: res_error });
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
return response;
|
|
70
141
|
}
|
|
71
142
|
|
|
72
143
|
/**
|
|
73
144
|
* @param {Object} arg - Arg object.
|
|
74
145
|
* @param {string} arg.id - A `id` is a unique identifier for a particular
|
|
75
146
|
* detail. Pass the `id` of the keywords which you want to delete.
|
|
147
|
+
* @returns {Promise<DeleteResponse>} - Success response
|
|
76
148
|
* @summary: Delete a Search Keywords
|
|
77
149
|
* @description: Delete a keywords by it's id. Returns an object that tells whether the keywords was deleted successfully
|
|
78
150
|
*/
|
|
79
|
-
deleteSearchKeywords({ id } = {}) {
|
|
151
|
+
async deleteSearchKeywords({ id } = {}) {
|
|
80
152
|
const { error } = CatalogValidator.deleteSearchKeywords().validate(
|
|
81
153
|
{
|
|
82
154
|
id,
|
|
@@ -87,23 +159,119 @@ class Catalog {
|
|
|
87
159
|
return Promise.reject(new FDKClientValidationError(error));
|
|
88
160
|
}
|
|
89
161
|
|
|
162
|
+
// Showing warrnings if extra unknown parameters are found
|
|
163
|
+
const {
|
|
164
|
+
error: warrning,
|
|
165
|
+
} = CatalogValidator.deleteSearchKeywords().validate(
|
|
166
|
+
{
|
|
167
|
+
id,
|
|
168
|
+
},
|
|
169
|
+
{ abortEarly: false, allowUnknown: false }
|
|
170
|
+
);
|
|
171
|
+
if (warrning) {
|
|
172
|
+
Logger({
|
|
173
|
+
level: "WARN",
|
|
174
|
+
message: "Parameter Validation warrnings for deleteSearchKeywords",
|
|
175
|
+
});
|
|
176
|
+
Logger({ level: "WARN", message: warrning });
|
|
177
|
+
}
|
|
178
|
+
|
|
90
179
|
const query_params = {};
|
|
91
180
|
|
|
92
|
-
|
|
181
|
+
const response = await PlatformAPIClient.execute(
|
|
93
182
|
this.config,
|
|
94
183
|
"delete",
|
|
95
184
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/${id}/`,
|
|
96
185
|
query_params,
|
|
97
186
|
undefined
|
|
98
187
|
);
|
|
188
|
+
|
|
189
|
+
const {
|
|
190
|
+
error: res_error,
|
|
191
|
+
} = CatalogModel.DeleteResponse().validate(response, {
|
|
192
|
+
abortEarly: false,
|
|
193
|
+
allowUnknown: false,
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
if (res_error) {
|
|
197
|
+
Logger({
|
|
198
|
+
level: "WARN",
|
|
199
|
+
message: "Response Validation Warnnings for deleteSearchKeywords",
|
|
200
|
+
});
|
|
201
|
+
Logger({ level: "WARN", message: res_error });
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return response;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @param {Object} arg - Arg object.
|
|
209
|
+
* @param {CreateSearchKeyword} arg.body
|
|
210
|
+
* @returns {Promise<GetSearchWordsData>} - Success response
|
|
211
|
+
* @summary: Add a Custom Search Keywords
|
|
212
|
+
* @description: Create a Custom Search Keywords. See `CreateSearchKeywordSchema` for the list of attributes needed to create a mapping and /collections/query-options for the available options to create a rule. On successful request, returns a paginated list of collections specified in `CreateSearchKeywordSchema`
|
|
213
|
+
*/
|
|
214
|
+
async createCustomKeyword({ body } = {}) {
|
|
215
|
+
const { error } = CatalogValidator.createCustomKeyword().validate(
|
|
216
|
+
{
|
|
217
|
+
body,
|
|
218
|
+
},
|
|
219
|
+
{ abortEarly: false, allowUnknown: true }
|
|
220
|
+
);
|
|
221
|
+
if (error) {
|
|
222
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// Showing warrnings if extra unknown parameters are found
|
|
226
|
+
const { error: warrning } = CatalogValidator.createCustomKeyword().validate(
|
|
227
|
+
{
|
|
228
|
+
body,
|
|
229
|
+
},
|
|
230
|
+
{ abortEarly: false, allowUnknown: false }
|
|
231
|
+
);
|
|
232
|
+
if (warrning) {
|
|
233
|
+
Logger({
|
|
234
|
+
level: "WARN",
|
|
235
|
+
message: "Parameter Validation warrnings for createCustomKeyword",
|
|
236
|
+
});
|
|
237
|
+
Logger({ level: "WARN", message: warrning });
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
const query_params = {};
|
|
241
|
+
|
|
242
|
+
const response = await PlatformAPIClient.execute(
|
|
243
|
+
this.config,
|
|
244
|
+
"post",
|
|
245
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/`,
|
|
246
|
+
query_params,
|
|
247
|
+
body
|
|
248
|
+
);
|
|
249
|
+
|
|
250
|
+
const {
|
|
251
|
+
error: res_error,
|
|
252
|
+
} = CatalogModel.GetSearchWordsData().validate(response, {
|
|
253
|
+
abortEarly: false,
|
|
254
|
+
allowUnknown: false,
|
|
255
|
+
});
|
|
256
|
+
|
|
257
|
+
if (res_error) {
|
|
258
|
+
Logger({
|
|
259
|
+
level: "WARN",
|
|
260
|
+
message: "Response Validation Warnnings for createCustomKeyword",
|
|
261
|
+
});
|
|
262
|
+
Logger({ level: "WARN", message: res_error });
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
return response;
|
|
99
266
|
}
|
|
100
267
|
|
|
101
268
|
/**
|
|
102
269
|
* @param {Object} arg - Arg object.
|
|
270
|
+
* @returns {Promise<GetSearchWordsResponse>} - Success response
|
|
103
271
|
* @summary: List all Search Custom Keyword Listing
|
|
104
272
|
* @description: Custom Search Keyword allows you to map conditions with keywords to give you the ultimate results
|
|
105
273
|
*/
|
|
106
|
-
getAllSearchKeyword({} = {}) {
|
|
274
|
+
async getAllSearchKeyword({} = {}) {
|
|
107
275
|
const { error } = CatalogValidator.getAllSearchKeyword().validate(
|
|
108
276
|
{},
|
|
109
277
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -112,27 +280,59 @@ class Catalog {
|
|
|
112
280
|
return Promise.reject(new FDKClientValidationError(error));
|
|
113
281
|
}
|
|
114
282
|
|
|
283
|
+
// Showing warrnings if extra unknown parameters are found
|
|
284
|
+
const { error: warrning } = CatalogValidator.getAllSearchKeyword().validate(
|
|
285
|
+
{},
|
|
286
|
+
{ abortEarly: false, allowUnknown: false }
|
|
287
|
+
);
|
|
288
|
+
if (warrning) {
|
|
289
|
+
Logger({
|
|
290
|
+
level: "WARN",
|
|
291
|
+
message: "Parameter Validation warrnings for getAllSearchKeyword",
|
|
292
|
+
});
|
|
293
|
+
Logger({ level: "WARN", message: warrning });
|
|
294
|
+
}
|
|
295
|
+
|
|
115
296
|
const query_params = {};
|
|
116
297
|
|
|
117
|
-
|
|
298
|
+
const response = await PlatformAPIClient.execute(
|
|
118
299
|
this.config,
|
|
119
300
|
"get",
|
|
120
301
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/keyword/`,
|
|
121
302
|
query_params,
|
|
122
303
|
undefined
|
|
123
304
|
);
|
|
305
|
+
|
|
306
|
+
const {
|
|
307
|
+
error: res_error,
|
|
308
|
+
} = CatalogModel.GetSearchWordsResponse().validate(response, {
|
|
309
|
+
abortEarly: false,
|
|
310
|
+
allowUnknown: false,
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
if (res_error) {
|
|
314
|
+
Logger({
|
|
315
|
+
level: "WARN",
|
|
316
|
+
message: "Response Validation Warnnings for getAllSearchKeyword",
|
|
317
|
+
});
|
|
318
|
+
Logger({ level: "WARN", message: res_error });
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return response;
|
|
124
322
|
}
|
|
125
323
|
|
|
126
324
|
/**
|
|
127
325
|
* @param {Object} arg - Arg object.
|
|
128
|
-
* @param {
|
|
129
|
-
*
|
|
130
|
-
* @
|
|
326
|
+
* @param {string} arg.id - A `id` is a unique identifier for a particular
|
|
327
|
+
* detail. Pass the `id` of the keywords which you want to retrieve.
|
|
328
|
+
* @returns {Promise<GetAutocompleteWordsResponse>} - Success response
|
|
329
|
+
* @summary: Get a Autocomplete Keywords Details
|
|
330
|
+
* @description: Get the details of a words by its `id`. If successful, returns a keywords resource in the response body specified in `GetAutocompleteWordsResponseSchema`
|
|
131
331
|
*/
|
|
132
|
-
|
|
133
|
-
const { error } = CatalogValidator.
|
|
332
|
+
async getAutocompleteKeywordDetail({ id } = {}) {
|
|
333
|
+
const { error } = CatalogValidator.getAutocompleteKeywordDetail().validate(
|
|
134
334
|
{
|
|
135
|
-
|
|
335
|
+
id,
|
|
136
336
|
},
|
|
137
337
|
{ abortEarly: false, allowUnknown: true }
|
|
138
338
|
);
|
|
@@ -140,15 +340,51 @@ class Catalog {
|
|
|
140
340
|
return Promise.reject(new FDKClientValidationError(error));
|
|
141
341
|
}
|
|
142
342
|
|
|
343
|
+
// Showing warrnings if extra unknown parameters are found
|
|
344
|
+
const {
|
|
345
|
+
error: warrning,
|
|
346
|
+
} = CatalogValidator.getAutocompleteKeywordDetail().validate(
|
|
347
|
+
{
|
|
348
|
+
id,
|
|
349
|
+
},
|
|
350
|
+
{ abortEarly: false, allowUnknown: false }
|
|
351
|
+
);
|
|
352
|
+
if (warrning) {
|
|
353
|
+
Logger({
|
|
354
|
+
level: "WARN",
|
|
355
|
+
message:
|
|
356
|
+
"Parameter Validation warrnings for getAutocompleteKeywordDetail",
|
|
357
|
+
});
|
|
358
|
+
Logger({ level: "WARN", message: warrning });
|
|
359
|
+
}
|
|
360
|
+
|
|
143
361
|
const query_params = {};
|
|
144
362
|
|
|
145
|
-
|
|
363
|
+
const response = await PlatformAPIClient.execute(
|
|
146
364
|
this.config,
|
|
147
|
-
"
|
|
148
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/
|
|
365
|
+
"get",
|
|
366
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/${id}/`,
|
|
149
367
|
query_params,
|
|
150
|
-
|
|
368
|
+
undefined
|
|
151
369
|
);
|
|
370
|
+
|
|
371
|
+
const {
|
|
372
|
+
error: res_error,
|
|
373
|
+
} = CatalogModel.GetAutocompleteWordsResponse().validate(response, {
|
|
374
|
+
abortEarly: false,
|
|
375
|
+
allowUnknown: false,
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
if (res_error) {
|
|
379
|
+
Logger({
|
|
380
|
+
level: "WARN",
|
|
381
|
+
message:
|
|
382
|
+
"Response Validation Warnnings for getAutocompleteKeywordDetail",
|
|
383
|
+
});
|
|
384
|
+
Logger({ level: "WARN", message: res_error });
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return response;
|
|
152
388
|
}
|
|
153
389
|
|
|
154
390
|
/**
|
|
@@ -156,10 +392,11 @@ class Catalog {
|
|
|
156
392
|
* @param {string} arg.id - A `id` is a unique identifier for a particular
|
|
157
393
|
* detail. Pass the `id` of the keywords which you want to delete.
|
|
158
394
|
* @param {CreateAutocompleteKeyword} arg.body
|
|
395
|
+
* @returns {Promise<GetAutocompleteWordsResponse>} - Success response
|
|
159
396
|
* @summary: Create & Update Autocomplete Keyword
|
|
160
397
|
* @description: Update a mapping by it's id. On successful request, returns the updated Keyword mapping
|
|
161
398
|
*/
|
|
162
|
-
updateAutocompleteKeyword({ id, body } = {}) {
|
|
399
|
+
async updateAutocompleteKeyword({ id, body } = {}) {
|
|
163
400
|
const { error } = CatalogValidator.updateAutocompleteKeyword().validate(
|
|
164
401
|
{
|
|
165
402
|
id,
|
|
@@ -171,26 +408,62 @@ class Catalog {
|
|
|
171
408
|
return Promise.reject(new FDKClientValidationError(error));
|
|
172
409
|
}
|
|
173
410
|
|
|
411
|
+
// Showing warrnings if extra unknown parameters are found
|
|
412
|
+
const {
|
|
413
|
+
error: warrning,
|
|
414
|
+
} = CatalogValidator.updateAutocompleteKeyword().validate(
|
|
415
|
+
{
|
|
416
|
+
id,
|
|
417
|
+
body,
|
|
418
|
+
},
|
|
419
|
+
{ abortEarly: false, allowUnknown: false }
|
|
420
|
+
);
|
|
421
|
+
if (warrning) {
|
|
422
|
+
Logger({
|
|
423
|
+
level: "WARN",
|
|
424
|
+
message: "Parameter Validation warrnings for updateAutocompleteKeyword",
|
|
425
|
+
});
|
|
426
|
+
Logger({ level: "WARN", message: warrning });
|
|
427
|
+
}
|
|
428
|
+
|
|
174
429
|
const query_params = {};
|
|
175
430
|
|
|
176
|
-
|
|
431
|
+
const response = await PlatformAPIClient.execute(
|
|
177
432
|
this.config,
|
|
178
433
|
"put",
|
|
179
434
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/${id}/`,
|
|
180
435
|
query_params,
|
|
181
436
|
body
|
|
182
437
|
);
|
|
438
|
+
|
|
439
|
+
const {
|
|
440
|
+
error: res_error,
|
|
441
|
+
} = CatalogModel.GetAutocompleteWordsResponse().validate(response, {
|
|
442
|
+
abortEarly: false,
|
|
443
|
+
allowUnknown: false,
|
|
444
|
+
});
|
|
445
|
+
|
|
446
|
+
if (res_error) {
|
|
447
|
+
Logger({
|
|
448
|
+
level: "WARN",
|
|
449
|
+
message: "Response Validation Warnnings for updateAutocompleteKeyword",
|
|
450
|
+
});
|
|
451
|
+
Logger({ level: "WARN", message: res_error });
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
return response;
|
|
183
455
|
}
|
|
184
456
|
|
|
185
457
|
/**
|
|
186
458
|
* @param {Object} arg - Arg object.
|
|
187
459
|
* @param {string} arg.id - A `id` is a unique identifier for a particular
|
|
188
|
-
* detail. Pass the `id` of the keywords which you want to
|
|
189
|
-
* @
|
|
190
|
-
* @
|
|
460
|
+
* detail. Pass the `id` of the keywords which you want to delete.
|
|
461
|
+
* @returns {Promise<DeleteResponse>} - Success response
|
|
462
|
+
* @summary: Delete a Autocomplete Keywords
|
|
463
|
+
* @description: Delete a keywords by it's id. Returns an object that tells whether the keywords was deleted successfully
|
|
191
464
|
*/
|
|
192
|
-
|
|
193
|
-
const { error } = CatalogValidator.
|
|
465
|
+
async deleteAutocompleteKeyword({ id } = {}) {
|
|
466
|
+
const { error } = CatalogValidator.deleteAutocompleteKeyword().validate(
|
|
194
467
|
{
|
|
195
468
|
id,
|
|
196
469
|
},
|
|
@@ -200,28 +473,62 @@ class Catalog {
|
|
|
200
473
|
return Promise.reject(new FDKClientValidationError(error));
|
|
201
474
|
}
|
|
202
475
|
|
|
476
|
+
// Showing warrnings if extra unknown parameters are found
|
|
477
|
+
const {
|
|
478
|
+
error: warrning,
|
|
479
|
+
} = CatalogValidator.deleteAutocompleteKeyword().validate(
|
|
480
|
+
{
|
|
481
|
+
id,
|
|
482
|
+
},
|
|
483
|
+
{ abortEarly: false, allowUnknown: false }
|
|
484
|
+
);
|
|
485
|
+
if (warrning) {
|
|
486
|
+
Logger({
|
|
487
|
+
level: "WARN",
|
|
488
|
+
message: "Parameter Validation warrnings for deleteAutocompleteKeyword",
|
|
489
|
+
});
|
|
490
|
+
Logger({ level: "WARN", message: warrning });
|
|
491
|
+
}
|
|
492
|
+
|
|
203
493
|
const query_params = {};
|
|
204
494
|
|
|
205
|
-
|
|
495
|
+
const response = await PlatformAPIClient.execute(
|
|
206
496
|
this.config,
|
|
207
|
-
"
|
|
497
|
+
"delete",
|
|
208
498
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/${id}/`,
|
|
209
499
|
query_params,
|
|
210
500
|
undefined
|
|
211
501
|
);
|
|
502
|
+
|
|
503
|
+
const {
|
|
504
|
+
error: res_error,
|
|
505
|
+
} = CatalogModel.DeleteResponse().validate(response, {
|
|
506
|
+
abortEarly: false,
|
|
507
|
+
allowUnknown: false,
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
if (res_error) {
|
|
511
|
+
Logger({
|
|
512
|
+
level: "WARN",
|
|
513
|
+
message: "Response Validation Warnnings for deleteAutocompleteKeyword",
|
|
514
|
+
});
|
|
515
|
+
Logger({ level: "WARN", message: res_error });
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
return response;
|
|
212
519
|
}
|
|
213
520
|
|
|
214
521
|
/**
|
|
215
522
|
* @param {Object} arg - Arg object.
|
|
216
|
-
* @param {
|
|
217
|
-
*
|
|
218
|
-
* @summary:
|
|
219
|
-
* @description:
|
|
523
|
+
* @param {CreateAutocompleteKeyword} arg.body
|
|
524
|
+
* @returns {Promise<CreateAutocompleteWordsResponse>} - Success response
|
|
525
|
+
* @summary: Add a Custom Autocomplete Keywords
|
|
526
|
+
* @description: Create a Custom Autocomplete Keywords. See `CreateAutocompleteKeywordSchema` for the list of attributes needed to create a mapping and /collections/query-options for the available options to create a rule. On successful request, returns a paginated list of collections specified in `CreateAutocompleteKeywordSchema`
|
|
220
527
|
*/
|
|
221
|
-
|
|
222
|
-
const { error } = CatalogValidator.
|
|
528
|
+
async createCustomAutocompleteRule({ body } = {}) {
|
|
529
|
+
const { error } = CatalogValidator.createCustomAutocompleteRule().validate(
|
|
223
530
|
{
|
|
224
|
-
|
|
531
|
+
body,
|
|
225
532
|
},
|
|
226
533
|
{ abortEarly: false, allowUnknown: true }
|
|
227
534
|
);
|
|
@@ -229,23 +536,60 @@ class Catalog {
|
|
|
229
536
|
return Promise.reject(new FDKClientValidationError(error));
|
|
230
537
|
}
|
|
231
538
|
|
|
539
|
+
// Showing warrnings if extra unknown parameters are found
|
|
540
|
+
const {
|
|
541
|
+
error: warrning,
|
|
542
|
+
} = CatalogValidator.createCustomAutocompleteRule().validate(
|
|
543
|
+
{
|
|
544
|
+
body,
|
|
545
|
+
},
|
|
546
|
+
{ abortEarly: false, allowUnknown: false }
|
|
547
|
+
);
|
|
548
|
+
if (warrning) {
|
|
549
|
+
Logger({
|
|
550
|
+
level: "WARN",
|
|
551
|
+
message:
|
|
552
|
+
"Parameter Validation warrnings for createCustomAutocompleteRule",
|
|
553
|
+
});
|
|
554
|
+
Logger({ level: "WARN", message: warrning });
|
|
555
|
+
}
|
|
556
|
+
|
|
232
557
|
const query_params = {};
|
|
233
558
|
|
|
234
|
-
|
|
559
|
+
const response = await PlatformAPIClient.execute(
|
|
235
560
|
this.config,
|
|
236
|
-
"
|
|
237
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete
|
|
561
|
+
"post",
|
|
562
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/`,
|
|
238
563
|
query_params,
|
|
239
|
-
|
|
564
|
+
body
|
|
240
565
|
);
|
|
566
|
+
|
|
567
|
+
const {
|
|
568
|
+
error: res_error,
|
|
569
|
+
} = CatalogModel.CreateAutocompleteWordsResponse().validate(response, {
|
|
570
|
+
abortEarly: false,
|
|
571
|
+
allowUnknown: false,
|
|
572
|
+
});
|
|
573
|
+
|
|
574
|
+
if (res_error) {
|
|
575
|
+
Logger({
|
|
576
|
+
level: "WARN",
|
|
577
|
+
message:
|
|
578
|
+
"Response Validation Warnnings for createCustomAutocompleteRule",
|
|
579
|
+
});
|
|
580
|
+
Logger({ level: "WARN", message: res_error });
|
|
581
|
+
}
|
|
582
|
+
|
|
583
|
+
return response;
|
|
241
584
|
}
|
|
242
585
|
|
|
243
586
|
/**
|
|
244
587
|
* @param {Object} arg - Arg object.
|
|
588
|
+
* @returns {Promise<GetAutocompleteWordsResponse>} - Success response
|
|
245
589
|
* @summary: List all Autocomplete Keyword Listing
|
|
246
590
|
* @description: Custom Autocomplete Keyword allows you to map conditions with keywords to give you the ultimate results
|
|
247
591
|
*/
|
|
248
|
-
getAutocompleteConfig({} = {}) {
|
|
592
|
+
async getAutocompleteConfig({} = {}) {
|
|
249
593
|
const { error } = CatalogValidator.getAutocompleteConfig().validate(
|
|
250
594
|
{},
|
|
251
595
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -254,27 +598,60 @@ class Catalog {
|
|
|
254
598
|
return Promise.reject(new FDKClientValidationError(error));
|
|
255
599
|
}
|
|
256
600
|
|
|
601
|
+
// Showing warrnings if extra unknown parameters are found
|
|
602
|
+
const {
|
|
603
|
+
error: warrning,
|
|
604
|
+
} = CatalogValidator.getAutocompleteConfig().validate(
|
|
605
|
+
{},
|
|
606
|
+
{ abortEarly: false, allowUnknown: false }
|
|
607
|
+
);
|
|
608
|
+
if (warrning) {
|
|
609
|
+
Logger({
|
|
610
|
+
level: "WARN",
|
|
611
|
+
message: "Parameter Validation warrnings for getAutocompleteConfig",
|
|
612
|
+
});
|
|
613
|
+
Logger({ level: "WARN", message: warrning });
|
|
614
|
+
}
|
|
615
|
+
|
|
257
616
|
const query_params = {};
|
|
258
617
|
|
|
259
|
-
|
|
618
|
+
const response = await PlatformAPIClient.execute(
|
|
260
619
|
this.config,
|
|
261
620
|
"get",
|
|
262
621
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/search/autocomplete/`,
|
|
263
622
|
query_params,
|
|
264
623
|
undefined
|
|
265
624
|
);
|
|
625
|
+
|
|
626
|
+
const {
|
|
627
|
+
error: res_error,
|
|
628
|
+
} = CatalogModel.GetAutocompleteWordsResponse().validate(response, {
|
|
629
|
+
abortEarly: false,
|
|
630
|
+
allowUnknown: false,
|
|
631
|
+
});
|
|
632
|
+
|
|
633
|
+
if (res_error) {
|
|
634
|
+
Logger({
|
|
635
|
+
level: "WARN",
|
|
636
|
+
message: "Response Validation Warnnings for getAutocompleteConfig",
|
|
637
|
+
});
|
|
638
|
+
Logger({ level: "WARN", message: res_error });
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
return response;
|
|
266
642
|
}
|
|
267
643
|
|
|
268
644
|
/**
|
|
269
645
|
* @param {Object} arg - Arg object.
|
|
270
|
-
* @param {
|
|
271
|
-
* @
|
|
272
|
-
* @
|
|
646
|
+
* @param {string} arg.itemId - Product id for a particular product.
|
|
647
|
+
* @returns {Promise<OwnerAppItemResponse>} - Success response
|
|
648
|
+
* @summary: Get company application product data.
|
|
649
|
+
* @description: Products are the core resource of an application. If successful, returns a Company Application Product resource in the response body depending upon filter sent.
|
|
273
650
|
*/
|
|
274
|
-
|
|
275
|
-
const { error } = CatalogValidator.
|
|
651
|
+
async getAppProduct({ itemId } = {}) {
|
|
652
|
+
const { error } = CatalogValidator.getAppProduct().validate(
|
|
276
653
|
{
|
|
277
|
-
|
|
654
|
+
itemId,
|
|
278
655
|
},
|
|
279
656
|
{ abortEarly: false, allowUnknown: true }
|
|
280
657
|
);
|
|
@@ -282,25 +659,58 @@ class Catalog {
|
|
|
282
659
|
return Promise.reject(new FDKClientValidationError(error));
|
|
283
660
|
}
|
|
284
661
|
|
|
662
|
+
// Showing warrnings if extra unknown parameters are found
|
|
663
|
+
const { error: warrning } = CatalogValidator.getAppProduct().validate(
|
|
664
|
+
{
|
|
665
|
+
itemId,
|
|
666
|
+
},
|
|
667
|
+
{ abortEarly: false, allowUnknown: false }
|
|
668
|
+
);
|
|
669
|
+
if (warrning) {
|
|
670
|
+
Logger({
|
|
671
|
+
level: "WARN",
|
|
672
|
+
message: "Parameter Validation warrnings for getAppProduct",
|
|
673
|
+
});
|
|
674
|
+
Logger({ level: "WARN", message: warrning });
|
|
675
|
+
}
|
|
676
|
+
|
|
285
677
|
const query_params = {};
|
|
286
678
|
|
|
287
|
-
|
|
679
|
+
const response = await PlatformAPIClient.execute(
|
|
288
680
|
this.config,
|
|
289
|
-
"
|
|
290
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
681
|
+
"get",
|
|
682
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product/${itemId}/`,
|
|
291
683
|
query_params,
|
|
292
|
-
|
|
684
|
+
undefined
|
|
293
685
|
);
|
|
686
|
+
|
|
687
|
+
const {
|
|
688
|
+
error: res_error,
|
|
689
|
+
} = CatalogModel.OwnerAppItemResponse().validate(response, {
|
|
690
|
+
abortEarly: false,
|
|
691
|
+
allowUnknown: false,
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
if (res_error) {
|
|
695
|
+
Logger({
|
|
696
|
+
level: "WARN",
|
|
697
|
+
message: "Response Validation Warnnings for getAppProduct",
|
|
698
|
+
});
|
|
699
|
+
Logger({ level: "WARN", message: res_error });
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
return response;
|
|
294
703
|
}
|
|
295
704
|
|
|
296
705
|
/**
|
|
297
706
|
* @param {Object} arg - Arg object.
|
|
298
707
|
* @param {string} arg.itemId - Product id for which the custom_meta is associated.
|
|
299
708
|
* @param {ApplicationItemMeta} arg.body
|
|
709
|
+
* @returns {Promise<SuccessResponse1>} - Success response
|
|
300
710
|
* @summary: Update a single custom meta.
|
|
301
711
|
* @description: This API helps to update data associated to a item custom meta.
|
|
302
712
|
*/
|
|
303
|
-
updateAppProduct({ itemId, body } = {}) {
|
|
713
|
+
async updateAppProduct({ itemId, body } = {}) {
|
|
304
714
|
const { error } = CatalogValidator.updateAppProduct().validate(
|
|
305
715
|
{
|
|
306
716
|
itemId,
|
|
@@ -312,27 +722,65 @@ class Catalog {
|
|
|
312
722
|
return Promise.reject(new FDKClientValidationError(error));
|
|
313
723
|
}
|
|
314
724
|
|
|
725
|
+
// Showing warrnings if extra unknown parameters are found
|
|
726
|
+
const { error: warrning } = CatalogValidator.updateAppProduct().validate(
|
|
727
|
+
{
|
|
728
|
+
itemId,
|
|
729
|
+
body,
|
|
730
|
+
},
|
|
731
|
+
{ abortEarly: false, allowUnknown: false }
|
|
732
|
+
);
|
|
733
|
+
if (warrning) {
|
|
734
|
+
Logger({
|
|
735
|
+
level: "WARN",
|
|
736
|
+
message: "Parameter Validation warrnings for updateAppProduct",
|
|
737
|
+
});
|
|
738
|
+
Logger({ level: "WARN", message: warrning });
|
|
739
|
+
}
|
|
740
|
+
|
|
315
741
|
const query_params = {};
|
|
316
742
|
|
|
317
|
-
|
|
743
|
+
const response = await PlatformAPIClient.execute(
|
|
318
744
|
this.config,
|
|
319
745
|
"patch",
|
|
320
746
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product/${itemId}/`,
|
|
321
747
|
query_params,
|
|
322
748
|
body
|
|
323
749
|
);
|
|
750
|
+
|
|
751
|
+
const {
|
|
752
|
+
error: res_error,
|
|
753
|
+
} = CatalogModel.SuccessResponse1().validate(response, {
|
|
754
|
+
abortEarly: false,
|
|
755
|
+
allowUnknown: false,
|
|
756
|
+
});
|
|
757
|
+
|
|
758
|
+
if (res_error) {
|
|
759
|
+
Logger({
|
|
760
|
+
level: "WARN",
|
|
761
|
+
message: "Response Validation Warnnings for updateAppProduct",
|
|
762
|
+
});
|
|
763
|
+
Logger({ level: "WARN", message: res_error });
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
return response;
|
|
324
767
|
}
|
|
325
768
|
|
|
326
769
|
/**
|
|
327
770
|
* @param {Object} arg - Arg object.
|
|
328
|
-
* @param {string} arg.
|
|
329
|
-
*
|
|
330
|
-
* @
|
|
771
|
+
* @param {string} arg.configType - A `config_type` is an identifier that
|
|
772
|
+
* defines a specific type of configuration.
|
|
773
|
+
* @param {string} [arg.templateSlug] - Get configuration list filtered by
|
|
774
|
+
* `template_slug` string. This is for the details and comparision groups.
|
|
775
|
+
* @returns {Promise<GetConfigMetadataResponse>} - Success response
|
|
776
|
+
* @summary: Get configuration metadata details for catalog for admin panel
|
|
777
|
+
* @description: Get the configuraion metadata details for catalog.
|
|
331
778
|
*/
|
|
332
|
-
|
|
333
|
-
const { error } = CatalogValidator.
|
|
779
|
+
async getConfigurationMetadata({ configType, templateSlug } = {}) {
|
|
780
|
+
const { error } = CatalogValidator.getConfigurationMetadata().validate(
|
|
334
781
|
{
|
|
335
|
-
|
|
782
|
+
configType,
|
|
783
|
+
templateSlug,
|
|
336
784
|
},
|
|
337
785
|
{ abortEarly: false, allowUnknown: true }
|
|
338
786
|
);
|
|
@@ -340,31 +788,67 @@ class Catalog {
|
|
|
340
788
|
return Promise.reject(new FDKClientValidationError(error));
|
|
341
789
|
}
|
|
342
790
|
|
|
791
|
+
// Showing warrnings if extra unknown parameters are found
|
|
792
|
+
const {
|
|
793
|
+
error: warrning,
|
|
794
|
+
} = CatalogValidator.getConfigurationMetadata().validate(
|
|
795
|
+
{
|
|
796
|
+
configType,
|
|
797
|
+
templateSlug,
|
|
798
|
+
},
|
|
799
|
+
{ abortEarly: false, allowUnknown: false }
|
|
800
|
+
);
|
|
801
|
+
if (warrning) {
|
|
802
|
+
Logger({
|
|
803
|
+
level: "WARN",
|
|
804
|
+
message: "Parameter Validation warrnings for getConfigurationMetadata",
|
|
805
|
+
});
|
|
806
|
+
Logger({ level: "WARN", message: warrning });
|
|
807
|
+
}
|
|
808
|
+
|
|
343
809
|
const query_params = {};
|
|
810
|
+
query_params["template_slug"] = templateSlug;
|
|
344
811
|
|
|
345
|
-
|
|
812
|
+
const response = await PlatformAPIClient.execute(
|
|
346
813
|
this.config,
|
|
347
814
|
"get",
|
|
348
|
-
`/service/platform/catalog/
|
|
815
|
+
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/metadata/`,
|
|
349
816
|
query_params,
|
|
350
817
|
undefined
|
|
351
818
|
);
|
|
819
|
+
|
|
820
|
+
const {
|
|
821
|
+
error: res_error,
|
|
822
|
+
} = CatalogModel.GetConfigMetadataResponse().validate(response, {
|
|
823
|
+
abortEarly: false,
|
|
824
|
+
allowUnknown: false,
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
if (res_error) {
|
|
828
|
+
Logger({
|
|
829
|
+
level: "WARN",
|
|
830
|
+
message: "Response Validation Warnnings for getConfigurationMetadata",
|
|
831
|
+
});
|
|
832
|
+
Logger({ level: "WARN", message: res_error });
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
return response;
|
|
352
836
|
}
|
|
353
837
|
|
|
354
838
|
/**
|
|
355
839
|
* @param {Object} arg - Arg object.
|
|
356
|
-
* @param {string} arg.configType - A `config_type` is
|
|
357
|
-
*
|
|
358
|
-
* @param {
|
|
359
|
-
*
|
|
360
|
-
* @summary:
|
|
361
|
-
* @description:
|
|
840
|
+
* @param {string} arg.configType - A `config_type` is a unique identifier
|
|
841
|
+
* for a particular group configuration type.
|
|
842
|
+
* @param {AppConfigurationDetail} arg.body
|
|
843
|
+
* @returns {Promise<AppConfigurationDetail>} - Success response
|
|
844
|
+
* @summary: Create configuration for Group config types.
|
|
845
|
+
* @description: Create configuration for Group config types.
|
|
362
846
|
*/
|
|
363
|
-
|
|
364
|
-
const { error } = CatalogValidator.
|
|
847
|
+
async createGroupConfiguration({ configType, body } = {}) {
|
|
848
|
+
const { error } = CatalogValidator.createGroupConfiguration().validate(
|
|
365
849
|
{
|
|
366
850
|
configType,
|
|
367
|
-
|
|
851
|
+
body,
|
|
368
852
|
},
|
|
369
853
|
{ abortEarly: false, allowUnknown: true }
|
|
370
854
|
);
|
|
@@ -372,16 +856,50 @@ class Catalog {
|
|
|
372
856
|
return Promise.reject(new FDKClientValidationError(error));
|
|
373
857
|
}
|
|
374
858
|
|
|
859
|
+
// Showing warrnings if extra unknown parameters are found
|
|
860
|
+
const {
|
|
861
|
+
error: warrning,
|
|
862
|
+
} = CatalogValidator.createGroupConfiguration().validate(
|
|
863
|
+
{
|
|
864
|
+
configType,
|
|
865
|
+
body,
|
|
866
|
+
},
|
|
867
|
+
{ abortEarly: false, allowUnknown: false }
|
|
868
|
+
);
|
|
869
|
+
if (warrning) {
|
|
870
|
+
Logger({
|
|
871
|
+
level: "WARN",
|
|
872
|
+
message: "Parameter Validation warrnings for createGroupConfiguration",
|
|
873
|
+
});
|
|
874
|
+
Logger({ level: "WARN", message: warrning });
|
|
875
|
+
}
|
|
876
|
+
|
|
375
877
|
const query_params = {};
|
|
376
|
-
query_params["template_slug"] = templateSlug;
|
|
377
878
|
|
|
378
|
-
|
|
879
|
+
const response = await PlatformAPIClient.execute(
|
|
379
880
|
this.config,
|
|
380
|
-
"
|
|
381
|
-
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/
|
|
881
|
+
"post",
|
|
882
|
+
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups`,
|
|
382
883
|
query_params,
|
|
383
|
-
|
|
884
|
+
body
|
|
384
885
|
);
|
|
886
|
+
|
|
887
|
+
const {
|
|
888
|
+
error: res_error,
|
|
889
|
+
} = CatalogModel.AppConfigurationDetail().validate(response, {
|
|
890
|
+
abortEarly: false,
|
|
891
|
+
allowUnknown: false,
|
|
892
|
+
});
|
|
893
|
+
|
|
894
|
+
if (res_error) {
|
|
895
|
+
Logger({
|
|
896
|
+
level: "WARN",
|
|
897
|
+
message: "Response Validation Warnnings for createGroupConfiguration",
|
|
898
|
+
});
|
|
899
|
+
Logger({ level: "WARN", message: res_error });
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
return response;
|
|
385
903
|
}
|
|
386
904
|
|
|
387
905
|
/**
|
|
@@ -395,10 +913,11 @@ class Catalog {
|
|
|
395
913
|
* @param {string} [arg.search] - Get configuration list filtered by `search` string.
|
|
396
914
|
* @param {string} [arg.templateSlug] - Get configuration list filtered by
|
|
397
915
|
* `template_slug` string. This is for the details and comparision groups.
|
|
916
|
+
* @returns {Promise<GetConfigResponse>} - Success response
|
|
398
917
|
* @summary: Get the details of the application configured configurations of group config types.
|
|
399
918
|
* @description: Get the details of the application configured configurations of group config types.
|
|
400
919
|
*/
|
|
401
|
-
getGroupConfigurations({
|
|
920
|
+
async getGroupConfigurations({
|
|
402
921
|
configType,
|
|
403
922
|
pageNo,
|
|
404
923
|
pageSize,
|
|
@@ -419,50 +938,57 @@ class Catalog {
|
|
|
419
938
|
return Promise.reject(new FDKClientValidationError(error));
|
|
420
939
|
}
|
|
421
940
|
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
query_params["template_slug"] = templateSlug;
|
|
427
|
-
|
|
428
|
-
return PlatformAPIClient.execute(
|
|
429
|
-
this.config,
|
|
430
|
-
"get",
|
|
431
|
-
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups`,
|
|
432
|
-
query_params,
|
|
433
|
-
undefined
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
/**
|
|
438
|
-
* @param {Object} arg - Arg object.
|
|
439
|
-
* @param {string} arg.configType - A `config_type` is a unique identifier
|
|
440
|
-
* for a particular group configuration type.
|
|
441
|
-
* @param {AppConfigurationDetail} arg.body
|
|
442
|
-
* @summary: Create configuration for Group config types.
|
|
443
|
-
* @description: Create configuration for Group config types.
|
|
444
|
-
*/
|
|
445
|
-
createGroupConfiguration({ configType, body } = {}) {
|
|
446
|
-
const { error } = CatalogValidator.createGroupConfiguration().validate(
|
|
941
|
+
// Showing warrnings if extra unknown parameters are found
|
|
942
|
+
const {
|
|
943
|
+
error: warrning,
|
|
944
|
+
} = CatalogValidator.getGroupConfigurations().validate(
|
|
447
945
|
{
|
|
448
946
|
configType,
|
|
449
|
-
|
|
947
|
+
pageNo,
|
|
948
|
+
pageSize,
|
|
949
|
+
search,
|
|
950
|
+
templateSlug,
|
|
450
951
|
},
|
|
451
|
-
{ abortEarly: false, allowUnknown:
|
|
952
|
+
{ abortEarly: false, allowUnknown: false }
|
|
452
953
|
);
|
|
453
|
-
if (
|
|
454
|
-
|
|
954
|
+
if (warrning) {
|
|
955
|
+
Logger({
|
|
956
|
+
level: "WARN",
|
|
957
|
+
message: "Parameter Validation warrnings for getGroupConfigurations",
|
|
958
|
+
});
|
|
959
|
+
Logger({ level: "WARN", message: warrning });
|
|
455
960
|
}
|
|
456
961
|
|
|
457
962
|
const query_params = {};
|
|
963
|
+
query_params["page_no"] = pageNo;
|
|
964
|
+
query_params["page_size"] = pageSize;
|
|
965
|
+
query_params["search"] = search;
|
|
966
|
+
query_params["template_slug"] = templateSlug;
|
|
458
967
|
|
|
459
|
-
|
|
968
|
+
const response = await PlatformAPIClient.execute(
|
|
460
969
|
this.config,
|
|
461
|
-
"
|
|
970
|
+
"get",
|
|
462
971
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups`,
|
|
463
972
|
query_params,
|
|
464
|
-
|
|
973
|
+
undefined
|
|
465
974
|
);
|
|
975
|
+
|
|
976
|
+
const {
|
|
977
|
+
error: res_error,
|
|
978
|
+
} = CatalogModel.GetConfigResponse().validate(response, {
|
|
979
|
+
abortEarly: false,
|
|
980
|
+
allowUnknown: false,
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
if (res_error) {
|
|
984
|
+
Logger({
|
|
985
|
+
level: "WARN",
|
|
986
|
+
message: "Response Validation Warnnings for getGroupConfigurations",
|
|
987
|
+
});
|
|
988
|
+
Logger({ level: "WARN", message: res_error });
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
return response;
|
|
466
992
|
}
|
|
467
993
|
|
|
468
994
|
/**
|
|
@@ -472,10 +998,11 @@ class Catalog {
|
|
|
472
998
|
* @param {string} arg.groupSlug - A `group_slug` is a unique identifier of
|
|
473
999
|
* a particular configuration.
|
|
474
1000
|
* @param {AppConfigurationDetail} arg.body
|
|
1001
|
+
* @returns {Promise<AppConfigurationDetail>} - Success response
|
|
475
1002
|
* @summary: Update the group configurations for the application.
|
|
476
1003
|
* @description: Update the group configurations for the application.
|
|
477
1004
|
*/
|
|
478
|
-
updateGroupConfiguration({ configType, groupSlug, body } = {}) {
|
|
1005
|
+
async updateGroupConfiguration({ configType, groupSlug, body } = {}) {
|
|
479
1006
|
const { error } = CatalogValidator.updateGroupConfiguration().validate(
|
|
480
1007
|
{
|
|
481
1008
|
configType,
|
|
@@ -488,15 +1015,51 @@ class Catalog {
|
|
|
488
1015
|
return Promise.reject(new FDKClientValidationError(error));
|
|
489
1016
|
}
|
|
490
1017
|
|
|
1018
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1019
|
+
const {
|
|
1020
|
+
error: warrning,
|
|
1021
|
+
} = CatalogValidator.updateGroupConfiguration().validate(
|
|
1022
|
+
{
|
|
1023
|
+
configType,
|
|
1024
|
+
groupSlug,
|
|
1025
|
+
body,
|
|
1026
|
+
},
|
|
1027
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1028
|
+
);
|
|
1029
|
+
if (warrning) {
|
|
1030
|
+
Logger({
|
|
1031
|
+
level: "WARN",
|
|
1032
|
+
message: "Parameter Validation warrnings for updateGroupConfiguration",
|
|
1033
|
+
});
|
|
1034
|
+
Logger({ level: "WARN", message: warrning });
|
|
1035
|
+
}
|
|
1036
|
+
|
|
491
1037
|
const query_params = {};
|
|
492
1038
|
|
|
493
|
-
|
|
1039
|
+
const response = await PlatformAPIClient.execute(
|
|
494
1040
|
this.config,
|
|
495
1041
|
"put",
|
|
496
1042
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups/${groupSlug}`,
|
|
497
1043
|
query_params,
|
|
498
1044
|
body
|
|
499
1045
|
);
|
|
1046
|
+
|
|
1047
|
+
const {
|
|
1048
|
+
error: res_error,
|
|
1049
|
+
} = CatalogModel.AppConfigurationDetail().validate(response, {
|
|
1050
|
+
abortEarly: false,
|
|
1051
|
+
allowUnknown: false,
|
|
1052
|
+
});
|
|
1053
|
+
|
|
1054
|
+
if (res_error) {
|
|
1055
|
+
Logger({
|
|
1056
|
+
level: "WARN",
|
|
1057
|
+
message: "Response Validation Warnnings for updateGroupConfiguration",
|
|
1058
|
+
});
|
|
1059
|
+
Logger({ level: "WARN", message: res_error });
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
return response;
|
|
500
1063
|
}
|
|
501
1064
|
|
|
502
1065
|
/**
|
|
@@ -505,10 +1068,11 @@ class Catalog {
|
|
|
505
1068
|
* for a particular group configuration type.
|
|
506
1069
|
* @param {string} arg.groupSlug - A `group_slug` is a unique identifier of
|
|
507
1070
|
* a particular configuration.
|
|
1071
|
+
* @returns {Promise<ConfigSuccessResponse>} - Success response
|
|
508
1072
|
* @summary: Delete configuration of the product config type of the application.
|
|
509
1073
|
* @description: Delete configuration of the product config type of the application.
|
|
510
1074
|
*/
|
|
511
|
-
deleteGroupConfiguration({ configType, groupSlug } = {}) {
|
|
1075
|
+
async deleteGroupConfiguration({ configType, groupSlug } = {}) {
|
|
512
1076
|
const { error } = CatalogValidator.deleteGroupConfiguration().validate(
|
|
513
1077
|
{
|
|
514
1078
|
configType,
|
|
@@ -520,15 +1084,118 @@ class Catalog {
|
|
|
520
1084
|
return Promise.reject(new FDKClientValidationError(error));
|
|
521
1085
|
}
|
|
522
1086
|
|
|
1087
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1088
|
+
const {
|
|
1089
|
+
error: warrning,
|
|
1090
|
+
} = CatalogValidator.deleteGroupConfiguration().validate(
|
|
1091
|
+
{
|
|
1092
|
+
configType,
|
|
1093
|
+
groupSlug,
|
|
1094
|
+
},
|
|
1095
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1096
|
+
);
|
|
1097
|
+
if (warrning) {
|
|
1098
|
+
Logger({
|
|
1099
|
+
level: "WARN",
|
|
1100
|
+
message: "Parameter Validation warrnings for deleteGroupConfiguration",
|
|
1101
|
+
});
|
|
1102
|
+
Logger({ level: "WARN", message: warrning });
|
|
1103
|
+
}
|
|
1104
|
+
|
|
523
1105
|
const query_params = {};
|
|
524
1106
|
|
|
525
|
-
|
|
1107
|
+
const response = await PlatformAPIClient.execute(
|
|
526
1108
|
this.config,
|
|
527
1109
|
"delete",
|
|
528
1110
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/groups/${groupSlug}`,
|
|
529
1111
|
query_params,
|
|
530
1112
|
undefined
|
|
531
1113
|
);
|
|
1114
|
+
|
|
1115
|
+
const {
|
|
1116
|
+
error: res_error,
|
|
1117
|
+
} = CatalogModel.ConfigSuccessResponse().validate(response, {
|
|
1118
|
+
abortEarly: false,
|
|
1119
|
+
allowUnknown: false,
|
|
1120
|
+
});
|
|
1121
|
+
|
|
1122
|
+
if (res_error) {
|
|
1123
|
+
Logger({
|
|
1124
|
+
level: "WARN",
|
|
1125
|
+
message: "Response Validation Warnnings for deleteGroupConfiguration",
|
|
1126
|
+
});
|
|
1127
|
+
Logger({ level: "WARN", message: res_error });
|
|
1128
|
+
}
|
|
1129
|
+
|
|
1130
|
+
return response;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
/**
|
|
1134
|
+
* @param {Object} arg - Arg object.
|
|
1135
|
+
* @param {string} arg.configType - A `config_type` is a unique identifier
|
|
1136
|
+
* for a particular listing configuration type.
|
|
1137
|
+
* @param {AppConfigurationsSort} arg.body
|
|
1138
|
+
* @returns {Promise<AppConfigurationsSort>} - Success response
|
|
1139
|
+
* @summary: Add configuration for listings
|
|
1140
|
+
* @description: Add configuration for listing.
|
|
1141
|
+
*/
|
|
1142
|
+
async createListingConfiguration({ configType, body } = {}) {
|
|
1143
|
+
const { error } = CatalogValidator.createListingConfiguration().validate(
|
|
1144
|
+
{
|
|
1145
|
+
configType,
|
|
1146
|
+
body,
|
|
1147
|
+
},
|
|
1148
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1149
|
+
);
|
|
1150
|
+
if (error) {
|
|
1151
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1155
|
+
const {
|
|
1156
|
+
error: warrning,
|
|
1157
|
+
} = CatalogValidator.createListingConfiguration().validate(
|
|
1158
|
+
{
|
|
1159
|
+
configType,
|
|
1160
|
+
body,
|
|
1161
|
+
},
|
|
1162
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1163
|
+
);
|
|
1164
|
+
if (warrning) {
|
|
1165
|
+
Logger({
|
|
1166
|
+
level: "WARN",
|
|
1167
|
+
message:
|
|
1168
|
+
"Parameter Validation warrnings for createListingConfiguration",
|
|
1169
|
+
});
|
|
1170
|
+
Logger({ level: "WARN", message: warrning });
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
const query_params = {};
|
|
1174
|
+
|
|
1175
|
+
const response = await PlatformAPIClient.execute(
|
|
1176
|
+
this.config,
|
|
1177
|
+
"post",
|
|
1178
|
+
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/`,
|
|
1179
|
+
query_params,
|
|
1180
|
+
body
|
|
1181
|
+
);
|
|
1182
|
+
|
|
1183
|
+
const {
|
|
1184
|
+
error: res_error,
|
|
1185
|
+
} = CatalogModel.AppConfigurationsSort().validate(response, {
|
|
1186
|
+
abortEarly: false,
|
|
1187
|
+
allowUnknown: false,
|
|
1188
|
+
});
|
|
1189
|
+
|
|
1190
|
+
if (res_error) {
|
|
1191
|
+
Logger({
|
|
1192
|
+
level: "WARN",
|
|
1193
|
+
message: "Response Validation Warnnings for createListingConfiguration",
|
|
1194
|
+
});
|
|
1195
|
+
Logger({ level: "WARN", message: res_error });
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1198
|
+
return response;
|
|
532
1199
|
}
|
|
533
1200
|
|
|
534
1201
|
/**
|
|
@@ -540,10 +1207,16 @@ class Catalog {
|
|
|
540
1207
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
541
1208
|
* page. Default is 12.
|
|
542
1209
|
* @param {string} [arg.search] - Get configuration list filtered by `search` string.
|
|
1210
|
+
* @returns {Promise<GetConfigResponse>} - Success response
|
|
543
1211
|
* @summary: Get the details of the application configured configurations of listing config types.
|
|
544
1212
|
* @description: Get the details of the application configured configurations of listing config types.
|
|
545
1213
|
*/
|
|
546
|
-
getListingConfigurations({
|
|
1214
|
+
async getListingConfigurations({
|
|
1215
|
+
configType,
|
|
1216
|
+
pageNo,
|
|
1217
|
+
pageSize,
|
|
1218
|
+
search,
|
|
1219
|
+
} = {}) {
|
|
547
1220
|
const { error } = CatalogValidator.getListingConfigurations().validate(
|
|
548
1221
|
{
|
|
549
1222
|
configType,
|
|
@@ -557,49 +1230,55 @@ class Catalog {
|
|
|
557
1230
|
return Promise.reject(new FDKClientValidationError(error));
|
|
558
1231
|
}
|
|
559
1232
|
|
|
1233
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1234
|
+
const {
|
|
1235
|
+
error: warrning,
|
|
1236
|
+
} = CatalogValidator.getListingConfigurations().validate(
|
|
1237
|
+
{
|
|
1238
|
+
configType,
|
|
1239
|
+
pageNo,
|
|
1240
|
+
pageSize,
|
|
1241
|
+
search,
|
|
1242
|
+
},
|
|
1243
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1244
|
+
);
|
|
1245
|
+
if (warrning) {
|
|
1246
|
+
Logger({
|
|
1247
|
+
level: "WARN",
|
|
1248
|
+
message: "Parameter Validation warrnings for getListingConfigurations",
|
|
1249
|
+
});
|
|
1250
|
+
Logger({ level: "WARN", message: warrning });
|
|
1251
|
+
}
|
|
1252
|
+
|
|
560
1253
|
const query_params = {};
|
|
561
1254
|
query_params["page_no"] = pageNo;
|
|
562
1255
|
query_params["page_size"] = pageSize;
|
|
563
1256
|
query_params["search"] = search;
|
|
564
1257
|
|
|
565
|
-
|
|
1258
|
+
const response = await PlatformAPIClient.execute(
|
|
566
1259
|
this.config,
|
|
567
1260
|
"get",
|
|
568
1261
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/`,
|
|
569
1262
|
query_params,
|
|
570
1263
|
undefined
|
|
571
1264
|
);
|
|
572
|
-
}
|
|
573
1265
|
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
},
|
|
588
|
-
{ abortEarly: false, allowUnknown: true }
|
|
589
|
-
);
|
|
590
|
-
if (error) {
|
|
591
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
1266
|
+
const {
|
|
1267
|
+
error: res_error,
|
|
1268
|
+
} = CatalogModel.GetConfigResponse().validate(response, {
|
|
1269
|
+
abortEarly: false,
|
|
1270
|
+
allowUnknown: false,
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
if (res_error) {
|
|
1274
|
+
Logger({
|
|
1275
|
+
level: "WARN",
|
|
1276
|
+
message: "Response Validation Warnnings for getListingConfigurations",
|
|
1277
|
+
});
|
|
1278
|
+
Logger({ level: "WARN", message: res_error });
|
|
592
1279
|
}
|
|
593
1280
|
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
return PlatformAPIClient.execute(
|
|
597
|
-
this.config,
|
|
598
|
-
"post",
|
|
599
|
-
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/`,
|
|
600
|
-
query_params,
|
|
601
|
-
body
|
|
602
|
-
);
|
|
1281
|
+
return response;
|
|
603
1282
|
}
|
|
604
1283
|
|
|
605
1284
|
/**
|
|
@@ -609,10 +1288,11 @@ class Catalog {
|
|
|
609
1288
|
* @param {string} arg.configId - A `config_id` is a unique identifier of a
|
|
610
1289
|
* particular configuration.
|
|
611
1290
|
* @param {AppConfigurationsSort} arg.body
|
|
1291
|
+
* @returns {Promise<AppConfigurationsSort>} - Success response
|
|
612
1292
|
* @summary: Update configuration for listings
|
|
613
1293
|
* @description: Update configuration for listing.
|
|
614
1294
|
*/
|
|
615
|
-
updateListingConfiguration({ configType, configId, body } = {}) {
|
|
1295
|
+
async updateListingConfiguration({ configType, configId, body } = {}) {
|
|
616
1296
|
const { error } = CatalogValidator.updateListingConfiguration().validate(
|
|
617
1297
|
{
|
|
618
1298
|
configType,
|
|
@@ -625,15 +1305,52 @@ class Catalog {
|
|
|
625
1305
|
return Promise.reject(new FDKClientValidationError(error));
|
|
626
1306
|
}
|
|
627
1307
|
|
|
1308
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1309
|
+
const {
|
|
1310
|
+
error: warrning,
|
|
1311
|
+
} = CatalogValidator.updateListingConfiguration().validate(
|
|
1312
|
+
{
|
|
1313
|
+
configType,
|
|
1314
|
+
configId,
|
|
1315
|
+
body,
|
|
1316
|
+
},
|
|
1317
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1318
|
+
);
|
|
1319
|
+
if (warrning) {
|
|
1320
|
+
Logger({
|
|
1321
|
+
level: "WARN",
|
|
1322
|
+
message:
|
|
1323
|
+
"Parameter Validation warrnings for updateListingConfiguration",
|
|
1324
|
+
});
|
|
1325
|
+
Logger({ level: "WARN", message: warrning });
|
|
1326
|
+
}
|
|
1327
|
+
|
|
628
1328
|
const query_params = {};
|
|
629
1329
|
|
|
630
|
-
|
|
1330
|
+
const response = await PlatformAPIClient.execute(
|
|
631
1331
|
this.config,
|
|
632
1332
|
"put",
|
|
633
1333
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/item/${configId}/`,
|
|
634
1334
|
query_params,
|
|
635
1335
|
body
|
|
636
1336
|
);
|
|
1337
|
+
|
|
1338
|
+
const {
|
|
1339
|
+
error: res_error,
|
|
1340
|
+
} = CatalogModel.AppConfigurationsSort().validate(response, {
|
|
1341
|
+
abortEarly: false,
|
|
1342
|
+
allowUnknown: false,
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1345
|
+
if (res_error) {
|
|
1346
|
+
Logger({
|
|
1347
|
+
level: "WARN",
|
|
1348
|
+
message: "Response Validation Warnnings for updateListingConfiguration",
|
|
1349
|
+
});
|
|
1350
|
+
Logger({ level: "WARN", message: res_error });
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
return response;
|
|
637
1354
|
}
|
|
638
1355
|
|
|
639
1356
|
/**
|
|
@@ -642,10 +1359,11 @@ class Catalog {
|
|
|
642
1359
|
* for a particular listing configuration type.
|
|
643
1360
|
* @param {string} arg.configId - A `config_id` is a unique identifier of a
|
|
644
1361
|
* particular configuration.
|
|
1362
|
+
* @returns {Promise<ConfigSuccessResponse>} - Success response
|
|
645
1363
|
* @summary: Delete configuration for listings
|
|
646
1364
|
* @description: Delete configuration for listing.
|
|
647
1365
|
*/
|
|
648
|
-
deleteListingConfiguration({ configType, configId } = {}) {
|
|
1366
|
+
async deleteListingConfiguration({ configType, configId } = {}) {
|
|
649
1367
|
const { error } = CatalogValidator.deleteListingConfiguration().validate(
|
|
650
1368
|
{
|
|
651
1369
|
configType,
|
|
@@ -657,24 +1375,61 @@ class Catalog {
|
|
|
657
1375
|
return Promise.reject(new FDKClientValidationError(error));
|
|
658
1376
|
}
|
|
659
1377
|
|
|
1378
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1379
|
+
const {
|
|
1380
|
+
error: warrning,
|
|
1381
|
+
} = CatalogValidator.deleteListingConfiguration().validate(
|
|
1382
|
+
{
|
|
1383
|
+
configType,
|
|
1384
|
+
configId,
|
|
1385
|
+
},
|
|
1386
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1387
|
+
);
|
|
1388
|
+
if (warrning) {
|
|
1389
|
+
Logger({
|
|
1390
|
+
level: "WARN",
|
|
1391
|
+
message:
|
|
1392
|
+
"Parameter Validation warrnings for deleteListingConfiguration",
|
|
1393
|
+
});
|
|
1394
|
+
Logger({ level: "WARN", message: warrning });
|
|
1395
|
+
}
|
|
1396
|
+
|
|
660
1397
|
const query_params = {};
|
|
661
1398
|
|
|
662
|
-
|
|
1399
|
+
const response = await PlatformAPIClient.execute(
|
|
663
1400
|
this.config,
|
|
664
1401
|
"delete",
|
|
665
1402
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${configType}/item/${configId}/`,
|
|
666
1403
|
query_params,
|
|
667
1404
|
undefined
|
|
668
1405
|
);
|
|
1406
|
+
|
|
1407
|
+
const {
|
|
1408
|
+
error: res_error,
|
|
1409
|
+
} = CatalogModel.ConfigSuccessResponse().validate(response, {
|
|
1410
|
+
abortEarly: false,
|
|
1411
|
+
allowUnknown: false,
|
|
1412
|
+
});
|
|
1413
|
+
|
|
1414
|
+
if (res_error) {
|
|
1415
|
+
Logger({
|
|
1416
|
+
level: "WARN",
|
|
1417
|
+
message: "Response Validation Warnnings for deleteListingConfiguration",
|
|
1418
|
+
});
|
|
1419
|
+
Logger({ level: "WARN", message: res_error });
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
return response;
|
|
669
1423
|
}
|
|
670
1424
|
|
|
671
1425
|
/**
|
|
672
1426
|
* @param {Object} arg - Arg object.
|
|
673
1427
|
* @param {AllowSingleRequest} arg.body
|
|
1428
|
+
* @returns {Promise<ConfigSuccessResponse>} - Success response
|
|
674
1429
|
* @summary: Update allow single flag for filters of the application.
|
|
675
1430
|
* @description: Update allow single flag for filters of the application.
|
|
676
1431
|
*/
|
|
677
|
-
updateAllowSingle({ body } = {}) {
|
|
1432
|
+
async updateAllowSingle({ body } = {}) {
|
|
678
1433
|
const { error } = CatalogValidator.updateAllowSingle().validate(
|
|
679
1434
|
{
|
|
680
1435
|
body,
|
|
@@ -685,24 +1440,57 @@ class Catalog {
|
|
|
685
1440
|
return Promise.reject(new FDKClientValidationError(error));
|
|
686
1441
|
}
|
|
687
1442
|
|
|
1443
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1444
|
+
const { error: warrning } = CatalogValidator.updateAllowSingle().validate(
|
|
1445
|
+
{
|
|
1446
|
+
body,
|
|
1447
|
+
},
|
|
1448
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1449
|
+
);
|
|
1450
|
+
if (warrning) {
|
|
1451
|
+
Logger({
|
|
1452
|
+
level: "WARN",
|
|
1453
|
+
message: "Parameter Validation warrnings for updateAllowSingle",
|
|
1454
|
+
});
|
|
1455
|
+
Logger({ level: "WARN", message: warrning });
|
|
1456
|
+
}
|
|
1457
|
+
|
|
688
1458
|
const query_params = {};
|
|
689
1459
|
|
|
690
|
-
|
|
1460
|
+
const response = await PlatformAPIClient.execute(
|
|
691
1461
|
this.config,
|
|
692
1462
|
"post",
|
|
693
1463
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/filter/allow_single`,
|
|
694
1464
|
query_params,
|
|
695
1465
|
body
|
|
696
1466
|
);
|
|
1467
|
+
|
|
1468
|
+
const {
|
|
1469
|
+
error: res_error,
|
|
1470
|
+
} = CatalogModel.ConfigSuccessResponse().validate(response, {
|
|
1471
|
+
abortEarly: false,
|
|
1472
|
+
allowUnknown: false,
|
|
1473
|
+
});
|
|
1474
|
+
|
|
1475
|
+
if (res_error) {
|
|
1476
|
+
Logger({
|
|
1477
|
+
level: "WARN",
|
|
1478
|
+
message: "Response Validation Warnnings for updateAllowSingle",
|
|
1479
|
+
});
|
|
1480
|
+
Logger({ level: "WARN", message: res_error });
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
return response;
|
|
697
1484
|
}
|
|
698
1485
|
|
|
699
1486
|
/**
|
|
700
1487
|
* @param {Object} arg - Arg object.
|
|
701
1488
|
* @param {DefaultKeyRequest} arg.body
|
|
1489
|
+
* @returns {Promise<ConfigSuccessResponse>} - Success response
|
|
702
1490
|
* @summary: Update the default sort key configuration for the application.
|
|
703
1491
|
* @description: Update the default sort key configuration for the application.
|
|
704
1492
|
*/
|
|
705
|
-
updateDefaultSort({ body } = {}) {
|
|
1493
|
+
async updateDefaultSort({ body } = {}) {
|
|
706
1494
|
const { error } = CatalogValidator.updateDefaultSort().validate(
|
|
707
1495
|
{
|
|
708
1496
|
body,
|
|
@@ -713,23 +1501,56 @@ class Catalog {
|
|
|
713
1501
|
return Promise.reject(new FDKClientValidationError(error));
|
|
714
1502
|
}
|
|
715
1503
|
|
|
1504
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1505
|
+
const { error: warrning } = CatalogValidator.updateDefaultSort().validate(
|
|
1506
|
+
{
|
|
1507
|
+
body,
|
|
1508
|
+
},
|
|
1509
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1510
|
+
);
|
|
1511
|
+
if (warrning) {
|
|
1512
|
+
Logger({
|
|
1513
|
+
level: "WARN",
|
|
1514
|
+
message: "Parameter Validation warrnings for updateDefaultSort",
|
|
1515
|
+
});
|
|
1516
|
+
Logger({ level: "WARN", message: warrning });
|
|
1517
|
+
}
|
|
1518
|
+
|
|
716
1519
|
const query_params = {};
|
|
717
1520
|
|
|
718
|
-
|
|
1521
|
+
const response = await PlatformAPIClient.execute(
|
|
719
1522
|
this.config,
|
|
720
1523
|
"post",
|
|
721
1524
|
`/service/platform/catalog/v2.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/sort/default_key`,
|
|
722
1525
|
query_params,
|
|
723
1526
|
body
|
|
724
1527
|
);
|
|
1528
|
+
|
|
1529
|
+
const {
|
|
1530
|
+
error: res_error,
|
|
1531
|
+
} = CatalogModel.ConfigSuccessResponse().validate(response, {
|
|
1532
|
+
abortEarly: false,
|
|
1533
|
+
allowUnknown: false,
|
|
1534
|
+
});
|
|
1535
|
+
|
|
1536
|
+
if (res_error) {
|
|
1537
|
+
Logger({
|
|
1538
|
+
level: "WARN",
|
|
1539
|
+
message: "Response Validation Warnnings for updateDefaultSort",
|
|
1540
|
+
});
|
|
1541
|
+
Logger({ level: "WARN", message: res_error });
|
|
1542
|
+
}
|
|
1543
|
+
|
|
1544
|
+
return response;
|
|
725
1545
|
}
|
|
726
1546
|
|
|
727
1547
|
/**
|
|
728
1548
|
* @param {Object} arg - Arg object.
|
|
1549
|
+
* @returns {Promise<GetCatalogConfigurationMetaData>} - Success response
|
|
729
1550
|
* @summary: Get configuration meta details for catalog for admin panel
|
|
730
1551
|
* @description: configuration meta details for catalog.
|
|
731
1552
|
*/
|
|
732
|
-
getCatalogConfiguration({} = {}) {
|
|
1553
|
+
async getCatalogConfiguration({} = {}) {
|
|
733
1554
|
const { error } = CatalogValidator.getCatalogConfiguration().validate(
|
|
734
1555
|
{},
|
|
735
1556
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -738,23 +1559,123 @@ class Catalog {
|
|
|
738
1559
|
return Promise.reject(new FDKClientValidationError(error));
|
|
739
1560
|
}
|
|
740
1561
|
|
|
1562
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1563
|
+
const {
|
|
1564
|
+
error: warrning,
|
|
1565
|
+
} = CatalogValidator.getCatalogConfiguration().validate(
|
|
1566
|
+
{},
|
|
1567
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1568
|
+
);
|
|
1569
|
+
if (warrning) {
|
|
1570
|
+
Logger({
|
|
1571
|
+
level: "WARN",
|
|
1572
|
+
message: "Parameter Validation warrnings for getCatalogConfiguration",
|
|
1573
|
+
});
|
|
1574
|
+
Logger({ level: "WARN", message: warrning });
|
|
1575
|
+
}
|
|
1576
|
+
|
|
741
1577
|
const query_params = {};
|
|
742
1578
|
|
|
743
|
-
|
|
1579
|
+
const response = await PlatformAPIClient.execute(
|
|
744
1580
|
this.config,
|
|
745
1581
|
"get",
|
|
746
1582
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/metadata/`,
|
|
747
1583
|
query_params,
|
|
748
1584
|
undefined
|
|
749
1585
|
);
|
|
1586
|
+
|
|
1587
|
+
const {
|
|
1588
|
+
error: res_error,
|
|
1589
|
+
} = CatalogModel.GetCatalogConfigurationMetaData().validate(response, {
|
|
1590
|
+
abortEarly: false,
|
|
1591
|
+
allowUnknown: false,
|
|
1592
|
+
});
|
|
1593
|
+
|
|
1594
|
+
if (res_error) {
|
|
1595
|
+
Logger({
|
|
1596
|
+
level: "WARN",
|
|
1597
|
+
message: "Response Validation Warnnings for getCatalogConfiguration",
|
|
1598
|
+
});
|
|
1599
|
+
Logger({ level: "WARN", message: res_error });
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1602
|
+
return response;
|
|
1603
|
+
}
|
|
1604
|
+
|
|
1605
|
+
/**
|
|
1606
|
+
* @param {Object} arg - Arg object.
|
|
1607
|
+
* @param {AppConfiguration} arg.body
|
|
1608
|
+
* @returns {Promise<GetAppCatalogConfiguration>} - Success response
|
|
1609
|
+
* @summary: Add configuration for products & listings
|
|
1610
|
+
* @description: Add configuration for products & listing.
|
|
1611
|
+
*/
|
|
1612
|
+
async createConfigurationProductListing({ body } = {}) {
|
|
1613
|
+
const {
|
|
1614
|
+
error,
|
|
1615
|
+
} = CatalogValidator.createConfigurationProductListing().validate(
|
|
1616
|
+
{
|
|
1617
|
+
body,
|
|
1618
|
+
},
|
|
1619
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1620
|
+
);
|
|
1621
|
+
if (error) {
|
|
1622
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1623
|
+
}
|
|
1624
|
+
|
|
1625
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1626
|
+
const {
|
|
1627
|
+
error: warrning,
|
|
1628
|
+
} = CatalogValidator.createConfigurationProductListing().validate(
|
|
1629
|
+
{
|
|
1630
|
+
body,
|
|
1631
|
+
},
|
|
1632
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1633
|
+
);
|
|
1634
|
+
if (warrning) {
|
|
1635
|
+
Logger({
|
|
1636
|
+
level: "WARN",
|
|
1637
|
+
message:
|
|
1638
|
+
"Parameter Validation warrnings for createConfigurationProductListing",
|
|
1639
|
+
});
|
|
1640
|
+
Logger({ level: "WARN", message: warrning });
|
|
1641
|
+
}
|
|
1642
|
+
|
|
1643
|
+
const query_params = {};
|
|
1644
|
+
|
|
1645
|
+
const response = await PlatformAPIClient.execute(
|
|
1646
|
+
this.config,
|
|
1647
|
+
"post",
|
|
1648
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/`,
|
|
1649
|
+
query_params,
|
|
1650
|
+
body
|
|
1651
|
+
);
|
|
1652
|
+
|
|
1653
|
+
const {
|
|
1654
|
+
error: res_error,
|
|
1655
|
+
} = CatalogModel.GetAppCatalogConfiguration().validate(response, {
|
|
1656
|
+
abortEarly: false,
|
|
1657
|
+
allowUnknown: false,
|
|
1658
|
+
});
|
|
1659
|
+
|
|
1660
|
+
if (res_error) {
|
|
1661
|
+
Logger({
|
|
1662
|
+
level: "WARN",
|
|
1663
|
+
message:
|
|
1664
|
+
"Response Validation Warnnings for createConfigurationProductListing",
|
|
1665
|
+
});
|
|
1666
|
+
Logger({ level: "WARN", message: res_error });
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
return response;
|
|
750
1670
|
}
|
|
751
1671
|
|
|
752
1672
|
/**
|
|
753
1673
|
* @param {Object} arg - Arg object.
|
|
1674
|
+
* @returns {Promise<GetAppCatalogConfiguration>} - Success response
|
|
754
1675
|
* @summary: Get configured details for catalog
|
|
755
1676
|
* @description: configured details for catalog.
|
|
756
1677
|
*/
|
|
757
|
-
getConfigurations({} = {}) {
|
|
1678
|
+
async getConfigurations({} = {}) {
|
|
758
1679
|
const { error } = CatalogValidator.getConfigurations().validate(
|
|
759
1680
|
{},
|
|
760
1681
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -763,54 +1684,121 @@ class Catalog {
|
|
|
763
1684
|
return Promise.reject(new FDKClientValidationError(error));
|
|
764
1685
|
}
|
|
765
1686
|
|
|
1687
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1688
|
+
const { error: warrning } = CatalogValidator.getConfigurations().validate(
|
|
1689
|
+
{},
|
|
1690
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1691
|
+
);
|
|
1692
|
+
if (warrning) {
|
|
1693
|
+
Logger({
|
|
1694
|
+
level: "WARN",
|
|
1695
|
+
message: "Parameter Validation warrnings for getConfigurations",
|
|
1696
|
+
});
|
|
1697
|
+
Logger({ level: "WARN", message: warrning });
|
|
1698
|
+
}
|
|
1699
|
+
|
|
766
1700
|
const query_params = {};
|
|
767
1701
|
|
|
768
|
-
|
|
1702
|
+
const response = await PlatformAPIClient.execute(
|
|
769
1703
|
this.config,
|
|
770
1704
|
"get",
|
|
771
1705
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/`,
|
|
772
1706
|
query_params,
|
|
773
1707
|
undefined
|
|
774
1708
|
);
|
|
1709
|
+
|
|
1710
|
+
const {
|
|
1711
|
+
error: res_error,
|
|
1712
|
+
} = CatalogModel.GetAppCatalogConfiguration().validate(response, {
|
|
1713
|
+
abortEarly: false,
|
|
1714
|
+
allowUnknown: false,
|
|
1715
|
+
});
|
|
1716
|
+
|
|
1717
|
+
if (res_error) {
|
|
1718
|
+
Logger({
|
|
1719
|
+
level: "WARN",
|
|
1720
|
+
message: "Response Validation Warnnings for getConfigurations",
|
|
1721
|
+
});
|
|
1722
|
+
Logger({ level: "WARN", message: res_error });
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
return response;
|
|
775
1726
|
}
|
|
776
1727
|
|
|
777
1728
|
/**
|
|
778
1729
|
* @param {Object} arg - Arg object.
|
|
1730
|
+
* @param {string} arg.type - Type can be brands, categories etc.
|
|
779
1731
|
* @param {AppConfiguration} arg.body
|
|
780
|
-
* @
|
|
781
|
-
* @
|
|
1732
|
+
* @returns {Promise<GetAppCatalogConfiguration>} - Success response
|
|
1733
|
+
* @summary: Add configuration for categories and brands
|
|
1734
|
+
* @description: Add configuration for categories & brands.
|
|
782
1735
|
*/
|
|
783
|
-
|
|
784
|
-
const {
|
|
785
|
-
|
|
786
|
-
|
|
1736
|
+
async createConfigurationByType({ type, body } = {}) {
|
|
1737
|
+
const { error } = CatalogValidator.createConfigurationByType().validate(
|
|
1738
|
+
{
|
|
1739
|
+
type,
|
|
1740
|
+
body,
|
|
1741
|
+
},
|
|
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
|
+
} = CatalogValidator.createConfigurationByType().validate(
|
|
787
1752
|
{
|
|
1753
|
+
type,
|
|
788
1754
|
body,
|
|
789
1755
|
},
|
|
790
|
-
{ abortEarly: false, allowUnknown:
|
|
1756
|
+
{ abortEarly: false, allowUnknown: false }
|
|
791
1757
|
);
|
|
792
|
-
if (
|
|
793
|
-
|
|
1758
|
+
if (warrning) {
|
|
1759
|
+
Logger({
|
|
1760
|
+
level: "WARN",
|
|
1761
|
+
message: "Parameter Validation warrnings for createConfigurationByType",
|
|
1762
|
+
});
|
|
1763
|
+
Logger({ level: "WARN", message: warrning });
|
|
794
1764
|
}
|
|
795
1765
|
|
|
796
1766
|
const query_params = {};
|
|
797
1767
|
|
|
798
|
-
|
|
1768
|
+
const response = await PlatformAPIClient.execute(
|
|
799
1769
|
this.config,
|
|
800
1770
|
"post",
|
|
801
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/`,
|
|
1771
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${type}/`,
|
|
802
1772
|
query_params,
|
|
803
1773
|
body
|
|
804
1774
|
);
|
|
1775
|
+
|
|
1776
|
+
const {
|
|
1777
|
+
error: res_error,
|
|
1778
|
+
} = CatalogModel.GetAppCatalogConfiguration().validate(response, {
|
|
1779
|
+
abortEarly: false,
|
|
1780
|
+
allowUnknown: false,
|
|
1781
|
+
});
|
|
1782
|
+
|
|
1783
|
+
if (res_error) {
|
|
1784
|
+
Logger({
|
|
1785
|
+
level: "WARN",
|
|
1786
|
+
message: "Response Validation Warnnings for createConfigurationByType",
|
|
1787
|
+
});
|
|
1788
|
+
Logger({ level: "WARN", message: res_error });
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
return response;
|
|
805
1792
|
}
|
|
806
1793
|
|
|
807
1794
|
/**
|
|
808
1795
|
* @param {Object} arg - Arg object.
|
|
809
1796
|
* @param {string} arg.type - Type can be brands, categories etc.
|
|
1797
|
+
* @returns {Promise<GetAppCatalogEntityConfiguration>} - Success response
|
|
810
1798
|
* @summary: Get configured details for catalog
|
|
811
1799
|
* @description: configured details for catalog.
|
|
812
1800
|
*/
|
|
813
|
-
getConfigurationByType({ type } = {}) {
|
|
1801
|
+
async getConfigurationByType({ type } = {}) {
|
|
814
1802
|
const { error } = CatalogValidator.getConfigurationByType().validate(
|
|
815
1803
|
{
|
|
816
1804
|
type,
|
|
@@ -821,70 +1809,166 @@ class Catalog {
|
|
|
821
1809
|
return Promise.reject(new FDKClientValidationError(error));
|
|
822
1810
|
}
|
|
823
1811
|
|
|
1812
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1813
|
+
const {
|
|
1814
|
+
error: warrning,
|
|
1815
|
+
} = CatalogValidator.getConfigurationByType().validate(
|
|
1816
|
+
{
|
|
1817
|
+
type,
|
|
1818
|
+
},
|
|
1819
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1820
|
+
);
|
|
1821
|
+
if (warrning) {
|
|
1822
|
+
Logger({
|
|
1823
|
+
level: "WARN",
|
|
1824
|
+
message: "Parameter Validation warrnings for getConfigurationByType",
|
|
1825
|
+
});
|
|
1826
|
+
Logger({ level: "WARN", message: warrning });
|
|
1827
|
+
}
|
|
1828
|
+
|
|
824
1829
|
const query_params = {};
|
|
825
1830
|
|
|
826
|
-
|
|
1831
|
+
const response = await PlatformAPIClient.execute(
|
|
827
1832
|
this.config,
|
|
828
1833
|
"get",
|
|
829
1834
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/product-configuration/${type}/`,
|
|
830
1835
|
query_params,
|
|
831
1836
|
undefined
|
|
832
1837
|
);
|
|
1838
|
+
|
|
1839
|
+
const {
|
|
1840
|
+
error: res_error,
|
|
1841
|
+
} = CatalogModel.GetAppCatalogEntityConfiguration().validate(response, {
|
|
1842
|
+
abortEarly: false,
|
|
1843
|
+
allowUnknown: false,
|
|
1844
|
+
});
|
|
1845
|
+
|
|
1846
|
+
if (res_error) {
|
|
1847
|
+
Logger({
|
|
1848
|
+
level: "WARN",
|
|
1849
|
+
message: "Response Validation Warnnings for getConfigurationByType",
|
|
1850
|
+
});
|
|
1851
|
+
Logger({ level: "WARN", message: res_error });
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1854
|
+
return response;
|
|
833
1855
|
}
|
|
834
1856
|
|
|
835
1857
|
/**
|
|
836
1858
|
* @param {Object} arg - Arg object.
|
|
837
|
-
* @
|
|
838
|
-
* @
|
|
839
|
-
* @
|
|
840
|
-
* @description: Add configuration for categories & brands.
|
|
1859
|
+
* @returns {Promise<GetCollectionQueryOptionResponse>} - Success response
|
|
1860
|
+
* @summary: Get query filters to configure a collection
|
|
1861
|
+
* @description: Get query filters to configure a collection
|
|
841
1862
|
*/
|
|
842
|
-
|
|
843
|
-
const { error } = CatalogValidator.
|
|
844
|
-
{
|
|
845
|
-
type,
|
|
846
|
-
body,
|
|
847
|
-
},
|
|
1863
|
+
async getQueryFilters({} = {}) {
|
|
1864
|
+
const { error } = CatalogValidator.getQueryFilters().validate(
|
|
1865
|
+
{},
|
|
848
1866
|
{ abortEarly: false, allowUnknown: true }
|
|
849
1867
|
);
|
|
850
1868
|
if (error) {
|
|
851
1869
|
return Promise.reject(new FDKClientValidationError(error));
|
|
852
1870
|
}
|
|
853
1871
|
|
|
1872
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1873
|
+
const { error: warrning } = CatalogValidator.getQueryFilters().validate(
|
|
1874
|
+
{},
|
|
1875
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1876
|
+
);
|
|
1877
|
+
if (warrning) {
|
|
1878
|
+
Logger({
|
|
1879
|
+
level: "WARN",
|
|
1880
|
+
message: "Parameter Validation warrnings for getQueryFilters",
|
|
1881
|
+
});
|
|
1882
|
+
Logger({ level: "WARN", message: warrning });
|
|
1883
|
+
}
|
|
1884
|
+
|
|
854
1885
|
const query_params = {};
|
|
855
1886
|
|
|
856
|
-
|
|
1887
|
+
const response = await PlatformAPIClient.execute(
|
|
857
1888
|
this.config,
|
|
858
|
-
"
|
|
859
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1889
|
+
"get",
|
|
1890
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/query-options/`,
|
|
860
1891
|
query_params,
|
|
861
|
-
|
|
1892
|
+
undefined
|
|
862
1893
|
);
|
|
1894
|
+
|
|
1895
|
+
const {
|
|
1896
|
+
error: res_error,
|
|
1897
|
+
} = CatalogModel.GetCollectionQueryOptionResponse().validate(response, {
|
|
1898
|
+
abortEarly: false,
|
|
1899
|
+
allowUnknown: false,
|
|
1900
|
+
});
|
|
1901
|
+
|
|
1902
|
+
if (res_error) {
|
|
1903
|
+
Logger({
|
|
1904
|
+
level: "WARN",
|
|
1905
|
+
message: "Response Validation Warnnings for getQueryFilters",
|
|
1906
|
+
});
|
|
1907
|
+
Logger({ level: "WARN", message: res_error });
|
|
1908
|
+
}
|
|
1909
|
+
|
|
1910
|
+
return response;
|
|
863
1911
|
}
|
|
864
1912
|
|
|
865
1913
|
/**
|
|
866
1914
|
* @param {Object} arg - Arg object.
|
|
867
|
-
* @
|
|
868
|
-
* @
|
|
1915
|
+
* @param {CreateCollection} arg.body
|
|
1916
|
+
* @returns {Promise<CollectionCreateResponse>} - Success response
|
|
1917
|
+
* @summary: Add a Collection
|
|
1918
|
+
* @description: Create a collection. See `CreateCollectionRequestSchema` for the list of attributes needed to create a collection and collections/query-options for the available options to create a collection. On successful request, returns a paginated list of collections specified in `CollectionCreateResponse`
|
|
869
1919
|
*/
|
|
870
|
-
|
|
871
|
-
const { error } = CatalogValidator.
|
|
872
|
-
{
|
|
1920
|
+
async createCollection({ body } = {}) {
|
|
1921
|
+
const { error } = CatalogValidator.createCollection().validate(
|
|
1922
|
+
{
|
|
1923
|
+
body,
|
|
1924
|
+
},
|
|
873
1925
|
{ abortEarly: false, allowUnknown: true }
|
|
874
1926
|
);
|
|
875
1927
|
if (error) {
|
|
876
1928
|
return Promise.reject(new FDKClientValidationError(error));
|
|
877
1929
|
}
|
|
878
1930
|
|
|
1931
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1932
|
+
const { error: warrning } = CatalogValidator.createCollection().validate(
|
|
1933
|
+
{
|
|
1934
|
+
body,
|
|
1935
|
+
},
|
|
1936
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1937
|
+
);
|
|
1938
|
+
if (warrning) {
|
|
1939
|
+
Logger({
|
|
1940
|
+
level: "WARN",
|
|
1941
|
+
message: "Parameter Validation warrnings for createCollection",
|
|
1942
|
+
});
|
|
1943
|
+
Logger({ level: "WARN", message: warrning });
|
|
1944
|
+
}
|
|
1945
|
+
|
|
879
1946
|
const query_params = {};
|
|
880
1947
|
|
|
881
|
-
|
|
1948
|
+
const response = await PlatformAPIClient.execute(
|
|
882
1949
|
this.config,
|
|
883
|
-
"
|
|
884
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections
|
|
1950
|
+
"post",
|
|
1951
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/`,
|
|
885
1952
|
query_params,
|
|
886
|
-
|
|
1953
|
+
body
|
|
887
1954
|
);
|
|
1955
|
+
|
|
1956
|
+
const {
|
|
1957
|
+
error: res_error,
|
|
1958
|
+
} = CatalogModel.CollectionCreateResponse().validate(response, {
|
|
1959
|
+
abortEarly: false,
|
|
1960
|
+
allowUnknown: false,
|
|
1961
|
+
});
|
|
1962
|
+
|
|
1963
|
+
if (res_error) {
|
|
1964
|
+
Logger({
|
|
1965
|
+
level: "WARN",
|
|
1966
|
+
message: "Response Validation Warnnings for createCollection",
|
|
1967
|
+
});
|
|
1968
|
+
Logger({ level: "WARN", message: res_error });
|
|
1969
|
+
}
|
|
1970
|
+
|
|
1971
|
+
return response;
|
|
888
1972
|
}
|
|
889
1973
|
|
|
890
1974
|
/**
|
|
@@ -900,10 +1984,11 @@ class Catalog {
|
|
|
900
1984
|
* given set of results.
|
|
901
1985
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
902
1986
|
* page. Default is 12.
|
|
1987
|
+
* @returns {Promise<GetCollectionListingResponse>} - Success response
|
|
903
1988
|
* @summary: List all the collections
|
|
904
1989
|
* @description: A Collection allows you to organize your products into hierarchical groups. For example, a dress might be in the category _Clothing_, the individual product might also be in the collection _Summer_. On successful request, returns all the collections as specified in `CollectionListingSchema`
|
|
905
1990
|
*/
|
|
906
|
-
getAllCollections({
|
|
1991
|
+
async getAllCollections({
|
|
907
1992
|
q,
|
|
908
1993
|
scheduleStatus,
|
|
909
1994
|
type,
|
|
@@ -928,6 +2013,27 @@ class Catalog {
|
|
|
928
2013
|
return Promise.reject(new FDKClientValidationError(error));
|
|
929
2014
|
}
|
|
930
2015
|
|
|
2016
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2017
|
+
const { error: warrning } = CatalogValidator.getAllCollections().validate(
|
|
2018
|
+
{
|
|
2019
|
+
q,
|
|
2020
|
+
scheduleStatus,
|
|
2021
|
+
type,
|
|
2022
|
+
tags,
|
|
2023
|
+
isActive,
|
|
2024
|
+
pageNo,
|
|
2025
|
+
pageSize,
|
|
2026
|
+
},
|
|
2027
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2028
|
+
);
|
|
2029
|
+
if (warrning) {
|
|
2030
|
+
Logger({
|
|
2031
|
+
level: "WARN",
|
|
2032
|
+
message: "Parameter Validation warrnings for getAllCollections",
|
|
2033
|
+
});
|
|
2034
|
+
Logger({ level: "WARN", message: warrning });
|
|
2035
|
+
}
|
|
2036
|
+
|
|
931
2037
|
const query_params = {};
|
|
932
2038
|
query_params["q"] = q;
|
|
933
2039
|
query_params["schedule_status"] = scheduleStatus;
|
|
@@ -937,41 +2043,30 @@ class Catalog {
|
|
|
937
2043
|
query_params["page_no"] = pageNo;
|
|
938
2044
|
query_params["page_size"] = pageSize;
|
|
939
2045
|
|
|
940
|
-
|
|
2046
|
+
const response = await PlatformAPIClient.execute(
|
|
941
2047
|
this.config,
|
|
942
2048
|
"get",
|
|
943
2049
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/`,
|
|
944
2050
|
query_params,
|
|
945
2051
|
undefined
|
|
946
2052
|
);
|
|
947
|
-
}
|
|
948
2053
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
{
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
if (error) {
|
|
963
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2054
|
+
const {
|
|
2055
|
+
error: res_error,
|
|
2056
|
+
} = CatalogModel.GetCollectionListingResponse().validate(response, {
|
|
2057
|
+
abortEarly: false,
|
|
2058
|
+
allowUnknown: false,
|
|
2059
|
+
});
|
|
2060
|
+
|
|
2061
|
+
if (res_error) {
|
|
2062
|
+
Logger({
|
|
2063
|
+
level: "WARN",
|
|
2064
|
+
message: "Response Validation Warnnings for getAllCollections",
|
|
2065
|
+
});
|
|
2066
|
+
Logger({ level: "WARN", message: res_error });
|
|
964
2067
|
}
|
|
965
2068
|
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
return PlatformAPIClient.execute(
|
|
969
|
-
this.config,
|
|
970
|
-
"post",
|
|
971
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/`,
|
|
972
|
-
query_params,
|
|
973
|
-
body
|
|
974
|
-
);
|
|
2069
|
+
return response;
|
|
975
2070
|
}
|
|
976
2071
|
|
|
977
2072
|
/**
|
|
@@ -979,10 +2074,11 @@ class Catalog {
|
|
|
979
2074
|
* @param {string} arg.slug - A `slug` is a human readable, URL friendly
|
|
980
2075
|
* unique identifier of an object. Pass the `slug` of the collection which
|
|
981
2076
|
* you want to retrieve.
|
|
2077
|
+
* @returns {Promise<CollectionDetailResponse>} - Success response
|
|
982
2078
|
* @summary: Get a particular collection
|
|
983
2079
|
* @description: Get the details of a collection by its `slug`. If successful, returns a Collection resource in the response body specified in `CollectionDetailResponse`
|
|
984
2080
|
*/
|
|
985
|
-
getCollectionDetail({ slug } = {}) {
|
|
2081
|
+
async getCollectionDetail({ slug } = {}) {
|
|
986
2082
|
const { error } = CatalogValidator.getCollectionDetail().validate(
|
|
987
2083
|
{
|
|
988
2084
|
slug,
|
|
@@ -993,25 +2089,58 @@ class Catalog {
|
|
|
993
2089
|
return Promise.reject(new FDKClientValidationError(error));
|
|
994
2090
|
}
|
|
995
2091
|
|
|
2092
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2093
|
+
const { error: warrning } = CatalogValidator.getCollectionDetail().validate(
|
|
2094
|
+
{
|
|
2095
|
+
slug,
|
|
2096
|
+
},
|
|
2097
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2098
|
+
);
|
|
2099
|
+
if (warrning) {
|
|
2100
|
+
Logger({
|
|
2101
|
+
level: "WARN",
|
|
2102
|
+
message: "Parameter Validation warrnings for getCollectionDetail",
|
|
2103
|
+
});
|
|
2104
|
+
Logger({ level: "WARN", message: warrning });
|
|
2105
|
+
}
|
|
2106
|
+
|
|
996
2107
|
const query_params = {};
|
|
997
2108
|
|
|
998
|
-
|
|
2109
|
+
const response = await PlatformAPIClient.execute(
|
|
999
2110
|
this.config,
|
|
1000
2111
|
"get",
|
|
1001
2112
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${slug}/`,
|
|
1002
2113
|
query_params,
|
|
1003
2114
|
undefined
|
|
1004
2115
|
);
|
|
2116
|
+
|
|
2117
|
+
const {
|
|
2118
|
+
error: res_error,
|
|
2119
|
+
} = CatalogModel.CollectionDetailResponse().validate(response, {
|
|
2120
|
+
abortEarly: false,
|
|
2121
|
+
allowUnknown: false,
|
|
2122
|
+
});
|
|
2123
|
+
|
|
2124
|
+
if (res_error) {
|
|
2125
|
+
Logger({
|
|
2126
|
+
level: "WARN",
|
|
2127
|
+
message: "Response Validation Warnnings for getCollectionDetail",
|
|
2128
|
+
});
|
|
2129
|
+
Logger({ level: "WARN", message: res_error });
|
|
2130
|
+
}
|
|
2131
|
+
|
|
2132
|
+
return response;
|
|
1005
2133
|
}
|
|
1006
2134
|
|
|
1007
2135
|
/**
|
|
1008
2136
|
* @param {Object} arg - Arg object.
|
|
1009
2137
|
* @param {string} arg.id - A `id` is a unique identifier of a collection.
|
|
1010
2138
|
* @param {UpdateCollection} arg.body
|
|
2139
|
+
* @returns {Promise<UpdateCollection>} - Success response
|
|
1011
2140
|
* @summary: Update a collection
|
|
1012
2141
|
* @description: Update a collection by it's id. On successful request, returns the updated collection
|
|
1013
2142
|
*/
|
|
1014
|
-
updateCollection({ id, body } = {}) {
|
|
2143
|
+
async updateCollection({ id, body } = {}) {
|
|
1015
2144
|
const { error } = CatalogValidator.updateCollection().validate(
|
|
1016
2145
|
{
|
|
1017
2146
|
id,
|
|
@@ -1023,24 +2152,58 @@ class Catalog {
|
|
|
1023
2152
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1024
2153
|
}
|
|
1025
2154
|
|
|
2155
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2156
|
+
const { error: warrning } = CatalogValidator.updateCollection().validate(
|
|
2157
|
+
{
|
|
2158
|
+
id,
|
|
2159
|
+
body,
|
|
2160
|
+
},
|
|
2161
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2162
|
+
);
|
|
2163
|
+
if (warrning) {
|
|
2164
|
+
Logger({
|
|
2165
|
+
level: "WARN",
|
|
2166
|
+
message: "Parameter Validation warrnings for updateCollection",
|
|
2167
|
+
});
|
|
2168
|
+
Logger({ level: "WARN", message: warrning });
|
|
2169
|
+
}
|
|
2170
|
+
|
|
1026
2171
|
const query_params = {};
|
|
1027
2172
|
|
|
1028
|
-
|
|
2173
|
+
const response = await PlatformAPIClient.execute(
|
|
1029
2174
|
this.config,
|
|
1030
2175
|
"put",
|
|
1031
2176
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/`,
|
|
1032
2177
|
query_params,
|
|
1033
2178
|
body
|
|
1034
2179
|
);
|
|
2180
|
+
|
|
2181
|
+
const {
|
|
2182
|
+
error: res_error,
|
|
2183
|
+
} = CatalogModel.UpdateCollection().validate(response, {
|
|
2184
|
+
abortEarly: false,
|
|
2185
|
+
allowUnknown: false,
|
|
2186
|
+
});
|
|
2187
|
+
|
|
2188
|
+
if (res_error) {
|
|
2189
|
+
Logger({
|
|
2190
|
+
level: "WARN",
|
|
2191
|
+
message: "Response Validation Warnnings for updateCollection",
|
|
2192
|
+
});
|
|
2193
|
+
Logger({ level: "WARN", message: res_error });
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2196
|
+
return response;
|
|
1035
2197
|
}
|
|
1036
2198
|
|
|
1037
2199
|
/**
|
|
1038
2200
|
* @param {Object} arg - Arg object.
|
|
1039
2201
|
* @param {string} arg.id - A `id` is a unique identifier of a collection.
|
|
2202
|
+
* @returns {Promise<DeleteResponse>} - Success response
|
|
1040
2203
|
* @summary: Delete a Collection
|
|
1041
2204
|
* @description: Delete a collection by it's id. Returns an object that tells whether the collection was deleted successfully
|
|
1042
2205
|
*/
|
|
1043
|
-
deleteCollection({ id } = {}) {
|
|
2206
|
+
async deleteCollection({ id } = {}) {
|
|
1044
2207
|
const { error } = CatalogValidator.deleteCollection().validate(
|
|
1045
2208
|
{
|
|
1046
2209
|
id,
|
|
@@ -1051,36 +2214,62 @@ class Catalog {
|
|
|
1051
2214
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1052
2215
|
}
|
|
1053
2216
|
|
|
2217
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2218
|
+
const { error: warrning } = CatalogValidator.deleteCollection().validate(
|
|
2219
|
+
{
|
|
2220
|
+
id,
|
|
2221
|
+
},
|
|
2222
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2223
|
+
);
|
|
2224
|
+
if (warrning) {
|
|
2225
|
+
Logger({
|
|
2226
|
+
level: "WARN",
|
|
2227
|
+
message: "Parameter Validation warrnings for deleteCollection",
|
|
2228
|
+
});
|
|
2229
|
+
Logger({ level: "WARN", message: warrning });
|
|
2230
|
+
}
|
|
2231
|
+
|
|
1054
2232
|
const query_params = {};
|
|
1055
2233
|
|
|
1056
|
-
|
|
2234
|
+
const response = await PlatformAPIClient.execute(
|
|
1057
2235
|
this.config,
|
|
1058
2236
|
"delete",
|
|
1059
2237
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/`,
|
|
1060
2238
|
query_params,
|
|
1061
2239
|
undefined
|
|
1062
2240
|
);
|
|
2241
|
+
|
|
2242
|
+
const {
|
|
2243
|
+
error: res_error,
|
|
2244
|
+
} = CatalogModel.DeleteResponse().validate(response, {
|
|
2245
|
+
abortEarly: false,
|
|
2246
|
+
allowUnknown: false,
|
|
2247
|
+
});
|
|
2248
|
+
|
|
2249
|
+
if (res_error) {
|
|
2250
|
+
Logger({
|
|
2251
|
+
level: "WARN",
|
|
2252
|
+
message: "Response Validation Warnnings for deleteCollection",
|
|
2253
|
+
});
|
|
2254
|
+
Logger({ level: "WARN", message: res_error });
|
|
2255
|
+
}
|
|
2256
|
+
|
|
2257
|
+
return response;
|
|
1063
2258
|
}
|
|
1064
2259
|
|
|
1065
2260
|
/**
|
|
1066
2261
|
* @param {Object} arg - Arg object.
|
|
1067
2262
|
* @param {string} arg.id - A `id` is a unique identifier of a collection.
|
|
1068
|
-
* @param {
|
|
1069
|
-
*
|
|
1070
|
-
* @
|
|
1071
|
-
*
|
|
1072
|
-
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
1073
|
-
* page. Default is 12.
|
|
1074
|
-
* @summary: Get the items for a collection
|
|
1075
|
-
* @description: Get items from a collection specified by its `id`.
|
|
2263
|
+
* @param {CollectionItemUpdate} arg.body
|
|
2264
|
+
* @returns {Promise<UpdatedResponse>} - Success response
|
|
2265
|
+
* @summary: Add items to a collection
|
|
2266
|
+
* @description: Adds items to a collection specified by its `id`. See `CollectionItemRequest` for the list of attributes needed to add items to an collection.
|
|
1076
2267
|
*/
|
|
1077
|
-
|
|
1078
|
-
const { error } = CatalogValidator.
|
|
2268
|
+
async addCollectionItems({ id, body } = {}) {
|
|
2269
|
+
const { error } = CatalogValidator.addCollectionItems().validate(
|
|
1079
2270
|
{
|
|
1080
2271
|
id,
|
|
1081
|
-
|
|
1082
|
-
pageId,
|
|
1083
|
-
pageSize,
|
|
2272
|
+
body,
|
|
1084
2273
|
},
|
|
1085
2274
|
{ abortEarly: false, allowUnknown: true }
|
|
1086
2275
|
);
|
|
@@ -1088,32 +2277,70 @@ class Catalog {
|
|
|
1088
2277
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1089
2278
|
}
|
|
1090
2279
|
|
|
2280
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2281
|
+
const { error: warrning } = CatalogValidator.addCollectionItems().validate(
|
|
2282
|
+
{
|
|
2283
|
+
id,
|
|
2284
|
+
body,
|
|
2285
|
+
},
|
|
2286
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2287
|
+
);
|
|
2288
|
+
if (warrning) {
|
|
2289
|
+
Logger({
|
|
2290
|
+
level: "WARN",
|
|
2291
|
+
message: "Parameter Validation warrnings for addCollectionItems",
|
|
2292
|
+
});
|
|
2293
|
+
Logger({ level: "WARN", message: warrning });
|
|
2294
|
+
}
|
|
2295
|
+
|
|
1091
2296
|
const query_params = {};
|
|
1092
|
-
query_params["sort_on"] = sortOn;
|
|
1093
|
-
query_params["page_id"] = pageId;
|
|
1094
|
-
query_params["page_size"] = pageSize;
|
|
1095
2297
|
|
|
1096
|
-
|
|
2298
|
+
const response = await PlatformAPIClient.execute(
|
|
1097
2299
|
this.config,
|
|
1098
|
-
"
|
|
2300
|
+
"post",
|
|
1099
2301
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/items/`,
|
|
1100
2302
|
query_params,
|
|
1101
|
-
|
|
2303
|
+
body
|
|
1102
2304
|
);
|
|
2305
|
+
|
|
2306
|
+
const {
|
|
2307
|
+
error: res_error,
|
|
2308
|
+
} = CatalogModel.UpdatedResponse().validate(response, {
|
|
2309
|
+
abortEarly: false,
|
|
2310
|
+
allowUnknown: false,
|
|
2311
|
+
});
|
|
2312
|
+
|
|
2313
|
+
if (res_error) {
|
|
2314
|
+
Logger({
|
|
2315
|
+
level: "WARN",
|
|
2316
|
+
message: "Response Validation Warnnings for addCollectionItems",
|
|
2317
|
+
});
|
|
2318
|
+
Logger({ level: "WARN", message: res_error });
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
return response;
|
|
1103
2322
|
}
|
|
1104
2323
|
|
|
1105
2324
|
/**
|
|
1106
2325
|
* @param {Object} arg - Arg object.
|
|
1107
2326
|
* @param {string} arg.id - A `id` is a unique identifier of a collection.
|
|
1108
|
-
* @param {
|
|
1109
|
-
*
|
|
1110
|
-
* @
|
|
2327
|
+
* @param {string} [arg.sortOn] - Each response will contain sort_on param,
|
|
2328
|
+
* which should be sent back to make pagination work.
|
|
2329
|
+
* @param {string} [arg.pageId] - Each response will contain next_id param,
|
|
2330
|
+
* which should be sent back to make pagination work.
|
|
2331
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
2332
|
+
* page. Default is 12.
|
|
2333
|
+
* @returns {Promise<GetCollectionItemsResponse>} - Success response
|
|
2334
|
+
* @summary: Get the items for a collection
|
|
2335
|
+
* @description: Get items from a collection specified by its `id`.
|
|
1111
2336
|
*/
|
|
1112
|
-
|
|
1113
|
-
const { error } = CatalogValidator.
|
|
2337
|
+
async getCollectionItems({ id, sortOn, pageId, pageSize } = {}) {
|
|
2338
|
+
const { error } = CatalogValidator.getCollectionItems().validate(
|
|
1114
2339
|
{
|
|
1115
2340
|
id,
|
|
1116
|
-
|
|
2341
|
+
sortOn,
|
|
2342
|
+
pageId,
|
|
2343
|
+
pageSize,
|
|
1117
2344
|
},
|
|
1118
2345
|
{ abortEarly: false, allowUnknown: true }
|
|
1119
2346
|
);
|
|
@@ -1121,24 +2348,63 @@ class Catalog {
|
|
|
1121
2348
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1122
2349
|
}
|
|
1123
2350
|
|
|
2351
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2352
|
+
const { error: warrning } = CatalogValidator.getCollectionItems().validate(
|
|
2353
|
+
{
|
|
2354
|
+
id,
|
|
2355
|
+
sortOn,
|
|
2356
|
+
pageId,
|
|
2357
|
+
pageSize,
|
|
2358
|
+
},
|
|
2359
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2360
|
+
);
|
|
2361
|
+
if (warrning) {
|
|
2362
|
+
Logger({
|
|
2363
|
+
level: "WARN",
|
|
2364
|
+
message: "Parameter Validation warrnings for getCollectionItems",
|
|
2365
|
+
});
|
|
2366
|
+
Logger({ level: "WARN", message: warrning });
|
|
2367
|
+
}
|
|
2368
|
+
|
|
1124
2369
|
const query_params = {};
|
|
2370
|
+
query_params["sort_on"] = sortOn;
|
|
2371
|
+
query_params["page_id"] = pageId;
|
|
2372
|
+
query_params["page_size"] = pageSize;
|
|
1125
2373
|
|
|
1126
|
-
|
|
2374
|
+
const response = await PlatformAPIClient.execute(
|
|
1127
2375
|
this.config,
|
|
1128
|
-
"
|
|
2376
|
+
"get",
|
|
1129
2377
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/collections/${id}/items/`,
|
|
1130
2378
|
query_params,
|
|
1131
|
-
|
|
2379
|
+
undefined
|
|
1132
2380
|
);
|
|
2381
|
+
|
|
2382
|
+
const {
|
|
2383
|
+
error: res_error,
|
|
2384
|
+
} = CatalogModel.GetCollectionItemsResponse().validate(response, {
|
|
2385
|
+
abortEarly: false,
|
|
2386
|
+
allowUnknown: false,
|
|
2387
|
+
});
|
|
2388
|
+
|
|
2389
|
+
if (res_error) {
|
|
2390
|
+
Logger({
|
|
2391
|
+
level: "WARN",
|
|
2392
|
+
message: "Response Validation Warnnings for getCollectionItems",
|
|
2393
|
+
});
|
|
2394
|
+
Logger({ level: "WARN", message: res_error });
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
return response;
|
|
1133
2398
|
}
|
|
1134
2399
|
|
|
1135
2400
|
/**
|
|
1136
2401
|
* @param {Object} arg - Arg object.
|
|
1137
2402
|
* @param {string} [arg.brand] - Brand slug
|
|
2403
|
+
* @returns {Promise<CatalogInsightResponse>} - Success response
|
|
1138
2404
|
* @summary: Analytics data of catalog and inventory.
|
|
1139
2405
|
* @description: Catalog Insights api returns the count of catalog related data like products, brands, departments and categories that have been made live as per configuration of the app.
|
|
1140
2406
|
*/
|
|
1141
|
-
getCatalogInsights({ brand } = {}) {
|
|
2407
|
+
async getCatalogInsights({ brand } = {}) {
|
|
1142
2408
|
const { error } = CatalogValidator.getCatalogInsights().validate(
|
|
1143
2409
|
{
|
|
1144
2410
|
brand,
|
|
@@ -1149,16 +2415,48 @@ class Catalog {
|
|
|
1149
2415
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1150
2416
|
}
|
|
1151
2417
|
|
|
2418
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2419
|
+
const { error: warrning } = CatalogValidator.getCatalogInsights().validate(
|
|
2420
|
+
{
|
|
2421
|
+
brand,
|
|
2422
|
+
},
|
|
2423
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2424
|
+
);
|
|
2425
|
+
if (warrning) {
|
|
2426
|
+
Logger({
|
|
2427
|
+
level: "WARN",
|
|
2428
|
+
message: "Parameter Validation warrnings for getCatalogInsights",
|
|
2429
|
+
});
|
|
2430
|
+
Logger({ level: "WARN", message: warrning });
|
|
2431
|
+
}
|
|
2432
|
+
|
|
1152
2433
|
const query_params = {};
|
|
1153
2434
|
query_params["brand"] = brand;
|
|
1154
2435
|
|
|
1155
|
-
|
|
2436
|
+
const response = await PlatformAPIClient.execute(
|
|
1156
2437
|
this.config,
|
|
1157
2438
|
"get",
|
|
1158
2439
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/analytics/insights/`,
|
|
1159
2440
|
query_params,
|
|
1160
2441
|
undefined
|
|
1161
2442
|
);
|
|
2443
|
+
|
|
2444
|
+
const {
|
|
2445
|
+
error: res_error,
|
|
2446
|
+
} = CatalogModel.CatalogInsightResponse().validate(response, {
|
|
2447
|
+
abortEarly: false,
|
|
2448
|
+
allowUnknown: false,
|
|
2449
|
+
});
|
|
2450
|
+
|
|
2451
|
+
if (res_error) {
|
|
2452
|
+
Logger({
|
|
2453
|
+
level: "WARN",
|
|
2454
|
+
message: "Response Validation Warnnings for getCatalogInsights",
|
|
2455
|
+
});
|
|
2456
|
+
Logger({ level: "WARN", message: res_error });
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
return response;
|
|
1162
2460
|
}
|
|
1163
2461
|
|
|
1164
2462
|
/**
|
|
@@ -1172,10 +2470,11 @@ class Catalog {
|
|
|
1172
2470
|
* page. Default is 12.
|
|
1173
2471
|
* @param {string} [arg.q] - Search with help of store code.
|
|
1174
2472
|
* @param {number[]} [arg.locationIds] - Search by store ids.
|
|
2473
|
+
* @returns {Promise<InventorySellerIdentifierResponsePaginated>} - Success response
|
|
1175
2474
|
* @summary: Get Inventory for company
|
|
1176
2475
|
* @description: This API allows get Inventory data for particular company grouped by size and store.
|
|
1177
2476
|
*/
|
|
1178
|
-
getDiscountedInventoryBySizeIdentifier({
|
|
2477
|
+
async getDiscountedInventoryBySizeIdentifier({
|
|
1179
2478
|
itemId,
|
|
1180
2479
|
sizeIdentifier,
|
|
1181
2480
|
pageNo,
|
|
@@ -1184,7 +2483,25 @@ class Catalog {
|
|
|
1184
2483
|
locationIds,
|
|
1185
2484
|
} = {}) {
|
|
1186
2485
|
const {
|
|
1187
|
-
error,
|
|
2486
|
+
error,
|
|
2487
|
+
} = CatalogValidator.getDiscountedInventoryBySizeIdentifier().validate(
|
|
2488
|
+
{
|
|
2489
|
+
itemId,
|
|
2490
|
+
sizeIdentifier,
|
|
2491
|
+
pageNo,
|
|
2492
|
+
pageSize,
|
|
2493
|
+
q,
|
|
2494
|
+
locationIds,
|
|
2495
|
+
},
|
|
2496
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2497
|
+
);
|
|
2498
|
+
if (error) {
|
|
2499
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2503
|
+
const {
|
|
2504
|
+
error: warrning,
|
|
1188
2505
|
} = CatalogValidator.getDiscountedInventoryBySizeIdentifier().validate(
|
|
1189
2506
|
{
|
|
1190
2507
|
itemId,
|
|
@@ -1194,10 +2511,15 @@ class Catalog {
|
|
|
1194
2511
|
q,
|
|
1195
2512
|
locationIds,
|
|
1196
2513
|
},
|
|
1197
|
-
{ abortEarly: false, allowUnknown:
|
|
2514
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1198
2515
|
);
|
|
1199
|
-
if (
|
|
1200
|
-
|
|
2516
|
+
if (warrning) {
|
|
2517
|
+
Logger({
|
|
2518
|
+
level: "WARN",
|
|
2519
|
+
message:
|
|
2520
|
+
"Parameter Validation warrnings for getDiscountedInventoryBySizeIdentifier",
|
|
2521
|
+
});
|
|
2522
|
+
Logger({ level: "WARN", message: warrning });
|
|
1201
2523
|
}
|
|
1202
2524
|
|
|
1203
2525
|
const query_params = {};
|
|
@@ -1206,13 +2528,31 @@ class Catalog {
|
|
|
1206
2528
|
query_params["q"] = q;
|
|
1207
2529
|
query_params["location_ids"] = locationIds;
|
|
1208
2530
|
|
|
1209
|
-
|
|
2531
|
+
const response = await PlatformAPIClient.execute(
|
|
1210
2532
|
this.config,
|
|
1211
2533
|
"get",
|
|
1212
2534
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/products/${itemId}/inventory/${sizeIdentifier}`,
|
|
1213
2535
|
query_params,
|
|
1214
2536
|
undefined
|
|
1215
2537
|
);
|
|
2538
|
+
|
|
2539
|
+
const {
|
|
2540
|
+
error: res_error,
|
|
2541
|
+
} = CatalogModel.InventorySellerIdentifierResponsePaginated().validate(
|
|
2542
|
+
response,
|
|
2543
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2544
|
+
);
|
|
2545
|
+
|
|
2546
|
+
if (res_error) {
|
|
2547
|
+
Logger({
|
|
2548
|
+
level: "WARN",
|
|
2549
|
+
message:
|
|
2550
|
+
"Response Validation Warnnings for getDiscountedInventoryBySizeIdentifier",
|
|
2551
|
+
});
|
|
2552
|
+
Logger({ level: "WARN", message: res_error });
|
|
2553
|
+
}
|
|
2554
|
+
|
|
2555
|
+
return response;
|
|
1216
2556
|
}
|
|
1217
2557
|
|
|
1218
2558
|
/**
|
|
@@ -1229,10 +2569,17 @@ class Catalog {
|
|
|
1229
2569
|
* to search brands by brand name.
|
|
1230
2570
|
* @param {number[]} [arg.brandId] - Helps to sort the brands list on the
|
|
1231
2571
|
* basis of uid list.
|
|
2572
|
+
* @returns {Promise<BrandListingResponse>} - Success response
|
|
1232
2573
|
* @summary: List all the brands
|
|
1233
2574
|
* @description: A brand is the name under which a product is being sold. Use this API to list all the brands. You can pass optionally filter the brands by the department. If successful, returns a paginated list of brands specified in `BrandListingResponse`
|
|
1234
2575
|
*/
|
|
1235
|
-
getApplicationBrands({
|
|
2576
|
+
async getApplicationBrands({
|
|
2577
|
+
department,
|
|
2578
|
+
pageNo,
|
|
2579
|
+
pageSize,
|
|
2580
|
+
q,
|
|
2581
|
+
brandId,
|
|
2582
|
+
} = {}) {
|
|
1236
2583
|
const { error } = CatalogValidator.getApplicationBrands().validate(
|
|
1237
2584
|
{
|
|
1238
2585
|
department,
|
|
@@ -1247,6 +2594,27 @@ class Catalog {
|
|
|
1247
2594
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1248
2595
|
}
|
|
1249
2596
|
|
|
2597
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2598
|
+
const {
|
|
2599
|
+
error: warrning,
|
|
2600
|
+
} = CatalogValidator.getApplicationBrands().validate(
|
|
2601
|
+
{
|
|
2602
|
+
department,
|
|
2603
|
+
pageNo,
|
|
2604
|
+
pageSize,
|
|
2605
|
+
q,
|
|
2606
|
+
brandId,
|
|
2607
|
+
},
|
|
2608
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2609
|
+
);
|
|
2610
|
+
if (warrning) {
|
|
2611
|
+
Logger({
|
|
2612
|
+
level: "WARN",
|
|
2613
|
+
message: "Parameter Validation warrnings for getApplicationBrands",
|
|
2614
|
+
});
|
|
2615
|
+
Logger({ level: "WARN", message: warrning });
|
|
2616
|
+
}
|
|
2617
|
+
|
|
1250
2618
|
const query_params = {};
|
|
1251
2619
|
query_params["department"] = department;
|
|
1252
2620
|
query_params["page_no"] = pageNo;
|
|
@@ -1254,13 +2622,30 @@ class Catalog {
|
|
|
1254
2622
|
query_params["q"] = q;
|
|
1255
2623
|
query_params["brand_id"] = brandId;
|
|
1256
2624
|
|
|
1257
|
-
|
|
2625
|
+
const response = await PlatformAPIClient.execute(
|
|
1258
2626
|
this.config,
|
|
1259
2627
|
"get",
|
|
1260
2628
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/brands`,
|
|
1261
2629
|
query_params,
|
|
1262
2630
|
undefined
|
|
1263
2631
|
);
|
|
2632
|
+
|
|
2633
|
+
const {
|
|
2634
|
+
error: res_error,
|
|
2635
|
+
} = CatalogModel.BrandListingResponse().validate(response, {
|
|
2636
|
+
abortEarly: false,
|
|
2637
|
+
allowUnknown: false,
|
|
2638
|
+
});
|
|
2639
|
+
|
|
2640
|
+
if (res_error) {
|
|
2641
|
+
Logger({
|
|
2642
|
+
level: "WARN",
|
|
2643
|
+
message: "Response Validation Warnnings for getApplicationBrands",
|
|
2644
|
+
});
|
|
2645
|
+
Logger({ level: "WARN", message: res_error });
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
return response;
|
|
1264
2649
|
}
|
|
1265
2650
|
|
|
1266
2651
|
/**
|
|
@@ -1316,10 +2701,11 @@ class Catalog {
|
|
|
1316
2701
|
|
|
1317
2702
|
/**
|
|
1318
2703
|
* @param {Object} arg - Arg object.
|
|
2704
|
+
* @returns {Promise<DepartmentResponse>} - Success response
|
|
1319
2705
|
* @summary: List all the departments
|
|
1320
2706
|
* @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the departments. If successful, returns the list of departments specified in `DepartmentResponse`
|
|
1321
2707
|
*/
|
|
1322
|
-
getDepartments({} = {}) {
|
|
2708
|
+
async getDepartments({} = {}) {
|
|
1323
2709
|
const { error } = CatalogValidator.getDepartments().validate(
|
|
1324
2710
|
{},
|
|
1325
2711
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1328,15 +2714,45 @@ class Catalog {
|
|
|
1328
2714
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1329
2715
|
}
|
|
1330
2716
|
|
|
2717
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2718
|
+
const { error: warrning } = CatalogValidator.getDepartments().validate(
|
|
2719
|
+
{},
|
|
2720
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2721
|
+
);
|
|
2722
|
+
if (warrning) {
|
|
2723
|
+
Logger({
|
|
2724
|
+
level: "WARN",
|
|
2725
|
+
message: "Parameter Validation warrnings for getDepartments",
|
|
2726
|
+
});
|
|
2727
|
+
Logger({ level: "WARN", message: warrning });
|
|
2728
|
+
}
|
|
2729
|
+
|
|
1331
2730
|
const query_params = {};
|
|
1332
2731
|
|
|
1333
|
-
|
|
2732
|
+
const response = await PlatformAPIClient.execute(
|
|
1334
2733
|
this.config,
|
|
1335
2734
|
"get",
|
|
1336
2735
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/departments`,
|
|
1337
2736
|
query_params,
|
|
1338
2737
|
undefined
|
|
1339
2738
|
);
|
|
2739
|
+
|
|
2740
|
+
const {
|
|
2741
|
+
error: res_error,
|
|
2742
|
+
} = CatalogModel.DepartmentResponse().validate(response, {
|
|
2743
|
+
abortEarly: false,
|
|
2744
|
+
allowUnknown: false,
|
|
2745
|
+
});
|
|
2746
|
+
|
|
2747
|
+
if (res_error) {
|
|
2748
|
+
Logger({
|
|
2749
|
+
level: "WARN",
|
|
2750
|
+
message: "Response Validation Warnnings for getDepartments",
|
|
2751
|
+
});
|
|
2752
|
+
Logger({ level: "WARN", message: res_error });
|
|
2753
|
+
}
|
|
2754
|
+
|
|
2755
|
+
return response;
|
|
1340
2756
|
}
|
|
1341
2757
|
|
|
1342
2758
|
/**
|
|
@@ -1345,10 +2761,11 @@ class Catalog {
|
|
|
1345
2761
|
* parameter to filter products by a particular department. See below the
|
|
1346
2762
|
* list of available departments. You can retrieve available departments
|
|
1347
2763
|
* from the **v1.0/departments/** API
|
|
2764
|
+
* @returns {Promise<CategoryListingResponse>} - Success response
|
|
1348
2765
|
* @summary: List all the categories
|
|
1349
2766
|
* @description: List all the categories. You can optionally pass filter the brands by the department. If successful, returns a paginated list of brands specified in `CategoryListingResponse`
|
|
1350
2767
|
*/
|
|
1351
|
-
getCategories({ department } = {}) {
|
|
2768
|
+
async getCategories({ department } = {}) {
|
|
1352
2769
|
const { error } = CatalogValidator.getCategories().validate(
|
|
1353
2770
|
{
|
|
1354
2771
|
department,
|
|
@@ -1359,16 +2776,48 @@ class Catalog {
|
|
|
1359
2776
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1360
2777
|
}
|
|
1361
2778
|
|
|
2779
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2780
|
+
const { error: warrning } = CatalogValidator.getCategories().validate(
|
|
2781
|
+
{
|
|
2782
|
+
department,
|
|
2783
|
+
},
|
|
2784
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2785
|
+
);
|
|
2786
|
+
if (warrning) {
|
|
2787
|
+
Logger({
|
|
2788
|
+
level: "WARN",
|
|
2789
|
+
message: "Parameter Validation warrnings for getCategories",
|
|
2790
|
+
});
|
|
2791
|
+
Logger({ level: "WARN", message: warrning });
|
|
2792
|
+
}
|
|
2793
|
+
|
|
1362
2794
|
const query_params = {};
|
|
1363
2795
|
query_params["department"] = department;
|
|
1364
2796
|
|
|
1365
|
-
|
|
2797
|
+
const response = await PlatformAPIClient.execute(
|
|
1366
2798
|
this.config,
|
|
1367
2799
|
"get",
|
|
1368
2800
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/categories`,
|
|
1369
2801
|
query_params,
|
|
1370
2802
|
undefined
|
|
1371
2803
|
);
|
|
2804
|
+
|
|
2805
|
+
const {
|
|
2806
|
+
error: res_error,
|
|
2807
|
+
} = CatalogModel.CategoryListingResponse().validate(response, {
|
|
2808
|
+
abortEarly: false,
|
|
2809
|
+
allowUnknown: false,
|
|
2810
|
+
});
|
|
2811
|
+
|
|
2812
|
+
if (res_error) {
|
|
2813
|
+
Logger({
|
|
2814
|
+
level: "WARN",
|
|
2815
|
+
message: "Response Validation Warnnings for getCategories",
|
|
2816
|
+
});
|
|
2817
|
+
Logger({ level: "WARN", message: res_error });
|
|
2818
|
+
}
|
|
2819
|
+
|
|
2820
|
+
return response;
|
|
1372
2821
|
}
|
|
1373
2822
|
|
|
1374
2823
|
/**
|
|
@@ -1397,10 +2846,11 @@ class Catalog {
|
|
|
1397
2846
|
* @param {string} [arg.pageType] - For pagination type should be cursor or
|
|
1398
2847
|
* number. Default is cursor.
|
|
1399
2848
|
* @param {number[]} [arg.itemIds] - Item Ids of product
|
|
2849
|
+
* @returns {Promise<ApplicationProductListingResponse>} - Success response
|
|
1400
2850
|
* @summary: List the products
|
|
1401
2851
|
* @description: List all the products associated with a brand, collection or category in a requested sort order. The API additionally supports arbitrary search queries that may refer the name of any product, brand, category or collection. If successful, returns a paginated list of products specified in `ApplicationProductListingResponse`
|
|
1402
2852
|
*/
|
|
1403
|
-
getAppicationProducts({
|
|
2853
|
+
async getAppicationProducts({
|
|
1404
2854
|
q,
|
|
1405
2855
|
f,
|
|
1406
2856
|
c,
|
|
@@ -1431,6 +2881,32 @@ class Catalog {
|
|
|
1431
2881
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1432
2882
|
}
|
|
1433
2883
|
|
|
2884
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2885
|
+
const {
|
|
2886
|
+
error: warrning,
|
|
2887
|
+
} = CatalogValidator.getAppicationProducts().validate(
|
|
2888
|
+
{
|
|
2889
|
+
q,
|
|
2890
|
+
f,
|
|
2891
|
+
c,
|
|
2892
|
+
filters,
|
|
2893
|
+
sortOn,
|
|
2894
|
+
pageId,
|
|
2895
|
+
pageSize,
|
|
2896
|
+
pageNo,
|
|
2897
|
+
pageType,
|
|
2898
|
+
itemIds,
|
|
2899
|
+
},
|
|
2900
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2901
|
+
);
|
|
2902
|
+
if (warrning) {
|
|
2903
|
+
Logger({
|
|
2904
|
+
level: "WARN",
|
|
2905
|
+
message: "Parameter Validation warrnings for getAppicationProducts",
|
|
2906
|
+
});
|
|
2907
|
+
Logger({ level: "WARN", message: warrning });
|
|
2908
|
+
}
|
|
2909
|
+
|
|
1434
2910
|
const query_params = {};
|
|
1435
2911
|
query_params["q"] = q;
|
|
1436
2912
|
query_params["f"] = f;
|
|
@@ -1443,13 +2919,30 @@ class Catalog {
|
|
|
1443
2919
|
query_params["page_type"] = pageType;
|
|
1444
2920
|
query_params["item_ids"] = itemIds;
|
|
1445
2921
|
|
|
1446
|
-
|
|
2922
|
+
const response = await PlatformAPIClient.execute(
|
|
1447
2923
|
this.config,
|
|
1448
2924
|
"get",
|
|
1449
2925
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/products`,
|
|
1450
2926
|
query_params,
|
|
1451
2927
|
undefined
|
|
1452
2928
|
);
|
|
2929
|
+
|
|
2930
|
+
const {
|
|
2931
|
+
error: res_error,
|
|
2932
|
+
} = CatalogModel.ApplicationProductListingResponse().validate(response, {
|
|
2933
|
+
abortEarly: false,
|
|
2934
|
+
allowUnknown: false,
|
|
2935
|
+
});
|
|
2936
|
+
|
|
2937
|
+
if (res_error) {
|
|
2938
|
+
Logger({
|
|
2939
|
+
level: "WARN",
|
|
2940
|
+
message: "Response Validation Warnnings for getAppicationProducts",
|
|
2941
|
+
});
|
|
2942
|
+
Logger({ level: "WARN", message: res_error });
|
|
2943
|
+
}
|
|
2944
|
+
|
|
2945
|
+
return response;
|
|
1453
2946
|
}
|
|
1454
2947
|
|
|
1455
2948
|
/**
|
|
@@ -1524,10 +3017,11 @@ class Catalog {
|
|
|
1524
3017
|
* @param {string} arg.slug - The unique identifier of a product. i.e;
|
|
1525
3018
|
* `slug` of a product. You can retrieve these from the APIs that list
|
|
1526
3019
|
* products like **v1.0/products/**
|
|
3020
|
+
* @returns {Promise<ProductDetail>} - Success response
|
|
1527
3021
|
* @summary: Get a product
|
|
1528
3022
|
* @description: Products are the core resource of an application. Products can be associated by categories, collections, brands and more. This API retrieves the product specified by the given **slug**. If successful, returns a Product resource in the response body specified in `ProductDetail`
|
|
1529
3023
|
*/
|
|
1530
|
-
getProductDetailBySlug({ slug } = {}) {
|
|
3024
|
+
async getProductDetailBySlug({ slug } = {}) {
|
|
1531
3025
|
const { error } = CatalogValidator.getProductDetailBySlug().validate(
|
|
1532
3026
|
{
|
|
1533
3027
|
slug,
|
|
@@ -1538,15 +3032,47 @@ class Catalog {
|
|
|
1538
3032
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1539
3033
|
}
|
|
1540
3034
|
|
|
3035
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3036
|
+
const {
|
|
3037
|
+
error: warrning,
|
|
3038
|
+
} = CatalogValidator.getProductDetailBySlug().validate(
|
|
3039
|
+
{
|
|
3040
|
+
slug,
|
|
3041
|
+
},
|
|
3042
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3043
|
+
);
|
|
3044
|
+
if (warrning) {
|
|
3045
|
+
Logger({
|
|
3046
|
+
level: "WARN",
|
|
3047
|
+
message: "Parameter Validation warrnings for getProductDetailBySlug",
|
|
3048
|
+
});
|
|
3049
|
+
Logger({ level: "WARN", message: warrning });
|
|
3050
|
+
}
|
|
3051
|
+
|
|
1541
3052
|
const query_params = {};
|
|
1542
3053
|
|
|
1543
|
-
|
|
3054
|
+
const response = await PlatformAPIClient.execute(
|
|
1544
3055
|
this.config,
|
|
1545
3056
|
"get",
|
|
1546
3057
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/products/${slug}`,
|
|
1547
3058
|
query_params,
|
|
1548
3059
|
undefined
|
|
1549
3060
|
);
|
|
3061
|
+
|
|
3062
|
+
const { error: res_error } = CatalogModel.ProductDetail().validate(
|
|
3063
|
+
response,
|
|
3064
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3065
|
+
);
|
|
3066
|
+
|
|
3067
|
+
if (res_error) {
|
|
3068
|
+
Logger({
|
|
3069
|
+
level: "WARN",
|
|
3070
|
+
message: "Response Validation Warnnings for getProductDetailBySlug",
|
|
3071
|
+
});
|
|
3072
|
+
Logger({ level: "WARN", message: res_error });
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
return response;
|
|
1550
3076
|
}
|
|
1551
3077
|
|
|
1552
3078
|
/**
|
|
@@ -1562,10 +3088,11 @@ class Catalog {
|
|
|
1562
3088
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
1563
3089
|
* page. Default is 10.
|
|
1564
3090
|
* @param {string} [arg.q] - Search with Item Code, Name, Slug or Identifier.
|
|
3091
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
1565
3092
|
* @summary: Get applicationwise products
|
|
1566
3093
|
* @description: Products are the core resource of an application. Products can be associated by categories, collections, brands and more. If successful, returns a Product resource in the response body specified in `ApplicationProductListingResponseDatabasePowered`
|
|
1567
3094
|
*/
|
|
1568
|
-
getAppProducts({
|
|
3095
|
+
async getAppProducts({
|
|
1569
3096
|
brandIds,
|
|
1570
3097
|
categoryIds,
|
|
1571
3098
|
departmentIds,
|
|
@@ -1590,6 +3117,27 @@ class Catalog {
|
|
|
1590
3117
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1591
3118
|
}
|
|
1592
3119
|
|
|
3120
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3121
|
+
const { error: warrning } = CatalogValidator.getAppProducts().validate(
|
|
3122
|
+
{
|
|
3123
|
+
brandIds,
|
|
3124
|
+
categoryIds,
|
|
3125
|
+
departmentIds,
|
|
3126
|
+
tags,
|
|
3127
|
+
pageNo,
|
|
3128
|
+
pageSize,
|
|
3129
|
+
q,
|
|
3130
|
+
},
|
|
3131
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3132
|
+
);
|
|
3133
|
+
if (warrning) {
|
|
3134
|
+
Logger({
|
|
3135
|
+
level: "WARN",
|
|
3136
|
+
message: "Parameter Validation warrnings for getAppProducts",
|
|
3137
|
+
});
|
|
3138
|
+
Logger({ level: "WARN", message: warrning });
|
|
3139
|
+
}
|
|
3140
|
+
|
|
1593
3141
|
const query_params = {};
|
|
1594
3142
|
query_params["brand_ids"] = brandIds;
|
|
1595
3143
|
query_params["category_ids"] = categoryIds;
|
|
@@ -1599,13 +3147,30 @@ class Catalog {
|
|
|
1599
3147
|
query_params["page_size"] = pageSize;
|
|
1600
3148
|
query_params["q"] = q;
|
|
1601
3149
|
|
|
1602
|
-
|
|
3150
|
+
const response = await PlatformAPIClient.execute(
|
|
1603
3151
|
this.config,
|
|
1604
3152
|
"get",
|
|
1605
3153
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/raw-products/`,
|
|
1606
3154
|
query_params,
|
|
1607
3155
|
undefined
|
|
1608
3156
|
);
|
|
3157
|
+
|
|
3158
|
+
const {
|
|
3159
|
+
error: res_error,
|
|
3160
|
+
} = CatalogModel.ProductListingResponse().validate(response, {
|
|
3161
|
+
abortEarly: false,
|
|
3162
|
+
allowUnknown: false,
|
|
3163
|
+
});
|
|
3164
|
+
|
|
3165
|
+
if (res_error) {
|
|
3166
|
+
Logger({
|
|
3167
|
+
level: "WARN",
|
|
3168
|
+
message: "Response Validation Warnnings for getAppProducts",
|
|
3169
|
+
});
|
|
3170
|
+
Logger({ level: "WARN", message: res_error });
|
|
3171
|
+
}
|
|
3172
|
+
|
|
3173
|
+
return response;
|
|
1609
3174
|
}
|
|
1610
3175
|
|
|
1611
3176
|
/**
|
|
@@ -1618,10 +3183,11 @@ class Catalog {
|
|
|
1618
3183
|
* @param {string} [arg.timestamp] - Timestamp in UTC format (2020-07-23T10:27:50Z)
|
|
1619
3184
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1620
3185
|
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
3186
|
+
* @returns {Promise<InventoryStockResponse>} - Success response
|
|
1621
3187
|
* @summary: Get the stock of a product
|
|
1622
3188
|
* @description: Retrieve the available Inventory of the products. Use this API to get the Inventory status of products with the filters of timestamp, store_ids, brand_ids, item_id - Items - Pagination
|
|
1623
3189
|
*/
|
|
1624
|
-
getAppInventory({
|
|
3190
|
+
async getAppInventory({
|
|
1625
3191
|
itemIds,
|
|
1626
3192
|
storeIds,
|
|
1627
3193
|
brandIds,
|
|
@@ -1646,6 +3212,27 @@ class Catalog {
|
|
|
1646
3212
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1647
3213
|
}
|
|
1648
3214
|
|
|
3215
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3216
|
+
const { error: warrning } = CatalogValidator.getAppInventory().validate(
|
|
3217
|
+
{
|
|
3218
|
+
itemIds,
|
|
3219
|
+
storeIds,
|
|
3220
|
+
brandIds,
|
|
3221
|
+
sellerIdentifiers,
|
|
3222
|
+
timestamp,
|
|
3223
|
+
pageSize,
|
|
3224
|
+
pageId,
|
|
3225
|
+
},
|
|
3226
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3227
|
+
);
|
|
3228
|
+
if (warrning) {
|
|
3229
|
+
Logger({
|
|
3230
|
+
level: "WARN",
|
|
3231
|
+
message: "Parameter Validation warrnings for getAppInventory",
|
|
3232
|
+
});
|
|
3233
|
+
Logger({ level: "WARN", message: warrning });
|
|
3234
|
+
}
|
|
3235
|
+
|
|
1649
3236
|
const query_params = {};
|
|
1650
3237
|
query_params["item_ids"] = itemIds;
|
|
1651
3238
|
query_params["store_ids"] = storeIds;
|
|
@@ -1655,13 +3242,30 @@ class Catalog {
|
|
|
1655
3242
|
query_params["page_size"] = pageSize;
|
|
1656
3243
|
query_params["page_id"] = pageId;
|
|
1657
3244
|
|
|
1658
|
-
|
|
3245
|
+
const response = await PlatformAPIClient.execute(
|
|
1659
3246
|
this.config,
|
|
1660
3247
|
"get",
|
|
1661
3248
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/inventory/`,
|
|
1662
3249
|
query_params,
|
|
1663
3250
|
undefined
|
|
1664
3251
|
);
|
|
3252
|
+
|
|
3253
|
+
const {
|
|
3254
|
+
error: res_error,
|
|
3255
|
+
} = CatalogModel.InventoryStockResponse().validate(response, {
|
|
3256
|
+
abortEarly: false,
|
|
3257
|
+
allowUnknown: false,
|
|
3258
|
+
});
|
|
3259
|
+
|
|
3260
|
+
if (res_error) {
|
|
3261
|
+
Logger({
|
|
3262
|
+
level: "WARN",
|
|
3263
|
+
message: "Response Validation Warnnings for getAppInventory",
|
|
3264
|
+
});
|
|
3265
|
+
Logger({ level: "WARN", message: res_error });
|
|
3266
|
+
}
|
|
3267
|
+
|
|
3268
|
+
return response;
|
|
1665
3269
|
}
|
|
1666
3270
|
|
|
1667
3271
|
/**
|
|
@@ -1677,10 +3281,11 @@ class Catalog {
|
|
|
1677
3281
|
* given set of results
|
|
1678
3282
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
1679
3283
|
* page. Default is 20.
|
|
3284
|
+
* @returns {Promise<LocationListSerializer>} - Success response
|
|
1680
3285
|
* @summary: Get list of locations
|
|
1681
3286
|
* @description: This API allows to view all the locations asscoiated to a application.
|
|
1682
3287
|
*/
|
|
1683
|
-
getAppLocations({ storeType, uid, q, stage, pageNo, pageSize } = {}) {
|
|
3288
|
+
async getAppLocations({ storeType, uid, q, stage, pageNo, pageSize } = {}) {
|
|
1684
3289
|
const { error } = CatalogValidator.getAppLocations().validate(
|
|
1685
3290
|
{
|
|
1686
3291
|
storeType,
|
|
@@ -1696,6 +3301,26 @@ class Catalog {
|
|
|
1696
3301
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1697
3302
|
}
|
|
1698
3303
|
|
|
3304
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3305
|
+
const { error: warrning } = CatalogValidator.getAppLocations().validate(
|
|
3306
|
+
{
|
|
3307
|
+
storeType,
|
|
3308
|
+
uid,
|
|
3309
|
+
q,
|
|
3310
|
+
stage,
|
|
3311
|
+
pageNo,
|
|
3312
|
+
pageSize,
|
|
3313
|
+
},
|
|
3314
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3315
|
+
);
|
|
3316
|
+
if (warrning) {
|
|
3317
|
+
Logger({
|
|
3318
|
+
level: "WARN",
|
|
3319
|
+
message: "Parameter Validation warrnings for getAppLocations",
|
|
3320
|
+
});
|
|
3321
|
+
Logger({ level: "WARN", message: warrning });
|
|
3322
|
+
}
|
|
3323
|
+
|
|
1699
3324
|
const query_params = {};
|
|
1700
3325
|
query_params["store_type"] = storeType;
|
|
1701
3326
|
query_params["uid"] = uid;
|
|
@@ -1704,13 +3329,30 @@ class Catalog {
|
|
|
1704
3329
|
query_params["page_no"] = pageNo;
|
|
1705
3330
|
query_params["page_size"] = pageSize;
|
|
1706
3331
|
|
|
1707
|
-
|
|
3332
|
+
const response = await PlatformAPIClient.execute(
|
|
1708
3333
|
this.config,
|
|
1709
3334
|
"get",
|
|
1710
3335
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/locations`,
|
|
1711
3336
|
query_params,
|
|
1712
3337
|
undefined
|
|
1713
3338
|
);
|
|
3339
|
+
|
|
3340
|
+
const {
|
|
3341
|
+
error: res_error,
|
|
3342
|
+
} = CatalogModel.LocationListSerializer().validate(response, {
|
|
3343
|
+
abortEarly: false,
|
|
3344
|
+
allowUnknown: false,
|
|
3345
|
+
});
|
|
3346
|
+
|
|
3347
|
+
if (res_error) {
|
|
3348
|
+
Logger({
|
|
3349
|
+
level: "WARN",
|
|
3350
|
+
message: "Response Validation Warnnings for getAppLocations",
|
|
3351
|
+
});
|
|
3352
|
+
Logger({ level: "WARN", message: res_error });
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3355
|
+
return response;
|
|
1714
3356
|
}
|
|
1715
3357
|
|
|
1716
3358
|
/**
|
|
@@ -1772,10 +3414,11 @@ class Catalog {
|
|
|
1772
3414
|
* page. Default is 12.
|
|
1773
3415
|
* @param {string} [arg.q] - Search query with brand name.Use this parameter
|
|
1774
3416
|
* to search brands by brand name.
|
|
3417
|
+
* @returns {Promise<BrandListingResponse>} - Success response
|
|
1775
3418
|
* @summary: List all the brands for the application
|
|
1776
3419
|
* @description: A brand is the name under which a product is being sold. Use this API to list all the brands. You can pass optionally filter the brands by the department. If successful, returns a paginated list of brands specified in `BrandListingResponse`
|
|
1777
3420
|
*/
|
|
1778
|
-
getApplicationBrandListing({ pageNo, pageSize, q } = {}) {
|
|
3421
|
+
async getApplicationBrandListing({ pageNo, pageSize, q } = {}) {
|
|
1779
3422
|
const { error } = CatalogValidator.getApplicationBrandListing().validate(
|
|
1780
3423
|
{
|
|
1781
3424
|
pageNo,
|
|
@@ -1788,18 +3431,55 @@ class Catalog {
|
|
|
1788
3431
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1789
3432
|
}
|
|
1790
3433
|
|
|
3434
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3435
|
+
const {
|
|
3436
|
+
error: warrning,
|
|
3437
|
+
} = CatalogValidator.getApplicationBrandListing().validate(
|
|
3438
|
+
{
|
|
3439
|
+
pageNo,
|
|
3440
|
+
pageSize,
|
|
3441
|
+
q,
|
|
3442
|
+
},
|
|
3443
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3444
|
+
);
|
|
3445
|
+
if (warrning) {
|
|
3446
|
+
Logger({
|
|
3447
|
+
level: "WARN",
|
|
3448
|
+
message:
|
|
3449
|
+
"Parameter Validation warrnings for getApplicationBrandListing",
|
|
3450
|
+
});
|
|
3451
|
+
Logger({ level: "WARN", message: warrning });
|
|
3452
|
+
}
|
|
3453
|
+
|
|
1791
3454
|
const query_params = {};
|
|
1792
3455
|
query_params["page_no"] = pageNo;
|
|
1793
3456
|
query_params["page_size"] = pageSize;
|
|
1794
3457
|
query_params["q"] = q;
|
|
1795
3458
|
|
|
1796
|
-
|
|
3459
|
+
const response = await PlatformAPIClient.execute(
|
|
1797
3460
|
this.config,
|
|
1798
3461
|
"get",
|
|
1799
3462
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/brand`,
|
|
1800
3463
|
query_params,
|
|
1801
3464
|
undefined
|
|
1802
3465
|
);
|
|
3466
|
+
|
|
3467
|
+
const {
|
|
3468
|
+
error: res_error,
|
|
3469
|
+
} = CatalogModel.BrandListingResponse().validate(response, {
|
|
3470
|
+
abortEarly: false,
|
|
3471
|
+
allowUnknown: false,
|
|
3472
|
+
});
|
|
3473
|
+
|
|
3474
|
+
if (res_error) {
|
|
3475
|
+
Logger({
|
|
3476
|
+
level: "WARN",
|
|
3477
|
+
message: "Response Validation Warnnings for getApplicationBrandListing",
|
|
3478
|
+
});
|
|
3479
|
+
Logger({ level: "WARN", message: res_error });
|
|
3480
|
+
}
|
|
3481
|
+
|
|
3482
|
+
return response;
|
|
1803
3483
|
}
|
|
1804
3484
|
|
|
1805
3485
|
/**
|
|
@@ -1847,10 +3527,11 @@ class Catalog {
|
|
|
1847
3527
|
* @param {Object} arg - Arg object.
|
|
1848
3528
|
* @param {string} arg.brandUid - Brand id for which the custom_json is associated.
|
|
1849
3529
|
* @param {ApplicationBrandJson} arg.body
|
|
3530
|
+
* @returns {Promise<SuccessResponse1>} - Success response
|
|
1850
3531
|
* @summary: Update a single custom json.
|
|
1851
3532
|
* @description: This API helps to update data associated to a item custom meta.
|
|
1852
3533
|
*/
|
|
1853
|
-
updateAppBrand({ brandUid, body } = {}) {
|
|
3534
|
+
async updateAppBrand({ brandUid, body } = {}) {
|
|
1854
3535
|
const { error } = CatalogValidator.updateAppBrand().validate(
|
|
1855
3536
|
{
|
|
1856
3537
|
brandUid,
|
|
@@ -1862,15 +3543,48 @@ class Catalog {
|
|
|
1862
3543
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1863
3544
|
}
|
|
1864
3545
|
|
|
3546
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3547
|
+
const { error: warrning } = CatalogValidator.updateAppBrand().validate(
|
|
3548
|
+
{
|
|
3549
|
+
brandUid,
|
|
3550
|
+
body,
|
|
3551
|
+
},
|
|
3552
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3553
|
+
);
|
|
3554
|
+
if (warrning) {
|
|
3555
|
+
Logger({
|
|
3556
|
+
level: "WARN",
|
|
3557
|
+
message: "Parameter Validation warrnings for updateAppBrand",
|
|
3558
|
+
});
|
|
3559
|
+
Logger({ level: "WARN", message: warrning });
|
|
3560
|
+
}
|
|
3561
|
+
|
|
1865
3562
|
const query_params = {};
|
|
1866
3563
|
|
|
1867
|
-
|
|
3564
|
+
const response = await PlatformAPIClient.execute(
|
|
1868
3565
|
this.config,
|
|
1869
3566
|
"patch",
|
|
1870
3567
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/brand/${brandUid}`,
|
|
1871
3568
|
query_params,
|
|
1872
3569
|
body
|
|
1873
3570
|
);
|
|
3571
|
+
|
|
3572
|
+
const {
|
|
3573
|
+
error: res_error,
|
|
3574
|
+
} = CatalogModel.SuccessResponse1().validate(response, {
|
|
3575
|
+
abortEarly: false,
|
|
3576
|
+
allowUnknown: false,
|
|
3577
|
+
});
|
|
3578
|
+
|
|
3579
|
+
if (res_error) {
|
|
3580
|
+
Logger({
|
|
3581
|
+
level: "WARN",
|
|
3582
|
+
message: "Response Validation Warnnings for updateAppBrand",
|
|
3583
|
+
});
|
|
3584
|
+
Logger({ level: "WARN", message: res_error });
|
|
3585
|
+
}
|
|
3586
|
+
|
|
3587
|
+
return response;
|
|
1874
3588
|
}
|
|
1875
3589
|
|
|
1876
3590
|
/**
|
|
@@ -1883,10 +3597,16 @@ class Catalog {
|
|
|
1883
3597
|
* page. Default is 12.
|
|
1884
3598
|
* @param {string} [arg.q] - Search query with brand name.Use this parameter
|
|
1885
3599
|
* to search brands by brand name.
|
|
3600
|
+
* @returns {Promise<BrandListingResponse>} - Success response
|
|
1886
3601
|
* @summary: List all the brands for the application
|
|
1887
3602
|
* @description: A brand is the name under which a product is being sold. Use this API to list all the brands. You can pass optionally filter the brands by the department. If successful, returns a paginated list of brands specified in `BrandListingResponse`
|
|
1888
3603
|
*/
|
|
1889
|
-
getApplicationCategoryListing({
|
|
3604
|
+
async getApplicationCategoryListing({
|
|
3605
|
+
departmentId,
|
|
3606
|
+
pageNo,
|
|
3607
|
+
pageSize,
|
|
3608
|
+
q,
|
|
3609
|
+
} = {}) {
|
|
1890
3610
|
const { error } = CatalogValidator.getApplicationCategoryListing().validate(
|
|
1891
3611
|
{
|
|
1892
3612
|
departmentId,
|
|
@@ -1900,19 +3620,58 @@ class Catalog {
|
|
|
1900
3620
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1901
3621
|
}
|
|
1902
3622
|
|
|
3623
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3624
|
+
const {
|
|
3625
|
+
error: warrning,
|
|
3626
|
+
} = CatalogValidator.getApplicationCategoryListing().validate(
|
|
3627
|
+
{
|
|
3628
|
+
departmentId,
|
|
3629
|
+
pageNo,
|
|
3630
|
+
pageSize,
|
|
3631
|
+
q,
|
|
3632
|
+
},
|
|
3633
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3634
|
+
);
|
|
3635
|
+
if (warrning) {
|
|
3636
|
+
Logger({
|
|
3637
|
+
level: "WARN",
|
|
3638
|
+
message:
|
|
3639
|
+
"Parameter Validation warrnings for getApplicationCategoryListing",
|
|
3640
|
+
});
|
|
3641
|
+
Logger({ level: "WARN", message: warrning });
|
|
3642
|
+
}
|
|
3643
|
+
|
|
1903
3644
|
const query_params = {};
|
|
1904
3645
|
query_params["department_id"] = departmentId;
|
|
1905
3646
|
query_params["page_no"] = pageNo;
|
|
1906
3647
|
query_params["page_size"] = pageSize;
|
|
1907
3648
|
query_params["q"] = q;
|
|
1908
3649
|
|
|
1909
|
-
|
|
3650
|
+
const response = await PlatformAPIClient.execute(
|
|
1910
3651
|
this.config,
|
|
1911
3652
|
"get",
|
|
1912
3653
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/category`,
|
|
1913
3654
|
query_params,
|
|
1914
3655
|
undefined
|
|
1915
3656
|
);
|
|
3657
|
+
|
|
3658
|
+
const {
|
|
3659
|
+
error: res_error,
|
|
3660
|
+
} = CatalogModel.BrandListingResponse().validate(response, {
|
|
3661
|
+
abortEarly: false,
|
|
3662
|
+
allowUnknown: false,
|
|
3663
|
+
});
|
|
3664
|
+
|
|
3665
|
+
if (res_error) {
|
|
3666
|
+
Logger({
|
|
3667
|
+
level: "WARN",
|
|
3668
|
+
message:
|
|
3669
|
+
"Response Validation Warnnings for getApplicationCategoryListing",
|
|
3670
|
+
});
|
|
3671
|
+
Logger({ level: "WARN", message: res_error });
|
|
3672
|
+
}
|
|
3673
|
+
|
|
3674
|
+
return response;
|
|
1916
3675
|
}
|
|
1917
3676
|
|
|
1918
3677
|
/**
|
|
@@ -1965,10 +3724,11 @@ class Catalog {
|
|
|
1965
3724
|
* @param {string} arg.categoryUid - Category id for which the custom_json
|
|
1966
3725
|
* is associated.
|
|
1967
3726
|
* @param {ApplicationCategoryJson} arg.body
|
|
3727
|
+
* @returns {Promise<SuccessResponse1>} - Success response
|
|
1968
3728
|
* @summary: Update a single custom json.
|
|
1969
3729
|
* @description: This API helps to update data associated to a item custom meta.
|
|
1970
3730
|
*/
|
|
1971
|
-
updateAppCategory({ categoryUid, body } = {}) {
|
|
3731
|
+
async updateAppCategory({ categoryUid, body } = {}) {
|
|
1972
3732
|
const { error } = CatalogValidator.updateAppCategory().validate(
|
|
1973
3733
|
{
|
|
1974
3734
|
categoryUid,
|
|
@@ -1980,15 +3740,48 @@ class Catalog {
|
|
|
1980
3740
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1981
3741
|
}
|
|
1982
3742
|
|
|
3743
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3744
|
+
const { error: warrning } = CatalogValidator.updateAppCategory().validate(
|
|
3745
|
+
{
|
|
3746
|
+
categoryUid,
|
|
3747
|
+
body,
|
|
3748
|
+
},
|
|
3749
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3750
|
+
);
|
|
3751
|
+
if (warrning) {
|
|
3752
|
+
Logger({
|
|
3753
|
+
level: "WARN",
|
|
3754
|
+
message: "Parameter Validation warrnings for updateAppCategory",
|
|
3755
|
+
});
|
|
3756
|
+
Logger({ level: "WARN", message: warrning });
|
|
3757
|
+
}
|
|
3758
|
+
|
|
1983
3759
|
const query_params = {};
|
|
1984
3760
|
|
|
1985
|
-
|
|
3761
|
+
const response = await PlatformAPIClient.execute(
|
|
1986
3762
|
this.config,
|
|
1987
3763
|
"patch",
|
|
1988
3764
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/category/${categoryUid}`,
|
|
1989
3765
|
query_params,
|
|
1990
3766
|
body
|
|
1991
3767
|
);
|
|
3768
|
+
|
|
3769
|
+
const {
|
|
3770
|
+
error: res_error,
|
|
3771
|
+
} = CatalogModel.SuccessResponse1().validate(response, {
|
|
3772
|
+
abortEarly: false,
|
|
3773
|
+
allowUnknown: false,
|
|
3774
|
+
});
|
|
3775
|
+
|
|
3776
|
+
if (res_error) {
|
|
3777
|
+
Logger({
|
|
3778
|
+
level: "WARN",
|
|
3779
|
+
message: "Response Validation Warnnings for updateAppCategory",
|
|
3780
|
+
});
|
|
3781
|
+
Logger({ level: "WARN", message: res_error });
|
|
3782
|
+
}
|
|
3783
|
+
|
|
3784
|
+
return response;
|
|
1992
3785
|
}
|
|
1993
3786
|
|
|
1994
3787
|
/**
|
|
@@ -1999,10 +3792,11 @@ class Catalog {
|
|
|
1999
3792
|
* page. Default is 12.
|
|
2000
3793
|
* @param {string} [arg.q] - Search query with brand name.Use this parameter
|
|
2001
3794
|
* to search department by name.
|
|
3795
|
+
* @returns {Promise<ApplicationDepartmentListingResponse>} - Success response
|
|
2002
3796
|
* @summary: List all the departments for the application
|
|
2003
3797
|
* @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the application departments. If successful, returns the list of departments specified in `ApplicationDepartmentListingResponse`
|
|
2004
3798
|
*/
|
|
2005
|
-
getApplicationDepartmentListing({ pageNo, pageSize, q } = {}) {
|
|
3799
|
+
async getApplicationDepartmentListing({ pageNo, pageSize, q } = {}) {
|
|
2006
3800
|
const {
|
|
2007
3801
|
error,
|
|
2008
3802
|
} = CatalogValidator.getApplicationDepartmentListing().validate(
|
|
@@ -2017,18 +3811,56 @@ class Catalog {
|
|
|
2017
3811
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2018
3812
|
}
|
|
2019
3813
|
|
|
3814
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3815
|
+
const {
|
|
3816
|
+
error: warrning,
|
|
3817
|
+
} = CatalogValidator.getApplicationDepartmentListing().validate(
|
|
3818
|
+
{
|
|
3819
|
+
pageNo,
|
|
3820
|
+
pageSize,
|
|
3821
|
+
q,
|
|
3822
|
+
},
|
|
3823
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3824
|
+
);
|
|
3825
|
+
if (warrning) {
|
|
3826
|
+
Logger({
|
|
3827
|
+
level: "WARN",
|
|
3828
|
+
message:
|
|
3829
|
+
"Parameter Validation warrnings for getApplicationDepartmentListing",
|
|
3830
|
+
});
|
|
3831
|
+
Logger({ level: "WARN", message: warrning });
|
|
3832
|
+
}
|
|
3833
|
+
|
|
2020
3834
|
const query_params = {};
|
|
2021
3835
|
query_params["page_no"] = pageNo;
|
|
2022
3836
|
query_params["page_size"] = pageSize;
|
|
2023
3837
|
query_params["q"] = q;
|
|
2024
3838
|
|
|
2025
|
-
|
|
3839
|
+
const response = await PlatformAPIClient.execute(
|
|
2026
3840
|
this.config,
|
|
2027
3841
|
"get",
|
|
2028
3842
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/department`,
|
|
2029
3843
|
query_params,
|
|
2030
3844
|
undefined
|
|
2031
3845
|
);
|
|
3846
|
+
|
|
3847
|
+
const {
|
|
3848
|
+
error: res_error,
|
|
3849
|
+
} = CatalogModel.ApplicationDepartmentListingResponse().validate(response, {
|
|
3850
|
+
abortEarly: false,
|
|
3851
|
+
allowUnknown: false,
|
|
3852
|
+
});
|
|
3853
|
+
|
|
3854
|
+
if (res_error) {
|
|
3855
|
+
Logger({
|
|
3856
|
+
level: "WARN",
|
|
3857
|
+
message:
|
|
3858
|
+
"Response Validation Warnnings for getApplicationDepartmentListing",
|
|
3859
|
+
});
|
|
3860
|
+
Logger({ level: "WARN", message: res_error });
|
|
3861
|
+
}
|
|
3862
|
+
|
|
3863
|
+
return response;
|
|
2032
3864
|
}
|
|
2033
3865
|
|
|
2034
3866
|
/**
|
|
@@ -2077,10 +3909,11 @@ class Catalog {
|
|
|
2077
3909
|
* @param {string} arg.departmentUid - Department id for which the
|
|
2078
3910
|
* custom_json is associated.
|
|
2079
3911
|
* @param {ApplicationDepartmentJson} arg.body
|
|
3912
|
+
* @returns {Promise<SuccessResponse1>} - Success response
|
|
2080
3913
|
* @summary: Update a single custom json.
|
|
2081
3914
|
* @description: This API helps to update data associated to a item custom meta.
|
|
2082
3915
|
*/
|
|
2083
|
-
updateAppDepartment({ departmentUid, body } = {}) {
|
|
3916
|
+
async updateAppDepartment({ departmentUid, body } = {}) {
|
|
2084
3917
|
const { error } = CatalogValidator.updateAppDepartment().validate(
|
|
2085
3918
|
{
|
|
2086
3919
|
departmentUid,
|
|
@@ -2092,25 +3925,59 @@ class Catalog {
|
|
|
2092
3925
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2093
3926
|
}
|
|
2094
3927
|
|
|
3928
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3929
|
+
const { error: warrning } = CatalogValidator.updateAppDepartment().validate(
|
|
3930
|
+
{
|
|
3931
|
+
departmentUid,
|
|
3932
|
+
body,
|
|
3933
|
+
},
|
|
3934
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3935
|
+
);
|
|
3936
|
+
if (warrning) {
|
|
3937
|
+
Logger({
|
|
3938
|
+
level: "WARN",
|
|
3939
|
+
message: "Parameter Validation warrnings for updateAppDepartment",
|
|
3940
|
+
});
|
|
3941
|
+
Logger({ level: "WARN", message: warrning });
|
|
3942
|
+
}
|
|
3943
|
+
|
|
2095
3944
|
const query_params = {};
|
|
2096
3945
|
|
|
2097
|
-
|
|
3946
|
+
const response = await PlatformAPIClient.execute(
|
|
2098
3947
|
this.config,
|
|
2099
3948
|
"patch",
|
|
2100
3949
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/department/${departmentUid}`,
|
|
2101
3950
|
query_params,
|
|
2102
3951
|
body
|
|
2103
3952
|
);
|
|
3953
|
+
|
|
3954
|
+
const {
|
|
3955
|
+
error: res_error,
|
|
3956
|
+
} = CatalogModel.SuccessResponse1().validate(response, {
|
|
3957
|
+
abortEarly: false,
|
|
3958
|
+
allowUnknown: false,
|
|
3959
|
+
});
|
|
3960
|
+
|
|
3961
|
+
if (res_error) {
|
|
3962
|
+
Logger({
|
|
3963
|
+
level: "WARN",
|
|
3964
|
+
message: "Response Validation Warnnings for updateAppDepartment",
|
|
3965
|
+
});
|
|
3966
|
+
Logger({ level: "WARN", message: res_error });
|
|
3967
|
+
}
|
|
3968
|
+
|
|
3969
|
+
return response;
|
|
2104
3970
|
}
|
|
2105
3971
|
|
|
2106
3972
|
/**
|
|
2107
3973
|
* @param {Object} arg - Arg object.
|
|
2108
3974
|
* @param {string} arg.storeUid - Store id for which the custom_json is associated.
|
|
2109
3975
|
* @param {ApplicationStoreJson} arg.body
|
|
3976
|
+
* @returns {Promise<SuccessResponse1>} - Success response
|
|
2110
3977
|
* @summary: Update a single custom json.
|
|
2111
3978
|
* @description: This API helps to update data associated to a item custom meta.
|
|
2112
3979
|
*/
|
|
2113
|
-
updateAppLocation({ storeUid, body } = {}) {
|
|
3980
|
+
async updateAppLocation({ storeUid, body } = {}) {
|
|
2114
3981
|
const { error } = CatalogValidator.updateAppLocation().validate(
|
|
2115
3982
|
{
|
|
2116
3983
|
storeUid,
|
|
@@ -2122,15 +3989,48 @@ class Catalog {
|
|
|
2122
3989
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2123
3990
|
}
|
|
2124
3991
|
|
|
3992
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3993
|
+
const { error: warrning } = CatalogValidator.updateAppLocation().validate(
|
|
3994
|
+
{
|
|
3995
|
+
storeUid,
|
|
3996
|
+
body,
|
|
3997
|
+
},
|
|
3998
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3999
|
+
);
|
|
4000
|
+
if (warrning) {
|
|
4001
|
+
Logger({
|
|
4002
|
+
level: "WARN",
|
|
4003
|
+
message: "Parameter Validation warrnings for updateAppLocation",
|
|
4004
|
+
});
|
|
4005
|
+
Logger({ level: "WARN", message: warrning });
|
|
4006
|
+
}
|
|
4007
|
+
|
|
2125
4008
|
const query_params = {};
|
|
2126
4009
|
|
|
2127
|
-
|
|
4010
|
+
const response = await PlatformAPIClient.execute(
|
|
2128
4011
|
this.config,
|
|
2129
4012
|
"patch",
|
|
2130
4013
|
`/service/platform/catalog/v1.0/company/${this.config.companyId}/application/${this.applicationId}/store/${storeUid}`,
|
|
2131
4014
|
query_params,
|
|
2132
4015
|
body
|
|
2133
4016
|
);
|
|
4017
|
+
|
|
4018
|
+
const {
|
|
4019
|
+
error: res_error,
|
|
4020
|
+
} = CatalogModel.SuccessResponse1().validate(response, {
|
|
4021
|
+
abortEarly: false,
|
|
4022
|
+
allowUnknown: false,
|
|
4023
|
+
});
|
|
4024
|
+
|
|
4025
|
+
if (res_error) {
|
|
4026
|
+
Logger({
|
|
4027
|
+
level: "WARN",
|
|
4028
|
+
message: "Response Validation Warnnings for updateAppLocation",
|
|
4029
|
+
});
|
|
4030
|
+
Logger({ level: "WARN", message: res_error });
|
|
4031
|
+
}
|
|
4032
|
+
|
|
4033
|
+
return response;
|
|
2134
4034
|
}
|
|
2135
4035
|
}
|
|
2136
4036
|
module.exports = Catalog;
|