@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.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- 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
|
-
|
|
39
|
-
|
|
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
|
-
|
|
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
|
-
|
|
87
|
-
|
|
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
|
-
|
|
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
|
-
|
|
139
|
-
|
|
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
|
-
|
|
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
|
-
|
|
223
|
-
|
|
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
|
-
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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
|
-
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
80
|
-
|
|
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
|
-
|
|
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
|
-
|
|
123
|
-
|
|
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
|
-
|
|
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
|
-
|
|
161
|
-
|
|
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
|
-
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
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<
|
|
120
|
+
}): Promise<CancelSubscriptionRes>;
|
|
109
121
|
}
|