@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 AnalyticsValidator = require("./AnalyticsPlatformValidator");
5
+ const AnalyticsModel = require("./AnalyticsPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+
5
8
  class Analytics {
6
9
  constructor(config) {
7
10
  this.config = config;
@@ -11,10 +14,11 @@ class Analytics {
11
14
  * @param {Object} arg - Arg object.
12
15
  * @param {string} arg.exportType - Export type / format
13
16
  * @param {ExportJobReq} arg.body
17
+ * @returns {Promise<ExportJobRes>} - Success response
14
18
  * @summary: Create data export job in required format
15
19
  * @description: Create data export job in required format
16
20
  */
17
- createExportJob({ exportType, body } = {}) {
21
+ async createExportJob({ exportType, body } = {}) {
18
22
  const { error } = AnalyticsValidator.createExportJob().validate(
19
23
  {
20
24
  exportType,
@@ -35,15 +39,18 @@ class Analytics {
35
39
  { abortEarly: false, allowUnknown: false }
36
40
  );
37
41
  if (warrning) {
38
- console.log("Parameter Validation warrnings for createExportJob");
39
- console.log(warrning);
42
+ Logger({
43
+ level: "WARN",
44
+ message: "Parameter Validation warrnings for createExportJob",
45
+ });
46
+ Logger({ level: "WARN", message: warrning });
40
47
  }
41
48
 
42
49
  const query_params = {};
43
50
 
44
51
  const xHeaders = {};
45
52
 
46
- return PlatformAPIClient.execute(
53
+ const response = await PlatformAPIClient.execute(
47
54
  this.config,
48
55
  "post",
49
56
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/export/${exportType}`,
@@ -51,16 +58,34 @@ class Analytics {
51
58
  body,
52
59
  xHeaders
53
60
  );
61
+
62
+ const {
63
+ error: res_error,
64
+ } = AnalyticsModel.ExportJobRes().validate(response, {
65
+ abortEarly: false,
66
+ allowUnknown: false,
67
+ });
68
+
69
+ if (res_error) {
70
+ Logger({
71
+ level: "WARN",
72
+ message: "Response Validation Warnnings for createExportJob",
73
+ });
74
+ Logger({ level: "WARN", message: res_error });
75
+ }
76
+
77
+ return response;
54
78
  }
55
79
 
56
80
  /**
57
81
  * @param {Object} arg - Arg object.
58
82
  * @param {string} arg.exportType - Export type / format
59
83
  * @param {string} arg.jobId - Export job id
84
+ * @returns {Promise<ExportJobStatusRes>} - Success response
60
85
  * @summary: Get data export job status
61
86
  * @description: Get data export job status
62
87
  */
63
- getExportJobStatus({ exportType, jobId } = {}) {
88
+ async getExportJobStatus({ exportType, jobId } = {}) {
64
89
  const { error } = AnalyticsValidator.getExportJobStatus().validate(
65
90
  {
66
91
  exportType,
@@ -83,15 +108,18 @@ class Analytics {
83
108
  { abortEarly: false, allowUnknown: false }
84
109
  );
85
110
  if (warrning) {
86
- console.log("Parameter Validation warrnings for getExportJobStatus");
87
- console.log(warrning);
111
+ Logger({
112
+ level: "WARN",
113
+ message: "Parameter Validation warrnings for getExportJobStatus",
114
+ });
115
+ Logger({ level: "WARN", message: warrning });
88
116
  }
89
117
 
90
118
  const query_params = {};
91
119
 
92
120
  const xHeaders = {};
93
121
 
94
- return PlatformAPIClient.execute(
122
+ const response = await PlatformAPIClient.execute(
95
123
  this.config,
96
124
  "get",
97
125
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/export/${exportType}/job/${jobId}`,
@@ -99,6 +127,23 @@ class Analytics {
99
127
  undefined,
100
128
  xHeaders
101
129
  );
130
+
131
+ const {
132
+ error: res_error,
133
+ } = AnalyticsModel.ExportJobStatusRes().validate(response, {
134
+ abortEarly: false,
135
+ allowUnknown: false,
136
+ });
137
+
138
+ if (res_error) {
139
+ Logger({
140
+ level: "WARN",
141
+ message: "Response Validation Warnnings for getExportJobStatus",
142
+ });
143
+ Logger({ level: "WARN", message: res_error });
144
+ }
145
+
146
+ return response;
102
147
  }
103
148
 
104
149
  /**
@@ -107,10 +152,11 @@ class Analytics {
107
152
  * @param {number} [arg.pageNo] - Current page number
108
153
  * @param {number} [arg.pageSize] - Current page size
109
154
  * @param {GetLogsListReq} arg.body
155
+ * @returns {Promise<GetLogsListRes>} - Success response
110
156
  * @summary: Get logs list
111
157
  * @description: Get logs list
112
158
  */
113
- getLogsList({ logType, body, pageNo, pageSize } = {}) {
159
+ async getLogsList({ logType, body, pageNo, pageSize } = {}) {
114
160
  const { error } = AnalyticsValidator.getLogsList().validate(
115
161
  {
116
162
  logType,
@@ -135,8 +181,11 @@ class Analytics {
135
181
  { abortEarly: false, allowUnknown: false }
136
182
  );
137
183
  if (warrning) {
138
- console.log("Parameter Validation warrnings for getLogsList");
139
- console.log(warrning);
184
+ Logger({
185
+ level: "WARN",
186
+ message: "Parameter Validation warrnings for getLogsList",
187
+ });
188
+ Logger({ level: "WARN", message: warrning });
140
189
  }
141
190
 
142
191
  const query_params = {};
@@ -145,7 +194,7 @@ class Analytics {
145
194
 
146
195
  const xHeaders = {};
147
196
 
148
- return PlatformAPIClient.execute(
197
+ const response = await PlatformAPIClient.execute(
149
198
  this.config,
150
199
  "post",
151
200
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/logs/${logType}`,
@@ -153,6 +202,23 @@ class Analytics {
153
202
  body,
154
203
  xHeaders
155
204
  );
205
+
206
+ const {
207
+ error: res_error,
208
+ } = AnalyticsModel.GetLogsListRes().validate(response, {
209
+ abortEarly: false,
210
+ allowUnknown: false,
211
+ });
212
+
213
+ if (res_error) {
214
+ Logger({
215
+ level: "WARN",
216
+ message: "Response Validation Warnnings for getLogsList",
217
+ });
218
+ Logger({ level: "WARN", message: res_error });
219
+ }
220
+
221
+ return response;
156
222
  }
157
223
 
158
224
  /**
@@ -191,10 +257,11 @@ class Analytics {
191
257
  * @param {number} [arg.pageSize] - Current page size
192
258
  * @param {string} arg.logType - Log type
193
259
  * @param {SearchLogReq} arg.body
260
+ * @returns {Promise<SearchLogRes>} - Success response
194
261
  * @summary: Search logs
195
262
  * @description: Search logs
196
263
  */
197
- searchLogs({ logType, body, pageNo, pageSize } = {}) {
264
+ async searchLogs({ logType, body, pageNo, pageSize } = {}) {
198
265
  const { error } = AnalyticsValidator.searchLogs().validate(
199
266
  {
200
267
  logType,
@@ -219,8 +286,11 @@ class Analytics {
219
286
  { abortEarly: false, allowUnknown: false }
220
287
  );
221
288
  if (warrning) {
222
- console.log("Parameter Validation warrnings for searchLogs");
223
- console.log(warrning);
289
+ Logger({
290
+ level: "WARN",
291
+ message: "Parameter Validation warrnings for searchLogs",
292
+ });
293
+ Logger({ level: "WARN", message: warrning });
224
294
  }
225
295
 
226
296
  const query_params = {};
@@ -229,7 +299,7 @@ class Analytics {
229
299
 
230
300
  const xHeaders = {};
231
301
 
232
- return PlatformAPIClient.execute(
302
+ const response = await PlatformAPIClient.execute(
233
303
  this.config,
234
304
  "post",
235
305
  `/service/platform/analytics/v1.0/company/${this.config.companyId}/logs/${logType}/search`,
@@ -237,6 +307,23 @@ class Analytics {
237
307
  body,
238
308
  xHeaders
239
309
  );
310
+
311
+ const {
312
+ error: res_error,
313
+ } = AnalyticsModel.SearchLogRes().validate(response, {
314
+ abortEarly: false,
315
+ allowUnknown: false,
316
+ });
317
+
318
+ if (res_error) {
319
+ Logger({
320
+ level: "WARN",
321
+ message: "Response Validation Warnnings for searchLogs",
322
+ });
323
+ Logger({ level: "WARN", message: res_error });
324
+ }
325
+
326
+ return response;
240
327
  }
241
328
 
242
329
  /**
@@ -5,34 +5,38 @@ declare class AuditTrail {
5
5
  /**
6
6
  * @param {Object} arg - Arg object.
7
7
  * @param {string} arg.qs - Logs Query
8
+ * @returns {Promise<LogSchemaResponse>} - Success response
8
9
  * @summary: Get paginated audit logs
9
10
  * @description: Get a paginated set of logs that can be filtered using the available set of parameters and get the relevant group of logs
10
11
  */
11
12
  getAuditLogs({ qs }?: {
12
13
  qs: string;
13
- }): Promise<any>;
14
+ }): Promise<LogSchemaResponse>;
14
15
  /**
15
16
  * @param {Object} arg - Arg object.
16
17
  * @param {RequestBodyAuditLog} arg.body
18
+ * @returns {Promise<CreateLogResponse>} - Success response
17
19
  * @summary: Create logs for auditing later on
18
20
  * @description: Create a log instance that stores all the relevant info to be logged
19
21
  */
20
22
  createAuditLog({ body }?: {
21
23
  body: RequestBodyAuditLog;
22
- }): Promise<any>;
24
+ }): Promise<CreateLogResponse>;
23
25
  /**
24
26
  * @param {Object} arg - Arg object.
25
27
  * @param {string} arg.id - Log uuid
28
+ * @returns {Promise<LogSchemaResponse>} - Success response
26
29
  * @summary: Get audit log
27
30
  * @description: Get detailed log information by their id
28
31
  */
29
32
  getAuditLog({ id }?: {
30
33
  id: string;
31
- }): Promise<any>;
34
+ }): Promise<LogSchemaResponse>;
32
35
  /**
33
36
  * @param {Object} arg - Arg object.
37
+ * @returns {Promise<EntityTypesResponse>} - Success response
34
38
  * @summary: Get entity types
35
39
  * @description: Get a consolidated list of entity types from all the logs stored on the db, which further helps to filter the logs better
36
40
  */
37
- getEntityTypes({}?: any): Promise<any>;
41
+ getEntityTypes({}?: any): Promise<EntityTypesResponse>;
38
42
  }
@@ -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 AuditTrailValidator = require("./AuditTrailPlatformValidator");
5
+ const AuditTrailModel = require("./AuditTrailPlatformModel");
6
+ const { Logger } = require("./../../common/Logger");
7
+
5
8
  class AuditTrail {
6
9
  constructor(config) {
7
10
  this.config = config;
@@ -10,10 +13,11 @@ class AuditTrail {
10
13
  /**
11
14
  * @param {Object} arg - Arg object.
12
15
  * @param {string} arg.qs - Logs Query
16
+ * @returns {Promise<LogSchemaResponse>} - Success response
13
17
  * @summary: Get paginated audit logs
14
18
  * @description: Get a paginated set of logs that can be filtered using the available set of parameters and get the relevant group of logs
15
19
  */
16
- getAuditLogs({ qs } = {}) {
20
+ async getAuditLogs({ qs } = {}) {
17
21
  const { error } = AuditTrailValidator.getAuditLogs().validate(
18
22
  {
19
23
  qs,
@@ -32,8 +36,11 @@ class AuditTrail {
32
36
  { abortEarly: false, allowUnknown: false }
33
37
  );
34
38
  if (warrning) {
35
- console.log("Parameter Validation warrnings for getAuditLogs");
36
- console.log(warrning);
39
+ Logger({
40
+ level: "WARN",
41
+ message: "Parameter Validation warrnings for getAuditLogs",
42
+ });
43
+ Logger({ level: "WARN", message: warrning });
37
44
  }
38
45
 
39
46
  const query_params = {};
@@ -41,7 +48,7 @@ class AuditTrail {
41
48
 
42
49
  const xHeaders = {};
43
50
 
44
- return PlatformAPIClient.execute(
51
+ const response = await PlatformAPIClient.execute(
45
52
  this.config,
46
53
  "get",
47
54
  `/service/platform/audit-trail/v1.0/company/${this.config.companyId}/logs/`,
@@ -49,15 +56,33 @@ class AuditTrail {
49
56
  undefined,
50
57
  xHeaders
51
58
  );
59
+
60
+ const {
61
+ error: res_error,
62
+ } = AuditTrailModel.LogSchemaResponse().validate(response, {
63
+ abortEarly: false,
64
+ allowUnknown: false,
65
+ });
66
+
67
+ if (res_error) {
68
+ Logger({
69
+ level: "WARN",
70
+ message: "Response Validation Warnnings for getAuditLogs",
71
+ });
72
+ Logger({ level: "WARN", message: res_error });
73
+ }
74
+
75
+ return response;
52
76
  }
53
77
 
54
78
  /**
55
79
  * @param {Object} arg - Arg object.
56
80
  * @param {RequestBodyAuditLog} arg.body
81
+ * @returns {Promise<CreateLogResponse>} - Success response
57
82
  * @summary: Create logs for auditing later on
58
83
  * @description: Create a log instance that stores all the relevant info to be logged
59
84
  */
60
- createAuditLog({ body } = {}) {
85
+ async createAuditLog({ body } = {}) {
61
86
  const { error } = AuditTrailValidator.createAuditLog().validate(
62
87
  {
63
88
  body,
@@ -76,15 +101,18 @@ class AuditTrail {
76
101
  { abortEarly: false, allowUnknown: false }
77
102
  );
78
103
  if (warrning) {
79
- console.log("Parameter Validation warrnings for createAuditLog");
80
- console.log(warrning);
104
+ Logger({
105
+ level: "WARN",
106
+ message: "Parameter Validation warrnings for createAuditLog",
107
+ });
108
+ Logger({ level: "WARN", message: warrning });
81
109
  }
82
110
 
83
111
  const query_params = {};
84
112
 
85
113
  const xHeaders = {};
86
114
 
87
- return PlatformAPIClient.execute(
115
+ const response = await PlatformAPIClient.execute(
88
116
  this.config,
89
117
  "post",
90
118
  `/service/platform/audit-trail/v1.0/company/${this.config.companyId}/logs/`,
@@ -92,15 +120,33 @@ class AuditTrail {
92
120
  body,
93
121
  xHeaders
94
122
  );
123
+
124
+ const {
125
+ error: res_error,
126
+ } = AuditTrailModel.CreateLogResponse().validate(response, {
127
+ abortEarly: false,
128
+ allowUnknown: false,
129
+ });
130
+
131
+ if (res_error) {
132
+ Logger({
133
+ level: "WARN",
134
+ message: "Response Validation Warnnings for createAuditLog",
135
+ });
136
+ Logger({ level: "WARN", message: res_error });
137
+ }
138
+
139
+ return response;
95
140
  }
96
141
 
97
142
  /**
98
143
  * @param {Object} arg - Arg object.
99
144
  * @param {string} arg.id - Log uuid
145
+ * @returns {Promise<LogSchemaResponse>} - Success response
100
146
  * @summary: Get audit log
101
147
  * @description: Get detailed log information by their id
102
148
  */
103
- getAuditLog({ id } = {}) {
149
+ async getAuditLog({ id } = {}) {
104
150
  const { error } = AuditTrailValidator.getAuditLog().validate(
105
151
  {
106
152
  id,
@@ -119,15 +165,18 @@ class AuditTrail {
119
165
  { abortEarly: false, allowUnknown: false }
120
166
  );
121
167
  if (warrning) {
122
- console.log("Parameter Validation warrnings for getAuditLog");
123
- console.log(warrning);
168
+ Logger({
169
+ level: "WARN",
170
+ message: "Parameter Validation warrnings for getAuditLog",
171
+ });
172
+ Logger({ level: "WARN", message: warrning });
124
173
  }
125
174
 
126
175
  const query_params = {};
127
176
 
128
177
  const xHeaders = {};
129
178
 
130
- return PlatformAPIClient.execute(
179
+ const response = await PlatformAPIClient.execute(
131
180
  this.config,
132
181
  "get",
133
182
  `/service/platform/audit-trail/v1.0/company/${this.config.companyId}/logs/${id}`,
@@ -135,14 +184,32 @@ class AuditTrail {
135
184
  undefined,
136
185
  xHeaders
137
186
  );
187
+
188
+ const {
189
+ error: res_error,
190
+ } = AuditTrailModel.LogSchemaResponse().validate(response, {
191
+ abortEarly: false,
192
+ allowUnknown: false,
193
+ });
194
+
195
+ if (res_error) {
196
+ Logger({
197
+ level: "WARN",
198
+ message: "Response Validation Warnnings for getAuditLog",
199
+ });
200
+ Logger({ level: "WARN", message: res_error });
201
+ }
202
+
203
+ return response;
138
204
  }
139
205
 
140
206
  /**
141
207
  * @param {Object} arg - Arg object.
208
+ * @returns {Promise<EntityTypesResponse>} - Success response
142
209
  * @summary: Get entity types
143
210
  * @description: Get a consolidated list of entity types from all the logs stored on the db, which further helps to filter the logs better
144
211
  */
145
- getEntityTypes({} = {}) {
212
+ async getEntityTypes({} = {}) {
146
213
  const { error } = AuditTrailValidator.getEntityTypes().validate(
147
214
  {},
148
215
  { abortEarly: false, allowUnknown: true }
@@ -157,15 +224,18 @@ class AuditTrail {
157
224
  { abortEarly: false, allowUnknown: false }
158
225
  );
159
226
  if (warrning) {
160
- console.log("Parameter Validation warrnings for getEntityTypes");
161
- console.log(warrning);
227
+ Logger({
228
+ level: "WARN",
229
+ message: "Parameter Validation warrnings for getEntityTypes",
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/audit-trail/v1.0/company/${this.config.companyId}/entity-types`,
@@ -173,6 +243,23 @@ class AuditTrail {
173
243
  undefined,
174
244
  xHeaders
175
245
  );
246
+
247
+ const {
248
+ error: res_error,
249
+ } = AuditTrailModel.EntityTypesResponse().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 getEntityTypes",
258
+ });
259
+ Logger({ level: "WARN", message: res_error });
260
+ }
261
+
262
+ return response;
176
263
  }
177
264
  }
178
265
 
@@ -6,104 +6,116 @@ declare class Billing {
6
6
  * @param {Object} arg - Arg object.
7
7
  * @param {string} arg.plan - ID of the plan.
8
8
  * @param {string} arg.couponCode - Coupon code.
9
+ * @returns {Promise<CheckValidityResponse>} - Success response
9
10
  * @summary: Check coupon validity
10
11
  * @description: Check coupon validity.
11
12
  */
12
13
  checkCouponValidity({ plan, couponCode }?: {
13
14
  plan: string;
14
15
  couponCode: string;
15
- }): Promise<any>;
16
+ }): Promise<CheckValidityResponse>;
16
17
  /**
17
18
  * @param {Object} arg - Arg object.
18
19
  * @param {string} arg.extensionId - Extension _id
19
20
  * @param {CreateSubscriptionCharge} arg.body
21
+ * @returns {Promise<CreateSubscriptionResponse>} - Success response
20
22
  * @summary: Create subscription charge
21
23
  * @description: Register subscription charge for a seller of your extension.
22
24
  */
23
25
  createSubscriptionCharge({ extensionId, body }?: {
24
26
  extensionId: string;
25
27
  body: CreateSubscriptionCharge;
26
- }): Promise<any>;
28
+ }): Promise<CreateSubscriptionResponse>;
27
29
  /**
28
30
  * @param {Object} arg - Arg object.
29
31
  * @param {string} arg.extensionId - Extension _id
30
32
  * @param {string} arg.subscriptionId - Subscription charge _id
33
+ * @returns {Promise<EntitySubscription>} - Success response
31
34
  * @summary: Get subscription charge details
32
35
  * @description: Get created subscription charge details
33
36
  */
34
37
  getSubscriptionCharge({ extensionId, subscriptionId }?: {
35
38
  extensionId: string;
36
39
  subscriptionId: string;
37
- }): Promise<any>;
40
+ }): Promise<EntitySubscription>;
38
41
  /**
39
42
  * @param {Object} arg - Arg object.
40
43
  * @param {string} arg.extensionId - Extension _id
41
44
  * @param {string} arg.subscriptionId - Subscription charge _id
45
+ * @returns {Promise<EntitySubscription>} - Success response
42
46
  * @summary: Cancel subscription charge
43
47
  * @description: Cancel subscription and attached charges.
44
48
  */
45
49
  cancelSubscriptionCharge({ extensionId, subscriptionId }?: {
46
50
  extensionId: string;
47
51
  subscriptionId: string;
48
- }): Promise<any>;
52
+ }): Promise<EntitySubscription>;
49
53
  /**
50
54
  * @param {Object} arg - Arg object.
55
+ * @returns {Promise<Invoices>} - Success response
51
56
  * @summary: Get invoices
52
57
  * @description: Get invoices.
53
58
  */
54
- getInvoices({}?: any): Promise<any>;
59
+ getInvoices({}?: any): Promise<Invoices>;
55
60
  /**
56
61
  * @param {Object} arg - Arg object.
57
62
  * @param {string} arg.invoiceId - Invoice id
63
+ * @returns {Promise<Invoice>} - Success response
58
64
  * @summary: Get invoice by id
59
65
  * @description: Get invoice by id.
60
66
  */
61
67
  getInvoiceById({ invoiceId }?: {
62
68
  invoiceId: string;
63
- }): Promise<any>;
69
+ }): Promise<Invoice>;
64
70
  /**
65
71
  * @param {Object} arg - Arg object.
72
+ * @returns {Promise<SubscriptionCustomer>} - Success response
66
73
  * @summary: Get subscription customer detail
67
74
  * @description: Get subscription customer detail.
68
75
  */
69
- getCustomerDetail({}?: any): Promise<any>;
76
+ getCustomerDetail({}?: any): Promise<SubscriptionCustomer>;
70
77
  /**
71
78
  * @param {Object} arg - Arg object.
72
79
  * @param {SubscriptionCustomerCreate} arg.body
80
+ * @returns {Promise<SubscriptionCustomer>} - Success response
73
81
  * @summary: Upsert subscription customer detail
74
82
  * @description: Upsert subscription customer detail.
75
83
  */
76
84
  upsertCustomerDetail({ body }?: {
77
85
  body: SubscriptionCustomerCreate;
78
- }): Promise<any>;
86
+ }): Promise<SubscriptionCustomer>;
79
87
  /**
80
88
  * @param {Object} arg - Arg object.
89
+ * @returns {Promise<SubscriptionStatus>} - Success response
81
90
  * @summary: Get current subscription detail
82
91
  * @description: If subscription is active then it will return is_enabled true and return subscription object. If subscription is not active then is_enabled false and message.
83
92
  */
84
- getSubscription({}?: any): Promise<any>;
93
+ getSubscription({}?: any): Promise<SubscriptionStatus>;
85
94
  /**
86
95
  * @param {Object} arg - Arg object.
96
+ * @returns {Promise<SubscriptionLimit>} - Success response
87
97
  * @summary: Get subscription subscription limits
88
98
  * @description: Get subscription subscription limits.
89
99
  */
90
- getFeatureLimitConfig({}?: any): Promise<any>;
100
+ getFeatureLimitConfig({}?: any): Promise<SubscriptionLimit>;
91
101
  /**
92
102
  * @param {Object} arg - Arg object.
93
103
  * @param {SubscriptionActivateReq} arg.body
104
+ * @returns {Promise<SubscriptionActivateRes>} - Success response
94
105
  * @summary: Activate subscription
95
106
  * @description: It will activate subscription plan for customer
96
107
  */
97
108
  activateSubscriptionPlan({ body }?: {
98
109
  body: SubscriptionActivateReq;
99
- }): Promise<any>;
110
+ }): Promise<SubscriptionActivateRes>;
100
111
  /**
101
112
  * @param {Object} arg - Arg object.
102
113
  * @param {CancelSubscriptionReq} arg.body
114
+ * @returns {Promise<CancelSubscriptionRes>} - Success response
103
115
  * @summary: Cancel subscription
104
116
  * @description: It will cancel current active subscription.
105
117
  */
106
118
  cancelSubscriptionPlan({ body }?: {
107
119
  body: CancelSubscriptionReq;
108
- }): Promise<any>;
120
+ }): Promise<CancelSubscriptionRes>;
109
121
  }