@gofynd/fdk-client-javascript 1.0.3 → 1.1.0

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 (185) hide show
  1. package/README.md +51 -2
  2. package/index.d.ts +7 -4
  3. package/index.js +22 -7
  4. package/package.json +23 -14
  5. package/partner.d.ts +4 -0
  6. package/partner.js +7 -0
  7. package/sdk/application/ApplicationAPIClient.js +2 -4
  8. package/sdk/application/Cart/CartApplicationClient.js +29 -28
  9. package/sdk/application/Cart/CartApplicationModel.js +3 -1
  10. package/sdk/application/Catalog/CatalogApplicationClient.js +43 -42
  11. package/sdk/application/Catalog/CatalogApplicationModel.js +5 -3
  12. package/sdk/application/Common/CommonApplicationClient.js +5 -4
  13. package/sdk/application/Communication/CommunicationApplicationClient.js +6 -5
  14. package/sdk/application/Configuration/ConfigurationApplicationClient.js +21 -20
  15. package/sdk/application/Content/ContentApplicationClient.js +26 -25
  16. package/sdk/application/FileStorage/FileStorageApplicationClient.js +6 -5
  17. package/sdk/application/Lead/LeadApplicationClient.js +10 -9
  18. package/sdk/application/Logistic/LogisticApplicationClient.d.ts +1 -3
  19. package/sdk/application/Logistic/LogisticApplicationClient.js +11 -12
  20. package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -1
  21. package/sdk/application/Order/OrderApplicationClient.js +15 -14
  22. package/sdk/application/Order/OrderApplicationModel.js +9 -0
  23. package/sdk/application/Payment/PaymentApplicationClient.js +42 -41
  24. package/sdk/application/PosCart/PosCartApplicationClient.js +30 -29
  25. package/sdk/application/PosCart/PosCartApplicationModel.js +3 -1
  26. package/sdk/application/Rewards/RewardsApplicationClient.js +11 -10
  27. package/sdk/application/Share/ShareApplicationClient.js +10 -9
  28. package/sdk/application/Theme/ThemeApplicationClient.js +7 -6
  29. package/sdk/application/User/UserApplicationClient.js +38 -37
  30. package/sdk/common/AxiosHelper.js +17 -6
  31. package/sdk/common/BaseOAuthClient.d.ts +17 -0
  32. package/sdk/common/BaseOAuthClient.js +67 -0
  33. package/sdk/common/RequestSigner.js +0 -5
  34. package/sdk/partner/OAuthClient.d.ts +14 -0
  35. package/sdk/partner/OAuthClient.js +112 -0
  36. package/sdk/partner/PartnerAPIClient.d.ts +12 -0
  37. package/sdk/partner/PartnerAPIClient.js +42 -0
  38. package/sdk/partner/PartnerClient.d.ts +6 -0
  39. package/sdk/partner/PartnerClient.js +17 -0
  40. package/sdk/partner/PartnerConfig.d.ts +30 -0
  41. package/sdk/partner/PartnerConfig.js +39 -0
  42. package/sdk/partner/index.d.ts +3 -0
  43. package/sdk/partner/index.js +5 -0
  44. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +3 -1
  45. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
  46. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
  47. package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
  48. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +3 -2
  49. package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +1 -0
  50. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
  51. package/sdk/platform/Billing/BillingPlatformClient.js +137 -2
  52. package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
  53. package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
  54. package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
  55. package/sdk/platform/Billing/BillingPlatformValidator.js +15 -0
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +27 -0
  57. package/sdk/platform/Cart/CartPlatformApplicationClient.js +177 -1
  58. package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
  59. package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -1
  60. package/sdk/platform/Cart/CartPlatformModel.js +7 -3
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +3 -1
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -1
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +2 -2
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +6 -9
  65. package/sdk/platform/Catalog/CatalogPlatformModel.js +9 -9
  66. package/sdk/platform/Catalog/CatalogPlatformValidator.js +2 -1
  67. package/sdk/platform/Common/CommonPlatformClient.js +7 -18
  68. package/sdk/platform/Common/CommonPlatformValidator.js +1 -0
  69. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3 -1
  70. package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -1
  71. package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
  72. package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
  73. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +5 -4
  74. package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +1 -0
  75. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -1
  76. package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +1 -1
  77. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +9 -8
  78. package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +1 -0
  79. package/sdk/platform/Content/ContentPlatformApplicationClient.js +3 -1
  80. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +1 -1
  81. package/sdk/platform/Discount/DiscountPlatformClient.js +3 -2
  82. package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -0
  83. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -3
  84. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +27 -5
  85. package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
  86. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -3
  87. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +28 -6
  88. package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +1 -0
  89. package/sdk/platform/Inventory/InventoryPlatformClient.js +3 -2
  90. package/sdk/platform/Inventory/InventoryPlatformValidator.js +1 -0
  91. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +3 -1
  92. package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +1 -1
  93. package/sdk/platform/Lead/LeadPlatformClient.js +4 -3
  94. package/sdk/platform/Lead/LeadPlatformValidator.js +1 -0
  95. package/sdk/platform/OAuthClient.js +3 -9
  96. package/sdk/platform/Order/OrderPlatformApplicationClient.js +3 -1
  97. package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -1
  98. package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
  99. package/sdk/platform/Order/OrderPlatformClient.js +16 -3
  100. package/sdk/platform/Order/OrderPlatformModel.js +1 -0
  101. package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
  102. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
  103. package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
  104. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +1 -1
  105. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +14 -14
  106. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +1 -1
  107. package/sdk/platform/Payment/PaymentPlatformClient.js +3 -2
  108. package/sdk/platform/Payment/PaymentPlatformValidator.js +1 -0
  109. package/sdk/platform/PlatformApplicationClient.d.ts +5 -1
  110. package/sdk/platform/PlatformApplicationClient.js +4 -0
  111. package/sdk/platform/PlatformClient.d.ts +51 -12
  112. package/sdk/platform/PlatformClient.js +54 -11
  113. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +17 -19
  114. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +88 -83
  115. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
  116. package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +8 -9
  117. package/sdk/platform/Share/SharePlatformApplicationClient.js +3 -1
  118. package/sdk/platform/Share/SharePlatformApplicationValidator.js +1 -1
  119. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +3 -1
  120. package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +1 -1
  121. package/sdk/platform/User/UserPlatformApplicationClient.js +3 -1
  122. package/sdk/platform/User/UserPlatformApplicationValidator.js +1 -1
  123. package/sdk/platform/Webhook/WebhookPlatformClient.js +3 -2
  124. package/sdk/platform/Webhook/WebhookPlatformValidator.js +1 -0
  125. package/sdk/public/Configuration/ConfigurationPublicClient.js +2 -0
  126. package/sdk/public/Inventory/InventoryPublicClient.js +2 -0
  127. package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
  128. package/.github/workflows/on_create_release.yml +0 -23
  129. package/.github/workflows/on_merge_main.yml +0 -38
  130. package/.github/workflows/on_pull_request.yml +0 -35
  131. package/.prettierrc +0 -5
  132. package/documentation/application/CART.md +0 -8771
  133. package/documentation/application/CATALOG.md +0 -8690
  134. package/documentation/application/COMMON.md +0 -325
  135. package/documentation/application/COMMUNICATION.md +0 -387
  136. package/documentation/application/CONFIGURATION.md +0 -2212
  137. package/documentation/application/CONTENT.md +0 -2629
  138. package/documentation/application/FILESTORAGE.md +0 -442
  139. package/documentation/application/LEAD.md +0 -1549
  140. package/documentation/application/LOGISTIC.md +0 -689
  141. package/documentation/application/ORDER.md +0 -2937
  142. package/documentation/application/PAYMENT.md +0 -4475
  143. package/documentation/application/POSCART.md +0 -9375
  144. package/documentation/application/README.md +0 -21
  145. package/documentation/application/REWARDS.md +0 -554
  146. package/documentation/application/SHARE.md +0 -635
  147. package/documentation/application/THEME.md +0 -5517
  148. package/documentation/application/USER.md +0 -3798
  149. package/documentation/platform/ANALYTICS.md +0 -1012
  150. package/documentation/platform/AUDITTRAIL.md +0 -493
  151. package/documentation/platform/BILLING.md +0 -1889
  152. package/documentation/platform/CART.md +0 -4711
  153. package/documentation/platform/CATALOG.md +0 -20522
  154. package/documentation/platform/COMMON.md +0 -325
  155. package/documentation/platform/COMMUNICATION.md +0 -4970
  156. package/documentation/platform/COMPANYPROFILE.md +0 -1646
  157. package/documentation/platform/CONFIGURATION.md +0 -6316
  158. package/documentation/platform/CONTENT.md +0 -8364
  159. package/documentation/platform/DISCOUNT.md +0 -767
  160. package/documentation/platform/FILESTORAGE.md +0 -945
  161. package/documentation/platform/INVENTORY.md +0 -1136
  162. package/documentation/platform/LEAD.md +0 -4394
  163. package/documentation/platform/ORDER.md +0 -6525
  164. package/documentation/platform/PARTNER.md +0 -193
  165. package/documentation/platform/PAYMENT.md +0 -3138
  166. package/documentation/platform/README.md +0 -27
  167. package/documentation/platform/REWARDS.md +0 -919
  168. package/documentation/platform/SHARE.md +0 -513
  169. package/documentation/platform/THEME.md +0 -35446
  170. package/documentation/platform/USER.md +0 -2174
  171. package/documentation/platform/WEBHOOK.md +0 -485
  172. package/documentation/public/CONFIGURATION.md +0 -325
  173. package/documentation/public/INVENTORY.md +0 -508
  174. package/documentation/public/WEBHOOK.md +0 -246
  175. package/jest.config.d.ts +0 -4
  176. package/jest.config.js +0 -6
  177. package/tests/application/catalog.spec.js +0 -54
  178. package/tests/common/action-url.spec.js +0 -35
  179. package/tests/common/schema/action-url.json +0 -178
  180. package/tests/common/schema/url-action.json +0 -683
  181. package/tests/common/url-action.spec.js +0 -48
  182. package/tests/helpers/cookie.helper.js +0 -31
  183. package/tests/helpers/oauth.helper.js +0 -43
  184. package/tests/platform/catalog.spec.js +0 -49
  185. package/tests/public/location.spec.js +0 -39
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const ConfigurationValidator = require("./ConfigurationPlatformApplicationValidator");
5
5
  const ConfigurationModel = require("./ConfigurationPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Configuration {
9
10
  constructor(config, applicationId) {
@@ -1966,4 +1967,5 @@ class Configuration {
1966
1967
  return response;
1967
1968
  }
1968
1969
  }
1970
+
1969
1971
  module.exports = Configuration;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const ConfigurationModel = require("./ConfigurationPlatformModel");
3
2
 
3
+ const ConfigurationModel = require("./ConfigurationPlatformModel");
4
4
  class ConfigurationValidator {
5
5
  static addDomain() {
6
6
  return Joi.object({
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const ConfigurationValidator = require("./ConfigurationPlatformValidator");
5
5
  const ConfigurationModel = require("./ConfigurationPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Configuration {
9
10
  constructor(config) {
@@ -175,7 +176,7 @@ class Configuration {
175
176
  });
176
177
  return data;
177
178
  };
178
- paginator.setCallback(callback);
179
+ paginator.setCallback(callback.bind(this));
179
180
  return paginator;
180
181
  }
181
182
 
@@ -272,7 +273,7 @@ class Configuration {
272
273
  });
273
274
  return data;
274
275
  };
275
- paginator.setCallback(callback);
276
+ paginator.setCallback(callback.bind(this));
276
277
  return paginator;
277
278
  }
278
279
 
@@ -441,7 +442,7 @@ class Configuration {
441
442
  });
442
443
  return data;
443
444
  };
444
- paginator.setCallback(callback);
445
+ paginator.setCallback(callback.bind(this));
445
446
  return paginator;
446
447
  }
447
448
 
@@ -1028,7 +1029,7 @@ class Configuration {
1028
1029
  });
1029
1030
  return data;
1030
1031
  };
1031
- paginator.setCallback(callback);
1032
+ paginator.setCallback(callback.bind(this));
1032
1033
  return paginator;
1033
1034
  }
1034
1035
 
@@ -1135,7 +1136,7 @@ class Configuration {
1135
1136
  });
1136
1137
  return data;
1137
1138
  };
1138
- paginator.setCallback(callback);
1139
+ paginator.setCallback(callback.bind(this));
1139
1140
  return paginator;
1140
1141
  }
1141
1142
 
@@ -1237,7 +1238,7 @@ class Configuration {
1237
1238
  });
1238
1239
  return data;
1239
1240
  };
1240
- paginator.setCallback(callback);
1241
+ paginator.setCallback(callback.bind(this));
1241
1242
  return paginator;
1242
1243
  }
1243
1244
 
@@ -132,4 +132,5 @@ class ConfigurationValidator {
132
132
  }).required();
133
133
  }
134
134
  }
135
+
135
136
  module.exports = ConfigurationValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const ContentValidator = require("./ContentPlatformApplicationValidator");
5
5
  const ContentModel = require("./ContentPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Content {
9
10
  constructor(config, applicationId) {
@@ -4511,4 +4512,5 @@ class Content {
4511
4512
  return response;
4512
4513
  }
4513
4514
  }
4515
+
4514
4516
  module.exports = Content;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const ContentModel = require("./ContentPlatformModel");
3
2
 
3
+ const ContentModel = require("./ContentPlatformModel");
4
4
  class ContentValidator {
5
5
  static addDataLoader() {
6
6
  return Joi.object({
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const DiscountValidator = require("./DiscountPlatformValidator");
5
5
  const DiscountModel = require("./DiscountPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Discount {
9
10
  constructor(config) {
@@ -80,4 +80,5 @@ class DiscountValidator {
80
80
  }).required();
81
81
  }
82
82
  }
83
+
83
84
  module.exports = DiscountValidator;
@@ -28,7 +28,7 @@ declare class FileStorage {
28
28
  * After successfully upload, call `appCompleteUpload` api to complete the upload process.
29
29
  * This operation will return the url for the uploaded file.
30
30
  */
31
- appCompleteUpload({ namespace, body }?: {
31
+ appCompleteUpload({ namespace, body, }?: {
32
32
  namespace: string;
33
33
  body: StartResponse;
34
34
  }): Promise<CompleteResponse>;
@@ -69,7 +69,7 @@ declare class FileStorage {
69
69
  * After successfully upload, call `appCompleteUpload` api to complete the upload process.
70
70
  * This operation will return the url for the uploaded file.
71
71
  */
72
- appStartUpload({ namespace, body }?: {
72
+ appStartUpload({ namespace, body, }?: {
73
73
  namespace: string;
74
74
  body: StartRequest;
75
75
  }): Promise<StartResponse>;
@@ -81,7 +81,7 @@ declare class FileStorage {
81
81
  * @summary: Browse Files
82
82
  * @description: Browse Files
83
83
  */
84
- browse({ namespace, pageNo }?: {
84
+ browse({ namespace, pageNo, }?: {
85
85
  namespace: string;
86
86
  pageNo?: number;
87
87
  }): Promise<BrowseResponse>;
@@ -1,9 +1,12 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const FileStorageValidator = require("./FileStoragePlatformApplicationValidator");
5
5
  const FileStorageModel = require("./FileStoragePlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
8
+
9
+ const axios = require("axios");
7
10
 
8
11
  class FileStorage {
9
12
  constructor(config, applicationId) {
@@ -36,10 +39,15 @@ class FileStorage {
36
39
  * After successfully upload, call `appCompleteUpload` api to complete the upload process.
37
40
  * This operation will return the url for the uploaded file.
38
41
  */
39
- async appCompleteUpload({ namespace, body } = {}) {
42
+ async appCompleteUpload({
43
+ namespace,
44
+
45
+ body,
46
+ } = {}) {
40
47
  const { error } = FileStorageValidator.appCompleteUpload().validate(
41
48
  {
42
49
  namespace,
50
+
43
51
  body,
44
52
  },
45
53
  { abortEarly: false, allowUnknown: true }
@@ -54,6 +62,7 @@ class FileStorage {
54
62
  } = FileStorageValidator.appCompleteUpload().validate(
55
63
  {
56
64
  namespace,
65
+
57
66
  body,
58
67
  },
59
68
  { abortEarly: false, allowUnknown: false }
@@ -184,10 +193,15 @@ class FileStorage {
184
193
  * After successfully upload, call `appCompleteUpload` api to complete the upload process.
185
194
  * This operation will return the url for the uploaded file.
186
195
  */
187
- async appStartUpload({ namespace, body } = {}) {
196
+ async appStartUpload({
197
+ namespace,
198
+
199
+ body,
200
+ } = {}) {
188
201
  const { error } = FileStorageValidator.appStartUpload().validate(
189
202
  {
190
203
  namespace,
204
+
191
205
  body,
192
206
  },
193
207
  { abortEarly: false, allowUnknown: true }
@@ -200,6 +214,7 @@ class FileStorage {
200
214
  const { error: warrning } = FileStorageValidator.appStartUpload().validate(
201
215
  {
202
216
  namespace,
217
+
203
218
  body,
204
219
  },
205
220
  { abortEarly: false, allowUnknown: false }
@@ -248,10 +263,15 @@ class FileStorage {
248
263
  * @summary: Browse Files
249
264
  * @description: Browse Files
250
265
  */
251
- async browse({ namespace, pageNo } = {}) {
266
+ async browse({
267
+ namespace,
268
+
269
+ pageNo,
270
+ } = {}) {
252
271
  const { error } = FileStorageValidator.browse().validate(
253
272
  {
254
273
  namespace,
274
+
255
275
  pageNo,
256
276
  },
257
277
  { abortEarly: false, allowUnknown: true }
@@ -264,6 +284,7 @@ class FileStorage {
264
284
  const { error: warrning } = FileStorageValidator.browse().validate(
265
285
  {
266
286
  namespace,
287
+
267
288
  pageNo,
268
289
  },
269
290
  { abortEarly: false, allowUnknown: false }
@@ -335,7 +356,6 @@ class FileStorage {
335
356
  return paginator;
336
357
  }
337
358
  }
338
- module.exports = FileStorage;
339
359
 
340
360
  /**
341
361
  * @param data
@@ -385,3 +405,5 @@ FileStorage.prototype.upload = function ({
385
405
  }
386
406
  });
387
407
  };
408
+
409
+ module.exports = FileStorage;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const FileStorageModel = require("./FileStoragePlatformModel");
3
2
 
3
+ const FileStorageModel = require("./FileStoragePlatformModel");
4
4
  class FileStorageValidator {
5
5
  static appCompleteUpload() {
6
6
  return Joi.object({
@@ -10,7 +10,7 @@ declare class FileStorage {
10
10
  * @summary: Browse Files
11
11
  * @description: Browse Files
12
12
  */
13
- browse({ namespace, pageNo }?: {
13
+ browse({ namespace, pageNo, }?: {
14
14
  namespace: string;
15
15
  pageNo?: number;
16
16
  }): Promise<BrowseResponse>;
@@ -48,7 +48,7 @@ declare class FileStorage {
48
48
  * After successfully upload, call `completeUpload` api to complete the upload process.
49
49
  * This operation will return the url for the uploaded file.
50
50
  */
51
- completeUpload({ namespace, body }?: {
51
+ completeUpload({ namespace, body, }?: {
52
52
  namespace: string;
53
53
  body: StartResponse;
54
54
  }): Promise<CompleteResponse>;
@@ -109,7 +109,7 @@ declare class FileStorage {
109
109
  * After successfully upload, call `completeUpload` api to complete the upload process.
110
110
  * This operation will return the url for the uploaded file.
111
111
  */
112
- startUpload({ namespace, body }?: {
112
+ startUpload({ namespace, body, }?: {
113
113
  namespace: string;
114
114
  body: StartRequest;
115
115
  }): Promise<StartResponse>;
@@ -1,9 +1,12 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const FileStorageValidator = require("./FileStoragePlatformValidator");
5
5
  const FileStorageModel = require("./FileStoragePlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
8
+
9
+ const axios = require("axios");
7
10
 
8
11
  class FileStorage {
9
12
  constructor(config) {
@@ -18,10 +21,15 @@ class FileStorage {
18
21
  * @summary: Browse Files
19
22
  * @description: Browse Files
20
23
  */
21
- async browse({ namespace, pageNo } = {}) {
24
+ async browse({
25
+ namespace,
26
+
27
+ pageNo,
28
+ } = {}) {
22
29
  const { error } = FileStorageValidator.browse().validate(
23
30
  {
24
31
  namespace,
32
+
25
33
  pageNo,
26
34
  },
27
35
  { abortEarly: false, allowUnknown: true }
@@ -34,6 +42,7 @@ class FileStorage {
34
42
  const { error: warrning } = FileStorageValidator.browse().validate(
35
43
  {
36
44
  namespace,
45
+
37
46
  pageNo,
38
47
  },
39
48
  { abortEarly: false, allowUnknown: false }
@@ -92,6 +101,7 @@ class FileStorage {
92
101
  const pageType = "number";
93
102
  const data = await this.browse({
94
103
  namespace: namespace,
104
+
95
105
  pageNo: pageNo,
96
106
  });
97
107
  paginator.setPaginator({
@@ -100,7 +110,7 @@ class FileStorage {
100
110
  });
101
111
  return data;
102
112
  };
103
- paginator.setCallback(callback);
113
+ paginator.setCallback(callback.bind(this));
104
114
  return paginator;
105
115
  }
106
116
 
@@ -129,10 +139,15 @@ class FileStorage {
129
139
  * After successfully upload, call `completeUpload` api to complete the upload process.
130
140
  * This operation will return the url for the uploaded file.
131
141
  */
132
- async completeUpload({ namespace, body } = {}) {
142
+ async completeUpload({
143
+ namespace,
144
+
145
+ body,
146
+ } = {}) {
133
147
  const { error } = FileStorageValidator.completeUpload().validate(
134
148
  {
135
149
  namespace,
150
+
136
151
  body,
137
152
  },
138
153
  { abortEarly: false, allowUnknown: true }
@@ -145,6 +160,7 @@ class FileStorage {
145
160
  const { error: warrning } = FileStorageValidator.completeUpload().validate(
146
161
  {
147
162
  namespace,
163
+
148
164
  body,
149
165
  },
150
166
  { abortEarly: false, allowUnknown: false }
@@ -407,10 +423,15 @@ class FileStorage {
407
423
  * After successfully upload, call `completeUpload` api to complete the upload process.
408
424
  * This operation will return the url for the uploaded file.
409
425
  */
410
- async startUpload({ namespace, body } = {}) {
426
+ async startUpload({
427
+ namespace,
428
+
429
+ body,
430
+ } = {}) {
411
431
  const { error } = FileStorageValidator.startUpload().validate(
412
432
  {
413
433
  namespace,
434
+
414
435
  body,
415
436
  },
416
437
  { abortEarly: false, allowUnknown: true }
@@ -423,6 +444,7 @@ class FileStorage {
423
444
  const { error: warrning } = FileStorageValidator.startUpload().validate(
424
445
  {
425
446
  namespace,
447
+
426
448
  body,
427
449
  },
428
450
  { abortEarly: false, allowUnknown: false }
@@ -42,4 +42,5 @@ class FileStorageValidator {
42
42
  }).required();
43
43
  }
44
44
  }
45
+
45
46
  module.exports = FileStorageValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const InventoryValidator = require("./InventoryPlatformValidator");
5
5
  const InventoryModel = require("./InventoryPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Inventory {
9
10
  constructor(config) {
@@ -79,4 +79,5 @@ class InventoryValidator {
79
79
  }).required();
80
80
  }
81
81
  }
82
+
82
83
  module.exports = InventoryValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const LeadValidator = require("./LeadPlatformApplicationValidator");
5
5
  const LeadModel = require("./LeadPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Lead {
9
10
  constructor(config, applicationId) {
@@ -815,4 +816,5 @@ class Lead {
815
816
  return response;
816
817
  }
817
818
  }
819
+
818
820
  module.exports = Lead;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const LeadModel = require("./LeadPlatformModel");
3
2
 
3
+ const LeadModel = require("./LeadPlatformModel");
4
4
  class LeadValidator {
5
5
  static closeVideoRoom() {
6
6
  return Joi.object({
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const LeadValidator = require("./LeadPlatformValidator");
5
5
  const LeadModel = require("./LeadPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Lead {
9
10
  constructor(config) {
@@ -600,7 +601,7 @@ class Lead {
600
601
  });
601
602
  return data;
602
603
  };
603
- paginator.setCallback(callback);
604
+ paginator.setCallback(callback.bind(this));
604
605
  return paginator;
605
606
  }
606
607
 
@@ -76,4 +76,5 @@ class LeadValidator {
76
76
  }).required();
77
77
  }
78
78
  }
79
+
79
80
  module.exports = LeadValidator;
@@ -3,6 +3,7 @@ const { fdkAxios } = require("../common/AxiosHelper");
3
3
  const { sign } = require("../common/RequestSigner");
4
4
  const { FDKTokenIssueError, FDKOAuthCodeError } = require("../common/FDKError");
5
5
  const { Logger } = require("../common/Logger");
6
+ const { btoa } = require("isomorphic-base64");
6
7
 
7
8
  const refreshTokenRequestCache = {};
8
9
  class OAuthClient {
@@ -158,11 +159,7 @@ class OAuthClient {
158
159
  } else if (grant_type === "authorization_code") {
159
160
  reqData = { ...reqData, code };
160
161
  }
161
-
162
- const token = Buffer.from(
163
- `${this.config.apiKey}:${this.config.apiSecret}`,
164
- "utf8"
165
- ).toString("base64");
162
+ const token = btoa(`${this.config.apiKey}:${this.config.apiSecret}`);
166
163
  let url = `${this.config.domain}/service/panel/authentication/v1.0/company/${this.config.companyId}/oauth/token`;
167
164
  const rawRequest = {
168
165
  method: "post",
@@ -201,10 +198,7 @@ class OAuthClient {
201
198
  scope: scopes,
202
199
  code: code,
203
200
  };
204
- const token = Buffer.from(
205
- `${this.config.apiKey}:${this.config.apiSecret}`,
206
- "utf8"
207
- ).toString("base64");
201
+ const token = btoa(`${this.config.apiKey}:${this.config.apiSecret}`);
208
202
  const rawRequest = {
209
203
  method: "post",
210
204
  url: url,
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const OrderValidator = require("./OrderPlatformApplicationValidator");
5
5
  const OrderModel = require("./OrderPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Order {
9
10
  constructor(config, applicationId) {
@@ -268,4 +269,5 @@ class Order {
268
269
  return response;
269
270
  }
270
271
  }
272
+
271
273
  module.exports = Order;
@@ -1,6 +1,6 @@
1
1
  const Joi = require("joi");
2
- const OrderModel = require("./OrderPlatformModel");
3
2
 
3
+ const OrderModel = require("./OrderPlatformModel");
4
4
  class OrderValidator {
5
5
  static getAppOrderShipmentDetails() {
6
6
  return Joi.object({
@@ -43,7 +43,7 @@ declare class Order {
43
43
  * @summary:
44
44
  * @description:
45
45
  */
46
- click2Call({ caller, receiver, bagId, callingTo, callerId }?: {
46
+ click2Call({ caller, receiver, bagId, callingTo, callerId, }?: {
47
47
  caller: string;
48
48
  receiver: string;
49
49
  bagId: string;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
- const { FDKClientValidationError } = require("../../common/FDKError");
3
1
  const PlatformAPIClient = require("../PlatformAPIClient");
2
+ const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const OrderValidator = require("./OrderPlatformValidator");
5
5
  const OrderModel = require("./OrderPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Order {
9
10
  constructor(config) {
@@ -215,12 +216,20 @@ class Order {
215
216
  * @summary:
216
217
  * @description:
217
218
  */
218
- async click2Call({ caller, receiver, bagId, callingTo, callerId } = {}) {
219
+ async click2Call({
220
+ caller,
221
+ receiver,
222
+ bagId,
223
+
224
+ callingTo,
225
+ callerId,
226
+ } = {}) {
219
227
  const { error } = OrderValidator.click2Call().validate(
220
228
  {
221
229
  caller,
222
230
  receiver,
223
231
  bagId,
232
+
224
233
  callingTo,
225
234
  callerId,
226
235
  },
@@ -236,6 +245,7 @@ class Order {
236
245
  caller,
237
246
  receiver,
238
247
  bagId,
248
+
239
249
  callingTo,
240
250
  callerId,
241
251
  },
@@ -2831,6 +2841,7 @@ class Order {
2831
2841
  async updateAddress({
2832
2842
  shipmentId,
2833
2843
  addressCategory,
2844
+
2834
2845
  name,
2835
2846
  address,
2836
2847
  addressType,
@@ -2846,6 +2857,7 @@ class Order {
2846
2857
  {
2847
2858
  shipmentId,
2848
2859
  addressCategory,
2860
+
2849
2861
  name,
2850
2862
  address,
2851
2863
  addressType,
@@ -2868,6 +2880,7 @@ class Order {
2868
2880
  {
2869
2881
  shipmentId,
2870
2882
  addressCategory,
2883
+
2871
2884
  name,
2872
2885
  address,
2873
2886
  addressType,
@@ -136,6 +136,7 @@ class OrderModel {
136
136
  employee_discount: Joi.number(),
137
137
  is_priority: Joi.boolean(),
138
138
  loyalty_discount: Joi.number(),
139
+ marketplace_invoice_id: Joi.string().allow("").allow(null),
139
140
  order_item_id: Joi.string().allow(""),
140
141
  quantity: Joi.number(),
141
142
  size_level_total_qty: Joi.number().allow(null),
@@ -357,4 +357,5 @@ class OrderValidator {
357
357
  }).required();
358
358
  }
359
359
  }
360
+
360
361
  module.exports = OrderValidator;
@@ -1,9 +1,10 @@
1
- const Paginator = require("../../common/Paginator");
2
1
  const PlatformAPIClient = require("../PlatformAPIClient");
3
2
  const { FDKClientValidationError } = require("../../common/FDKError");
3
+ const Paginator = require("../../common/Paginator");
4
4
  const PartnerValidator = require("./PartnerPlatformApplicationValidator");
5
5
  const PartnerModel = require("./PartnerPlatformModel");
6
6
  const { Logger } = require("./../../common/Logger");
7
+ const Joi = require("joi");
7
8
 
8
9
  class Partner {
9
10
  constructor(config, applicationId) {
@@ -141,4 +142,5 @@ class Partner {
141
142
  return response;
142
143
  }
143
144
  }
145
+
144
146
  module.exports = Partner;