@gofynd/fdk-client-javascript 1.0.1 → 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 +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- 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 +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- 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 +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
3
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
4
4
|
const DiscountValidator = require("./DiscountPlatformValidator");
|
|
5
|
+
const DiscountModel = require("./DiscountPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
5
8
|
class Discount {
|
|
6
9
|
constructor(config) {
|
|
7
10
|
this.config = config;
|
|
@@ -19,10 +22,11 @@ class Discount {
|
|
|
19
22
|
* @param {number} [arg.year] - Year. Default is current year.
|
|
20
23
|
* @param {string} [arg.type] - Basic or custom.
|
|
21
24
|
* @param {string[]} [arg.appIds] - Application ids.
|
|
25
|
+
* @returns {Promise<ListOrCalender>} - Success response
|
|
22
26
|
* @summary: Fetch discount list.
|
|
23
27
|
* @description: Fetch discount list.
|
|
24
28
|
*/
|
|
25
|
-
getDiscounts({
|
|
29
|
+
async getDiscounts({
|
|
26
30
|
view,
|
|
27
31
|
q,
|
|
28
32
|
pageNo,
|
|
@@ -67,8 +71,11 @@ class Discount {
|
|
|
67
71
|
{ abortEarly: false, allowUnknown: false }
|
|
68
72
|
);
|
|
69
73
|
if (warrning) {
|
|
70
|
-
|
|
71
|
-
|
|
74
|
+
Logger({
|
|
75
|
+
level: "WARN",
|
|
76
|
+
message: "Parameter Validation warrnings for getDiscounts",
|
|
77
|
+
});
|
|
78
|
+
Logger({ level: "WARN", message: warrning });
|
|
72
79
|
}
|
|
73
80
|
|
|
74
81
|
const query_params = {};
|
|
@@ -84,7 +91,7 @@ class Discount {
|
|
|
84
91
|
|
|
85
92
|
const xHeaders = {};
|
|
86
93
|
|
|
87
|
-
|
|
94
|
+
const response = await PlatformAPIClient.execute(
|
|
88
95
|
this.config,
|
|
89
96
|
"get",
|
|
90
97
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/job/`,
|
|
@@ -92,15 +99,33 @@ class Discount {
|
|
|
92
99
|
undefined,
|
|
93
100
|
xHeaders
|
|
94
101
|
);
|
|
102
|
+
|
|
103
|
+
const {
|
|
104
|
+
error: res_error,
|
|
105
|
+
} = DiscountModel.ListOrCalender().validate(response, {
|
|
106
|
+
abortEarly: false,
|
|
107
|
+
allowUnknown: false,
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
if (res_error) {
|
|
111
|
+
Logger({
|
|
112
|
+
level: "WARN",
|
|
113
|
+
message: "Response Validation Warnnings for getDiscounts",
|
|
114
|
+
});
|
|
115
|
+
Logger({ level: "WARN", message: res_error });
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return response;
|
|
95
119
|
}
|
|
96
120
|
|
|
97
121
|
/**
|
|
98
122
|
* @param {Object} arg - Arg object.
|
|
99
123
|
* @param {CreateUpdateDiscount} arg.body
|
|
124
|
+
* @returns {Promise<DiscountJob>} - Success response
|
|
100
125
|
* @summary: Create Discount.
|
|
101
126
|
* @description: Create Discount.
|
|
102
127
|
*/
|
|
103
|
-
createDiscount({ body } = {}) {
|
|
128
|
+
async createDiscount({ body } = {}) {
|
|
104
129
|
const { error } = DiscountValidator.createDiscount().validate(
|
|
105
130
|
{
|
|
106
131
|
body,
|
|
@@ -119,15 +144,18 @@ class Discount {
|
|
|
119
144
|
{ abortEarly: false, allowUnknown: false }
|
|
120
145
|
);
|
|
121
146
|
if (warrning) {
|
|
122
|
-
|
|
123
|
-
|
|
147
|
+
Logger({
|
|
148
|
+
level: "WARN",
|
|
149
|
+
message: "Parameter Validation warrnings for createDiscount",
|
|
150
|
+
});
|
|
151
|
+
Logger({ level: "WARN", message: warrning });
|
|
124
152
|
}
|
|
125
153
|
|
|
126
154
|
const query_params = {};
|
|
127
155
|
|
|
128
156
|
const xHeaders = {};
|
|
129
157
|
|
|
130
|
-
|
|
158
|
+
const response = await PlatformAPIClient.execute(
|
|
131
159
|
this.config,
|
|
132
160
|
"post",
|
|
133
161
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/job/`,
|
|
@@ -135,15 +163,31 @@ class Discount {
|
|
|
135
163
|
body,
|
|
136
164
|
xHeaders
|
|
137
165
|
);
|
|
166
|
+
|
|
167
|
+
const { error: res_error } = DiscountModel.DiscountJob().validate(
|
|
168
|
+
response,
|
|
169
|
+
{ abortEarly: false, allowUnknown: false }
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
if (res_error) {
|
|
173
|
+
Logger({
|
|
174
|
+
level: "WARN",
|
|
175
|
+
message: "Response Validation Warnnings for createDiscount",
|
|
176
|
+
});
|
|
177
|
+
Logger({ level: "WARN", message: res_error });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
return response;
|
|
138
181
|
}
|
|
139
182
|
|
|
140
183
|
/**
|
|
141
184
|
* @param {Object} arg - Arg object.
|
|
142
185
|
* @param {string} arg.id - Unique id.
|
|
186
|
+
* @returns {Promise<DiscountJob>} - Success response
|
|
143
187
|
* @summary: Fetch discount.
|
|
144
188
|
* @description: Fetch discount.
|
|
145
189
|
*/
|
|
146
|
-
getDiscount({ id } = {}) {
|
|
190
|
+
async getDiscount({ id } = {}) {
|
|
147
191
|
const { error } = DiscountValidator.getDiscount().validate(
|
|
148
192
|
{
|
|
149
193
|
id,
|
|
@@ -162,15 +206,18 @@ class Discount {
|
|
|
162
206
|
{ abortEarly: false, allowUnknown: false }
|
|
163
207
|
);
|
|
164
208
|
if (warrning) {
|
|
165
|
-
|
|
166
|
-
|
|
209
|
+
Logger({
|
|
210
|
+
level: "WARN",
|
|
211
|
+
message: "Parameter Validation warrnings for getDiscount",
|
|
212
|
+
});
|
|
213
|
+
Logger({ level: "WARN", message: warrning });
|
|
167
214
|
}
|
|
168
215
|
|
|
169
216
|
const query_params = {};
|
|
170
217
|
|
|
171
218
|
const xHeaders = {};
|
|
172
219
|
|
|
173
|
-
|
|
220
|
+
const response = await PlatformAPIClient.execute(
|
|
174
221
|
this.config,
|
|
175
222
|
"get",
|
|
176
223
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/job/${id}/`,
|
|
@@ -178,16 +225,32 @@ class Discount {
|
|
|
178
225
|
undefined,
|
|
179
226
|
xHeaders
|
|
180
227
|
);
|
|
228
|
+
|
|
229
|
+
const { error: res_error } = DiscountModel.DiscountJob().validate(
|
|
230
|
+
response,
|
|
231
|
+
{ abortEarly: false, allowUnknown: false }
|
|
232
|
+
);
|
|
233
|
+
|
|
234
|
+
if (res_error) {
|
|
235
|
+
Logger({
|
|
236
|
+
level: "WARN",
|
|
237
|
+
message: "Response Validation Warnnings for getDiscount",
|
|
238
|
+
});
|
|
239
|
+
Logger({ level: "WARN", message: res_error });
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return response;
|
|
181
243
|
}
|
|
182
244
|
|
|
183
245
|
/**
|
|
184
246
|
* @param {Object} arg - Arg object.
|
|
185
247
|
* @param {string} arg.id - Id
|
|
186
248
|
* @param {CreateUpdateDiscount} arg.body
|
|
249
|
+
* @returns {Promise<DiscountJob>} - Success response
|
|
187
250
|
* @summary: Create Discount.
|
|
188
251
|
* @description: Create Discount.
|
|
189
252
|
*/
|
|
190
|
-
updateDiscount({ id, body } = {}) {
|
|
253
|
+
async updateDiscount({ id, body } = {}) {
|
|
191
254
|
const { error } = DiscountValidator.updateDiscount().validate(
|
|
192
255
|
{
|
|
193
256
|
id,
|
|
@@ -208,15 +271,18 @@ class Discount {
|
|
|
208
271
|
{ abortEarly: false, allowUnknown: false }
|
|
209
272
|
);
|
|
210
273
|
if (warrning) {
|
|
211
|
-
|
|
212
|
-
|
|
274
|
+
Logger({
|
|
275
|
+
level: "WARN",
|
|
276
|
+
message: "Parameter Validation warrnings for updateDiscount",
|
|
277
|
+
});
|
|
278
|
+
Logger({ level: "WARN", message: warrning });
|
|
213
279
|
}
|
|
214
280
|
|
|
215
281
|
const query_params = {};
|
|
216
282
|
|
|
217
283
|
const xHeaders = {};
|
|
218
284
|
|
|
219
|
-
|
|
285
|
+
const response = await PlatformAPIClient.execute(
|
|
220
286
|
this.config,
|
|
221
287
|
"put",
|
|
222
288
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/job/${id}/`,
|
|
@@ -224,16 +290,32 @@ class Discount {
|
|
|
224
290
|
body,
|
|
225
291
|
xHeaders
|
|
226
292
|
);
|
|
293
|
+
|
|
294
|
+
const { error: res_error } = DiscountModel.DiscountJob().validate(
|
|
295
|
+
response,
|
|
296
|
+
{ abortEarly: false, allowUnknown: false }
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
if (res_error) {
|
|
300
|
+
Logger({
|
|
301
|
+
level: "WARN",
|
|
302
|
+
message: "Response Validation Warnnings for updateDiscount",
|
|
303
|
+
});
|
|
304
|
+
Logger({ level: "WARN", message: res_error });
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
return response;
|
|
227
308
|
}
|
|
228
309
|
|
|
229
310
|
/**
|
|
230
311
|
* @param {Object} arg - Arg object.
|
|
231
312
|
* @param {string} arg.id - Job ID of the discount.
|
|
232
313
|
* @param {BulkDiscount} arg.body
|
|
314
|
+
* @returns {Promise<Object>} - Success response
|
|
233
315
|
* @summary: Create custom discount from bulk.
|
|
234
316
|
* @description: Create custom discounts through API.
|
|
235
317
|
*/
|
|
236
|
-
upsertDiscountItems({ id, body } = {}) {
|
|
318
|
+
async upsertDiscountItems({ id, body } = {}) {
|
|
237
319
|
const { error } = DiscountValidator.upsertDiscountItems().validate(
|
|
238
320
|
{
|
|
239
321
|
id,
|
|
@@ -256,15 +338,18 @@ class Discount {
|
|
|
256
338
|
{ abortEarly: false, allowUnknown: false }
|
|
257
339
|
);
|
|
258
340
|
if (warrning) {
|
|
259
|
-
|
|
260
|
-
|
|
341
|
+
Logger({
|
|
342
|
+
level: "WARN",
|
|
343
|
+
message: "Parameter Validation warrnings for upsertDiscountItems",
|
|
344
|
+
});
|
|
345
|
+
Logger({ level: "WARN", message: warrning });
|
|
261
346
|
}
|
|
262
347
|
|
|
263
348
|
const query_params = {};
|
|
264
349
|
|
|
265
350
|
const xHeaders = {};
|
|
266
351
|
|
|
267
|
-
|
|
352
|
+
const response = await PlatformAPIClient.execute(
|
|
268
353
|
this.config,
|
|
269
354
|
"post",
|
|
270
355
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/job/${id}/items/`,
|
|
@@ -272,16 +357,32 @@ class Discount {
|
|
|
272
357
|
body,
|
|
273
358
|
xHeaders
|
|
274
359
|
);
|
|
360
|
+
|
|
361
|
+
const { error: res_error } = Joi.any().validate(response, {
|
|
362
|
+
abortEarly: false,
|
|
363
|
+
allowUnknown: false,
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
if (res_error) {
|
|
367
|
+
Logger({
|
|
368
|
+
level: "WARN",
|
|
369
|
+
message: "Response Validation Warnnings for upsertDiscountItems",
|
|
370
|
+
});
|
|
371
|
+
Logger({ level: "WARN", message: res_error });
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
return response;
|
|
275
375
|
}
|
|
276
376
|
|
|
277
377
|
/**
|
|
278
378
|
* @param {Object} arg - Arg object.
|
|
279
379
|
* @param {string} [arg.discount] - Discount
|
|
280
380
|
* @param {DiscountJob} arg.body
|
|
381
|
+
* @returns {Promise<FileJobResponse>} - Success response
|
|
281
382
|
* @summary: Validate File.
|
|
282
383
|
* @description: Validate File.
|
|
283
384
|
*/
|
|
284
|
-
validateDiscountFile({ body, discount } = {}) {
|
|
385
|
+
async validateDiscountFile({ body, discount } = {}) {
|
|
285
386
|
const { error } = DiscountValidator.validateDiscountFile().validate(
|
|
286
387
|
{
|
|
287
388
|
body,
|
|
@@ -304,8 +405,11 @@ class Discount {
|
|
|
304
405
|
{ abortEarly: false, allowUnknown: false }
|
|
305
406
|
);
|
|
306
407
|
if (warrning) {
|
|
307
|
-
|
|
308
|
-
|
|
408
|
+
Logger({
|
|
409
|
+
level: "WARN",
|
|
410
|
+
message: "Parameter Validation warrnings for validateDiscountFile",
|
|
411
|
+
});
|
|
412
|
+
Logger({ level: "WARN", message: warrning });
|
|
309
413
|
}
|
|
310
414
|
|
|
311
415
|
const query_params = {};
|
|
@@ -313,7 +417,7 @@ class Discount {
|
|
|
313
417
|
|
|
314
418
|
const xHeaders = {};
|
|
315
419
|
|
|
316
|
-
|
|
420
|
+
const response = await PlatformAPIClient.execute(
|
|
317
421
|
this.config,
|
|
318
422
|
"post",
|
|
319
423
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/file/validation/`,
|
|
@@ -321,16 +425,34 @@ class Discount {
|
|
|
321
425
|
body,
|
|
322
426
|
xHeaders
|
|
323
427
|
);
|
|
428
|
+
|
|
429
|
+
const {
|
|
430
|
+
error: res_error,
|
|
431
|
+
} = DiscountModel.FileJobResponse().validate(response, {
|
|
432
|
+
abortEarly: false,
|
|
433
|
+
allowUnknown: false,
|
|
434
|
+
});
|
|
435
|
+
|
|
436
|
+
if (res_error) {
|
|
437
|
+
Logger({
|
|
438
|
+
level: "WARN",
|
|
439
|
+
message: "Response Validation Warnnings for validateDiscountFile",
|
|
440
|
+
});
|
|
441
|
+
Logger({ level: "WARN", message: res_error });
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
return response;
|
|
324
445
|
}
|
|
325
446
|
|
|
326
447
|
/**
|
|
327
448
|
* @param {Object} arg - Arg object.
|
|
328
449
|
* @param {string} arg.type - Type
|
|
329
450
|
* @param {DownloadFileJob} arg.body
|
|
451
|
+
* @returns {Promise<FileJobResponse>} - Success response
|
|
330
452
|
* @summary: Validate File.
|
|
331
453
|
* @description: Validate File.
|
|
332
454
|
*/
|
|
333
|
-
downloadDiscountFile({ type, body } = {}) {
|
|
455
|
+
async downloadDiscountFile({ type, body } = {}) {
|
|
334
456
|
const { error } = DiscountValidator.downloadDiscountFile().validate(
|
|
335
457
|
{
|
|
336
458
|
type,
|
|
@@ -353,15 +475,18 @@ class Discount {
|
|
|
353
475
|
{ abortEarly: false, allowUnknown: false }
|
|
354
476
|
);
|
|
355
477
|
if (warrning) {
|
|
356
|
-
|
|
357
|
-
|
|
478
|
+
Logger({
|
|
479
|
+
level: "WARN",
|
|
480
|
+
message: "Parameter Validation warrnings for downloadDiscountFile",
|
|
481
|
+
});
|
|
482
|
+
Logger({ level: "WARN", message: warrning });
|
|
358
483
|
}
|
|
359
484
|
|
|
360
485
|
const query_params = {};
|
|
361
486
|
|
|
362
487
|
const xHeaders = {};
|
|
363
488
|
|
|
364
|
-
|
|
489
|
+
const response = await PlatformAPIClient.execute(
|
|
365
490
|
this.config,
|
|
366
491
|
"post",
|
|
367
492
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/file/${type}/download/`,
|
|
@@ -369,15 +494,33 @@ class Discount {
|
|
|
369
494
|
body,
|
|
370
495
|
xHeaders
|
|
371
496
|
);
|
|
497
|
+
|
|
498
|
+
const {
|
|
499
|
+
error: res_error,
|
|
500
|
+
} = DiscountModel.FileJobResponse().validate(response, {
|
|
501
|
+
abortEarly: false,
|
|
502
|
+
allowUnknown: false,
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
if (res_error) {
|
|
506
|
+
Logger({
|
|
507
|
+
level: "WARN",
|
|
508
|
+
message: "Response Validation Warnnings for downloadDiscountFile",
|
|
509
|
+
});
|
|
510
|
+
Logger({ level: "WARN", message: res_error });
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return response;
|
|
372
514
|
}
|
|
373
515
|
|
|
374
516
|
/**
|
|
375
517
|
* @param {Object} arg - Arg object.
|
|
376
518
|
* @param {string} arg.id - Id
|
|
519
|
+
* @returns {Promise<FileJobResponse>} - Success response
|
|
377
520
|
* @summary: Validate File Job.
|
|
378
521
|
* @description: Validate File Job.
|
|
379
522
|
*/
|
|
380
|
-
getValidationJob({ id } = {}) {
|
|
523
|
+
async getValidationJob({ id } = {}) {
|
|
381
524
|
const { error } = DiscountValidator.getValidationJob().validate(
|
|
382
525
|
{
|
|
383
526
|
id,
|
|
@@ -396,15 +539,18 @@ class Discount {
|
|
|
396
539
|
{ abortEarly: false, allowUnknown: false }
|
|
397
540
|
);
|
|
398
541
|
if (warrning) {
|
|
399
|
-
|
|
400
|
-
|
|
542
|
+
Logger({
|
|
543
|
+
level: "WARN",
|
|
544
|
+
message: "Parameter Validation warrnings for getValidationJob",
|
|
545
|
+
});
|
|
546
|
+
Logger({ level: "WARN", message: warrning });
|
|
401
547
|
}
|
|
402
548
|
|
|
403
549
|
const query_params = {};
|
|
404
550
|
|
|
405
551
|
const xHeaders = {};
|
|
406
552
|
|
|
407
|
-
|
|
553
|
+
const response = await PlatformAPIClient.execute(
|
|
408
554
|
this.config,
|
|
409
555
|
"get",
|
|
410
556
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/file/validation/${id}/`,
|
|
@@ -412,15 +558,33 @@ class Discount {
|
|
|
412
558
|
undefined,
|
|
413
559
|
xHeaders
|
|
414
560
|
);
|
|
561
|
+
|
|
562
|
+
const {
|
|
563
|
+
error: res_error,
|
|
564
|
+
} = DiscountModel.FileJobResponse().validate(response, {
|
|
565
|
+
abortEarly: false,
|
|
566
|
+
allowUnknown: false,
|
|
567
|
+
});
|
|
568
|
+
|
|
569
|
+
if (res_error) {
|
|
570
|
+
Logger({
|
|
571
|
+
level: "WARN",
|
|
572
|
+
message: "Response Validation Warnnings for getValidationJob",
|
|
573
|
+
});
|
|
574
|
+
Logger({ level: "WARN", message: res_error });
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
return response;
|
|
415
578
|
}
|
|
416
579
|
|
|
417
580
|
/**
|
|
418
581
|
* @param {Object} arg - Arg object.
|
|
419
582
|
* @param {string} arg.id - Id
|
|
583
|
+
* @returns {Promise<CancelJobResponse>} - Success response
|
|
420
584
|
* @summary: Cancel Validation Job.
|
|
421
585
|
* @description: Cancel Validation Job.
|
|
422
586
|
*/
|
|
423
|
-
cancelValidationJob({ id } = {}) {
|
|
587
|
+
async cancelValidationJob({ id } = {}) {
|
|
424
588
|
const { error } = DiscountValidator.cancelValidationJob().validate(
|
|
425
589
|
{
|
|
426
590
|
id,
|
|
@@ -441,15 +605,18 @@ class Discount {
|
|
|
441
605
|
{ abortEarly: false, allowUnknown: false }
|
|
442
606
|
);
|
|
443
607
|
if (warrning) {
|
|
444
|
-
|
|
445
|
-
|
|
608
|
+
Logger({
|
|
609
|
+
level: "WARN",
|
|
610
|
+
message: "Parameter Validation warrnings for cancelValidationJob",
|
|
611
|
+
});
|
|
612
|
+
Logger({ level: "WARN", message: warrning });
|
|
446
613
|
}
|
|
447
614
|
|
|
448
615
|
const query_params = {};
|
|
449
616
|
|
|
450
617
|
const xHeaders = {};
|
|
451
618
|
|
|
452
|
-
|
|
619
|
+
const response = await PlatformAPIClient.execute(
|
|
453
620
|
this.config,
|
|
454
621
|
"delete",
|
|
455
622
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/file/validation/${id}/`,
|
|
@@ -457,15 +624,33 @@ class Discount {
|
|
|
457
624
|
undefined,
|
|
458
625
|
xHeaders
|
|
459
626
|
);
|
|
627
|
+
|
|
628
|
+
const {
|
|
629
|
+
error: res_error,
|
|
630
|
+
} = DiscountModel.CancelJobResponse().validate(response, {
|
|
631
|
+
abortEarly: false,
|
|
632
|
+
allowUnknown: false,
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
if (res_error) {
|
|
636
|
+
Logger({
|
|
637
|
+
level: "WARN",
|
|
638
|
+
message: "Response Validation Warnnings for cancelValidationJob",
|
|
639
|
+
});
|
|
640
|
+
Logger({ level: "WARN", message: res_error });
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
return response;
|
|
460
644
|
}
|
|
461
645
|
|
|
462
646
|
/**
|
|
463
647
|
* @param {Object} arg - Arg object.
|
|
464
648
|
* @param {string} arg.id - Id
|
|
649
|
+
* @returns {Promise<FileJobResponse>} - Success response
|
|
465
650
|
* @summary: Download File Job.
|
|
466
651
|
* @description: Download File Job.
|
|
467
652
|
*/
|
|
468
|
-
getDownloadJob({ id } = {}) {
|
|
653
|
+
async getDownloadJob({ id } = {}) {
|
|
469
654
|
const { error } = DiscountValidator.getDownloadJob().validate(
|
|
470
655
|
{
|
|
471
656
|
id,
|
|
@@ -484,15 +669,18 @@ class Discount {
|
|
|
484
669
|
{ abortEarly: false, allowUnknown: false }
|
|
485
670
|
);
|
|
486
671
|
if (warrning) {
|
|
487
|
-
|
|
488
|
-
|
|
672
|
+
Logger({
|
|
673
|
+
level: "WARN",
|
|
674
|
+
message: "Parameter Validation warrnings for getDownloadJob",
|
|
675
|
+
});
|
|
676
|
+
Logger({ level: "WARN", message: warrning });
|
|
489
677
|
}
|
|
490
678
|
|
|
491
679
|
const query_params = {};
|
|
492
680
|
|
|
493
681
|
const xHeaders = {};
|
|
494
682
|
|
|
495
|
-
|
|
683
|
+
const response = await PlatformAPIClient.execute(
|
|
496
684
|
this.config,
|
|
497
685
|
"get",
|
|
498
686
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/file/download/${id}/`,
|
|
@@ -500,15 +688,33 @@ class Discount {
|
|
|
500
688
|
undefined,
|
|
501
689
|
xHeaders
|
|
502
690
|
);
|
|
691
|
+
|
|
692
|
+
const {
|
|
693
|
+
error: res_error,
|
|
694
|
+
} = DiscountModel.FileJobResponse().validate(response, {
|
|
695
|
+
abortEarly: false,
|
|
696
|
+
allowUnknown: false,
|
|
697
|
+
});
|
|
698
|
+
|
|
699
|
+
if (res_error) {
|
|
700
|
+
Logger({
|
|
701
|
+
level: "WARN",
|
|
702
|
+
message: "Response Validation Warnnings for getDownloadJob",
|
|
703
|
+
});
|
|
704
|
+
Logger({ level: "WARN", message: res_error });
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
return response;
|
|
503
708
|
}
|
|
504
709
|
|
|
505
710
|
/**
|
|
506
711
|
* @param {Object} arg - Arg object.
|
|
507
712
|
* @param {string} arg.id - Id
|
|
713
|
+
* @returns {Promise<CancelJobResponse>} - Success response
|
|
508
714
|
* @summary: Cancel Download Job.
|
|
509
715
|
* @description: Cancel Download Job.
|
|
510
716
|
*/
|
|
511
|
-
cancelDownloadJob({ id } = {}) {
|
|
717
|
+
async cancelDownloadJob({ id } = {}) {
|
|
512
718
|
const { error } = DiscountValidator.cancelDownloadJob().validate(
|
|
513
719
|
{
|
|
514
720
|
id,
|
|
@@ -527,15 +733,18 @@ class Discount {
|
|
|
527
733
|
{ abortEarly: false, allowUnknown: false }
|
|
528
734
|
);
|
|
529
735
|
if (warrning) {
|
|
530
|
-
|
|
531
|
-
|
|
736
|
+
Logger({
|
|
737
|
+
level: "WARN",
|
|
738
|
+
message: "Parameter Validation warrnings for cancelDownloadJob",
|
|
739
|
+
});
|
|
740
|
+
Logger({ level: "WARN", message: warrning });
|
|
532
741
|
}
|
|
533
742
|
|
|
534
743
|
const query_params = {};
|
|
535
744
|
|
|
536
745
|
const xHeaders = {};
|
|
537
746
|
|
|
538
|
-
|
|
747
|
+
const response = await PlatformAPIClient.execute(
|
|
539
748
|
this.config,
|
|
540
749
|
"delete",
|
|
541
750
|
`/service/platform/discount/v1.0/company/${this.config.companyId}/file/download/${id}/`,
|
|
@@ -543,6 +752,23 @@ class Discount {
|
|
|
543
752
|
undefined,
|
|
544
753
|
xHeaders
|
|
545
754
|
);
|
|
755
|
+
|
|
756
|
+
const {
|
|
757
|
+
error: res_error,
|
|
758
|
+
} = DiscountModel.CancelJobResponse().validate(response, {
|
|
759
|
+
abortEarly: false,
|
|
760
|
+
allowUnknown: false,
|
|
761
|
+
});
|
|
762
|
+
|
|
763
|
+
if (res_error) {
|
|
764
|
+
Logger({
|
|
765
|
+
level: "WARN",
|
|
766
|
+
message: "Response Validation Warnnings for cancelDownloadJob",
|
|
767
|
+
});
|
|
768
|
+
Logger({ level: "WARN", message: res_error });
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
return response;
|
|
546
772
|
}
|
|
547
773
|
}
|
|
548
774
|
|
|
@@ -7,6 +7,7 @@ declare class FileStorage {
|
|
|
7
7
|
* @param {Object} arg - Arg object.
|
|
8
8
|
* @param {string} arg.namespace - Bucket name
|
|
9
9
|
* @param {StartRequest} arg.body
|
|
10
|
+
* @returns {Promise<StartResponse>} - Success response
|
|
10
11
|
* @summary: This operation initiates upload and returns storage link which is valid for 30 Minutes. You can use that storage link to make subsequent upload request with file buffer or blob.
|
|
11
12
|
* @description: Uploads an arbitrarily sized buffer or blob.
|
|
12
13
|
*
|
|
@@ -30,11 +31,12 @@ declare class FileStorage {
|
|
|
30
31
|
appStartUpload({ namespace, body }?: {
|
|
31
32
|
namespace: string;
|
|
32
33
|
body: StartRequest;
|
|
33
|
-
}): Promise<
|
|
34
|
+
}): Promise<StartResponse>;
|
|
34
35
|
/**
|
|
35
36
|
* @param {Object} arg - Arg object.
|
|
36
37
|
* @param {string} arg.namespace - Bucket name
|
|
37
38
|
* @param {StartResponse} arg.body
|
|
39
|
+
* @returns {Promise<CompleteResponse>} - Success response
|
|
38
40
|
* @summary: This will complete the upload process. After successfully uploading file, you can call this operation to complete the upload process.
|
|
39
41
|
* @description: Uploads an arbitrarily sized buffer or blob.
|
|
40
42
|
*
|
|
@@ -58,29 +60,31 @@ declare class FileStorage {
|
|
|
58
60
|
appCompleteUpload({ namespace, body }?: {
|
|
59
61
|
namespace: string;
|
|
60
62
|
body: StartResponse;
|
|
61
|
-
}): Promise<
|
|
63
|
+
}): Promise<CompleteResponse>;
|
|
62
64
|
/**
|
|
63
65
|
* @param {Object} arg - Arg object.
|
|
64
66
|
* @param {boolean} [arg.sync] - Sync
|
|
65
67
|
* @param {BulkRequest} arg.body
|
|
68
|
+
* @returns {Promise<BulkUploadResponse>} - Success response
|
|
66
69
|
* @summary: Copy Files
|
|
67
70
|
* @description: Copy Files
|
|
68
71
|
*/
|
|
69
72
|
appCopyFiles({ body, sync }?: {
|
|
70
73
|
sync?: boolean;
|
|
71
74
|
body: BulkRequest;
|
|
72
|
-
}): Promise<
|
|
75
|
+
}): Promise<BulkUploadResponse>;
|
|
73
76
|
/**
|
|
74
77
|
* @param {Object} arg - Arg object.
|
|
75
78
|
* @param {string} arg.namespace - Bucket name
|
|
76
79
|
* @param {number} [arg.pageNo] - Page no
|
|
80
|
+
* @returns {Promise<BrowseResponse>} - Success response
|
|
77
81
|
* @summary: Browse Files
|
|
78
82
|
* @description: Browse Files
|
|
79
83
|
*/
|
|
80
84
|
browse({ namespace, pageNo }?: {
|
|
81
85
|
namespace: string;
|
|
82
86
|
pageNo?: number;
|
|
83
|
-
}): Promise<
|
|
87
|
+
}): Promise<BrowseResponse>;
|
|
84
88
|
/**
|
|
85
89
|
* @param {Object} arg - Arg object.
|
|
86
90
|
* @param {string} arg.namespace - Bucket name
|