@gofynd/fdk-client-javascript 3.0.0-beta.1 → 3.1.0-beta.1

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.
Files changed (83) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/sdk/application/Cart/CartApplicationClient.d.ts +14 -14
  4. package/sdk/application/Cart/CartApplicationClient.js +14 -14
  5. package/sdk/application/Content/ContentApplicationClient.d.ts +10 -0
  6. package/sdk/application/Content/ContentApplicationClient.js +53 -0
  7. package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -6
  8. package/sdk/application/FileStorage/FileStorageApplicationClient.js +3 -3
  9. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +34 -0
  10. package/sdk/application/Logistic/LogisticApplicationClient.js +136 -0
  11. package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +12 -12
  12. package/sdk/partner/FileStorage/FileStoragePartnerClient.js +12 -12
  13. package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +46 -33
  14. package/sdk/partner/FileStorage/FileStoragePartnerModel.js +41 -25
  15. package/sdk/partner/FileStorage/FileStoragePartnerValidator.js +4 -4
  16. package/sdk/platform/Billing/BillingPlatformClient.d.ts +6 -397
  17. package/sdk/platform/Billing/BillingPlatformClient.js +77 -3215
  18. package/sdk/platform/Billing/BillingPlatformModel.d.ts +417 -3811
  19. package/sdk/platform/Billing/BillingPlatformModel.js +292 -2544
  20. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +12 -451
  21. package/sdk/platform/Billing/BillingPlatformValidator.js +8 -483
  22. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -34
  23. package/sdk/platform/Cart/CartPlatformApplicationClient.js +34 -34
  24. package/sdk/platform/Cart/CartPlatformModel.d.ts +363 -29
  25. package/sdk/platform/Cart/CartPlatformModel.js +203 -31
  26. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +57 -57
  27. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +220 -200
  28. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +121 -91
  29. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +58 -46
  30. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +10 -51
  31. package/sdk/platform/Catalog/CatalogPlatformClient.js +79 -400
  32. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +22 -228
  33. package/sdk/platform/Catalog/CatalogPlatformModel.js +12 -163
  34. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +15 -61
  35. package/sdk/platform/Catalog/CatalogPlatformValidator.js +13 -65
  36. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +4 -8
  37. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +10 -14
  38. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +94 -30
  39. package/sdk/platform/Communication/CommunicationPlatformModel.js +110 -32
  40. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +33 -1
  41. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +62 -0
  42. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +11 -0
  43. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +5 -0
  44. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +12 -2
  45. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +5 -1
  46. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +6 -4
  47. package/sdk/platform/Content/ContentPlatformApplicationClient.js +12 -10
  48. package/sdk/platform/Content/ContentPlatformModel.d.ts +42 -12
  49. package/sdk/platform/Content/ContentPlatformModel.js +43 -13
  50. package/sdk/platform/Finance/FinancePlatformClient.d.ts +28 -28
  51. package/sdk/platform/Finance/FinancePlatformClient.js +28 -28
  52. package/sdk/platform/Order/OrderPlatformClient.d.ts +21 -21
  53. package/sdk/platform/Order/OrderPlatformClient.js +21 -21
  54. package/sdk/platform/Order/OrderPlatformModel.d.ts +1010 -80
  55. package/sdk/platform/Order/OrderPlatformModel.js +665 -70
  56. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +31 -4
  57. package/sdk/platform/Payment/PaymentPlatformModel.js +11 -4
  58. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +1 -1
  59. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +8 -0
  60. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +14 -0
  61. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +6 -0
  62. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +24 -0
  63. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +119 -0
  64. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +194 -23
  65. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +116 -22
  66. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +23 -1
  67. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +16 -0
  68. package/sdk/platform/Share/SharePlatformModel.d.ts +5 -0
  69. package/sdk/platform/Share/SharePlatformModel.js +2 -0
  70. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +10 -12
  71. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +45 -49
  72. package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +10 -10
  73. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +12 -12
  74. package/sdk/public/PublicClient.d.ts +0 -2
  75. package/sdk/public/PublicClient.js +0 -4
  76. package/sdk/public/index.d.ts +0 -1
  77. package/sdk/public/index.js +0 -2
  78. package/sdk/public/Billing/BillingPublicClient.d.ts +0 -56
  79. package/sdk/public/Billing/BillingPublicClient.js +0 -397
  80. package/sdk/public/Billing/BillingPublicModel.d.ts +0 -919
  81. package/sdk/public/Billing/BillingPublicModel.js +0 -560
  82. package/sdk/public/Billing/BillingPublicValidator.d.ts +0 -43
  83. package/sdk/public/Billing/BillingPublicValidator.js +0 -50
@@ -1,397 +0,0 @@
1
- const {
2
- FDKClientValidationError,
3
- FDKResponseValidationError,
4
- } = require("../../common/FDKError");
5
-
6
- const PublicAPIClient = require("../PublicAPIClient");
7
- const constructUrl = require("../constructUrl");
8
- const Paginator = require("../../common/Paginator");
9
-
10
- const BillingPublicValidator = require("./BillingPublicValidator");
11
- const BillingPublicModel = require("./BillingPublicModel");
12
- const Joi = require("joi");
13
- const { Logger } = require("./../../common/Logger");
14
-
15
- class Billing {
16
- constructor(_conf) {
17
- this._conf = _conf;
18
- this._relativeUrls = {
19
- getPlanDetails: "/service/public/billing/v1.0/plan/details/{plan_id}",
20
- getStandardPlans: "/service/public/billing/v1.0/plan/detailed-list/",
21
- getTenureConfig:
22
- "/service/public/billing/v1.0/tenure-config/{country_code}",
23
- planList: "/service/public/billing/v1.0/plan/list",
24
- };
25
- this._urls = Object.entries(this._relativeUrls).reduce(
26
- (urls, [method, relativeUrl]) => {
27
- urls[method] = `${_conf.domain}${relativeUrl}`;
28
- return urls;
29
- },
30
- {}
31
- );
32
- }
33
-
34
- updateUrls(urls) {
35
- this._urls = {
36
- ...this._urls,
37
- ...urls,
38
- };
39
- }
40
-
41
- /**
42
- * @param {BillingPublicValidator.GetPlanDetailsParam} arg - Arg object.
43
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
44
- * @param {import("../PublicAPIClient").Options} - Options
45
- * @returns {Promise<BillingPublicModel.PlanDetails>} - Success response
46
- * @name getPlanDetails
47
- * @summary: Get plan details
48
- * @description: Get plan details.
49
- * - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/billing/getPlanDetails/).
50
- */
51
- async getPlanDetails(
52
- { planId, requestHeaders } = { requestHeaders: {} },
53
- { responseHeaders } = { responseHeaders: false }
54
- ) {
55
- let invalidInput = [];
56
-
57
- if (!planId) {
58
- invalidInput.push({
59
- message: `The 'planId' field is required.`,
60
- path: ["planId"],
61
- });
62
- }
63
- if (invalidInput.length) {
64
- const error = new Error();
65
- error.message = "Missing required field";
66
- error.details = invalidInput;
67
- return Promise.reject(new FDKClientValidationError(error));
68
- }
69
-
70
- const { error } = BillingPublicValidator.getPlanDetails().validate(
71
- { planId },
72
- { abortEarly: false, allowUnknown: true }
73
- );
74
- if (error) {
75
- return Promise.reject(new FDKClientValidationError(error));
76
- }
77
-
78
- // Showing warrnings if extra unknown parameters are found
79
- const {
80
- error: warrning,
81
- } = BillingPublicValidator.getPlanDetails().validate(
82
- { planId },
83
- { abortEarly: false, allowUnknown: false }
84
- );
85
- if (warrning) {
86
- Logger({
87
- level: "WARN",
88
- message: `Parameter Validation warrnings for public > Billing > getPlanDetails \n ${warrning}`,
89
- });
90
- }
91
-
92
- const query_params = {};
93
-
94
- const xHeaders = {};
95
-
96
- const response = await PublicAPIClient.execute(
97
- this._conf,
98
- "get",
99
- constructUrl({
100
- url: this._urls["getPlanDetails"],
101
- params: { planId },
102
- }),
103
- query_params,
104
- undefined,
105
- { ...xHeaders, ...requestHeaders },
106
- { responseHeaders }
107
- );
108
-
109
- let responseData = response;
110
- if (responseHeaders) {
111
- responseData = response[0];
112
- }
113
-
114
- const {
115
- error: res_error,
116
- } = BillingPublicModel.PlanDetails().validate(responseData, {
117
- abortEarly: false,
118
- allowUnknown: true,
119
- });
120
-
121
- if (res_error) {
122
- if (this._conf.options.strictResponseCheck === true) {
123
- return Promise.reject(new FDKResponseValidationError(res_error));
124
- } else {
125
- Logger({
126
- level: "WARN",
127
- message: `Response Validation Warnings for public > Billing > getPlanDetails \n ${res_error}`,
128
- });
129
- }
130
- }
131
-
132
- return response;
133
- }
134
-
135
- /**
136
- * @param {BillingPublicValidator.GetStandardPlansParam} arg - Arg object.
137
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
138
- * @param {import("../PublicAPIClient").Options} - Options
139
- * @returns {Promise<BillingPublicModel.DetailList>} - Success response
140
- * @name getStandardPlans
141
- * @summary: Get Standard/Public Plans
142
- * @description: Get Standard/Public Plans. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/billing/getStandardPlans/).
143
- */
144
- async getStandardPlans(
145
- { platform, requestHeaders } = { requestHeaders: {} },
146
- { responseHeaders } = { responseHeaders: false }
147
- ) {
148
- let invalidInput = [];
149
- if (invalidInput.length) {
150
- const error = new Error();
151
- error.message = "Missing required field";
152
- error.details = invalidInput;
153
- return Promise.reject(new FDKClientValidationError(error));
154
- }
155
-
156
- const { error } = BillingPublicValidator.getStandardPlans().validate(
157
- { platform },
158
- { abortEarly: false, allowUnknown: true }
159
- );
160
- if (error) {
161
- return Promise.reject(new FDKClientValidationError(error));
162
- }
163
-
164
- // Showing warrnings if extra unknown parameters are found
165
- const {
166
- error: warrning,
167
- } = BillingPublicValidator.getStandardPlans().validate(
168
- { platform },
169
- { abortEarly: false, allowUnknown: false }
170
- );
171
- if (warrning) {
172
- Logger({
173
- level: "WARN",
174
- message: `Parameter Validation warrnings for public > Billing > getStandardPlans \n ${warrning}`,
175
- });
176
- }
177
-
178
- const query_params = {};
179
- query_params["platform"] = platform;
180
-
181
- const xHeaders = {};
182
-
183
- const response = await PublicAPIClient.execute(
184
- this._conf,
185
- "get",
186
- constructUrl({
187
- url: this._urls["getStandardPlans"],
188
- params: {},
189
- }),
190
- query_params,
191
- undefined,
192
- { ...xHeaders, ...requestHeaders },
193
- { responseHeaders }
194
- );
195
-
196
- let responseData = response;
197
- if (responseHeaders) {
198
- responseData = response[0];
199
- }
200
-
201
- const {
202
- error: res_error,
203
- } = BillingPublicModel.DetailList().validate(responseData, {
204
- abortEarly: false,
205
- allowUnknown: true,
206
- });
207
-
208
- if (res_error) {
209
- if (this._conf.options.strictResponseCheck === true) {
210
- return Promise.reject(new FDKResponseValidationError(res_error));
211
- } else {
212
- Logger({
213
- level: "WARN",
214
- message: `Response Validation Warnings for public > Billing > getStandardPlans \n ${res_error}`,
215
- });
216
- }
217
- }
218
-
219
- return response;
220
- }
221
-
222
- /**
223
- * @param {BillingPublicValidator.GetTenureConfigParam} arg - Arg object.
224
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
225
- * @param {import("../PublicAPIClient").Options} - Options
226
- * @returns {Promise<BillingPublicModel.TenureConfigResponse>} - Success response
227
- * @name getTenureConfig
228
- * @summary: Get Tenure Configuration
229
- * @description: Retrieve the tenure configuration for a specific country. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/billing/getTenureConfig/).
230
- */
231
- async getTenureConfig(
232
- { countryCode, requestHeaders } = { requestHeaders: {} },
233
- { responseHeaders } = { responseHeaders: false }
234
- ) {
235
- let invalidInput = [];
236
-
237
- if (!countryCode) {
238
- invalidInput.push({
239
- message: `The 'countryCode' field is required.`,
240
- path: ["countryCode"],
241
- });
242
- }
243
- if (invalidInput.length) {
244
- const error = new Error();
245
- error.message = "Missing required field";
246
- error.details = invalidInput;
247
- return Promise.reject(new FDKClientValidationError(error));
248
- }
249
-
250
- const { error } = BillingPublicValidator.getTenureConfig().validate(
251
- { countryCode },
252
- { abortEarly: false, allowUnknown: true }
253
- );
254
- if (error) {
255
- return Promise.reject(new FDKClientValidationError(error));
256
- }
257
-
258
- // Showing warrnings if extra unknown parameters are found
259
- const {
260
- error: warrning,
261
- } = BillingPublicValidator.getTenureConfig().validate(
262
- { countryCode },
263
- { abortEarly: false, allowUnknown: false }
264
- );
265
- if (warrning) {
266
- Logger({
267
- level: "WARN",
268
- message: `Parameter Validation warrnings for public > Billing > getTenureConfig \n ${warrning}`,
269
- });
270
- }
271
-
272
- const query_params = {};
273
-
274
- const xHeaders = {};
275
-
276
- const response = await PublicAPIClient.execute(
277
- this._conf,
278
- "get",
279
- constructUrl({
280
- url: this._urls["getTenureConfig"],
281
- params: { countryCode },
282
- }),
283
- query_params,
284
- undefined,
285
- { ...xHeaders, ...requestHeaders },
286
- { responseHeaders }
287
- );
288
-
289
- let responseData = response;
290
- if (responseHeaders) {
291
- responseData = response[0];
292
- }
293
-
294
- const {
295
- error: res_error,
296
- } = BillingPublicModel.TenureConfigResponse().validate(responseData, {
297
- abortEarly: false,
298
- allowUnknown: true,
299
- });
300
-
301
- if (res_error) {
302
- if (this._conf.options.strictResponseCheck === true) {
303
- return Promise.reject(new FDKResponseValidationError(res_error));
304
- } else {
305
- Logger({
306
- level: "WARN",
307
- message: `Response Validation Warnings for public > Billing > getTenureConfig \n ${res_error}`,
308
- });
309
- }
310
- }
311
-
312
- return response;
313
- }
314
-
315
- /**
316
- * @param {BillingPublicValidator.PlanListParam} arg - Arg object.
317
- * @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
318
- * @param {import("../PublicAPIClient").Options} - Options
319
- * @returns {Promise<BillingPublicModel.PlanList[]>} - Success response
320
- * @name planList
321
- * @summary: Get List of all plans
322
- * @description: Get List of all plans - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/billing/planList/).
323
- */
324
- async planList(
325
- { requestHeaders } = { requestHeaders: {} },
326
- { responseHeaders } = { responseHeaders: false }
327
- ) {
328
- let invalidInput = [];
329
- if (invalidInput.length) {
330
- const error = new Error();
331
- error.message = "Missing required field";
332
- error.details = invalidInput;
333
- return Promise.reject(new FDKClientValidationError(error));
334
- }
335
-
336
- const { error } = BillingPublicValidator.planList().validate(
337
- {},
338
- { abortEarly: false, allowUnknown: true }
339
- );
340
- if (error) {
341
- return Promise.reject(new FDKClientValidationError(error));
342
- }
343
-
344
- // Showing warrnings if extra unknown parameters are found
345
- const { error: warrning } = BillingPublicValidator.planList().validate(
346
- {},
347
- { abortEarly: false, allowUnknown: false }
348
- );
349
- if (warrning) {
350
- Logger({
351
- level: "WARN",
352
- message: `Parameter Validation warrnings for public > Billing > planList \n ${warrning}`,
353
- });
354
- }
355
-
356
- const query_params = {};
357
-
358
- const xHeaders = {};
359
-
360
- const response = await PublicAPIClient.execute(
361
- this._conf,
362
- "get",
363
- constructUrl({
364
- url: this._urls["planList"],
365
- params: {},
366
- }),
367
- query_params,
368
- undefined,
369
- { ...xHeaders, ...requestHeaders },
370
- { responseHeaders }
371
- );
372
-
373
- let responseData = response;
374
- if (responseHeaders) {
375
- responseData = response[0];
376
- }
377
-
378
- const { error: res_error } = Joi.array()
379
- .items(BillingPublicModel.PlanList())
380
- .validate(responseData, { abortEarly: false, allowUnknown: true });
381
-
382
- if (res_error) {
383
- if (this._conf.options.strictResponseCheck === true) {
384
- return Promise.reject(new FDKResponseValidationError(res_error));
385
- } else {
386
- Logger({
387
- level: "WARN",
388
- message: `Response Validation Warnings for public > Billing > planList \n ${res_error}`,
389
- });
390
- }
391
- }
392
-
393
- return response;
394
- }
395
- }
396
-
397
- module.exports = Billing;