@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,558 +0,0 @@
|
|
|
1
|
-
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
2
|
-
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
-
const Paginator = require("../../common/Paginator");
|
|
4
|
-
const AnalyticsValidator = require("./AnalyticsPlatformApplicationValidator");
|
|
5
|
-
const AnalyticsModel = require("./AnalyticsPlatformModel");
|
|
6
|
-
const { Logger } = require("./../../common/Logger");
|
|
7
|
-
const Joi = require("joi");
|
|
8
|
-
|
|
9
|
-
class Analytics {
|
|
10
|
-
constructor(config, applicationId) {
|
|
11
|
-
this.config = config;
|
|
12
|
-
this.applicationId = applicationId;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @param {Object} arg - Arg object.
|
|
17
|
-
* @param {string} arg.cartId - Cart Id
|
|
18
|
-
* @returns {Promise<AbandonCartDetail>} - Success response
|
|
19
|
-
* @summary: Get abandon carts details
|
|
20
|
-
* @description: Get abandon cart details
|
|
21
|
-
*/
|
|
22
|
-
async getAbandonCartDetail({ cartId } = {}) {
|
|
23
|
-
const { error } = AnalyticsValidator.getAbandonCartDetail().validate(
|
|
24
|
-
{
|
|
25
|
-
cartId,
|
|
26
|
-
},
|
|
27
|
-
{ abortEarly: false, allowUnknown: true }
|
|
28
|
-
);
|
|
29
|
-
if (error) {
|
|
30
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Showing warrnings if extra unknown parameters are found
|
|
34
|
-
const {
|
|
35
|
-
error: warrning,
|
|
36
|
-
} = AnalyticsValidator.getAbandonCartDetail().validate(
|
|
37
|
-
{
|
|
38
|
-
cartId,
|
|
39
|
-
},
|
|
40
|
-
{ abortEarly: false, allowUnknown: false }
|
|
41
|
-
);
|
|
42
|
-
if (warrning) {
|
|
43
|
-
Logger({
|
|
44
|
-
level: "WARN",
|
|
45
|
-
message: "Parameter Validation warrnings for getAbandonCartDetail",
|
|
46
|
-
});
|
|
47
|
-
Logger({ level: "WARN", message: warrning });
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
const query_params = {};
|
|
51
|
-
|
|
52
|
-
const response = await PlatformAPIClient.execute(
|
|
53
|
-
this.config,
|
|
54
|
-
"get",
|
|
55
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/abandon-cart/${cartId}`,
|
|
56
|
-
query_params,
|
|
57
|
-
undefined
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const {
|
|
61
|
-
error: res_error,
|
|
62
|
-
} = AnalyticsModel.AbandonCartDetail().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 getAbandonCartDetail",
|
|
71
|
-
});
|
|
72
|
-
Logger({ level: "WARN", message: res_error });
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
return response;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* @param {Object} arg - Arg object.
|
|
80
|
-
* @param {string} arg.fromDate - From date
|
|
81
|
-
* @param {string} arg.toDate - To date
|
|
82
|
-
* @param {number} [arg.pageNo] - Current page number
|
|
83
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
84
|
-
* @returns {Promise<AbandonCartsList>} - Success response
|
|
85
|
-
* @summary: Get abandon carts list
|
|
86
|
-
* @description: Get abandon carts list
|
|
87
|
-
*/
|
|
88
|
-
async getAbandonCartList({ fromDate, toDate, pageNo, pageSize } = {}) {
|
|
89
|
-
const { error } = AnalyticsValidator.getAbandonCartList().validate(
|
|
90
|
-
{
|
|
91
|
-
fromDate,
|
|
92
|
-
toDate,
|
|
93
|
-
pageNo,
|
|
94
|
-
pageSize,
|
|
95
|
-
},
|
|
96
|
-
{ abortEarly: false, allowUnknown: true }
|
|
97
|
-
);
|
|
98
|
-
if (error) {
|
|
99
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
// Showing warrnings if extra unknown parameters are found
|
|
103
|
-
const {
|
|
104
|
-
error: warrning,
|
|
105
|
-
} = AnalyticsValidator.getAbandonCartList().validate(
|
|
106
|
-
{
|
|
107
|
-
fromDate,
|
|
108
|
-
toDate,
|
|
109
|
-
pageNo,
|
|
110
|
-
pageSize,
|
|
111
|
-
},
|
|
112
|
-
{ abortEarly: false, allowUnknown: false }
|
|
113
|
-
);
|
|
114
|
-
if (warrning) {
|
|
115
|
-
Logger({
|
|
116
|
-
level: "WARN",
|
|
117
|
-
message: "Parameter Validation warrnings for getAbandonCartList",
|
|
118
|
-
});
|
|
119
|
-
Logger({ level: "WARN", message: warrning });
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
const query_params = {};
|
|
123
|
-
query_params["page_no"] = pageNo;
|
|
124
|
-
query_params["page_size"] = pageSize;
|
|
125
|
-
|
|
126
|
-
const response = await PlatformAPIClient.execute(
|
|
127
|
-
this.config,
|
|
128
|
-
"get",
|
|
129
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/from/${fromDate}/to/${toDate}/abandon-cart/`,
|
|
130
|
-
query_params,
|
|
131
|
-
undefined
|
|
132
|
-
);
|
|
133
|
-
|
|
134
|
-
const {
|
|
135
|
-
error: res_error,
|
|
136
|
-
} = AnalyticsModel.AbandonCartsList().validate(response, {
|
|
137
|
-
abortEarly: false,
|
|
138
|
-
allowUnknown: false,
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
if (res_error) {
|
|
142
|
-
Logger({
|
|
143
|
-
level: "WARN",
|
|
144
|
-
message: "Response Validation Warnnings for getAbandonCartList",
|
|
145
|
-
});
|
|
146
|
-
Logger({ level: "WARN", message: res_error });
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return response;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* @param {Object} arg - Arg object.
|
|
154
|
-
* @param {string} arg.companyId - Company Id
|
|
155
|
-
* @param {string} arg.applicationId - Application Id
|
|
156
|
-
* @param {string} arg.fromDate - From date
|
|
157
|
-
* @param {string} arg.toDate - To date
|
|
158
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
159
|
-
* @summary: Get abandon carts list
|
|
160
|
-
* @description: Get abandon carts list
|
|
161
|
-
*/
|
|
162
|
-
getAbandonCartListPaginator({
|
|
163
|
-
companyId,
|
|
164
|
-
applicationId,
|
|
165
|
-
fromDate,
|
|
166
|
-
toDate,
|
|
167
|
-
pageSize,
|
|
168
|
-
} = {}) {
|
|
169
|
-
const paginator = new Paginator();
|
|
170
|
-
const callback = async () => {
|
|
171
|
-
const pageId = paginator.nextId;
|
|
172
|
-
const pageNo = paginator.pageNo;
|
|
173
|
-
const pageType = "number";
|
|
174
|
-
const data = await this.getAbandonCartList({
|
|
175
|
-
companyId: companyId,
|
|
176
|
-
applicationId: applicationId,
|
|
177
|
-
fromDate: fromDate,
|
|
178
|
-
toDate: toDate,
|
|
179
|
-
pageNo: pageNo,
|
|
180
|
-
pageSize: pageSize,
|
|
181
|
-
});
|
|
182
|
-
paginator.setPaginator({
|
|
183
|
-
hasNext: data.page.has_next ? true : false,
|
|
184
|
-
nextId: data.page.next_id,
|
|
185
|
-
});
|
|
186
|
-
return data;
|
|
187
|
-
};
|
|
188
|
-
paginator.setCallback(callback.bind(this));
|
|
189
|
-
return paginator;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
/**
|
|
193
|
-
* @param {Object} arg - Arg object.
|
|
194
|
-
* @param {string} arg.fromDate - From date
|
|
195
|
-
* @param {string} arg.toDate - To date
|
|
196
|
-
* @returns {Promise<string>} - Success response
|
|
197
|
-
* @summary: Get abandon carts csv
|
|
198
|
-
* @description: Get abandon carts csv
|
|
199
|
-
*/
|
|
200
|
-
async getAbandonCartsCSV({ fromDate, toDate } = {}) {
|
|
201
|
-
const { error } = AnalyticsValidator.getAbandonCartsCSV().validate(
|
|
202
|
-
{
|
|
203
|
-
fromDate,
|
|
204
|
-
toDate,
|
|
205
|
-
},
|
|
206
|
-
{ abortEarly: false, allowUnknown: true }
|
|
207
|
-
);
|
|
208
|
-
if (error) {
|
|
209
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// Showing warrnings if extra unknown parameters are found
|
|
213
|
-
const {
|
|
214
|
-
error: warrning,
|
|
215
|
-
} = AnalyticsValidator.getAbandonCartsCSV().validate(
|
|
216
|
-
{
|
|
217
|
-
fromDate,
|
|
218
|
-
toDate,
|
|
219
|
-
},
|
|
220
|
-
{ abortEarly: false, allowUnknown: false }
|
|
221
|
-
);
|
|
222
|
-
if (warrning) {
|
|
223
|
-
Logger({
|
|
224
|
-
level: "WARN",
|
|
225
|
-
message: "Parameter Validation warrnings for getAbandonCartsCSV",
|
|
226
|
-
});
|
|
227
|
-
Logger({ level: "WARN", message: warrning });
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
const query_params = {};
|
|
231
|
-
|
|
232
|
-
const response = await PlatformAPIClient.execute(
|
|
233
|
-
this.config,
|
|
234
|
-
"get",
|
|
235
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/${fromDate}/to/${toDate}/abandon-cart.csv`,
|
|
236
|
-
query_params,
|
|
237
|
-
undefined
|
|
238
|
-
);
|
|
239
|
-
|
|
240
|
-
const { error: res_error } = Joi.string()
|
|
241
|
-
.allow("")
|
|
242
|
-
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
243
|
-
|
|
244
|
-
if (res_error) {
|
|
245
|
-
Logger({
|
|
246
|
-
level: "WARN",
|
|
247
|
-
message: "Response Validation Warnnings for getAbandonCartsCSV",
|
|
248
|
-
});
|
|
249
|
-
Logger({ level: "WARN", message: res_error });
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return response;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* @param {Object} arg - Arg object.
|
|
257
|
-
* @param {string} arg.componentName - Component name
|
|
258
|
-
* @returns {Promise<StatsRes>} - Success response
|
|
259
|
-
* @summary: Get component statistics
|
|
260
|
-
* @description: Get component statistics
|
|
261
|
-
*/
|
|
262
|
-
async getComponentStats({ componentName } = {}) {
|
|
263
|
-
const { error } = AnalyticsValidator.getComponentStats().validate(
|
|
264
|
-
{
|
|
265
|
-
componentName,
|
|
266
|
-
},
|
|
267
|
-
{ abortEarly: false, allowUnknown: true }
|
|
268
|
-
);
|
|
269
|
-
if (error) {
|
|
270
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
// Showing warrnings if extra unknown parameters are found
|
|
274
|
-
const { error: warrning } = AnalyticsValidator.getComponentStats().validate(
|
|
275
|
-
{
|
|
276
|
-
componentName,
|
|
277
|
-
},
|
|
278
|
-
{ abortEarly: false, allowUnknown: false }
|
|
279
|
-
);
|
|
280
|
-
if (warrning) {
|
|
281
|
-
Logger({
|
|
282
|
-
level: "WARN",
|
|
283
|
-
message: "Parameter Validation warrnings for getComponentStats",
|
|
284
|
-
});
|
|
285
|
-
Logger({ level: "WARN", message: warrning });
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
const query_params = {};
|
|
289
|
-
|
|
290
|
-
const response = await PlatformAPIClient.execute(
|
|
291
|
-
this.config,
|
|
292
|
-
"get",
|
|
293
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/${componentName}`,
|
|
294
|
-
query_params,
|
|
295
|
-
undefined
|
|
296
|
-
);
|
|
297
|
-
|
|
298
|
-
const { error: res_error } = AnalyticsModel.StatsRes().validate(response, {
|
|
299
|
-
abortEarly: false,
|
|
300
|
-
allowUnknown: false,
|
|
301
|
-
});
|
|
302
|
-
|
|
303
|
-
if (res_error) {
|
|
304
|
-
Logger({
|
|
305
|
-
level: "WARN",
|
|
306
|
-
message: "Response Validation Warnnings for getComponentStats",
|
|
307
|
-
});
|
|
308
|
-
Logger({ level: "WARN", message: res_error });
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
return response;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/**
|
|
315
|
-
* @param {Object} arg - Arg object.
|
|
316
|
-
* @param {string} arg.componentName - Component name
|
|
317
|
-
* @returns {Promise<string>} - Success response
|
|
318
|
-
* @summary: Get component statistics csv
|
|
319
|
-
* @description: Get component statistics csv
|
|
320
|
-
*/
|
|
321
|
-
async getComponentStatsCSV({ componentName } = {}) {
|
|
322
|
-
const { error } = AnalyticsValidator.getComponentStatsCSV().validate(
|
|
323
|
-
{
|
|
324
|
-
componentName,
|
|
325
|
-
},
|
|
326
|
-
{ abortEarly: false, allowUnknown: true }
|
|
327
|
-
);
|
|
328
|
-
if (error) {
|
|
329
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
// Showing warrnings if extra unknown parameters are found
|
|
333
|
-
const {
|
|
334
|
-
error: warrning,
|
|
335
|
-
} = AnalyticsValidator.getComponentStatsCSV().validate(
|
|
336
|
-
{
|
|
337
|
-
componentName,
|
|
338
|
-
},
|
|
339
|
-
{ abortEarly: false, allowUnknown: false }
|
|
340
|
-
);
|
|
341
|
-
if (warrning) {
|
|
342
|
-
Logger({
|
|
343
|
-
level: "WARN",
|
|
344
|
-
message: "Parameter Validation warrnings for getComponentStatsCSV",
|
|
345
|
-
});
|
|
346
|
-
Logger({ level: "WARN", message: warrning });
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
const query_params = {};
|
|
350
|
-
|
|
351
|
-
const response = await PlatformAPIClient.execute(
|
|
352
|
-
this.config,
|
|
353
|
-
"get",
|
|
354
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/{component_name}.csv`,
|
|
355
|
-
query_params,
|
|
356
|
-
undefined
|
|
357
|
-
);
|
|
358
|
-
|
|
359
|
-
const { error: res_error } = Joi.string()
|
|
360
|
-
.allow("")
|
|
361
|
-
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
362
|
-
|
|
363
|
-
if (res_error) {
|
|
364
|
-
Logger({
|
|
365
|
-
level: "WARN",
|
|
366
|
-
message: "Response Validation Warnnings for getComponentStatsCSV",
|
|
367
|
-
});
|
|
368
|
-
Logger({ level: "WARN", message: res_error });
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
return response;
|
|
372
|
-
}
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* @param {Object} arg - Arg object.
|
|
376
|
-
* @param {string} arg.componentName - Component name
|
|
377
|
-
* @returns {Promise<string>} - Success response
|
|
378
|
-
* @summary: Get component statistics pdf
|
|
379
|
-
* @description: Get component statistics pdf
|
|
380
|
-
*/
|
|
381
|
-
async getComponentStatsPDF({ componentName } = {}) {
|
|
382
|
-
const { error } = AnalyticsValidator.getComponentStatsPDF().validate(
|
|
383
|
-
{
|
|
384
|
-
componentName,
|
|
385
|
-
},
|
|
386
|
-
{ abortEarly: false, allowUnknown: true }
|
|
387
|
-
);
|
|
388
|
-
if (error) {
|
|
389
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
// Showing warrnings if extra unknown parameters are found
|
|
393
|
-
const {
|
|
394
|
-
error: warrning,
|
|
395
|
-
} = AnalyticsValidator.getComponentStatsPDF().validate(
|
|
396
|
-
{
|
|
397
|
-
componentName,
|
|
398
|
-
},
|
|
399
|
-
{ abortEarly: false, allowUnknown: false }
|
|
400
|
-
);
|
|
401
|
-
if (warrning) {
|
|
402
|
-
Logger({
|
|
403
|
-
level: "WARN",
|
|
404
|
-
message: "Parameter Validation warrnings for getComponentStatsPDF",
|
|
405
|
-
});
|
|
406
|
-
Logger({ level: "WARN", message: warrning });
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
const query_params = {};
|
|
410
|
-
|
|
411
|
-
const response = await PlatformAPIClient.execute(
|
|
412
|
-
this.config,
|
|
413
|
-
"get",
|
|
414
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/{component_name}.pdf`,
|
|
415
|
-
query_params,
|
|
416
|
-
undefined
|
|
417
|
-
);
|
|
418
|
-
|
|
419
|
-
const { error: res_error } = Joi.string()
|
|
420
|
-
.allow("")
|
|
421
|
-
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
422
|
-
|
|
423
|
-
if (res_error) {
|
|
424
|
-
Logger({
|
|
425
|
-
level: "WARN",
|
|
426
|
-
message: "Response Validation Warnnings for getComponentStatsPDF",
|
|
427
|
-
});
|
|
428
|
-
Logger({ level: "WARN", message: res_error });
|
|
429
|
-
}
|
|
430
|
-
|
|
431
|
-
return response;
|
|
432
|
-
}
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* @param {Object} arg - Arg object.
|
|
436
|
-
* @param {string} arg.groupName - Group name
|
|
437
|
-
* @returns {Promise<StatsGroupComponents>} - Success response
|
|
438
|
-
* @summary: Get statistics group components
|
|
439
|
-
* @description: Get statistics group components
|
|
440
|
-
*/
|
|
441
|
-
async getStatiscticsGroupComponents({ groupName } = {}) {
|
|
442
|
-
const {
|
|
443
|
-
error,
|
|
444
|
-
} = AnalyticsValidator.getStatiscticsGroupComponents().validate(
|
|
445
|
-
{
|
|
446
|
-
groupName,
|
|
447
|
-
},
|
|
448
|
-
{ abortEarly: false, allowUnknown: true }
|
|
449
|
-
);
|
|
450
|
-
if (error) {
|
|
451
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
// Showing warrnings if extra unknown parameters are found
|
|
455
|
-
const {
|
|
456
|
-
error: warrning,
|
|
457
|
-
} = AnalyticsValidator.getStatiscticsGroupComponents().validate(
|
|
458
|
-
{
|
|
459
|
-
groupName,
|
|
460
|
-
},
|
|
461
|
-
{ abortEarly: false, allowUnknown: false }
|
|
462
|
-
);
|
|
463
|
-
if (warrning) {
|
|
464
|
-
Logger({
|
|
465
|
-
level: "WARN",
|
|
466
|
-
message:
|
|
467
|
-
"Parameter Validation warrnings for getStatiscticsGroupComponents",
|
|
468
|
-
});
|
|
469
|
-
Logger({ level: "WARN", message: warrning });
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
const query_params = {};
|
|
473
|
-
|
|
474
|
-
const response = await PlatformAPIClient.execute(
|
|
475
|
-
this.config,
|
|
476
|
-
"get",
|
|
477
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/group/${groupName}`,
|
|
478
|
-
query_params,
|
|
479
|
-
undefined
|
|
480
|
-
);
|
|
481
|
-
|
|
482
|
-
const {
|
|
483
|
-
error: res_error,
|
|
484
|
-
} = AnalyticsModel.StatsGroupComponents().validate(response, {
|
|
485
|
-
abortEarly: false,
|
|
486
|
-
allowUnknown: false,
|
|
487
|
-
});
|
|
488
|
-
|
|
489
|
-
if (res_error) {
|
|
490
|
-
Logger({
|
|
491
|
-
level: "WARN",
|
|
492
|
-
message:
|
|
493
|
-
"Response Validation Warnnings for getStatiscticsGroupComponents",
|
|
494
|
-
});
|
|
495
|
-
Logger({ level: "WARN", message: res_error });
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
return response;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
/**
|
|
502
|
-
* @param {Object} arg - Arg object.
|
|
503
|
-
* @returns {Promise<StatsGroups>} - Success response
|
|
504
|
-
* @summary: Get statistics groups
|
|
505
|
-
* @description: Get statistics groups
|
|
506
|
-
*/
|
|
507
|
-
async getStatiscticsGroups({} = {}) {
|
|
508
|
-
const { error } = AnalyticsValidator.getStatiscticsGroups().validate(
|
|
509
|
-
{},
|
|
510
|
-
{ abortEarly: false, allowUnknown: true }
|
|
511
|
-
);
|
|
512
|
-
if (error) {
|
|
513
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// Showing warrnings if extra unknown parameters are found
|
|
517
|
-
const {
|
|
518
|
-
error: warrning,
|
|
519
|
-
} = AnalyticsValidator.getStatiscticsGroups().validate(
|
|
520
|
-
{},
|
|
521
|
-
{ abortEarly: false, allowUnknown: false }
|
|
522
|
-
);
|
|
523
|
-
if (warrning) {
|
|
524
|
-
Logger({
|
|
525
|
-
level: "WARN",
|
|
526
|
-
message: "Parameter Validation warrnings for getStatiscticsGroups",
|
|
527
|
-
});
|
|
528
|
-
Logger({ level: "WARN", message: warrning });
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
const query_params = {};
|
|
532
|
-
|
|
533
|
-
const response = await PlatformAPIClient.execute(
|
|
534
|
-
this.config,
|
|
535
|
-
"get",
|
|
536
|
-
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/group`,
|
|
537
|
-
query_params,
|
|
538
|
-
undefined
|
|
539
|
-
);
|
|
540
|
-
|
|
541
|
-
const { error: res_error } = AnalyticsModel.StatsGroups().validate(
|
|
542
|
-
response,
|
|
543
|
-
{ abortEarly: false, allowUnknown: false }
|
|
544
|
-
);
|
|
545
|
-
|
|
546
|
-
if (res_error) {
|
|
547
|
-
Logger({
|
|
548
|
-
level: "WARN",
|
|
549
|
-
message: "Response Validation Warnnings for getStatiscticsGroups",
|
|
550
|
-
});
|
|
551
|
-
Logger({ level: "WARN", message: res_error });
|
|
552
|
-
}
|
|
553
|
-
|
|
554
|
-
return response;
|
|
555
|
-
}
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
module.exports = Analytics;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export = AnalyticsValidator;
|
|
2
|
-
declare class AnalyticsValidator {
|
|
3
|
-
static getAbandonCartDetail(): any;
|
|
4
|
-
static getAbandonCartList(): any;
|
|
5
|
-
static getAbandonCartsCSV(): any;
|
|
6
|
-
static getComponentStats(): any;
|
|
7
|
-
static getComponentStatsCSV(): any;
|
|
8
|
-
static getComponentStatsPDF(): any;
|
|
9
|
-
static getStatiscticsGroupComponents(): any;
|
|
10
|
-
static getStatiscticsGroups(): any;
|
|
11
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
const Joi = require("joi");
|
|
2
|
-
|
|
3
|
-
const AnalyticsModel = require("./AnalyticsPlatformModel");
|
|
4
|
-
class AnalyticsValidator {
|
|
5
|
-
static getAbandonCartDetail() {
|
|
6
|
-
return Joi.object({
|
|
7
|
-
cartId: Joi.string().allow("").required(),
|
|
8
|
-
}).required();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
static getAbandonCartList() {
|
|
12
|
-
return Joi.object({
|
|
13
|
-
fromDate: Joi.string().allow("").required(),
|
|
14
|
-
toDate: Joi.string().allow("").required(),
|
|
15
|
-
pageNo: Joi.number(),
|
|
16
|
-
pageSize: Joi.number(),
|
|
17
|
-
}).required();
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static getAbandonCartsCSV() {
|
|
21
|
-
return Joi.object({
|
|
22
|
-
fromDate: Joi.string().allow("").required(),
|
|
23
|
-
toDate: Joi.string().allow("").required(),
|
|
24
|
-
}).required();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
static getComponentStats() {
|
|
28
|
-
return Joi.object({
|
|
29
|
-
componentName: Joi.string().allow("").required(),
|
|
30
|
-
}).required();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
static getComponentStatsCSV() {
|
|
34
|
-
return Joi.object({
|
|
35
|
-
componentName: Joi.string().allow("").required(),
|
|
36
|
-
}).required();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
static getComponentStatsPDF() {
|
|
40
|
-
return Joi.object({
|
|
41
|
-
componentName: Joi.string().allow("").required(),
|
|
42
|
-
}).required();
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static getStatiscticsGroupComponents() {
|
|
46
|
-
return Joi.object({
|
|
47
|
-
groupName: Joi.string().allow("").required(),
|
|
48
|
-
}).required();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static getStatiscticsGroups() {
|
|
52
|
-
return Joi.object({}).required();
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
module.exports = AnalyticsValidator;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
export = Analytics;
|
|
2
|
-
declare class Analytics {
|
|
3
|
-
constructor(config: any);
|
|
4
|
-
config: any;
|
|
5
|
-
/**
|
|
6
|
-
* @param {Object} arg - Arg object.
|
|
7
|
-
* @param {string} arg.exportType - Export type / format
|
|
8
|
-
* @param {ExportJobReq} arg.body
|
|
9
|
-
* @returns {Promise<ExportJobRes>} - Success response
|
|
10
|
-
* @summary: Create data export job in required format
|
|
11
|
-
* @description: Create data export job in required format
|
|
12
|
-
*/
|
|
13
|
-
createExportJob({ exportType, body }?: {
|
|
14
|
-
exportType: string;
|
|
15
|
-
body: ExportJobReq;
|
|
16
|
-
}): Promise<ExportJobRes>;
|
|
17
|
-
/**
|
|
18
|
-
* @param {Object} arg - Arg object.
|
|
19
|
-
* @param {string} arg.exportType - Export type / format
|
|
20
|
-
* @param {string} arg.jobId - Export job id
|
|
21
|
-
* @returns {Promise<ExportJobStatusRes>} - Success response
|
|
22
|
-
* @summary: Get data export job status
|
|
23
|
-
* @description: Get data export job status
|
|
24
|
-
*/
|
|
25
|
-
getExportJobStatus({ exportType, jobId }?: {
|
|
26
|
-
exportType: string;
|
|
27
|
-
jobId: string;
|
|
28
|
-
}): Promise<ExportJobStatusRes>;
|
|
29
|
-
/**
|
|
30
|
-
* @param {Object} arg - Arg object.
|
|
31
|
-
* @param {string} arg.logType - Log type
|
|
32
|
-
* @param {number} [arg.pageNo] - Current page number
|
|
33
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
34
|
-
* @param {GetLogsListReq} arg.body
|
|
35
|
-
* @returns {Promise<GetLogsListRes>} - Success response
|
|
36
|
-
* @summary: Get logs list
|
|
37
|
-
* @description: Get logs list
|
|
38
|
-
*/
|
|
39
|
-
getLogsList({ logType, body, pageNo, pageSize }?: {
|
|
40
|
-
logType: string;
|
|
41
|
-
pageNo?: number;
|
|
42
|
-
pageSize?: number;
|
|
43
|
-
body: GetLogsListReq;
|
|
44
|
-
}): Promise<GetLogsListRes>;
|
|
45
|
-
/**
|
|
46
|
-
* @param {Object} arg - Arg object.
|
|
47
|
-
* @param {string} arg.logType - Log type
|
|
48
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
49
|
-
* @param {GetLogsListReq} arg.body
|
|
50
|
-
* @summary: Get logs list
|
|
51
|
-
* @description: Get logs list
|
|
52
|
-
*/
|
|
53
|
-
getLogsListPaginator({ logType, pageSize, body }?: {
|
|
54
|
-
logType: string;
|
|
55
|
-
pageSize?: number;
|
|
56
|
-
body: GetLogsListReq;
|
|
57
|
-
}): Paginator;
|
|
58
|
-
/**
|
|
59
|
-
* @param {Object} arg - Arg object.
|
|
60
|
-
* @param {number} [arg.pageNo] - Current page number
|
|
61
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
62
|
-
* @param {string} arg.logType - Log type
|
|
63
|
-
* @param {SearchLogReq} arg.body
|
|
64
|
-
* @returns {Promise<SearchLogRes>} - Success response
|
|
65
|
-
* @summary: Search logs
|
|
66
|
-
* @description: Search logs
|
|
67
|
-
*/
|
|
68
|
-
searchLogs({ logType, body, pageNo, pageSize }?: {
|
|
69
|
-
pageNo?: number;
|
|
70
|
-
pageSize?: number;
|
|
71
|
-
logType: string;
|
|
72
|
-
body: SearchLogReq;
|
|
73
|
-
}): Promise<SearchLogRes>;
|
|
74
|
-
/**
|
|
75
|
-
* @param {Object} arg - Arg object.
|
|
76
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
77
|
-
* @param {string} arg.logType - Log type
|
|
78
|
-
* @param {SearchLogReq} arg.body
|
|
79
|
-
* @summary: Search logs
|
|
80
|
-
* @description: Search logs
|
|
81
|
-
*/
|
|
82
|
-
searchLogsPaginator({ pageSize, logType, body }?: {
|
|
83
|
-
pageSize?: number;
|
|
84
|
-
logType: string;
|
|
85
|
-
body: SearchLogReq;
|
|
86
|
-
}): Paginator;
|
|
87
|
-
}
|
|
88
|
-
import Paginator = require("../../common/Paginator");
|