@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.
Files changed (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. 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 CompanyProfileValidator = require("./CompanyProfilePlatformValidator");
5
+ const CompanyProfileModel = require("./CompanyProfilePlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+
5
8
  class CompanyProfile {
6
9
  constructor(config) {
7
10
  this.config = config;
@@ -9,10 +12,11 @@ class CompanyProfile {
9
12
 
10
13
  /**
11
14
  * @param {Object} arg - Arg object.
15
+ * @returns {Promise<GetCompanyProfileSerializerResponse>} - Success response
12
16
  * @summary: Get company profile
13
17
  * @description: This API allows to view the company profile of the seller account.
14
18
  */
15
- cbsOnboardGet({} = {}) {
19
+ async cbsOnboardGet({} = {}) {
16
20
  const { error } = CompanyProfileValidator.cbsOnboardGet().validate(
17
21
  {},
18
22
  { abortEarly: false, allowUnknown: true }
@@ -29,15 +33,18 @@ class CompanyProfile {
29
33
  { abortEarly: false, allowUnknown: false }
30
34
  );
31
35
  if (warrning) {
32
- console.log("Parameter Validation warrnings for cbsOnboardGet");
33
- console.log(warrning);
36
+ Logger({
37
+ level: "WARN",
38
+ message: "Parameter Validation warrnings for cbsOnboardGet",
39
+ });
40
+ Logger({ level: "WARN", message: warrning });
34
41
  }
35
42
 
36
43
  const query_params = {};
37
44
 
38
45
  const xHeaders = {};
39
46
 
40
- return PlatformAPIClient.execute(
47
+ const response = await PlatformAPIClient.execute(
41
48
  this.config,
42
49
  "get",
43
50
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}`,
@@ -45,15 +52,33 @@ class CompanyProfile {
45
52
  undefined,
46
53
  xHeaders
47
54
  );
55
+
56
+ const {
57
+ error: res_error,
58
+ } = CompanyProfileModel.GetCompanyProfileSerializerResponse().validate(
59
+ response,
60
+ { abortEarly: false, allowUnknown: false }
61
+ );
62
+
63
+ if (res_error) {
64
+ Logger({
65
+ level: "WARN",
66
+ message: "Response Validation Warnnings for cbsOnboardGet",
67
+ });
68
+ Logger({ level: "WARN", message: res_error });
69
+ }
70
+
71
+ return response;
48
72
  }
49
73
 
50
74
  /**
51
75
  * @param {Object} arg - Arg object.
52
76
  * @param {UpdateCompany} arg.body
77
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
53
78
  * @summary: Edit company profile
54
79
  * @description: This API allows to edit the company profile of the seller account.
55
80
  */
56
- updateCompany({ body } = {}) {
81
+ async updateCompany({ body } = {}) {
57
82
  const { error } = CompanyProfileValidator.updateCompany().validate(
58
83
  {
59
84
  body,
@@ -74,15 +99,18 @@ class CompanyProfile {
74
99
  { abortEarly: false, allowUnknown: false }
75
100
  );
76
101
  if (warrning) {
77
- console.log("Parameter Validation warrnings for updateCompany");
78
- console.log(warrning);
102
+ Logger({
103
+ level: "WARN",
104
+ message: "Parameter Validation warrnings for updateCompany",
105
+ });
106
+ Logger({ level: "WARN", message: warrning });
79
107
  }
80
108
 
81
109
  const query_params = {};
82
110
 
83
111
  const xHeaders = {};
84
112
 
85
- return PlatformAPIClient.execute(
113
+ const response = await PlatformAPIClient.execute(
86
114
  this.config,
87
115
  "patch",
88
116
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}`,
@@ -90,14 +118,32 @@ class CompanyProfile {
90
118
  body,
91
119
  xHeaders
92
120
  );
121
+
122
+ const {
123
+ error: res_error,
124
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
125
+ abortEarly: false,
126
+ allowUnknown: false,
127
+ });
128
+
129
+ if (res_error) {
130
+ Logger({
131
+ level: "WARN",
132
+ message: "Response Validation Warnnings for updateCompany",
133
+ });
134
+ Logger({ level: "WARN", message: res_error });
135
+ }
136
+
137
+ return response;
93
138
  }
94
139
 
95
140
  /**
96
141
  * @param {Object} arg - Arg object.
142
+ * @returns {Promise<MetricsSerializer>} - Success response
97
143
  * @summary: Get company metrics
98
144
  * @description: This API allows to view the company metrics, i.e. the status of its brand and stores. Also its allows to view the number of products, company documents & store documents which are verified and unverified.
99
145
  */
100
- getCompanyMetrics({} = {}) {
146
+ async getCompanyMetrics({} = {}) {
101
147
  const { error } = CompanyProfileValidator.getCompanyMetrics().validate(
102
148
  {},
103
149
  { abortEarly: false, allowUnknown: true }
@@ -114,15 +160,18 @@ class CompanyProfile {
114
160
  { abortEarly: false, allowUnknown: false }
115
161
  );
116
162
  if (warrning) {
117
- console.log("Parameter Validation warrnings for getCompanyMetrics");
118
- console.log(warrning);
163
+ Logger({
164
+ level: "WARN",
165
+ message: "Parameter Validation warrnings for getCompanyMetrics",
166
+ });
167
+ Logger({ level: "WARN", message: warrning });
119
168
  }
120
169
 
121
170
  const query_params = {};
122
171
 
123
172
  const xHeaders = {};
124
173
 
125
- return PlatformAPIClient.execute(
174
+ const response = await PlatformAPIClient.execute(
126
175
  this.config,
127
176
  "get",
128
177
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/metrics`,
@@ -130,15 +179,33 @@ class CompanyProfile {
130
179
  undefined,
131
180
  xHeaders
132
181
  );
182
+
183
+ const {
184
+ error: res_error,
185
+ } = CompanyProfileModel.MetricsSerializer().validate(response, {
186
+ abortEarly: false,
187
+ allowUnknown: false,
188
+ });
189
+
190
+ if (res_error) {
191
+ Logger({
192
+ level: "WARN",
193
+ message: "Response Validation Warnnings for getCompanyMetrics",
194
+ });
195
+ Logger({ level: "WARN", message: res_error });
196
+ }
197
+
198
+ return response;
133
199
  }
134
200
 
135
201
  /**
136
202
  * @param {Object} arg - Arg object.
137
203
  * @param {string} arg.brandId - Id of the brand to be viewed.
204
+ * @returns {Promise<GetBrandResponseSerializer>} - Success response
138
205
  * @summary: Get a single brand.
139
206
  * @description: This API helps to get data associated to a particular brand.
140
207
  */
141
- getBrand({ brandId } = {}) {
208
+ async getBrand({ brandId } = {}) {
142
209
  const { error } = CompanyProfileValidator.getBrand().validate(
143
210
  {
144
211
  brandId,
@@ -157,15 +224,18 @@ class CompanyProfile {
157
224
  { abortEarly: false, allowUnknown: false }
158
225
  );
159
226
  if (warrning) {
160
- console.log("Parameter Validation warrnings for getBrand");
161
- console.log(warrning);
227
+ Logger({
228
+ level: "WARN",
229
+ message: "Parameter Validation warrnings for getBrand",
230
+ });
231
+ Logger({ level: "WARN", message: warrning });
162
232
  }
163
233
 
164
234
  const query_params = {};
165
235
 
166
236
  const xHeaders = {};
167
237
 
168
- return PlatformAPIClient.execute(
238
+ const response = await PlatformAPIClient.execute(
169
239
  this.config,
170
240
  "get",
171
241
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/${brandId}`,
@@ -173,16 +243,34 @@ class CompanyProfile {
173
243
  undefined,
174
244
  xHeaders
175
245
  );
246
+
247
+ const {
248
+ error: res_error,
249
+ } = CompanyProfileModel.GetBrandResponseSerializer().validate(response, {
250
+ abortEarly: false,
251
+ allowUnknown: false,
252
+ });
253
+
254
+ if (res_error) {
255
+ Logger({
256
+ level: "WARN",
257
+ message: "Response Validation Warnnings for getBrand",
258
+ });
259
+ Logger({ level: "WARN", message: res_error });
260
+ }
261
+
262
+ return response;
176
263
  }
177
264
 
178
265
  /**
179
266
  * @param {Object} arg - Arg object.
180
267
  * @param {string} arg.brandId - Id of the brand to be viewed.
181
268
  * @param {CreateUpdateBrandRequestSerializer} arg.body
269
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
182
270
  * @summary: Edit a brand.
183
271
  * @description: This API allows to edit meta of a brand.
184
272
  */
185
- editBrand({ brandId, body } = {}) {
273
+ async editBrand({ brandId, body } = {}) {
186
274
  const { error } = CompanyProfileValidator.editBrand().validate(
187
275
  {
188
276
  brandId,
@@ -203,15 +291,18 @@ class CompanyProfile {
203
291
  { abortEarly: false, allowUnknown: false }
204
292
  );
205
293
  if (warrning) {
206
- console.log("Parameter Validation warrnings for editBrand");
207
- console.log(warrning);
294
+ Logger({
295
+ level: "WARN",
296
+ message: "Parameter Validation warrnings for editBrand",
297
+ });
298
+ Logger({ level: "WARN", message: warrning });
208
299
  }
209
300
 
210
301
  const query_params = {};
211
302
 
212
303
  const xHeaders = {};
213
304
 
214
- return PlatformAPIClient.execute(
305
+ const response = await PlatformAPIClient.execute(
215
306
  this.config,
216
307
  "put",
217
308
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/${brandId}`,
@@ -219,15 +310,33 @@ class CompanyProfile {
219
310
  body,
220
311
  xHeaders
221
312
  );
313
+
314
+ const {
315
+ error: res_error,
316
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
317
+ abortEarly: false,
318
+ allowUnknown: false,
319
+ });
320
+
321
+ if (res_error) {
322
+ Logger({
323
+ level: "WARN",
324
+ message: "Response Validation Warnnings for editBrand",
325
+ });
326
+ Logger({ level: "WARN", message: res_error });
327
+ }
328
+
329
+ return response;
222
330
  }
223
331
 
224
332
  /**
225
333
  * @param {Object} arg - Arg object.
226
334
  * @param {CreateUpdateBrandRequestSerializer} arg.body
335
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
227
336
  * @summary: Create a Brand.
228
337
  * @description: This API allows to create a brand associated to a company.
229
338
  */
230
- createBrand({ body } = {}) {
339
+ async createBrand({ body } = {}) {
231
340
  const { error } = CompanyProfileValidator.createBrand().validate(
232
341
  {
233
342
  body,
@@ -246,15 +355,18 @@ class CompanyProfile {
246
355
  { abortEarly: false, allowUnknown: false }
247
356
  );
248
357
  if (warrning) {
249
- console.log("Parameter Validation warrnings for createBrand");
250
- console.log(warrning);
358
+ Logger({
359
+ level: "WARN",
360
+ message: "Parameter Validation warrnings for createBrand",
361
+ });
362
+ Logger({ level: "WARN", message: warrning });
251
363
  }
252
364
 
253
365
  const query_params = {};
254
366
 
255
367
  const xHeaders = {};
256
368
 
257
- return PlatformAPIClient.execute(
369
+ const response = await PlatformAPIClient.execute(
258
370
  this.config,
259
371
  "post",
260
372
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/`,
@@ -262,6 +374,23 @@ class CompanyProfile {
262
374
  body,
263
375
  xHeaders
264
376
  );
377
+
378
+ const {
379
+ error: res_error,
380
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
381
+ abortEarly: false,
382
+ allowUnknown: false,
383
+ });
384
+
385
+ if (res_error) {
386
+ Logger({
387
+ level: "WARN",
388
+ message: "Response Validation Warnnings for createBrand",
389
+ });
390
+ Logger({ level: "WARN", message: res_error });
391
+ }
392
+
393
+ return response;
265
394
  }
266
395
 
267
396
  /**
@@ -271,10 +400,11 @@ class CompanyProfile {
271
400
  * @param {number} [arg.pageSize] - Number of items to retrieve in each
272
401
  * page. Default is 10.
273
402
  * @param {string} [arg.q] - Search term for name.
403
+ * @returns {Promise<CompanyBrandListSerializer>} - Success response
274
404
  * @summary: Get brands associated to a company
275
405
  * @description: This API helps to get view brands associated to a particular company.
276
406
  */
277
- getBrands({ pageNo, pageSize, q } = {}) {
407
+ async getBrands({ pageNo, pageSize, q } = {}) {
278
408
  const { error } = CompanyProfileValidator.getBrands().validate(
279
409
  {
280
410
  pageNo,
@@ -297,8 +427,11 @@ class CompanyProfile {
297
427
  { abortEarly: false, allowUnknown: false }
298
428
  );
299
429
  if (warrning) {
300
- console.log("Parameter Validation warrnings for getBrands");
301
- console.log(warrning);
430
+ Logger({
431
+ level: "WARN",
432
+ message: "Parameter Validation warrnings for getBrands",
433
+ });
434
+ Logger({ level: "WARN", message: warrning });
302
435
  }
303
436
 
304
437
  const query_params = {};
@@ -308,7 +441,7 @@ class CompanyProfile {
308
441
 
309
442
  const xHeaders = {};
310
443
 
311
- return PlatformAPIClient.execute(
444
+ const response = await PlatformAPIClient.execute(
312
445
  this.config,
313
446
  "get",
314
447
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/company-brand`,
@@ -316,6 +449,23 @@ class CompanyProfile {
316
449
  undefined,
317
450
  xHeaders
318
451
  );
452
+
453
+ const {
454
+ error: res_error,
455
+ } = CompanyProfileModel.CompanyBrandListSerializer().validate(response, {
456
+ abortEarly: false,
457
+ allowUnknown: false,
458
+ });
459
+
460
+ if (res_error) {
461
+ Logger({
462
+ level: "WARN",
463
+ message: "Response Validation Warnnings for getBrands",
464
+ });
465
+ Logger({ level: "WARN", message: res_error });
466
+ }
467
+
468
+ return response;
319
469
  }
320
470
 
321
471
  /**
@@ -350,10 +500,11 @@ class CompanyProfile {
350
500
  /**
351
501
  * @param {Object} arg - Arg object.
352
502
  * @param {CompanyBrandPostRequestSerializer} arg.body
503
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
353
504
  * @summary: Create a company brand mapping.
354
505
  * @description: This API allows to create a company brand mapping, for a already existing brand in the system.
355
506
  */
356
- createCompanyBrandMapping({ body } = {}) {
507
+ async createCompanyBrandMapping({ body } = {}) {
357
508
  const {
358
509
  error,
359
510
  } = CompanyProfileValidator.createCompanyBrandMapping().validate(
@@ -376,17 +527,18 @@ class CompanyProfile {
376
527
  { abortEarly: false, allowUnknown: false }
377
528
  );
378
529
  if (warrning) {
379
- console.log(
380
- "Parameter Validation warrnings for createCompanyBrandMapping"
381
- );
382
- console.log(warrning);
530
+ Logger({
531
+ level: "WARN",
532
+ message: "Parameter Validation warrnings for createCompanyBrandMapping",
533
+ });
534
+ Logger({ level: "WARN", message: warrning });
383
535
  }
384
536
 
385
537
  const query_params = {};
386
538
 
387
539
  const xHeaders = {};
388
540
 
389
- return PlatformAPIClient.execute(
541
+ const response = await PlatformAPIClient.execute(
390
542
  this.config,
391
543
  "post",
392
544
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/company-brand`,
@@ -394,6 +546,23 @@ class CompanyProfile {
394
546
  body,
395
547
  xHeaders
396
548
  );
549
+
550
+ const {
551
+ error: res_error,
552
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
553
+ abortEarly: false,
554
+ allowUnknown: false,
555
+ });
556
+
557
+ if (res_error) {
558
+ Logger({
559
+ level: "WARN",
560
+ message: "Response Validation Warnnings for createCompanyBrandMapping",
561
+ });
562
+ Logger({ level: "WARN", message: res_error });
563
+ }
564
+
565
+ return response;
397
566
  }
398
567
 
399
568
  /**
@@ -408,10 +577,18 @@ class CompanyProfile {
408
577
  * @param {number} [arg.pageSize] - Number of items to retrieve in each
409
578
  * page. Default is 10.
410
579
  * @param {number[]} [arg.locationIds] - Helps to filter stores on the basis of uids.
580
+ * @returns {Promise<LocationListSerializer>} - Success response
411
581
  * @summary: Get list of locations
412
582
  * @description: This API allows to view all the locations associated to a company.
413
583
  */
414
- getLocations({ storeType, q, stage, pageNo, pageSize, locationIds } = {}) {
584
+ async getLocations({
585
+ storeType,
586
+ q,
587
+ stage,
588
+ pageNo,
589
+ pageSize,
590
+ locationIds,
591
+ } = {}) {
415
592
  const { error } = CompanyProfileValidator.getLocations().validate(
416
593
  {
417
594
  storeType,
@@ -440,8 +617,11 @@ class CompanyProfile {
440
617
  { abortEarly: false, allowUnknown: false }
441
618
  );
442
619
  if (warrning) {
443
- console.log("Parameter Validation warrnings for getLocations");
444
- console.log(warrning);
620
+ Logger({
621
+ level: "WARN",
622
+ message: "Parameter Validation warrnings for getLocations",
623
+ });
624
+ Logger({ level: "WARN", message: warrning });
445
625
  }
446
626
 
447
627
  const query_params = {};
@@ -454,7 +634,7 @@ class CompanyProfile {
454
634
 
455
635
  const xHeaders = {};
456
636
 
457
- return PlatformAPIClient.execute(
637
+ const response = await PlatformAPIClient.execute(
458
638
  this.config,
459
639
  "get",
460
640
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/location`,
@@ -462,6 +642,23 @@ class CompanyProfile {
462
642
  undefined,
463
643
  xHeaders
464
644
  );
645
+
646
+ const {
647
+ error: res_error,
648
+ } = CompanyProfileModel.LocationListSerializer().validate(response, {
649
+ abortEarly: false,
650
+ allowUnknown: false,
651
+ });
652
+
653
+ if (res_error) {
654
+ Logger({
655
+ level: "WARN",
656
+ message: "Response Validation Warnnings for getLocations",
657
+ });
658
+ Logger({ level: "WARN", message: res_error });
659
+ }
660
+
661
+ return response;
465
662
  }
466
663
 
467
664
  /**
@@ -504,10 +701,11 @@ class CompanyProfile {
504
701
  /**
505
702
  * @param {Object} arg - Arg object.
506
703
  * @param {LocationSerializer} arg.body
704
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
507
705
  * @summary: Create a location associated to a company.
508
706
  * @description: This API allows to edit a location associated to a company.
509
707
  */
510
- createLocation({ body } = {}) {
708
+ async createLocation({ body } = {}) {
511
709
  const { error } = CompanyProfileValidator.createLocation().validate(
512
710
  {
513
711
  body,
@@ -528,15 +726,18 @@ class CompanyProfile {
528
726
  { abortEarly: false, allowUnknown: false }
529
727
  );
530
728
  if (warrning) {
531
- console.log("Parameter Validation warrnings for createLocation");
532
- console.log(warrning);
729
+ Logger({
730
+ level: "WARN",
731
+ message: "Parameter Validation warrnings for createLocation",
732
+ });
733
+ Logger({ level: "WARN", message: warrning });
533
734
  }
534
735
 
535
736
  const query_params = {};
536
737
 
537
738
  const xHeaders = {};
538
739
 
539
- return PlatformAPIClient.execute(
740
+ const response = await PlatformAPIClient.execute(
540
741
  this.config,
541
742
  "post",
542
743
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/location`,
@@ -544,15 +745,33 @@ class CompanyProfile {
544
745
  body,
545
746
  xHeaders
546
747
  );
748
+
749
+ const {
750
+ error: res_error,
751
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
752
+ abortEarly: false,
753
+ allowUnknown: false,
754
+ });
755
+
756
+ if (res_error) {
757
+ Logger({
758
+ level: "WARN",
759
+ message: "Response Validation Warnnings for createLocation",
760
+ });
761
+ Logger({ level: "WARN", message: res_error });
762
+ }
763
+
764
+ return response;
547
765
  }
548
766
 
549
767
  /**
550
768
  * @param {Object} arg - Arg object.
551
769
  * @param {string} arg.locationId - Id of the location which you want to view.
770
+ * @returns {Promise<GetLocationSerializer>} - Success response
552
771
  * @summary: Get details of a specific location.
553
772
  * @description: This API helps to get data associated to a specific location.
554
773
  */
555
- getLocationDetail({ locationId } = {}) {
774
+ async getLocationDetail({ locationId } = {}) {
556
775
  const { error } = CompanyProfileValidator.getLocationDetail().validate(
557
776
  {
558
777
  locationId,
@@ -573,15 +792,18 @@ class CompanyProfile {
573
792
  { abortEarly: false, allowUnknown: false }
574
793
  );
575
794
  if (warrning) {
576
- console.log("Parameter Validation warrnings for getLocationDetail");
577
- console.log(warrning);
795
+ Logger({
796
+ level: "WARN",
797
+ message: "Parameter Validation warrnings for getLocationDetail",
798
+ });
799
+ Logger({ level: "WARN", message: warrning });
578
800
  }
579
801
 
580
802
  const query_params = {};
581
803
 
582
804
  const xHeaders = {};
583
805
 
584
- return PlatformAPIClient.execute(
806
+ const response = await PlatformAPIClient.execute(
585
807
  this.config,
586
808
  "get",
587
809
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/${locationId}`,
@@ -589,16 +811,34 @@ class CompanyProfile {
589
811
  undefined,
590
812
  xHeaders
591
813
  );
814
+
815
+ const {
816
+ error: res_error,
817
+ } = CompanyProfileModel.GetLocationSerializer().validate(response, {
818
+ abortEarly: false,
819
+ allowUnknown: false,
820
+ });
821
+
822
+ if (res_error) {
823
+ Logger({
824
+ level: "WARN",
825
+ message: "Response Validation Warnnings for getLocationDetail",
826
+ });
827
+ Logger({ level: "WARN", message: res_error });
828
+ }
829
+
830
+ return response;
592
831
  }
593
832
 
594
833
  /**
595
834
  * @param {Object} arg - Arg object.
596
835
  * @param {string} arg.locationId - Id of the location which you want to edit.
597
836
  * @param {LocationSerializer} arg.body
837
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
598
838
  * @summary: Edit a location asscoiated to a company.
599
839
  * @description: This API allows to edit a location associated to a company.
600
840
  */
601
- updateLocation({ locationId, body } = {}) {
841
+ async updateLocation({ locationId, body } = {}) {
602
842
  const { error } = CompanyProfileValidator.updateLocation().validate(
603
843
  {
604
844
  locationId,
@@ -621,15 +861,18 @@ class CompanyProfile {
621
861
  { abortEarly: false, allowUnknown: false }
622
862
  );
623
863
  if (warrning) {
624
- console.log("Parameter Validation warrnings for updateLocation");
625
- console.log(warrning);
864
+ Logger({
865
+ level: "WARN",
866
+ message: "Parameter Validation warrnings for updateLocation",
867
+ });
868
+ Logger({ level: "WARN", message: warrning });
626
869
  }
627
870
 
628
871
  const query_params = {};
629
872
 
630
873
  const xHeaders = {};
631
874
 
632
- return PlatformAPIClient.execute(
875
+ const response = await PlatformAPIClient.execute(
633
876
  this.config,
634
877
  "put",
635
878
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/${locationId}`,
@@ -637,15 +880,33 @@ class CompanyProfile {
637
880
  body,
638
881
  xHeaders
639
882
  );
883
+
884
+ const {
885
+ error: res_error,
886
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
887
+ abortEarly: false,
888
+ allowUnknown: false,
889
+ });
890
+
891
+ if (res_error) {
892
+ Logger({
893
+ level: "WARN",
894
+ message: "Response Validation Warnnings for updateLocation",
895
+ });
896
+ Logger({ level: "WARN", message: res_error });
897
+ }
898
+
899
+ return response;
640
900
  }
641
901
 
642
902
  /**
643
903
  * @param {Object} arg - Arg object.
644
904
  * @param {BulkLocationSerializer} arg.body
905
+ * @returns {Promise<ProfileSuccessResponse>} - Success response
645
906
  * @summary: Create a location asscoiated to a company in bulk.
646
907
  * @description: This API allows to create a location associated to a company.
647
908
  */
648
- createLocationBulk({ body } = {}) {
909
+ async createLocationBulk({ body } = {}) {
649
910
  const { error } = CompanyProfileValidator.createLocationBulk().validate(
650
911
  {
651
912
  body,
@@ -666,15 +927,18 @@ class CompanyProfile {
666
927
  { abortEarly: false, allowUnknown: false }
667
928
  );
668
929
  if (warrning) {
669
- console.log("Parameter Validation warrnings for createLocationBulk");
670
- console.log(warrning);
930
+ Logger({
931
+ level: "WARN",
932
+ message: "Parameter Validation warrnings for createLocationBulk",
933
+ });
934
+ Logger({ level: "WARN", message: warrning });
671
935
  }
672
936
 
673
937
  const query_params = {};
674
938
 
675
939
  const xHeaders = {};
676
940
 
677
- return PlatformAPIClient.execute(
941
+ const response = await PlatformAPIClient.execute(
678
942
  this.config,
679
943
  "post",
680
944
  `/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/bulk`,
@@ -682,6 +946,23 @@ class CompanyProfile {
682
946
  body,
683
947
  xHeaders
684
948
  );
949
+
950
+ const {
951
+ error: res_error,
952
+ } = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
953
+ abortEarly: false,
954
+ allowUnknown: false,
955
+ });
956
+
957
+ if (res_error) {
958
+ Logger({
959
+ level: "WARN",
960
+ message: "Response Validation Warnnings for createLocationBulk",
961
+ });
962
+ Logger({ level: "WARN", message: res_error });
963
+ }
964
+
965
+ return response;
685
966
  }
686
967
  }
687
968