@gofynd/fdk-client-javascript 1.1.2 → 1.1.4

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 (120) hide show
  1. package/README.md +2 -2
  2. package/index.d.ts +7 -7
  3. package/index.js +12 -12
  4. package/package.json +1 -1
  5. package/sdk/application/ApplicationClient.d.ts +20 -20
  6. package/sdk/application/ApplicationClient.js +26 -26
  7. package/sdk/application/Cart/CartApplicationClient.d.ts +36 -6
  8. package/sdk/application/Cart/CartApplicationClient.js +105 -10
  9. package/sdk/application/Cart/CartApplicationModel.d.ts +9 -0
  10. package/sdk/application/Cart/CartApplicationModel.js +105 -1
  11. package/sdk/application/Cart/CartApplicationValidator.d.ts +1 -0
  12. package/sdk/application/Cart/CartApplicationValidator.js +15 -1
  13. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +1 -0
  14. package/sdk/application/Catalog/CatalogApplicationModel.js +13 -0
  15. package/sdk/application/Common/CommonApplicationModel.js +4 -0
  16. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +14 -10
  17. package/sdk/application/Configuration/ConfigurationApplicationClient.js +16 -10
  18. package/sdk/application/Configuration/ConfigurationApplicationModel.js +6 -5
  19. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  20. package/sdk/application/Content/ContentApplicationModel.js +3 -1
  21. package/sdk/application/Lead/LeadApplicationModel.js +4 -1
  22. package/sdk/application/Logistic/LogisticApplicationModel.js +3 -2
  23. package/sdk/application/Order/OrderApplicationClient.d.ts +2 -2
  24. package/sdk/application/Order/OrderApplicationClient.js +2 -2
  25. package/sdk/application/Order/OrderApplicationModel.js +18 -8
  26. package/sdk/application/Payment/PaymentApplicationClient.d.ts +35 -0
  27. package/sdk/application/Payment/PaymentApplicationClient.js +200 -0
  28. package/sdk/application/Payment/PaymentApplicationModel.d.ts +4 -0
  29. package/sdk/application/Payment/PaymentApplicationModel.js +58 -7
  30. package/sdk/application/Payment/PaymentApplicationValidator.d.ts +3 -0
  31. package/sdk/application/Payment/PaymentApplicationValidator.js +19 -0
  32. package/sdk/application/PosCart/PosCartApplicationClient.d.ts +16 -3
  33. package/sdk/application/PosCart/PosCartApplicationClient.js +39 -6
  34. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +6 -0
  35. package/sdk/application/PosCart/PosCartApplicationModel.js +63 -1
  36. package/sdk/application/PosCart/PosCartApplicationValidator.js +6 -0
  37. package/sdk/application/index.d.ts +10 -10
  38. package/sdk/application/index.js +13 -13
  39. package/sdk/common/Constant.d.ts +5 -0
  40. package/sdk/common/Constant.js +5 -0
  41. package/sdk/partner/OAuthClient.js +1 -1
  42. package/sdk/platform/Billing/BillingPlatformModel.js +6 -1
  43. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +491 -2
  44. package/sdk/platform/Cart/CartPlatformApplicationClient.js +2661 -337
  45. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +32 -0
  46. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +269 -0
  47. package/sdk/platform/Cart/CartPlatformModel.d.ts +58 -0
  48. package/sdk/platform/Cart/CartPlatformModel.js +652 -3
  49. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +8 -2
  50. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +10 -0
  51. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
  52. package/sdk/platform/Catalog/CatalogPlatformClient.js +2 -2
  53. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +1 -0
  54. package/sdk/platform/Catalog/CatalogPlatformModel.js +43 -31
  55. package/sdk/platform/Common/CommonPlatformModel.js +4 -0
  56. package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +1 -0
  57. package/sdk/platform/Communication/CommunicationPlatformModel.js +9 -0
  58. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +2 -2
  59. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +2 -2
  60. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +5 -4
  61. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +99 -78
  62. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +99 -78
  63. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +87 -71
  64. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +87 -71
  65. package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +2 -0
  66. package/sdk/platform/Configuration/ConfigurationPlatformModel.js +34 -7
  67. package/sdk/platform/Content/ContentPlatformModel.js +3 -1
  68. package/sdk/platform/Finance/FinancePlatformClient.d.ts +135 -0
  69. package/sdk/platform/Finance/FinancePlatformClient.js +853 -0
  70. package/sdk/platform/Finance/FinancePlatformModel.d.ts +51 -0
  71. package/sdk/platform/Finance/FinancePlatformModel.js +342 -0
  72. package/sdk/platform/Finance/FinancePlatformValidator.d.ts +16 -0
  73. package/sdk/platform/Finance/FinancePlatformValidator.js +84 -0
  74. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +11 -1
  75. package/sdk/platform/Order/OrderPlatformApplicationClient.js +66 -2
  76. package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -0
  77. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -0
  78. package/sdk/platform/Order/OrderPlatformClient.d.ts +161 -79
  79. package/sdk/platform/Order/OrderPlatformClient.js +546 -114
  80. package/sdk/platform/Order/OrderPlatformModel.d.ts +42 -6
  81. package/sdk/platform/Order/OrderPlatformModel.js +569 -159
  82. package/sdk/platform/Order/OrderPlatformValidator.d.ts +6 -0
  83. package/sdk/platform/Order/OrderPlatformValidator.js +52 -9
  84. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +22 -0
  85. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +127 -0
  86. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +2 -0
  87. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +13 -0
  88. package/sdk/platform/Partner/PartnerPlatformClient.d.ts +145 -0
  89. package/sdk/platform/Partner/PartnerPlatformClient.js +799 -0
  90. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +39 -0
  91. package/sdk/platform/Partner/PartnerPlatformModel.js +367 -0
  92. package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +14 -0
  93. package/sdk/platform/Partner/PartnerPlatformValidator.js +87 -0
  94. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +221 -0
  95. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +1476 -190
  96. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +20 -0
  97. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +126 -0
  98. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +48 -0
  99. package/sdk/platform/Payment/PaymentPlatformModel.js +452 -7
  100. package/sdk/platform/PlatformApplicationClient.d.ts +1249 -937
  101. package/sdk/platform/PlatformApplicationClient.js +1366 -1033
  102. package/sdk/platform/PlatformClient.d.ts +10979 -8771
  103. package/sdk/platform/PlatformClient.js +11874 -9197
  104. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +134 -0
  105. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +852 -0
  106. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +16 -0
  107. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +81 -0
  108. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +223 -0
  109. package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +1296 -0
  110. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +97 -0
  111. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +778 -0
  112. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +21 -0
  113. package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +130 -0
  114. package/sdk/platform/index.d.ts +16 -14
  115. package/sdk/platform/index.js +22 -18
  116. package/sdk/public/Configuration/ConfigurationPublicModel.js +5 -0
  117. package/sdk/public/PublicClient.d.ts +2 -2
  118. package/sdk/public/PublicClient.js +4 -4
  119. package/sdk/public/index.d.ts +1 -1
  120. package/sdk/public/index.js +2 -2
@@ -0,0 +1,799 @@
1
+ const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
+ const PartnerValidator = require("./PartnerPlatformValidator");
5
+ const PartnerModel = require("./PartnerPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
8
+
9
+ class Partner {
10
+ constructor(config) {
11
+ this.config = config;
12
+ }
13
+
14
+ /**
15
+ * @param {Object} arg - Arg object.
16
+ * @param {string} arg.extensionId - Extension id
17
+ * @param {string} arg.message - Message while uninstalling extension
18
+ * @param {string} arg.uninstallReasonType - Reason for uninstalling extension
19
+ * @returns {Promise<UninstallExtension>} - Success response
20
+ * @summary: Uninstall extension
21
+ * @description: Use this API to remove extension from yout company or channel
22
+ */
23
+ async deleteExtensionById({
24
+ extensionId,
25
+ message,
26
+ uninstallReasonType,
27
+ } = {}) {
28
+ const { error } = PartnerValidator.deleteExtensionById().validate(
29
+ {
30
+ extensionId,
31
+ message,
32
+ uninstallReasonType,
33
+ },
34
+ { abortEarly: false, allowUnknown: true }
35
+ );
36
+ if (error) {
37
+ return Promise.reject(new FDKClientValidationError(error));
38
+ }
39
+
40
+ // Showing warrnings if extra unknown parameters are found
41
+ const { error: warrning } = PartnerValidator.deleteExtensionById().validate(
42
+ {
43
+ extensionId,
44
+ message,
45
+ uninstallReasonType,
46
+ },
47
+ { abortEarly: false, allowUnknown: false }
48
+ );
49
+ if (warrning) {
50
+ Logger({
51
+ level: "WARN",
52
+ message: "Parameter Validation warrnings for deleteExtensionById",
53
+ });
54
+ Logger({ level: "WARN", message: warrning });
55
+ }
56
+
57
+ const query_params = {};
58
+ query_params["message"] = message;
59
+ query_params["uninstall_reason_type"] = uninstallReasonType;
60
+
61
+ const xHeaders = {};
62
+
63
+ const response = await PlatformAPIClient.execute(
64
+ this.config,
65
+ "delete",
66
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/extension/${extensionId}`,
67
+ query_params,
68
+ undefined,
69
+ xHeaders
70
+ );
71
+
72
+ const {
73
+ error: res_error,
74
+ } = PartnerModel.UninstallExtension().validate(response, {
75
+ abortEarly: false,
76
+ allowUnknown: false,
77
+ });
78
+
79
+ if (res_error) {
80
+ Logger({
81
+ level: "WARN",
82
+ message: "Response Validation Warnnings for deleteExtensionById",
83
+ });
84
+ Logger({ level: "WARN", message: res_error });
85
+ }
86
+
87
+ return response;
88
+ }
89
+
90
+ /**
91
+ * @param {Object} arg - Arg object.
92
+ * @param {string} arg.extensionId - Extension id
93
+ * @returns {Promise<ExtensionCommon>} - Success response
94
+ * @summary: Get extension details
95
+ * @description: Use this API to get the details of extension
96
+ */
97
+ async getExtensionById({ extensionId } = {}) {
98
+ const { error } = PartnerValidator.getExtensionById().validate(
99
+ {
100
+ extensionId,
101
+ },
102
+ { abortEarly: false, allowUnknown: true }
103
+ );
104
+ if (error) {
105
+ return Promise.reject(new FDKClientValidationError(error));
106
+ }
107
+
108
+ // Showing warrnings if extra unknown parameters are found
109
+ const { error: warrning } = PartnerValidator.getExtensionById().validate(
110
+ {
111
+ extensionId,
112
+ },
113
+ { abortEarly: false, allowUnknown: false }
114
+ );
115
+ if (warrning) {
116
+ Logger({
117
+ level: "WARN",
118
+ message: "Parameter Validation warrnings for getExtensionById",
119
+ });
120
+ Logger({ level: "WARN", message: warrning });
121
+ }
122
+
123
+ const query_params = {};
124
+
125
+ const xHeaders = {};
126
+
127
+ const response = await PlatformAPIClient.execute(
128
+ this.config,
129
+ "get",
130
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/extension/${extensionId}`,
131
+ query_params,
132
+ undefined,
133
+ xHeaders
134
+ );
135
+
136
+ const {
137
+ error: res_error,
138
+ } = PartnerModel.ExtensionCommon().validate(response, {
139
+ abortEarly: false,
140
+ allowUnknown: false,
141
+ });
142
+
143
+ if (res_error) {
144
+ Logger({
145
+ level: "WARN",
146
+ message: "Response Validation Warnnings for getExtensionById",
147
+ });
148
+ Logger({ level: "WARN", message: res_error });
149
+ }
150
+
151
+ return response;
152
+ }
153
+
154
+ /**
155
+ * @param {Object} arg - Arg object.
156
+ * @param {number} [arg.pageSize] - Number of records you want to get in single page
157
+ * @param {string} [arg.tag] - Tag
158
+ * @param {string} [arg.currentPage] - Tag
159
+ * @param {number} [arg.pageNo] - Current page number
160
+ * @param {string} [arg.filterBy] - Filter by
161
+ * @param {string} [arg.query] - Query
162
+ * @returns {Promise<ExtensionList>} - Success response
163
+ * @summary: Get the list of all the extensions
164
+ * @description: Use this API to get the the extensions for the company
165
+ */
166
+ async getExtensionsForCompany({
167
+ pageSize,
168
+ tag,
169
+ currentPage,
170
+ pageNo,
171
+ filterBy,
172
+ query,
173
+ } = {}) {
174
+ const { error } = PartnerValidator.getExtensionsForCompany().validate(
175
+ {
176
+ pageSize,
177
+ tag,
178
+ currentPage,
179
+ pageNo,
180
+ filterBy,
181
+ query,
182
+ },
183
+ { abortEarly: false, allowUnknown: true }
184
+ );
185
+ if (error) {
186
+ return Promise.reject(new FDKClientValidationError(error));
187
+ }
188
+
189
+ // Showing warrnings if extra unknown parameters are found
190
+ const {
191
+ error: warrning,
192
+ } = PartnerValidator.getExtensionsForCompany().validate(
193
+ {
194
+ pageSize,
195
+ tag,
196
+ currentPage,
197
+ pageNo,
198
+ filterBy,
199
+ query,
200
+ },
201
+ { abortEarly: false, allowUnknown: false }
202
+ );
203
+ if (warrning) {
204
+ Logger({
205
+ level: "WARN",
206
+ message: "Parameter Validation warrnings for getExtensionsForCompany",
207
+ });
208
+ Logger({ level: "WARN", message: warrning });
209
+ }
210
+
211
+ const query_params = {};
212
+ query_params["page_size"] = pageSize;
213
+ query_params["tag"] = tag;
214
+ query_params["current_page"] = currentPage;
215
+ query_params["page_no"] = pageNo;
216
+ query_params["filter_by"] = filterBy;
217
+ query_params["query"] = query;
218
+
219
+ const xHeaders = {};
220
+
221
+ const response = await PlatformAPIClient.execute(
222
+ this.config,
223
+ "get",
224
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/extensions`,
225
+ query_params,
226
+ undefined,
227
+ xHeaders
228
+ );
229
+
230
+ const { error: res_error } = PartnerModel.ExtensionList().validate(
231
+ response,
232
+ { abortEarly: false, allowUnknown: false }
233
+ );
234
+
235
+ if (res_error) {
236
+ Logger({
237
+ level: "WARN",
238
+ message: "Response Validation Warnnings for getExtensionsForCompany",
239
+ });
240
+ Logger({ level: "WARN", message: res_error });
241
+ }
242
+
243
+ return response;
244
+ }
245
+
246
+ /**
247
+ * @param {Object} arg - Arg object.
248
+ * @param {number} [arg.pageSize] - Number of records you want to get in single page
249
+ * @returns {Promise<ExtensionSuggestionList>} - Success response
250
+ * @summary: Get the list of all the extension suggestions
251
+ * @description: Use this API to get the the extensions suggestions
252
+ */
253
+ async getExtensionsSuggestions({ pageSize } = {}) {
254
+ const { error } = PartnerValidator.getExtensionsSuggestions().validate(
255
+ {
256
+ pageSize,
257
+ },
258
+ { abortEarly: false, allowUnknown: true }
259
+ );
260
+ if (error) {
261
+ return Promise.reject(new FDKClientValidationError(error));
262
+ }
263
+
264
+ // Showing warrnings if extra unknown parameters are found
265
+ const {
266
+ error: warrning,
267
+ } = PartnerValidator.getExtensionsSuggestions().validate(
268
+ {
269
+ pageSize,
270
+ },
271
+ { abortEarly: false, allowUnknown: false }
272
+ );
273
+ if (warrning) {
274
+ Logger({
275
+ level: "WARN",
276
+ message: "Parameter Validation warrnings for getExtensionsSuggestions",
277
+ });
278
+ Logger({ level: "WARN", message: warrning });
279
+ }
280
+
281
+ const query_params = {};
282
+ query_params["page_size"] = pageSize;
283
+
284
+ const xHeaders = {};
285
+
286
+ const response = await PlatformAPIClient.execute(
287
+ this.config,
288
+ "get",
289
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/extension/suggestions`,
290
+ query_params,
291
+ undefined,
292
+ xHeaders
293
+ );
294
+
295
+ const {
296
+ error: res_error,
297
+ } = PartnerModel.ExtensionSuggestionList().validate(response, {
298
+ abortEarly: false,
299
+ allowUnknown: false,
300
+ });
301
+
302
+ if (res_error) {
303
+ Logger({
304
+ level: "WARN",
305
+ message: "Response Validation Warnnings for getExtensionsSuggestions",
306
+ });
307
+ Logger({ level: "WARN", message: res_error });
308
+ }
309
+
310
+ return response;
311
+ }
312
+
313
+ /**
314
+ * @param {Object} arg - Arg object.
315
+ * @param {string} [arg.requestStatus] - Status of the request
316
+ * @param {string} [arg.pageSize] - Number of records per page
317
+ * @param {string} [arg.pageNo] - Number of page the user want to fetch
318
+ * @returns {Promise<PartnerRequestList>} - Success response
319
+ * @summary: Get partner invites
320
+ * @description: Use this API to get pending, accepted and rejected partner invites in platform
321
+ */
322
+ async getPartnerInvites({ requestStatus, pageSize, pageNo } = {}) {
323
+ const { error } = PartnerValidator.getPartnerInvites().validate(
324
+ {
325
+ requestStatus,
326
+ pageSize,
327
+ pageNo,
328
+ },
329
+ { abortEarly: false, allowUnknown: true }
330
+ );
331
+ if (error) {
332
+ return Promise.reject(new FDKClientValidationError(error));
333
+ }
334
+
335
+ // Showing warrnings if extra unknown parameters are found
336
+ const { error: warrning } = PartnerValidator.getPartnerInvites().validate(
337
+ {
338
+ requestStatus,
339
+ pageSize,
340
+ pageNo,
341
+ },
342
+ { abortEarly: false, allowUnknown: false }
343
+ );
344
+ if (warrning) {
345
+ Logger({
346
+ level: "WARN",
347
+ message: "Parameter Validation warrnings for getPartnerInvites",
348
+ });
349
+ Logger({ level: "WARN", message: warrning });
350
+ }
351
+
352
+ const query_params = {};
353
+ query_params["request_status"] = requestStatus;
354
+ query_params["page_size"] = pageSize;
355
+ query_params["page_no"] = pageNo;
356
+
357
+ const xHeaders = {};
358
+
359
+ const response = await PlatformAPIClient.execute(
360
+ this.config,
361
+ "get",
362
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/partner-request`,
363
+ query_params,
364
+ undefined,
365
+ xHeaders
366
+ );
367
+
368
+ const {
369
+ error: res_error,
370
+ } = PartnerModel.PartnerRequestList().validate(response, {
371
+ abortEarly: false,
372
+ allowUnknown: false,
373
+ });
374
+
375
+ if (res_error) {
376
+ Logger({
377
+ level: "WARN",
378
+ message: "Response Validation Warnnings for getPartnerInvites",
379
+ });
380
+ Logger({ level: "WARN", message: res_error });
381
+ }
382
+
383
+ return response;
384
+ }
385
+
386
+ /**
387
+ * @param {Object} arg - Arg object.
388
+ * @param {string} arg.inviteId - Invitation id
389
+ * @returns {Promise<PartnerInviteDetails>} - Success response
390
+ * @summary: Get partner request details
391
+ * @description: Use this API to get details of pending partner request
392
+ */
393
+ async getPartnerRequestDetails({ inviteId } = {}) {
394
+ const { error } = PartnerValidator.getPartnerRequestDetails().validate(
395
+ {
396
+ inviteId,
397
+ },
398
+ { abortEarly: false, allowUnknown: true }
399
+ );
400
+ if (error) {
401
+ return Promise.reject(new FDKClientValidationError(error));
402
+ }
403
+
404
+ // Showing warrnings if extra unknown parameters are found
405
+ const {
406
+ error: warrning,
407
+ } = PartnerValidator.getPartnerRequestDetails().validate(
408
+ {
409
+ inviteId,
410
+ },
411
+ { abortEarly: false, allowUnknown: false }
412
+ );
413
+ if (warrning) {
414
+ Logger({
415
+ level: "WARN",
416
+ message: "Parameter Validation warrnings for getPartnerRequestDetails",
417
+ });
418
+ Logger({ level: "WARN", message: warrning });
419
+ }
420
+
421
+ const query_params = {};
422
+
423
+ const xHeaders = {};
424
+
425
+ const response = await PlatformAPIClient.execute(
426
+ this.config,
427
+ "get",
428
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/partner-request/${inviteId}`,
429
+ query_params,
430
+ undefined,
431
+ xHeaders
432
+ );
433
+
434
+ const {
435
+ error: res_error,
436
+ } = PartnerModel.PartnerInviteDetails().validate(response, {
437
+ abortEarly: false,
438
+ allowUnknown: false,
439
+ });
440
+
441
+ if (res_error) {
442
+ Logger({
443
+ level: "WARN",
444
+ message: "Response Validation Warnnings for getPartnerRequestDetails",
445
+ });
446
+ Logger({ level: "WARN", message: res_error });
447
+ }
448
+
449
+ return response;
450
+ }
451
+
452
+ /**
453
+ * @param {Object} arg - Arg object.
454
+ * @param {number} [arg.pageSize] - Number of records you want to get in single page
455
+ * @param {number} [arg.pageNo] - Number of page
456
+ * @param {string} [arg.query] - Filter query which we want to pass
457
+ * @returns {Promise<ExtensionResponse>} - Success response
458
+ * @summary: Get the list of private extensions
459
+ * @description: Use this API to get the list of private extensions
460
+ */
461
+ async getPrivateExtensions({ pageSize, pageNo, query } = {}) {
462
+ const { error } = PartnerValidator.getPrivateExtensions().validate(
463
+ {
464
+ pageSize,
465
+ pageNo,
466
+ query,
467
+ },
468
+ { abortEarly: false, allowUnknown: true }
469
+ );
470
+ if (error) {
471
+ return Promise.reject(new FDKClientValidationError(error));
472
+ }
473
+
474
+ // Showing warrnings if extra unknown parameters are found
475
+ const {
476
+ error: warrning,
477
+ } = PartnerValidator.getPrivateExtensions().validate(
478
+ {
479
+ pageSize,
480
+ pageNo,
481
+ query,
482
+ },
483
+ { abortEarly: false, allowUnknown: false }
484
+ );
485
+ if (warrning) {
486
+ Logger({
487
+ level: "WARN",
488
+ message: "Parameter Validation warrnings for getPrivateExtensions",
489
+ });
490
+ Logger({ level: "WARN", message: warrning });
491
+ }
492
+
493
+ const query_params = {};
494
+ query_params["page_size"] = pageSize;
495
+ query_params["page_no"] = pageNo;
496
+ query_params["query"] = query;
497
+
498
+ const xHeaders = {};
499
+
500
+ const response = await PlatformAPIClient.execute(
501
+ this.config,
502
+ "get",
503
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/private-extensions`,
504
+ query_params,
505
+ undefined,
506
+ xHeaders
507
+ );
508
+
509
+ const {
510
+ error: res_error,
511
+ } = PartnerModel.ExtensionResponse().validate(response, {
512
+ abortEarly: false,
513
+ allowUnknown: false,
514
+ });
515
+
516
+ if (res_error) {
517
+ Logger({
518
+ level: "WARN",
519
+ message: "Response Validation Warnnings for getPrivateExtensions",
520
+ });
521
+ Logger({ level: "WARN", message: res_error });
522
+ }
523
+
524
+ return response;
525
+ }
526
+
527
+ /**
528
+ * @param {Object} arg - Arg object.
529
+ * @param {string} arg.extensionId - Extension id
530
+ * @returns {Promise<PublicExtension>} - Success response
531
+ * @summary: Get details of public extension
532
+ * @description: Use this API to get the details of public extensions
533
+ */
534
+ async getPublicExtension({ extensionId } = {}) {
535
+ const { error } = PartnerValidator.getPublicExtension().validate(
536
+ {
537
+ extensionId,
538
+ },
539
+ { abortEarly: false, allowUnknown: true }
540
+ );
541
+ if (error) {
542
+ return Promise.reject(new FDKClientValidationError(error));
543
+ }
544
+
545
+ // Showing warrnings if extra unknown parameters are found
546
+ const { error: warrning } = PartnerValidator.getPublicExtension().validate(
547
+ {
548
+ extensionId,
549
+ },
550
+ { abortEarly: false, allowUnknown: false }
551
+ );
552
+ if (warrning) {
553
+ Logger({
554
+ level: "WARN",
555
+ message: "Parameter Validation warrnings for getPublicExtension",
556
+ });
557
+ Logger({ level: "WARN", message: warrning });
558
+ }
559
+
560
+ const query_params = {};
561
+
562
+ const xHeaders = {};
563
+
564
+ const response = await PlatformAPIClient.execute(
565
+ this.config,
566
+ "get",
567
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/public-extension/${extensionId}`,
568
+ query_params,
569
+ undefined,
570
+ xHeaders
571
+ );
572
+
573
+ const {
574
+ error: res_error,
575
+ } = PartnerModel.PublicExtension().validate(response, {
576
+ abortEarly: false,
577
+ allowUnknown: false,
578
+ });
579
+
580
+ if (res_error) {
581
+ Logger({
582
+ level: "WARN",
583
+ message: "Response Validation Warnnings for getPublicExtension",
584
+ });
585
+ Logger({ level: "WARN", message: res_error });
586
+ }
587
+
588
+ return response;
589
+ }
590
+
591
+ /**
592
+ * @param {Object} arg - Arg object.
593
+ * @param {string} arg.inviteId - Invitation id
594
+ * @param {ModifyPartnerReq} arg.body
595
+ * @returns {Promise<PartnerInviteDetails>} - Success response
596
+ * @summary: Act on the pending partner request
597
+ * @description: Use this API to approve or reject the pending partner request
598
+ */
599
+ async modifyPartnerRequest({ inviteId, body } = {}) {
600
+ const { error } = PartnerValidator.modifyPartnerRequest().validate(
601
+ {
602
+ inviteId,
603
+ body,
604
+ },
605
+ { abortEarly: false, allowUnknown: true }
606
+ );
607
+ if (error) {
608
+ return Promise.reject(new FDKClientValidationError(error));
609
+ }
610
+
611
+ // Showing warrnings if extra unknown parameters are found
612
+ const {
613
+ error: warrning,
614
+ } = PartnerValidator.modifyPartnerRequest().validate(
615
+ {
616
+ inviteId,
617
+ body,
618
+ },
619
+ { abortEarly: false, allowUnknown: false }
620
+ );
621
+ if (warrning) {
622
+ Logger({
623
+ level: "WARN",
624
+ message: "Parameter Validation warrnings for modifyPartnerRequest",
625
+ });
626
+ Logger({ level: "WARN", message: warrning });
627
+ }
628
+
629
+ const query_params = {};
630
+
631
+ const xHeaders = {};
632
+
633
+ const response = await PlatformAPIClient.execute(
634
+ this.config,
635
+ "put",
636
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/partner-request/${inviteId}`,
637
+ query_params,
638
+ body,
639
+ xHeaders
640
+ );
641
+
642
+ const {
643
+ error: res_error,
644
+ } = PartnerModel.PartnerInviteDetails().validate(response, {
645
+ abortEarly: false,
646
+ allowUnknown: false,
647
+ });
648
+
649
+ if (res_error) {
650
+ Logger({
651
+ level: "WARN",
652
+ message: "Response Validation Warnnings for modifyPartnerRequest",
653
+ });
654
+ Logger({ level: "WARN", message: res_error });
655
+ }
656
+
657
+ return response;
658
+ }
659
+
660
+ /**
661
+ * @param {Object} arg - Arg object.
662
+ * @param {string} [arg.requestId] - Extrequest id
663
+ * @returns {Promise<SetupProductRes>} - Success response
664
+ * @summary:
665
+ * @description: Use this API for setup
666
+ */
667
+ async setupProducts({ requestId } = {}) {
668
+ const { error } = PartnerValidator.setupProducts().validate(
669
+ {
670
+ requestId,
671
+ },
672
+ { abortEarly: false, allowUnknown: true }
673
+ );
674
+ if (error) {
675
+ return Promise.reject(new FDKClientValidationError(error));
676
+ }
677
+
678
+ // Showing warrnings if extra unknown parameters are found
679
+ const { error: warrning } = PartnerValidator.setupProducts().validate(
680
+ {
681
+ requestId,
682
+ },
683
+ { abortEarly: false, allowUnknown: false }
684
+ );
685
+ if (warrning) {
686
+ Logger({
687
+ level: "WARN",
688
+ message: "Parameter Validation warrnings for setupProducts",
689
+ });
690
+ Logger({ level: "WARN", message: warrning });
691
+ }
692
+
693
+ const query_params = {};
694
+ query_params["request_id"] = requestId;
695
+
696
+ const xHeaders = {};
697
+
698
+ const response = await PlatformAPIClient.execute(
699
+ this.config,
700
+ "post",
701
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/setup`,
702
+ query_params,
703
+ undefined,
704
+ xHeaders
705
+ );
706
+
707
+ const {
708
+ error: res_error,
709
+ } = PartnerModel.SetupProductRes().validate(response, {
710
+ abortEarly: false,
711
+ allowUnknown: false,
712
+ });
713
+
714
+ if (res_error) {
715
+ Logger({
716
+ level: "WARN",
717
+ message: "Response Validation Warnnings for setupProducts",
718
+ });
719
+ Logger({ level: "WARN", message: res_error });
720
+ }
721
+
722
+ return response;
723
+ }
724
+
725
+ /**
726
+ * @param {Object} arg - Arg object.
727
+ * @param {string} arg.entity - Entity
728
+ * @param {string} arg.extensionId - Extension id
729
+ * @param {string} arg.entityId - Entity id
730
+ * @param {SubscriptionRequest} arg.body
731
+ * @returns {Promise<SubscriptionRes>} - Success response
732
+ * @summary: Subscribe for extension plan
733
+ * @description: Use this API to select plan for paid extension
734
+ */
735
+ async subscribeExtension({ entity, extensionId, entityId, body } = {}) {
736
+ const { error } = PartnerValidator.subscribeExtension().validate(
737
+ {
738
+ entity,
739
+ extensionId,
740
+ entityId,
741
+ body,
742
+ },
743
+ { abortEarly: false, allowUnknown: true }
744
+ );
745
+ if (error) {
746
+ return Promise.reject(new FDKClientValidationError(error));
747
+ }
748
+
749
+ // Showing warrnings if extra unknown parameters are found
750
+ const { error: warrning } = PartnerValidator.subscribeExtension().validate(
751
+ {
752
+ entity,
753
+ extensionId,
754
+ entityId,
755
+ body,
756
+ },
757
+ { abortEarly: false, allowUnknown: false }
758
+ );
759
+ if (warrning) {
760
+ Logger({
761
+ level: "WARN",
762
+ message: "Parameter Validation warrnings for subscribeExtension",
763
+ });
764
+ Logger({ level: "WARN", message: warrning });
765
+ }
766
+
767
+ const query_params = {};
768
+
769
+ const xHeaders = {};
770
+
771
+ const response = await PlatformAPIClient.execute(
772
+ this.config,
773
+ "post",
774
+ `/service/platform/partners/v1.0/company/${this.config.companyId}/extension/${extensionId}/${entity}/${entityId}/charge_consent`,
775
+ query_params,
776
+ body,
777
+ xHeaders
778
+ );
779
+
780
+ const {
781
+ error: res_error,
782
+ } = PartnerModel.SubscriptionRes().validate(response, {
783
+ abortEarly: false,
784
+ allowUnknown: false,
785
+ });
786
+
787
+ if (res_error) {
788
+ Logger({
789
+ level: "WARN",
790
+ message: "Response Validation Warnnings for subscribeExtension",
791
+ });
792
+ Logger({ level: "WARN", message: res_error });
793
+ }
794
+
795
+ return response;
796
+ }
797
+ }
798
+
799
+ module.exports = Partner;