@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 InventoryValidator = require("./InventoryPlatformValidator");
5
+ const InventoryModel = require("./InventoryPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+
5
8
  class Inventory {
6
9
  constructor(config) {
7
10
  this.config = config;
@@ -11,10 +14,11 @@ class Inventory {
11
14
  * @param {Object} arg - Arg object.
12
15
  * @param {number} [arg.pageNo] - Page Number
13
16
  * @param {number} [arg.pageSize] - Page Size
17
+ * @returns {Promise<ResponseEnvelopeListJobConfigRawDTO>} - Success response
14
18
  * @summary: Get Job Configs For A Company
15
19
  * @description: REST Endpoint that returns all job configs for a company
16
20
  */
17
- getJobsByCompany({ pageNo, pageSize } = {}) {
21
+ async getJobsByCompany({ pageNo, pageSize } = {}) {
18
22
  const { error } = InventoryValidator.getJobsByCompany().validate(
19
23
  {
20
24
  pageNo,
@@ -35,8 +39,11 @@ class Inventory {
35
39
  { abortEarly: false, allowUnknown: false }
36
40
  );
37
41
  if (warrning) {
38
- console.log("Parameter Validation warrnings for getJobsByCompany");
39
- console.log(warrning);
42
+ Logger({
43
+ level: "WARN",
44
+ message: "Parameter Validation warrnings for getJobsByCompany",
45
+ });
46
+ Logger({ level: "WARN", message: warrning });
40
47
  }
41
48
 
42
49
  const query_params = {};
@@ -45,7 +52,7 @@ class Inventory {
45
52
 
46
53
  const xHeaders = {};
47
54
 
48
- return PlatformAPIClient.execute(
55
+ const response = await PlatformAPIClient.execute(
49
56
  this.config,
50
57
  "get",
51
58
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs`,
@@ -53,15 +60,33 @@ class Inventory {
53
60
  undefined,
54
61
  xHeaders
55
62
  );
63
+
64
+ const {
65
+ error: res_error,
66
+ } = InventoryModel.ResponseEnvelopeListJobConfigRawDTO().validate(
67
+ response,
68
+ { abortEarly: false, allowUnknown: false }
69
+ );
70
+
71
+ if (res_error) {
72
+ Logger({
73
+ level: "WARN",
74
+ message: "Response Validation Warnnings for getJobsByCompany",
75
+ });
76
+ Logger({ level: "WARN", message: res_error });
77
+ }
78
+
79
+ return response;
56
80
  }
57
81
 
58
82
  /**
59
83
  * @param {Object} arg - Arg object.
60
84
  * @param {JobConfigDTO} arg.body
85
+ * @returns {Promise<ResponseEnvelopeString>} - Success response
61
86
  * @summary: Updates An Existing Job Config
62
87
  * @description: REST Endpoint that updates a job config
63
88
  */
64
- updateJob({ body } = {}) {
89
+ async updateJob({ body } = {}) {
65
90
  const { error } = InventoryValidator.updateJob().validate(
66
91
  {
67
92
  body,
@@ -80,15 +105,18 @@ class Inventory {
80
105
  { abortEarly: false, allowUnknown: false }
81
106
  );
82
107
  if (warrning) {
83
- console.log("Parameter Validation warrnings for updateJob");
84
- console.log(warrning);
108
+ Logger({
109
+ level: "WARN",
110
+ message: "Parameter Validation warrnings for updateJob",
111
+ });
112
+ Logger({ level: "WARN", message: warrning });
85
113
  }
86
114
 
87
115
  const query_params = {};
88
116
 
89
117
  const xHeaders = {};
90
118
 
91
- return PlatformAPIClient.execute(
119
+ const response = await PlatformAPIClient.execute(
92
120
  this.config,
93
121
  "put",
94
122
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs`,
@@ -96,15 +124,33 @@ class Inventory {
96
124
  body,
97
125
  xHeaders
98
126
  );
127
+
128
+ const {
129
+ error: res_error,
130
+ } = InventoryModel.ResponseEnvelopeString().validate(response, {
131
+ abortEarly: false,
132
+ allowUnknown: false,
133
+ });
134
+
135
+ if (res_error) {
136
+ Logger({
137
+ level: "WARN",
138
+ message: "Response Validation Warnnings for updateJob",
139
+ });
140
+ Logger({ level: "WARN", message: res_error });
141
+ }
142
+
143
+ return response;
99
144
  }
100
145
 
101
146
  /**
102
147
  * @param {Object} arg - Arg object.
103
148
  * @param {JobConfigDTO} arg.body
149
+ * @returns {Promise<ResponseEnvelopeString>} - Success response
104
150
  * @summary: Creates A New Job Config
105
151
  * @description: REST Endpoint that creates a new job config
106
152
  */
107
- createJob({ body } = {}) {
153
+ async createJob({ body } = {}) {
108
154
  const { error } = InventoryValidator.createJob().validate(
109
155
  {
110
156
  body,
@@ -123,15 +169,18 @@ class Inventory {
123
169
  { abortEarly: false, allowUnknown: false }
124
170
  );
125
171
  if (warrning) {
126
- console.log("Parameter Validation warrnings for createJob");
127
- console.log(warrning);
172
+ Logger({
173
+ level: "WARN",
174
+ message: "Parameter Validation warrnings for createJob",
175
+ });
176
+ Logger({ level: "WARN", message: warrning });
128
177
  }
129
178
 
130
179
  const query_params = {};
131
180
 
132
181
  const xHeaders = {};
133
182
 
134
- return PlatformAPIClient.execute(
183
+ const response = await PlatformAPIClient.execute(
135
184
  this.config,
136
185
  "post",
137
186
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs`,
@@ -139,15 +188,33 @@ class Inventory {
139
188
  body,
140
189
  xHeaders
141
190
  );
191
+
192
+ const {
193
+ error: res_error,
194
+ } = InventoryModel.ResponseEnvelopeString().validate(response, {
195
+ abortEarly: false,
196
+ allowUnknown: false,
197
+ });
198
+
199
+ if (res_error) {
200
+ Logger({
201
+ level: "WARN",
202
+ message: "Response Validation Warnnings for createJob",
203
+ });
204
+ Logger({ level: "WARN", message: res_error });
205
+ }
206
+
207
+ return response;
142
208
  }
143
209
 
144
210
  /**
145
211
  * @param {Object} arg - Arg object.
146
212
  * @param {SuppressStorePayload} arg.body
213
+ * @returns {Promise<ResponseEnvelopeKafkaResponse>} - Success response
147
214
  * @summary: Get Slingshot Configuration Of A Company
148
215
  * @description: REST Endpoint that returns all configuration detail of a company
149
216
  */
150
- suppressStores({ body } = {}) {
217
+ async suppressStores({ body } = {}) {
151
218
  const { error } = InventoryValidator.suppressStores().validate(
152
219
  {
153
220
  body,
@@ -166,15 +233,18 @@ class Inventory {
166
233
  { abortEarly: false, allowUnknown: false }
167
234
  );
168
235
  if (warrning) {
169
- console.log("Parameter Validation warrnings for suppressStores");
170
- console.log(warrning);
236
+ Logger({
237
+ level: "WARN",
238
+ message: "Parameter Validation warrnings for suppressStores",
239
+ });
240
+ Logger({ level: "WARN", message: warrning });
171
241
  }
172
242
 
173
243
  const query_params = {};
174
244
 
175
245
  const xHeaders = {};
176
246
 
177
- return PlatformAPIClient.execute(
247
+ const response = await PlatformAPIClient.execute(
178
248
  this.config,
179
249
  "post",
180
250
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/kafka/suppressStore`,
@@ -182,14 +252,33 @@ class Inventory {
182
252
  body,
183
253
  xHeaders
184
254
  );
255
+
256
+ const {
257
+ error: res_error,
258
+ } = InventoryModel.ResponseEnvelopeKafkaResponse().validate(response, {
259
+ abortEarly: false,
260
+ allowUnknown: false,
261
+ });
262
+
263
+ if (res_error) {
264
+ Logger({
265
+ level: "WARN",
266
+ message: "Response Validation Warnnings for suppressStores",
267
+ });
268
+ Logger({ level: "WARN", message: res_error });
269
+ }
270
+
271
+ return response;
185
272
  }
186
273
 
187
274
  /**
188
275
  * @param {Object} arg - Arg object.
276
+ * @returns {Promise<ResponseEnvelopeListSlingshotConfigurationDetail>} -
277
+ * Success response
189
278
  * @summary: Get Slingshot Configuration Of A Company
190
279
  * @description: REST Endpoint that returns all configuration detail of a company
191
280
  */
192
- getConfigByCompany({} = {}) {
281
+ async getConfigByCompany({} = {}) {
193
282
  const { error } = InventoryValidator.getConfigByCompany().validate(
194
283
  {},
195
284
  { abortEarly: false, allowUnknown: true }
@@ -206,15 +295,18 @@ class Inventory {
206
295
  { abortEarly: false, allowUnknown: false }
207
296
  );
208
297
  if (warrning) {
209
- console.log("Parameter Validation warrnings for getConfigByCompany");
210
- console.log(warrning);
298
+ Logger({
299
+ level: "WARN",
300
+ message: "Parameter Validation warrnings for getConfigByCompany",
301
+ });
302
+ Logger({ level: "WARN", message: warrning });
211
303
  }
212
304
 
213
305
  const query_params = {};
214
306
 
215
307
  const xHeaders = {};
216
308
 
217
- return PlatformAPIClient.execute(
309
+ const response = await PlatformAPIClient.execute(
218
310
  this.config,
219
311
  "get",
220
312
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/slingshot`,
@@ -222,15 +314,33 @@ class Inventory {
222
314
  undefined,
223
315
  xHeaders
224
316
  );
317
+
318
+ const {
319
+ error: res_error,
320
+ } = InventoryModel.ResponseEnvelopeListSlingshotConfigurationDetail().validate(
321
+ response,
322
+ { abortEarly: false, allowUnknown: false }
323
+ );
324
+
325
+ if (res_error) {
326
+ Logger({
327
+ level: "WARN",
328
+ message: "Response Validation Warnnings for getConfigByCompany",
329
+ });
330
+ Logger({ level: "WARN", message: res_error });
331
+ }
332
+
333
+ return response;
225
334
  }
226
335
 
227
336
  /**
228
337
  * @param {Object} arg - Arg object.
229
338
  * @param {number} arg.jobId - Job Id
339
+ * @returns {Promise<ResponseEnvelopeListJobStepsDTO>} - Success response
230
340
  * @summary: Get Job Code Steps
231
341
  * @description: REST Endpoint that returns Inventory Job Steps
232
342
  */
233
- getJobSteps({ jobId } = {}) {
343
+ async getJobSteps({ jobId } = {}) {
234
344
  const { error } = InventoryValidator.getJobSteps().validate(
235
345
  {
236
346
  jobId,
@@ -249,15 +359,18 @@ class Inventory {
249
359
  { abortEarly: false, allowUnknown: false }
250
360
  );
251
361
  if (warrning) {
252
- console.log("Parameter Validation warrnings for getJobSteps");
253
- console.log(warrning);
362
+ Logger({
363
+ level: "WARN",
364
+ message: "Parameter Validation warrnings for getJobSteps",
365
+ });
366
+ Logger({ level: "WARN", message: warrning });
254
367
  }
255
368
 
256
369
  const query_params = {};
257
370
 
258
371
  const xHeaders = {};
259
372
 
260
- return PlatformAPIClient.execute(
373
+ const response = await PlatformAPIClient.execute(
261
374
  this.config,
262
375
  "get",
263
376
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/steps/${jobId}`,
@@ -265,6 +378,23 @@ class Inventory {
265
378
  undefined,
266
379
  xHeaders
267
380
  );
381
+
382
+ const {
383
+ error: res_error,
384
+ } = InventoryModel.ResponseEnvelopeListJobStepsDTO().validate(response, {
385
+ abortEarly: false,
386
+ allowUnknown: false,
387
+ });
388
+
389
+ if (res_error) {
390
+ Logger({
391
+ level: "WARN",
392
+ message: "Response Validation Warnnings for getJobSteps",
393
+ });
394
+ Logger({ level: "WARN", message: res_error });
395
+ }
396
+
397
+ return response;
268
398
  }
269
399
 
270
400
  /**
@@ -272,10 +402,15 @@ class Inventory {
272
402
  * @param {string} arg.integrationId - Integration Id
273
403
  * @param {number} [arg.pageNo] - Page Number
274
404
  * @param {number} [arg.pageSize] - Page Size
405
+ * @returns {Promise<ResponseEnvelopeListJobConfigDTO>} - Success response
275
406
  * @summary: Get Job Configs By Company And Integration
276
407
  * @description: REST Endpoint that returns all job configs by company And integration
277
408
  */
278
- getJobByCompanyAndIntegration({ integrationId, pageNo, pageSize } = {}) {
409
+ async getJobByCompanyAndIntegration({
410
+ integrationId,
411
+ pageNo,
412
+ pageSize,
413
+ } = {}) {
279
414
  const {
280
415
  error,
281
416
  } = InventoryValidator.getJobByCompanyAndIntegration().validate(
@@ -302,10 +437,12 @@ class Inventory {
302
437
  { abortEarly: false, allowUnknown: false }
303
438
  );
304
439
  if (warrning) {
305
- console.log(
306
- "Parameter Validation warrnings for getJobByCompanyAndIntegration"
307
- );
308
- console.log(warrning);
440
+ Logger({
441
+ level: "WARN",
442
+ message:
443
+ "Parameter Validation warrnings for getJobByCompanyAndIntegration",
444
+ });
445
+ Logger({ level: "WARN", message: warrning });
309
446
  }
310
447
 
311
448
  const query_params = {};
@@ -314,7 +451,7 @@ class Inventory {
314
451
 
315
452
  const xHeaders = {};
316
453
 
317
- return PlatformAPIClient.execute(
454
+ const response = await PlatformAPIClient.execute(
318
455
  this.config,
319
456
  "get",
320
457
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/integration/${integrationId}`,
@@ -322,15 +459,34 @@ class Inventory {
322
459
  undefined,
323
460
  xHeaders
324
461
  );
462
+
463
+ const {
464
+ error: res_error,
465
+ } = InventoryModel.ResponseEnvelopeListJobConfigDTO().validate(response, {
466
+ abortEarly: false,
467
+ allowUnknown: false,
468
+ });
469
+
470
+ if (res_error) {
471
+ Logger({
472
+ level: "WARN",
473
+ message:
474
+ "Response Validation Warnnings for getJobByCompanyAndIntegration",
475
+ });
476
+ Logger({ level: "WARN", message: res_error });
477
+ }
478
+
479
+ return response;
325
480
  }
326
481
 
327
482
  /**
328
483
  * @param {Object} arg - Arg object.
329
484
  * @param {string} arg.integrationId - IntegrationId
485
+ * @returns {Promise<ResponseEnvelopeString>} - Success response
330
486
  * @summary: Disable Job Config
331
487
  * @description: REST Endpoint that disables Inventory Job Config
332
488
  */
333
- disable({ integrationId } = {}) {
489
+ async disable({ integrationId } = {}) {
334
490
  const { error } = InventoryValidator.disable().validate(
335
491
  {
336
492
  integrationId,
@@ -349,15 +505,18 @@ class Inventory {
349
505
  { abortEarly: false, allowUnknown: false }
350
506
  );
351
507
  if (warrning) {
352
- console.log("Parameter Validation warrnings for disable");
353
- console.log(warrning);
508
+ Logger({
509
+ level: "WARN",
510
+ message: "Parameter Validation warrnings for disable",
511
+ });
512
+ Logger({ level: "WARN", message: warrning });
354
513
  }
355
514
 
356
515
  const query_params = {};
357
516
 
358
517
  const xHeaders = {};
359
518
 
360
- return PlatformAPIClient.execute(
519
+ const response = await PlatformAPIClient.execute(
361
520
  this.config,
362
521
  "get",
363
522
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/disable/integration/${integrationId}`,
@@ -365,14 +524,32 @@ class Inventory {
365
524
  undefined,
366
525
  xHeaders
367
526
  );
527
+
528
+ const {
529
+ error: res_error,
530
+ } = InventoryModel.ResponseEnvelopeString().validate(response, {
531
+ abortEarly: false,
532
+ allowUnknown: false,
533
+ });
534
+
535
+ if (res_error) {
536
+ Logger({
537
+ level: "WARN",
538
+ message: "Response Validation Warnnings for disable",
539
+ });
540
+ Logger({ level: "WARN", message: res_error });
541
+ }
542
+
543
+ return response;
368
544
  }
369
545
 
370
546
  /**
371
547
  * @param {Object} arg - Arg object.
548
+ * @returns {Promise<ResponseEnvelopeJobConfigDTO>} - Success response
372
549
  * @summary: Get Job Configs Defaults
373
550
  * @description: REST Endpoint that returns default fields job configs by company And integration
374
551
  */
375
- getJobConfigDefaults({} = {}) {
552
+ async getJobConfigDefaults({} = {}) {
376
553
  const { error } = InventoryValidator.getJobConfigDefaults().validate(
377
554
  {},
378
555
  { abortEarly: false, allowUnknown: true }
@@ -389,15 +566,18 @@ class Inventory {
389
566
  { abortEarly: false, allowUnknown: false }
390
567
  );
391
568
  if (warrning) {
392
- console.log("Parameter Validation warrnings for getJobConfigDefaults");
393
- console.log(warrning);
569
+ Logger({
570
+ level: "WARN",
571
+ message: "Parameter Validation warrnings for getJobConfigDefaults",
572
+ });
573
+ Logger({ level: "WARN", message: warrning });
394
574
  }
395
575
 
396
576
  const query_params = {};
397
577
 
398
578
  const xHeaders = {};
399
579
 
400
- return PlatformAPIClient.execute(
580
+ const response = await PlatformAPIClient.execute(
401
581
  this.config,
402
582
  "get",
403
583
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/defaults`,
@@ -405,15 +585,33 @@ class Inventory {
405
585
  undefined,
406
586
  xHeaders
407
587
  );
588
+
589
+ const {
590
+ error: res_error,
591
+ } = InventoryModel.ResponseEnvelopeJobConfigDTO().validate(response, {
592
+ abortEarly: false,
593
+ allowUnknown: false,
594
+ });
595
+
596
+ if (res_error) {
597
+ Logger({
598
+ level: "WARN",
599
+ message: "Response Validation Warnnings for getJobConfigDefaults",
600
+ });
601
+ Logger({ level: "WARN", message: res_error });
602
+ }
603
+
604
+ return response;
408
605
  }
409
606
 
410
607
  /**
411
608
  * @param {Object} arg - Arg object.
412
609
  * @param {string} arg.code - Job Code
610
+ * @returns {Promise<ResponseEnvelopeJobConfigDTO>} - Success response
413
611
  * @summary: Get Job Config By Code
414
612
  * @description: REST Endpoint that returns job config by code
415
613
  */
416
- getJobByCode({ code } = {}) {
614
+ async getJobByCode({ code } = {}) {
417
615
  const { error } = InventoryValidator.getJobByCode().validate(
418
616
  {
419
617
  code,
@@ -432,15 +630,18 @@ class Inventory {
432
630
  { abortEarly: false, allowUnknown: false }
433
631
  );
434
632
  if (warrning) {
435
- console.log("Parameter Validation warrnings for getJobByCode");
436
- console.log(warrning);
633
+ Logger({
634
+ level: "WARN",
635
+ message: "Parameter Validation warrnings for getJobByCode",
636
+ });
637
+ Logger({ level: "WARN", message: warrning });
437
638
  }
438
639
 
439
640
  const query_params = {};
440
641
 
441
642
  const xHeaders = {};
442
643
 
443
- return PlatformAPIClient.execute(
644
+ const response = await PlatformAPIClient.execute(
444
645
  this.config,
445
646
  "get",
446
647
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/code/${code}`,
@@ -448,6 +649,23 @@ class Inventory {
448
649
  undefined,
449
650
  xHeaders
450
651
  );
652
+
653
+ const {
654
+ error: res_error,
655
+ } = InventoryModel.ResponseEnvelopeJobConfigDTO().validate(response, {
656
+ abortEarly: false,
657
+ allowUnknown: false,
658
+ });
659
+
660
+ if (res_error) {
661
+ Logger({
662
+ level: "WARN",
663
+ message: "Response Validation Warnnings for getJobByCode",
664
+ });
665
+ Logger({ level: "WARN", message: res_error });
666
+ }
667
+
668
+ return response;
451
669
  }
452
670
 
453
671
  /**
@@ -457,10 +675,11 @@ class Inventory {
457
675
  * @param {number} [arg.pageSize] - Page Size
458
676
  * @param {string} [arg.status] - Status
459
677
  * @param {string} [arg.date] - From Date
678
+ * @returns {Promise<ResponseEnvelopeJobMetricsDto>} - Success response
460
679
  * @summary: Get Job Metrics
461
680
  * @description: REST Endpoint that returns Inventory Run History For A Job Code
462
681
  */
463
- getJobCodeMetrics({ code, pageNo, pageSize, status, date } = {}) {
682
+ async getJobCodeMetrics({ code, pageNo, pageSize, status, date } = {}) {
464
683
  const { error } = InventoryValidator.getJobCodeMetrics().validate(
465
684
  {
466
685
  code,
@@ -487,8 +706,11 @@ class Inventory {
487
706
  { abortEarly: false, allowUnknown: false }
488
707
  );
489
708
  if (warrning) {
490
- console.log("Parameter Validation warrnings for getJobCodeMetrics");
491
- console.log(warrning);
709
+ Logger({
710
+ level: "WARN",
711
+ message: "Parameter Validation warrnings for getJobCodeMetrics",
712
+ });
713
+ Logger({ level: "WARN", message: warrning });
492
714
  }
493
715
 
494
716
  const query_params = {};
@@ -499,7 +721,7 @@ class Inventory {
499
721
 
500
722
  const xHeaders = {};
501
723
 
502
- return PlatformAPIClient.execute(
724
+ const response = await PlatformAPIClient.execute(
503
725
  this.config,
504
726
  "get",
505
727
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/code/${code}/metrics`,
@@ -507,6 +729,23 @@ class Inventory {
507
729
  undefined,
508
730
  xHeaders
509
731
  );
732
+
733
+ const {
734
+ error: res_error,
735
+ } = InventoryModel.ResponseEnvelopeJobMetricsDto().validate(response, {
736
+ abortEarly: false,
737
+ allowUnknown: false,
738
+ });
739
+
740
+ if (res_error) {
741
+ Logger({
742
+ level: "WARN",
743
+ message: "Response Validation Warnnings for getJobCodeMetrics",
744
+ });
745
+ Logger({ level: "WARN", message: res_error });
746
+ }
747
+
748
+ return response;
510
749
  }
511
750
 
512
751
  /**
@@ -514,10 +753,15 @@ class Inventory {
514
753
  * @param {string} arg.integrationId - Integration Id
515
754
  * @param {number} [arg.pageNo] - Page Number
516
755
  * @param {number} [arg.pageSize] - Page Size
756
+ * @returns {Promise<ResponseEnvelopeListJobConfigListDTO>} - Success response
517
757
  * @summary: Get Job Codes By Company And Integration
518
758
  * @description: REST Endpoint that returns all job codes by company And integration
519
759
  */
520
- getJobCodesByCompanyAndIntegration({ integrationId, pageNo, pageSize } = {}) {
760
+ async getJobCodesByCompanyAndIntegration({
761
+ integrationId,
762
+ pageNo,
763
+ pageSize,
764
+ } = {}) {
521
765
  const {
522
766
  error,
523
767
  } = InventoryValidator.getJobCodesByCompanyAndIntegration().validate(
@@ -544,10 +788,12 @@ class Inventory {
544
788
  { abortEarly: false, allowUnknown: false }
545
789
  );
546
790
  if (warrning) {
547
- console.log(
548
- "Parameter Validation warrnings for getJobCodesByCompanyAndIntegration"
549
- );
550
- console.log(warrning);
791
+ Logger({
792
+ level: "WARN",
793
+ message:
794
+ "Parameter Validation warrnings for getJobCodesByCompanyAndIntegration",
795
+ });
796
+ Logger({ level: "WARN", message: warrning });
551
797
  }
552
798
 
553
799
  const query_params = {};
@@ -556,7 +802,7 @@ class Inventory {
556
802
 
557
803
  const xHeaders = {};
558
804
 
559
- return PlatformAPIClient.execute(
805
+ const response = await PlatformAPIClient.execute(
560
806
  this.config,
561
807
  "get",
562
808
  `/service/platform/inventory/v1.0/company/${this.config.companyId}/jobs/code/integration/${integrationId}`,
@@ -564,6 +810,24 @@ class Inventory {
564
810
  undefined,
565
811
  xHeaders
566
812
  );
813
+
814
+ const {
815
+ error: res_error,
816
+ } = InventoryModel.ResponseEnvelopeListJobConfigListDTO().validate(
817
+ response,
818
+ { abortEarly: false, allowUnknown: false }
819
+ );
820
+
821
+ if (res_error) {
822
+ Logger({
823
+ level: "WARN",
824
+ message:
825
+ "Response Validation Warnnings for getJobCodesByCompanyAndIntegration",
826
+ });
827
+ Logger({ level: "WARN", message: res_error });
828
+ }
829
+
830
+ return response;
567
831
  }
568
832
  }
569
833