@gofynd/fdk-client-javascript 1.0.4 → 1.1.1
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/README.md +19 -0
- package/index.d.ts +4 -1
- package/index.js +19 -3
- package/package.json +13 -4
- package/partner.d.ts +4 -0
- package/partner.js +7 -0
- package/sdk/application/ApplicationAPIClient.js +2 -4
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +6 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +11 -2
- package/sdk/application/Catalog/CatalogApplicationModel.js +4 -2
- package/sdk/application/Catalog/CatalogApplicationValidator.js +2 -0
- package/sdk/application/Content/ContentApplicationModel.js +0 -5
- package/sdk/application/Lead/LeadApplicationModel.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +0 -15
- package/sdk/application/Order/OrderApplicationClient.js +0 -68
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -17
- package/sdk/application/Order/OrderApplicationModel.js +0 -111
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -1
- package/sdk/application/Order/OrderApplicationValidator.js +0 -7
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/common/BaseOAuthClient.d.ts +17 -0
- package/sdk/common/BaseOAuthClient.js +67 -0
- package/sdk/common/Constant.d.ts +0 -18
- package/sdk/common/Constant.js +0 -22
- package/sdk/common/RequestSigner.js +0 -5
- package/sdk/partner/OAuthClient.d.ts +14 -0
- package/sdk/partner/OAuthClient.js +112 -0
- package/sdk/{APIClient.d.ts → partner/PartnerAPIClient.d.ts} +2 -1
- package/sdk/{APIClient.js → partner/PartnerAPIClient.js} +13 -6
- package/sdk/{Client.d.ts → partner/PartnerClient.d.ts} +2 -2
- package/sdk/{Client.js → partner/PartnerClient.js} +2 -2
- package/sdk/partner/PartnerConfig.d.ts +30 -0
- package/sdk/partner/PartnerConfig.js +39 -0
- package/sdk/partner/index.d.ts +3 -0
- package/sdk/partner/index.js +5 -0
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
- package/sdk/platform/Billing/BillingPlatformClient.js +134 -0
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
- package/sdk/platform/Billing/BillingPlatformValidator.js +14 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +29 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +181 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +4 -0
- package/sdk/platform/Cart/CartPlatformModel.js +37 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +3 -1
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +5 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +1 -1
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -5
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +0 -183
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +0 -417
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +0 -10
- package/sdk/platform/Communication/CommunicationPlatformClient.js +0 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +4 -0
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +0 -22
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +0 -56
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +22 -1
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +123 -2
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +2 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +12 -0
- package/sdk/platform/Content/ContentPlatformModel.js +0 -5
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +2 -2
- package/sdk/platform/Discount/DiscountPlatformClient.js +1 -1
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +1 -0
- package/sdk/platform/Discount/DiscountPlatformModel.js +15 -0
- package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +1 -1
- package/sdk/platform/Lead/LeadPlatformModel.js +1 -0
- package/sdk/platform/OAuthClient.js +3 -9
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +1 -47
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +5 -201
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -3
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -26
- package/sdk/platform/Order/OrderPlatformClient.d.ts +51 -183
- package/sdk/platform/Order/OrderPlatformClient.js +243 -931
- package/sdk/platform/Order/OrderPlatformModel.d.ts +4 -20
- package/sdk/platform/Order/OrderPlatformModel.js +38 -182
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +3 -12
- package/sdk/platform/Order/OrderPlatformValidator.js +19 -95
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +24 -10
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +111 -44
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +2 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +13 -5
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +2 -0
- package/sdk/platform/Payment/PaymentPlatformModel.js +12 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +16 -41
- package/sdk/platform/PlatformApplicationClient.js +17 -45
- package/sdk/platform/PlatformClient.d.ts +124 -263
- package/sdk/platform/PlatformClient.js +148 -315
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +14 -16
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +63 -77
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +7 -8
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +11 -0
- package/sdk/platform/Share/SharePlatformApplicationClient.js +61 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -0
- package/sdk/platform/Share/SharePlatformModel.d.ts +2 -0
- package/sdk/platform/Share/SharePlatformModel.js +11 -0
- package/sdk/platform/index.d.ts +0 -1
- package/sdk/platform/index.js +0 -2
- package/sdk/Config.d.ts +0 -9
- package/sdk/Config.js +0 -17
- package/sdk/constructUrl.d.ts +0 -5
- package/sdk/constructUrl.js +0 -13
- package/sdk/index.d.ts +0 -3
- package/sdk/index.js +0 -5
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +0 -109
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +0 -558
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +0 -11
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +0 -56
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +0 -88
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +0 -361
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +0 -23
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +0 -169
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.d.ts +0 -7
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +0 -38
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
2
|
-
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
-
const Paginator = require("../../common/Paginator");
|
|
4
|
-
const AnalyticsValidator = require("./AnalyticsPlatformValidator");
|
|
5
|
-
const AnalyticsModel = require("./AnalyticsPlatformModel");
|
|
6
|
-
const { Logger } = require("./../../common/Logger");
|
|
7
|
-
const Joi = require("joi");
|
|
8
|
-
|
|
9
|
-
class Analytics {
|
|
10
|
-
constructor(config) {
|
|
11
|
-
this.config = config;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* @param {Object} arg - Arg object.
|
|
16
|
-
* @param {string} arg.exportType - Export type / format
|
|
17
|
-
* @param {ExportJobReq} arg.body
|
|
18
|
-
* @returns {Promise<ExportJobRes>} - Success response
|
|
19
|
-
* @summary: Create data export job in required format
|
|
20
|
-
* @description: Create data export job in required format
|
|
21
|
-
*/
|
|
22
|
-
async createExportJob({ exportType, body } = {}) {
|
|
23
|
-
const { error } = AnalyticsValidator.createExportJob().validate(
|
|
24
|
-
{
|
|
25
|
-
exportType,
|
|
26
|
-
body,
|
|
27
|
-
},
|
|
28
|
-
{ abortEarly: false, allowUnknown: true }
|
|
29
|
-
);
|
|
30
|
-
if (error) {
|
|
31
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
// Showing warrnings if extra unknown parameters are found
|
|
35
|
-
const { error: warrning } = AnalyticsValidator.createExportJob().validate(
|
|
36
|
-
{
|
|
37
|
-
exportType,
|
|
38
|
-
body,
|
|
39
|
-
},
|
|
40
|
-
{ abortEarly: false, allowUnknown: false }
|
|
41
|
-
);
|
|
42
|
-
if (warrning) {
|
|
43
|
-
Logger({
|
|
44
|
-
level: "WARN",
|
|
45
|
-
message: "Parameter Validation warrnings for createExportJob",
|
|
46
|
-
});
|
|
47
|
-
Logger({ level: "WARN", message: warrning });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const query_params = {};
|
|
51
|
-
|
|
52
|
-
const xHeaders = {};
|
|
53
|
-
|
|
54
|
-
const response = await PlatformAPIClient.execute(
|
|
55
|
-
this.config,
|
|
56
|
-
"post",
|
|
57
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/export/${exportType}`,
|
|
58
|
-
query_params,
|
|
59
|
-
body,
|
|
60
|
-
xHeaders
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
const {
|
|
64
|
-
error: res_error,
|
|
65
|
-
} = AnalyticsModel.ExportJobRes().validate(response, {
|
|
66
|
-
abortEarly: false,
|
|
67
|
-
allowUnknown: false,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (res_error) {
|
|
71
|
-
Logger({
|
|
72
|
-
level: "WARN",
|
|
73
|
-
message: "Response Validation Warnnings for createExportJob",
|
|
74
|
-
});
|
|
75
|
-
Logger({ level: "WARN", message: res_error });
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return response;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* @param {Object} arg - Arg object.
|
|
83
|
-
* @param {string} arg.exportType - Export type / format
|
|
84
|
-
* @param {string} arg.jobId - Export job id
|
|
85
|
-
* @returns {Promise<ExportJobStatusRes>} - Success response
|
|
86
|
-
* @summary: Get data export job status
|
|
87
|
-
* @description: Get data export job status
|
|
88
|
-
*/
|
|
89
|
-
async getExportJobStatus({ exportType, jobId } = {}) {
|
|
90
|
-
const { error } = AnalyticsValidator.getExportJobStatus().validate(
|
|
91
|
-
{
|
|
92
|
-
exportType,
|
|
93
|
-
jobId,
|
|
94
|
-
},
|
|
95
|
-
{ abortEarly: false, allowUnknown: true }
|
|
96
|
-
);
|
|
97
|
-
if (error) {
|
|
98
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
// Showing warrnings if extra unknown parameters are found
|
|
102
|
-
const {
|
|
103
|
-
error: warrning,
|
|
104
|
-
} = AnalyticsValidator.getExportJobStatus().validate(
|
|
105
|
-
{
|
|
106
|
-
exportType,
|
|
107
|
-
jobId,
|
|
108
|
-
},
|
|
109
|
-
{ abortEarly: false, allowUnknown: false }
|
|
110
|
-
);
|
|
111
|
-
if (warrning) {
|
|
112
|
-
Logger({
|
|
113
|
-
level: "WARN",
|
|
114
|
-
message: "Parameter Validation warrnings for getExportJobStatus",
|
|
115
|
-
});
|
|
116
|
-
Logger({ level: "WARN", message: warrning });
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
const query_params = {};
|
|
120
|
-
|
|
121
|
-
const xHeaders = {};
|
|
122
|
-
|
|
123
|
-
const response = await PlatformAPIClient.execute(
|
|
124
|
-
this.config,
|
|
125
|
-
"get",
|
|
126
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/export/${exportType}/job/${jobId}`,
|
|
127
|
-
query_params,
|
|
128
|
-
undefined,
|
|
129
|
-
xHeaders
|
|
130
|
-
);
|
|
131
|
-
|
|
132
|
-
const {
|
|
133
|
-
error: res_error,
|
|
134
|
-
} = AnalyticsModel.ExportJobStatusRes().validate(response, {
|
|
135
|
-
abortEarly: false,
|
|
136
|
-
allowUnknown: false,
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
if (res_error) {
|
|
140
|
-
Logger({
|
|
141
|
-
level: "WARN",
|
|
142
|
-
message: "Response Validation Warnnings for getExportJobStatus",
|
|
143
|
-
});
|
|
144
|
-
Logger({ level: "WARN", message: res_error });
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return response;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* @param {Object} arg - Arg object.
|
|
152
|
-
* @param {string} arg.logType - Log type
|
|
153
|
-
* @param {number} [arg.pageNo] - Current page number
|
|
154
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
155
|
-
* @param {GetLogsListReq} arg.body
|
|
156
|
-
* @returns {Promise<GetLogsListRes>} - Success response
|
|
157
|
-
* @summary: Get logs list
|
|
158
|
-
* @description: Get logs list
|
|
159
|
-
*/
|
|
160
|
-
async getLogsList({ logType, body, pageNo, pageSize } = {}) {
|
|
161
|
-
const { error } = AnalyticsValidator.getLogsList().validate(
|
|
162
|
-
{
|
|
163
|
-
logType,
|
|
164
|
-
body,
|
|
165
|
-
pageNo,
|
|
166
|
-
pageSize,
|
|
167
|
-
},
|
|
168
|
-
{ abortEarly: false, allowUnknown: true }
|
|
169
|
-
);
|
|
170
|
-
if (error) {
|
|
171
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
// Showing warrnings if extra unknown parameters are found
|
|
175
|
-
const { error: warrning } = AnalyticsValidator.getLogsList().validate(
|
|
176
|
-
{
|
|
177
|
-
logType,
|
|
178
|
-
body,
|
|
179
|
-
pageNo,
|
|
180
|
-
pageSize,
|
|
181
|
-
},
|
|
182
|
-
{ abortEarly: false, allowUnknown: false }
|
|
183
|
-
);
|
|
184
|
-
if (warrning) {
|
|
185
|
-
Logger({
|
|
186
|
-
level: "WARN",
|
|
187
|
-
message: "Parameter Validation warrnings for getLogsList",
|
|
188
|
-
});
|
|
189
|
-
Logger({ level: "WARN", message: warrning });
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const query_params = {};
|
|
193
|
-
query_params["page_no"] = pageNo;
|
|
194
|
-
query_params["page_size"] = pageSize;
|
|
195
|
-
|
|
196
|
-
const xHeaders = {};
|
|
197
|
-
|
|
198
|
-
const response = await PlatformAPIClient.execute(
|
|
199
|
-
this.config,
|
|
200
|
-
"post",
|
|
201
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/logs/${logType}`,
|
|
202
|
-
query_params,
|
|
203
|
-
body,
|
|
204
|
-
xHeaders
|
|
205
|
-
);
|
|
206
|
-
|
|
207
|
-
const {
|
|
208
|
-
error: res_error,
|
|
209
|
-
} = AnalyticsModel.GetLogsListRes().validate(response, {
|
|
210
|
-
abortEarly: false,
|
|
211
|
-
allowUnknown: false,
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
if (res_error) {
|
|
215
|
-
Logger({
|
|
216
|
-
level: "WARN",
|
|
217
|
-
message: "Response Validation Warnnings for getLogsList",
|
|
218
|
-
});
|
|
219
|
-
Logger({ level: "WARN", message: res_error });
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return response;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* @param {Object} arg - Arg object.
|
|
227
|
-
* @param {string} arg.logType - Log type
|
|
228
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
229
|
-
* @param {GetLogsListReq} arg.body
|
|
230
|
-
* @summary: Get logs list
|
|
231
|
-
* @description: Get logs list
|
|
232
|
-
*/
|
|
233
|
-
getLogsListPaginator({ logType, pageSize, body } = {}) {
|
|
234
|
-
const paginator = new Paginator();
|
|
235
|
-
const callback = async () => {
|
|
236
|
-
const pageId = paginator.nextId;
|
|
237
|
-
const pageNo = paginator.pageNo;
|
|
238
|
-
const pageType = "number";
|
|
239
|
-
const data = await this.getLogsList({
|
|
240
|
-
logType: logType,
|
|
241
|
-
body: body,
|
|
242
|
-
pageNo: pageNo,
|
|
243
|
-
pageSize: pageSize,
|
|
244
|
-
});
|
|
245
|
-
paginator.setPaginator({
|
|
246
|
-
hasNext: data.page.has_next ? true : false,
|
|
247
|
-
nextId: data.page.next_id,
|
|
248
|
-
});
|
|
249
|
-
return data;
|
|
250
|
-
};
|
|
251
|
-
paginator.setCallback(callback.bind(this));
|
|
252
|
-
return paginator;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* @param {Object} arg - Arg object.
|
|
257
|
-
* @param {number} [arg.pageNo] - Current page number
|
|
258
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
259
|
-
* @param {string} arg.logType - Log type
|
|
260
|
-
* @param {SearchLogReq} arg.body
|
|
261
|
-
* @returns {Promise<SearchLogRes>} - Success response
|
|
262
|
-
* @summary: Search logs
|
|
263
|
-
* @description: Search logs
|
|
264
|
-
*/
|
|
265
|
-
async searchLogs({ logType, body, pageNo, pageSize } = {}) {
|
|
266
|
-
const { error } = AnalyticsValidator.searchLogs().validate(
|
|
267
|
-
{
|
|
268
|
-
logType,
|
|
269
|
-
body,
|
|
270
|
-
pageNo,
|
|
271
|
-
pageSize,
|
|
272
|
-
},
|
|
273
|
-
{ abortEarly: false, allowUnknown: true }
|
|
274
|
-
);
|
|
275
|
-
if (error) {
|
|
276
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Showing warrnings if extra unknown parameters are found
|
|
280
|
-
const { error: warrning } = AnalyticsValidator.searchLogs().validate(
|
|
281
|
-
{
|
|
282
|
-
logType,
|
|
283
|
-
body,
|
|
284
|
-
pageNo,
|
|
285
|
-
pageSize,
|
|
286
|
-
},
|
|
287
|
-
{ abortEarly: false, allowUnknown: false }
|
|
288
|
-
);
|
|
289
|
-
if (warrning) {
|
|
290
|
-
Logger({
|
|
291
|
-
level: "WARN",
|
|
292
|
-
message: "Parameter Validation warrnings for searchLogs",
|
|
293
|
-
});
|
|
294
|
-
Logger({ level: "WARN", message: warrning });
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const query_params = {};
|
|
298
|
-
query_params["page_no"] = pageNo;
|
|
299
|
-
query_params["page_size"] = pageSize;
|
|
300
|
-
|
|
301
|
-
const xHeaders = {};
|
|
302
|
-
|
|
303
|
-
const response = await PlatformAPIClient.execute(
|
|
304
|
-
this.config,
|
|
305
|
-
"post",
|
|
306
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/logs/${logType}/search`,
|
|
307
|
-
query_params,
|
|
308
|
-
body,
|
|
309
|
-
xHeaders
|
|
310
|
-
);
|
|
311
|
-
|
|
312
|
-
const {
|
|
313
|
-
error: res_error,
|
|
314
|
-
} = AnalyticsModel.SearchLogRes().validate(response, {
|
|
315
|
-
abortEarly: false,
|
|
316
|
-
allowUnknown: false,
|
|
317
|
-
});
|
|
318
|
-
|
|
319
|
-
if (res_error) {
|
|
320
|
-
Logger({
|
|
321
|
-
level: "WARN",
|
|
322
|
-
message: "Response Validation Warnnings for searchLogs",
|
|
323
|
-
});
|
|
324
|
-
Logger({ level: "WARN", message: res_error });
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return response;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* @param {Object} arg - Arg object.
|
|
332
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
333
|
-
* @param {string} arg.logType - Log type
|
|
334
|
-
* @param {SearchLogReq} arg.body
|
|
335
|
-
* @summary: Search logs
|
|
336
|
-
* @description: Search logs
|
|
337
|
-
*/
|
|
338
|
-
searchLogsPaginator({ pageSize, logType, body } = {}) {
|
|
339
|
-
const paginator = new Paginator();
|
|
340
|
-
const callback = async () => {
|
|
341
|
-
const pageId = paginator.nextId;
|
|
342
|
-
const pageNo = paginator.pageNo;
|
|
343
|
-
const pageType = "number";
|
|
344
|
-
const data = await this.searchLogs({
|
|
345
|
-
logType: logType,
|
|
346
|
-
body: body,
|
|
347
|
-
pageNo: pageNo,
|
|
348
|
-
pageSize: pageSize,
|
|
349
|
-
});
|
|
350
|
-
paginator.setPaginator({
|
|
351
|
-
hasNext: data.page.has_next ? true : false,
|
|
352
|
-
nextId: data.page.next_id,
|
|
353
|
-
});
|
|
354
|
-
return data;
|
|
355
|
-
};
|
|
356
|
-
paginator.setCallback(callback.bind(this));
|
|
357
|
-
return paginator;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
|
|
361
|
-
module.exports = Analytics;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export = AnalyticsModel;
|
|
2
|
-
declare class AnalyticsModel {
|
|
3
|
-
static AbandonCartDetail(): any;
|
|
4
|
-
static AbandonCartsDetail(): any;
|
|
5
|
-
static AbandonCartsList(): any;
|
|
6
|
-
static ErrorRes(): any;
|
|
7
|
-
static ExportJobReq(): any;
|
|
8
|
-
static ExportJobRes(): any;
|
|
9
|
-
static ExportJobStatusRes(): any;
|
|
10
|
-
static GetLogsListReq(): any;
|
|
11
|
-
static GetLogsListRes(): any;
|
|
12
|
-
static LogInfo(): any;
|
|
13
|
-
static MkpLogsResp(): any;
|
|
14
|
-
static Page(): any;
|
|
15
|
-
static ReceivedAt(): any;
|
|
16
|
-
static SearchLogReq(): any;
|
|
17
|
-
static SearchLogRes(): any;
|
|
18
|
-
static StatGroup(): any;
|
|
19
|
-
static StatsGroupComponent(): any;
|
|
20
|
-
static StatsGroupComponents(): any;
|
|
21
|
-
static StatsGroups(): any;
|
|
22
|
-
static StatsRes(): any;
|
|
23
|
-
}
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
const Joi = require("joi");
|
|
2
|
-
|
|
3
|
-
class AnalyticsModel {
|
|
4
|
-
static AbandonCartDetail() {
|
|
5
|
-
return Joi.object({
|
|
6
|
-
_id: Joi.string().allow(""),
|
|
7
|
-
address: Joi.any(),
|
|
8
|
-
articles: Joi.array().items(Joi.any()),
|
|
9
|
-
breakup: Joi.any(),
|
|
10
|
-
cart_value: Joi.string().allow(""),
|
|
11
|
-
user_id: Joi.string().allow(""),
|
|
12
|
-
});
|
|
13
|
-
}
|
|
14
|
-
static AbandonCartsDetail() {
|
|
15
|
-
return Joi.object({
|
|
16
|
-
context_app_application_id: Joi.string().allow(""),
|
|
17
|
-
context_traits_email: Joi.string().allow(""),
|
|
18
|
-
context_traits_first_name: Joi.string().allow(""),
|
|
19
|
-
context_traits_last_name: Joi.string().allow(""),
|
|
20
|
-
context_traits_phone_number: Joi.string().allow(""),
|
|
21
|
-
properties_breakup_values_raw_total: Joi.string().allow(""),
|
|
22
|
-
properties_cart_id: Joi.string().allow(""),
|
|
23
|
-
received_at: AnalyticsModel.ReceivedAt(),
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
static AbandonCartsList() {
|
|
27
|
-
return Joi.object({
|
|
28
|
-
cart_total: Joi.string().allow(""),
|
|
29
|
-
items: Joi.array().items(AnalyticsModel.AbandonCartsDetail()),
|
|
30
|
-
page: AnalyticsModel.Page(),
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
static ErrorRes() {
|
|
34
|
-
return Joi.object({
|
|
35
|
-
message: Joi.string().allow(""),
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
static ExportJobReq() {
|
|
39
|
-
return Joi.object({
|
|
40
|
-
end_time: Joi.string().allow(""),
|
|
41
|
-
event_type: Joi.string().allow(""),
|
|
42
|
-
marketplace_name: Joi.string().allow(""),
|
|
43
|
-
start_time: Joi.string().allow(""),
|
|
44
|
-
trace_id: Joi.string().allow(""),
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
static ExportJobRes() {
|
|
48
|
-
return Joi.object({
|
|
49
|
-
job_id: Joi.string().allow(""),
|
|
50
|
-
status: Joi.string().allow(""),
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
static ExportJobStatusRes() {
|
|
54
|
-
return Joi.object({
|
|
55
|
-
download_url: Joi.string().allow(""),
|
|
56
|
-
job_id: Joi.string().allow(""),
|
|
57
|
-
status: Joi.string().allow(""),
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
static GetLogsListReq() {
|
|
61
|
-
return Joi.object({
|
|
62
|
-
company_id: Joi.string().allow(""),
|
|
63
|
-
end_date: Joi.string().allow(""),
|
|
64
|
-
marketplace_name: Joi.string().allow(""),
|
|
65
|
-
start_date: Joi.string().allow(""),
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
static GetLogsListRes() {
|
|
69
|
-
return Joi.object({
|
|
70
|
-
items: Joi.array().items(AnalyticsModel.MkpLogsResp()),
|
|
71
|
-
page: AnalyticsModel.Page(),
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
static LogInfo() {
|
|
75
|
-
return Joi.object({
|
|
76
|
-
_id: Joi.string().allow(""),
|
|
77
|
-
article_id: Joi.string().allow(""),
|
|
78
|
-
brand_id: Joi.number(),
|
|
79
|
-
company_id: Joi.number(),
|
|
80
|
-
event: Joi.string().allow(""),
|
|
81
|
-
event_type: Joi.string().allow(""),
|
|
82
|
-
item_id: Joi.number(),
|
|
83
|
-
marketplace_name: Joi.string().allow(""),
|
|
84
|
-
seller_identifier: Joi.string().allow(""),
|
|
85
|
-
status: Joi.string().allow(""),
|
|
86
|
-
store_code: Joi.string().allow(""),
|
|
87
|
-
store_id: Joi.number(),
|
|
88
|
-
trace_id: Joi.string().allow(""),
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
static MkpLogsResp() {
|
|
92
|
-
return Joi.object({
|
|
93
|
-
count: Joi.string().allow(""),
|
|
94
|
-
end_time_iso: Joi.string().allow(""),
|
|
95
|
-
event_type: Joi.string().allow(""),
|
|
96
|
-
start_time_iso: Joi.string().allow(""),
|
|
97
|
-
status: Joi.string().allow(""),
|
|
98
|
-
trace_id: Joi.string().allow(""),
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
static Page() {
|
|
102
|
-
return Joi.object({
|
|
103
|
-
current: Joi.number(),
|
|
104
|
-
has_next: Joi.boolean(),
|
|
105
|
-
has_previous: Joi.boolean(),
|
|
106
|
-
item_total: Joi.number(),
|
|
107
|
-
next_id: Joi.string().allow(""),
|
|
108
|
-
size: Joi.number(),
|
|
109
|
-
type: Joi.string().allow("").required(),
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
static ReceivedAt() {
|
|
113
|
-
return Joi.object({
|
|
114
|
-
value: Joi.string().allow(""),
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
static SearchLogReq() {
|
|
118
|
-
return Joi.object({
|
|
119
|
-
company_id: Joi.string().allow(""),
|
|
120
|
-
end_date: Joi.string().allow(""),
|
|
121
|
-
identifier: Joi.string().allow(""),
|
|
122
|
-
identifier_value: Joi.string().allow(""),
|
|
123
|
-
marketplace_name: Joi.string().allow(""),
|
|
124
|
-
start_date: Joi.string().allow(""),
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
static SearchLogRes() {
|
|
128
|
-
return Joi.object({
|
|
129
|
-
items: Joi.array().items(AnalyticsModel.LogInfo()),
|
|
130
|
-
page: AnalyticsModel.Page(),
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
static StatGroup() {
|
|
134
|
-
return Joi.object({
|
|
135
|
-
key: Joi.string().allow(""),
|
|
136
|
-
title: Joi.string().allow(""),
|
|
137
|
-
url: Joi.string().allow(""),
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
static StatsGroupComponent() {
|
|
141
|
-
return Joi.object({
|
|
142
|
-
filters: Joi.any(),
|
|
143
|
-
key: Joi.string().allow(""),
|
|
144
|
-
title: Joi.string().allow(""),
|
|
145
|
-
type: Joi.string().allow(""),
|
|
146
|
-
url: Joi.string().allow(""),
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
static StatsGroupComponents() {
|
|
150
|
-
return Joi.object({
|
|
151
|
-
components: Joi.array().items(AnalyticsModel.StatsGroupComponent()),
|
|
152
|
-
title: Joi.string().allow(""),
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
static StatsGroups() {
|
|
156
|
-
return Joi.object({
|
|
157
|
-
groups: Joi.array().items(AnalyticsModel.StatGroup()),
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
static StatsRes() {
|
|
161
|
-
return Joi.object({
|
|
162
|
-
data: Joi.any(),
|
|
163
|
-
key: Joi.string().allow(""),
|
|
164
|
-
title: Joi.string().allow(""),
|
|
165
|
-
type: Joi.string().allow(""),
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
module.exports = AnalyticsModel;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
const Joi = require("joi");
|
|
2
|
-
|
|
3
|
-
const AnalyticsModel = require("./AnalyticsPlatformModel");
|
|
4
|
-
class AnalyticsValidator {
|
|
5
|
-
static createExportJob() {
|
|
6
|
-
return Joi.object({
|
|
7
|
-
exportType: Joi.string().allow("").required(),
|
|
8
|
-
body: AnalyticsModel.ExportJobReq().required(),
|
|
9
|
-
}).required();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
static getExportJobStatus() {
|
|
13
|
-
return Joi.object({
|
|
14
|
-
exportType: Joi.string().allow("").required(),
|
|
15
|
-
jobId: Joi.string().allow("").required(),
|
|
16
|
-
}).required();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
static getLogsList() {
|
|
20
|
-
return Joi.object({
|
|
21
|
-
logType: Joi.string().allow("").required(),
|
|
22
|
-
pageNo: Joi.number(),
|
|
23
|
-
pageSize: Joi.number(),
|
|
24
|
-
body: AnalyticsModel.GetLogsListReq().required(),
|
|
25
|
-
}).required();
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static searchLogs() {
|
|
29
|
-
return Joi.object({
|
|
30
|
-
pageNo: Joi.number(),
|
|
31
|
-
pageSize: Joi.number(),
|
|
32
|
-
logType: Joi.string().allow("").required(),
|
|
33
|
-
body: AnalyticsModel.SearchLogReq().required(),
|
|
34
|
-
}).required();
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
module.exports = AnalyticsValidator;
|