@gofynd/fdk-client-javascript 1.0.0 → 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 +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- 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 +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- 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 +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -38,7 +38,7 @@ function requestInterceptorFn() {
|
|
|
38
38
|
}
|
|
39
39
|
const { host, pathname, search } = new URL(url);
|
|
40
40
|
const { data, headers, method, params } = config;
|
|
41
|
-
headers["x-fp-sdk-version"] = "1.0.
|
|
41
|
+
headers["x-fp-sdk-version"] = "1.0.1";
|
|
42
42
|
let querySearchObj = querystring.parse(search);
|
|
43
43
|
querySearchObj = { ...querySearchObj, ...params };
|
|
44
44
|
let queryParam = "";
|
|
@@ -5,52 +5,58 @@ declare class Analytics {
|
|
|
5
5
|
applicationId: any;
|
|
6
6
|
/**
|
|
7
7
|
* @param {Object} arg - Arg object.
|
|
8
|
+
* @returns {Promise<StatsGroups>} - Success response
|
|
8
9
|
* @summary: Get statistics groups
|
|
9
10
|
* @description: Get statistics groups
|
|
10
11
|
*/
|
|
11
|
-
getStatiscticsGroups({}?: any): Promise<
|
|
12
|
+
getStatiscticsGroups({}?: any): Promise<StatsGroups>;
|
|
12
13
|
/**
|
|
13
14
|
* @param {Object} arg - Arg object.
|
|
14
15
|
* @param {string} arg.groupName - Group name
|
|
16
|
+
* @returns {Promise<StatsGroupComponents>} - Success response
|
|
15
17
|
* @summary: Get statistics group components
|
|
16
18
|
* @description: Get statistics group components
|
|
17
19
|
*/
|
|
18
20
|
getStatiscticsGroupComponents({ groupName }?: {
|
|
19
21
|
groupName: string;
|
|
20
|
-
}): Promise<
|
|
22
|
+
}): Promise<StatsGroupComponents>;
|
|
21
23
|
/**
|
|
22
24
|
* @param {Object} arg - Arg object.
|
|
23
25
|
* @param {string} arg.componentName - Component name
|
|
26
|
+
* @returns {Promise<string>} - Success response
|
|
24
27
|
* @summary: Get component statistics csv
|
|
25
28
|
* @description: Get component statistics csv
|
|
26
29
|
*/
|
|
27
30
|
getComponentStatsCSV({ componentName }?: {
|
|
28
31
|
componentName: string;
|
|
29
|
-
}): Promise<
|
|
32
|
+
}): Promise<string>;
|
|
30
33
|
/**
|
|
31
34
|
* @param {Object} arg - Arg object.
|
|
32
35
|
* @param {string} arg.componentName - Component name
|
|
36
|
+
* @returns {Promise<string>} - Success response
|
|
33
37
|
* @summary: Get component statistics pdf
|
|
34
38
|
* @description: Get component statistics pdf
|
|
35
39
|
*/
|
|
36
40
|
getComponentStatsPDF({ componentName }?: {
|
|
37
41
|
componentName: string;
|
|
38
|
-
}): Promise<
|
|
42
|
+
}): Promise<string>;
|
|
39
43
|
/**
|
|
40
44
|
* @param {Object} arg - Arg object.
|
|
41
45
|
* @param {string} arg.componentName - Component name
|
|
46
|
+
* @returns {Promise<StatsRes>} - Success response
|
|
42
47
|
* @summary: Get component statistics
|
|
43
48
|
* @description: Get component statistics
|
|
44
49
|
*/
|
|
45
50
|
getComponentStats({ componentName }?: {
|
|
46
51
|
componentName: string;
|
|
47
|
-
}): Promise<
|
|
52
|
+
}): Promise<StatsRes>;
|
|
48
53
|
/**
|
|
49
54
|
* @param {Object} arg - Arg object.
|
|
50
55
|
* @param {string} arg.fromDate - From date
|
|
51
56
|
* @param {string} arg.toDate - To date
|
|
52
57
|
* @param {number} [arg.pageNo] - Current page number
|
|
53
58
|
* @param {number} [arg.pageSize] - Current page size
|
|
59
|
+
* @returns {Promise<AbandonCartsList>} - Success response
|
|
54
60
|
* @summary: Get abandon carts list
|
|
55
61
|
* @description: Get abandon carts list
|
|
56
62
|
*/
|
|
@@ -59,7 +65,7 @@ declare class Analytics {
|
|
|
59
65
|
toDate: string;
|
|
60
66
|
pageNo?: number;
|
|
61
67
|
pageSize?: number;
|
|
62
|
-
}): Promise<
|
|
68
|
+
}): Promise<AbandonCartsList>;
|
|
63
69
|
/**
|
|
64
70
|
* @param {Object} arg - Arg object.
|
|
65
71
|
* @param {string} arg.companyId - Company Id
|
|
@@ -81,21 +87,23 @@ declare class Analytics {
|
|
|
81
87
|
* @param {Object} arg - Arg object.
|
|
82
88
|
* @param {string} arg.fromDate - From date
|
|
83
89
|
* @param {string} arg.toDate - To date
|
|
90
|
+
* @returns {Promise<string>} - Success response
|
|
84
91
|
* @summary: Get abandon carts csv
|
|
85
92
|
* @description: Get abandon carts csv
|
|
86
93
|
*/
|
|
87
94
|
getAbandonCartsCSV({ fromDate, toDate }?: {
|
|
88
95
|
fromDate: string;
|
|
89
96
|
toDate: string;
|
|
90
|
-
}): Promise<
|
|
97
|
+
}): Promise<string>;
|
|
91
98
|
/**
|
|
92
99
|
* @param {Object} arg - Arg object.
|
|
93
100
|
* @param {string} arg.cartId - Cart Id
|
|
101
|
+
* @returns {Promise<AbandonCartDetail>} - Success response
|
|
94
102
|
* @summary: Get abandon carts details
|
|
95
103
|
* @description: Get abandon cart details
|
|
96
104
|
*/
|
|
97
105
|
getAbandonCartDetail({ cartId }?: {
|
|
98
106
|
cartId: string;
|
|
99
|
-
}): Promise<
|
|
107
|
+
}): Promise<AbandonCartDetail>;
|
|
100
108
|
}
|
|
101
109
|
import Paginator = require("../../common/Paginator");
|
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const AnalyticsValidator = require("./AnalyticsPlatformApplicationValidator");
|
|
5
|
+
const AnalyticsModel = require("./AnalyticsPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Analytics {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -11,10 +13,11 @@ class Analytics {
|
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
15
|
* @param {Object} arg - Arg object.
|
|
16
|
+
* @returns {Promise<StatsGroups>} - Success response
|
|
14
17
|
* @summary: Get statistics groups
|
|
15
18
|
* @description: Get statistics groups
|
|
16
19
|
*/
|
|
17
|
-
getStatiscticsGroups({} = {}) {
|
|
20
|
+
async getStatiscticsGroups({} = {}) {
|
|
18
21
|
const { error } = AnalyticsValidator.getStatiscticsGroups().validate(
|
|
19
22
|
{},
|
|
20
23
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -23,24 +26,55 @@ class Analytics {
|
|
|
23
26
|
return Promise.reject(new FDKClientValidationError(error));
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
// Showing warrnings if extra unknown parameters are found
|
|
30
|
+
const {
|
|
31
|
+
error: warrning,
|
|
32
|
+
} = AnalyticsValidator.getStatiscticsGroups().validate(
|
|
33
|
+
{},
|
|
34
|
+
{ abortEarly: false, allowUnknown: false }
|
|
35
|
+
);
|
|
36
|
+
if (warrning) {
|
|
37
|
+
Logger({
|
|
38
|
+
level: "WARN",
|
|
39
|
+
message: "Parameter Validation warrnings for getStatiscticsGroups",
|
|
40
|
+
});
|
|
41
|
+
Logger({ level: "WARN", message: warrning });
|
|
42
|
+
}
|
|
43
|
+
|
|
26
44
|
const query_params = {};
|
|
27
45
|
|
|
28
|
-
|
|
46
|
+
const response = await PlatformAPIClient.execute(
|
|
29
47
|
this.config,
|
|
30
48
|
"get",
|
|
31
49
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/group`,
|
|
32
50
|
query_params,
|
|
33
51
|
undefined
|
|
34
52
|
);
|
|
53
|
+
|
|
54
|
+
const { error: res_error } = AnalyticsModel.StatsGroups().validate(
|
|
55
|
+
response,
|
|
56
|
+
{ abortEarly: false, allowUnknown: false }
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
if (res_error) {
|
|
60
|
+
Logger({
|
|
61
|
+
level: "WARN",
|
|
62
|
+
message: "Response Validation Warnnings for getStatiscticsGroups",
|
|
63
|
+
});
|
|
64
|
+
Logger({ level: "WARN", message: res_error });
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return response;
|
|
35
68
|
}
|
|
36
69
|
|
|
37
70
|
/**
|
|
38
71
|
* @param {Object} arg - Arg object.
|
|
39
72
|
* @param {string} arg.groupName - Group name
|
|
73
|
+
* @returns {Promise<StatsGroupComponents>} - Success response
|
|
40
74
|
* @summary: Get statistics group components
|
|
41
75
|
* @description: Get statistics group components
|
|
42
76
|
*/
|
|
43
|
-
getStatiscticsGroupComponents({ groupName } = {}) {
|
|
77
|
+
async getStatiscticsGroupComponents({ groupName } = {}) {
|
|
44
78
|
const {
|
|
45
79
|
error,
|
|
46
80
|
} = AnalyticsValidator.getStatiscticsGroupComponents().validate(
|
|
@@ -53,24 +87,61 @@ class Analytics {
|
|
|
53
87
|
return Promise.reject(new FDKClientValidationError(error));
|
|
54
88
|
}
|
|
55
89
|
|
|
90
|
+
// Showing warrnings if extra unknown parameters are found
|
|
91
|
+
const {
|
|
92
|
+
error: warrning,
|
|
93
|
+
} = AnalyticsValidator.getStatiscticsGroupComponents().validate(
|
|
94
|
+
{
|
|
95
|
+
groupName,
|
|
96
|
+
},
|
|
97
|
+
{ abortEarly: false, allowUnknown: false }
|
|
98
|
+
);
|
|
99
|
+
if (warrning) {
|
|
100
|
+
Logger({
|
|
101
|
+
level: "WARN",
|
|
102
|
+
message:
|
|
103
|
+
"Parameter Validation warrnings for getStatiscticsGroupComponents",
|
|
104
|
+
});
|
|
105
|
+
Logger({ level: "WARN", message: warrning });
|
|
106
|
+
}
|
|
107
|
+
|
|
56
108
|
const query_params = {};
|
|
57
109
|
|
|
58
|
-
|
|
110
|
+
const response = await PlatformAPIClient.execute(
|
|
59
111
|
this.config,
|
|
60
112
|
"get",
|
|
61
113
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/group/${groupName}`,
|
|
62
114
|
query_params,
|
|
63
115
|
undefined
|
|
64
116
|
);
|
|
117
|
+
|
|
118
|
+
const {
|
|
119
|
+
error: res_error,
|
|
120
|
+
} = AnalyticsModel.StatsGroupComponents().validate(response, {
|
|
121
|
+
abortEarly: false,
|
|
122
|
+
allowUnknown: false,
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
if (res_error) {
|
|
126
|
+
Logger({
|
|
127
|
+
level: "WARN",
|
|
128
|
+
message:
|
|
129
|
+
"Response Validation Warnnings for getStatiscticsGroupComponents",
|
|
130
|
+
});
|
|
131
|
+
Logger({ level: "WARN", message: res_error });
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return response;
|
|
65
135
|
}
|
|
66
136
|
|
|
67
137
|
/**
|
|
68
138
|
* @param {Object} arg - Arg object.
|
|
69
139
|
* @param {string} arg.componentName - Component name
|
|
140
|
+
* @returns {Promise<string>} - Success response
|
|
70
141
|
* @summary: Get component statistics csv
|
|
71
142
|
* @description: Get component statistics csv
|
|
72
143
|
*/
|
|
73
|
-
getComponentStatsCSV({ componentName } = {}) {
|
|
144
|
+
async getComponentStatsCSV({ componentName } = {}) {
|
|
74
145
|
const { error } = AnalyticsValidator.getComponentStatsCSV().validate(
|
|
75
146
|
{
|
|
76
147
|
componentName,
|
|
@@ -81,24 +152,56 @@ class Analytics {
|
|
|
81
152
|
return Promise.reject(new FDKClientValidationError(error));
|
|
82
153
|
}
|
|
83
154
|
|
|
155
|
+
// Showing warrnings if extra unknown parameters are found
|
|
156
|
+
const {
|
|
157
|
+
error: warrning,
|
|
158
|
+
} = AnalyticsValidator.getComponentStatsCSV().validate(
|
|
159
|
+
{
|
|
160
|
+
componentName,
|
|
161
|
+
},
|
|
162
|
+
{ abortEarly: false, allowUnknown: false }
|
|
163
|
+
);
|
|
164
|
+
if (warrning) {
|
|
165
|
+
Logger({
|
|
166
|
+
level: "WARN",
|
|
167
|
+
message: "Parameter Validation warrnings for getComponentStatsCSV",
|
|
168
|
+
});
|
|
169
|
+
Logger({ level: "WARN", message: warrning });
|
|
170
|
+
}
|
|
171
|
+
|
|
84
172
|
const query_params = {};
|
|
85
173
|
|
|
86
|
-
|
|
174
|
+
const response = await PlatformAPIClient.execute(
|
|
87
175
|
this.config,
|
|
88
176
|
"get",
|
|
89
177
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/{component_name}.csv`,
|
|
90
178
|
query_params,
|
|
91
179
|
undefined
|
|
92
180
|
);
|
|
181
|
+
|
|
182
|
+
const { error: res_error } = Joi.string()
|
|
183
|
+
.allow("")
|
|
184
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
185
|
+
|
|
186
|
+
if (res_error) {
|
|
187
|
+
Logger({
|
|
188
|
+
level: "WARN",
|
|
189
|
+
message: "Response Validation Warnnings for getComponentStatsCSV",
|
|
190
|
+
});
|
|
191
|
+
Logger({ level: "WARN", message: res_error });
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
return response;
|
|
93
195
|
}
|
|
94
196
|
|
|
95
197
|
/**
|
|
96
198
|
* @param {Object} arg - Arg object.
|
|
97
199
|
* @param {string} arg.componentName - Component name
|
|
200
|
+
* @returns {Promise<string>} - Success response
|
|
98
201
|
* @summary: Get component statistics pdf
|
|
99
202
|
* @description: Get component statistics pdf
|
|
100
203
|
*/
|
|
101
|
-
getComponentStatsPDF({ componentName } = {}) {
|
|
204
|
+
async getComponentStatsPDF({ componentName } = {}) {
|
|
102
205
|
const { error } = AnalyticsValidator.getComponentStatsPDF().validate(
|
|
103
206
|
{
|
|
104
207
|
componentName,
|
|
@@ -109,24 +212,56 @@ class Analytics {
|
|
|
109
212
|
return Promise.reject(new FDKClientValidationError(error));
|
|
110
213
|
}
|
|
111
214
|
|
|
215
|
+
// Showing warrnings if extra unknown parameters are found
|
|
216
|
+
const {
|
|
217
|
+
error: warrning,
|
|
218
|
+
} = AnalyticsValidator.getComponentStatsPDF().validate(
|
|
219
|
+
{
|
|
220
|
+
componentName,
|
|
221
|
+
},
|
|
222
|
+
{ abortEarly: false, allowUnknown: false }
|
|
223
|
+
);
|
|
224
|
+
if (warrning) {
|
|
225
|
+
Logger({
|
|
226
|
+
level: "WARN",
|
|
227
|
+
message: "Parameter Validation warrnings for getComponentStatsPDF",
|
|
228
|
+
});
|
|
229
|
+
Logger({ level: "WARN", message: warrning });
|
|
230
|
+
}
|
|
231
|
+
|
|
112
232
|
const query_params = {};
|
|
113
233
|
|
|
114
|
-
|
|
234
|
+
const response = await PlatformAPIClient.execute(
|
|
115
235
|
this.config,
|
|
116
236
|
"get",
|
|
117
237
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/{component_name}.pdf`,
|
|
118
238
|
query_params,
|
|
119
239
|
undefined
|
|
120
240
|
);
|
|
241
|
+
|
|
242
|
+
const { error: res_error } = Joi.string()
|
|
243
|
+
.allow("")
|
|
244
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
245
|
+
|
|
246
|
+
if (res_error) {
|
|
247
|
+
Logger({
|
|
248
|
+
level: "WARN",
|
|
249
|
+
message: "Response Validation Warnnings for getComponentStatsPDF",
|
|
250
|
+
});
|
|
251
|
+
Logger({ level: "WARN", message: res_error });
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
return response;
|
|
121
255
|
}
|
|
122
256
|
|
|
123
257
|
/**
|
|
124
258
|
* @param {Object} arg - Arg object.
|
|
125
259
|
* @param {string} arg.componentName - Component name
|
|
260
|
+
* @returns {Promise<StatsRes>} - Success response
|
|
126
261
|
* @summary: Get component statistics
|
|
127
262
|
* @description: Get component statistics
|
|
128
263
|
*/
|
|
129
|
-
getComponentStats({ componentName } = {}) {
|
|
264
|
+
async getComponentStats({ componentName } = {}) {
|
|
130
265
|
const { error } = AnalyticsValidator.getComponentStats().validate(
|
|
131
266
|
{
|
|
132
267
|
componentName,
|
|
@@ -137,15 +272,45 @@ class Analytics {
|
|
|
137
272
|
return Promise.reject(new FDKClientValidationError(error));
|
|
138
273
|
}
|
|
139
274
|
|
|
275
|
+
// Showing warrnings if extra unknown parameters are found
|
|
276
|
+
const { error: warrning } = AnalyticsValidator.getComponentStats().validate(
|
|
277
|
+
{
|
|
278
|
+
componentName,
|
|
279
|
+
},
|
|
280
|
+
{ abortEarly: false, allowUnknown: false }
|
|
281
|
+
);
|
|
282
|
+
if (warrning) {
|
|
283
|
+
Logger({
|
|
284
|
+
level: "WARN",
|
|
285
|
+
message: "Parameter Validation warrnings for getComponentStats",
|
|
286
|
+
});
|
|
287
|
+
Logger({ level: "WARN", message: warrning });
|
|
288
|
+
}
|
|
289
|
+
|
|
140
290
|
const query_params = {};
|
|
141
291
|
|
|
142
|
-
|
|
292
|
+
const response = await PlatformAPIClient.execute(
|
|
143
293
|
this.config,
|
|
144
294
|
"get",
|
|
145
295
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/stats/component/${componentName}`,
|
|
146
296
|
query_params,
|
|
147
297
|
undefined
|
|
148
298
|
);
|
|
299
|
+
|
|
300
|
+
const { error: res_error } = AnalyticsModel.StatsRes().validate(response, {
|
|
301
|
+
abortEarly: false,
|
|
302
|
+
allowUnknown: false,
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
if (res_error) {
|
|
306
|
+
Logger({
|
|
307
|
+
level: "WARN",
|
|
308
|
+
message: "Response Validation Warnnings for getComponentStats",
|
|
309
|
+
});
|
|
310
|
+
Logger({ level: "WARN", message: res_error });
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
return response;
|
|
149
314
|
}
|
|
150
315
|
|
|
151
316
|
/**
|
|
@@ -154,10 +319,11 @@ class Analytics {
|
|
|
154
319
|
* @param {string} arg.toDate - To date
|
|
155
320
|
* @param {number} [arg.pageNo] - Current page number
|
|
156
321
|
* @param {number} [arg.pageSize] - Current page size
|
|
322
|
+
* @returns {Promise<AbandonCartsList>} - Success response
|
|
157
323
|
* @summary: Get abandon carts list
|
|
158
324
|
* @description: Get abandon carts list
|
|
159
325
|
*/
|
|
160
|
-
getAbandonCartList({ fromDate, toDate, pageNo, pageSize } = {}) {
|
|
326
|
+
async getAbandonCartList({ fromDate, toDate, pageNo, pageSize } = {}) {
|
|
161
327
|
const { error } = AnalyticsValidator.getAbandonCartList().validate(
|
|
162
328
|
{
|
|
163
329
|
fromDate,
|
|
@@ -171,17 +337,54 @@ class Analytics {
|
|
|
171
337
|
return Promise.reject(new FDKClientValidationError(error));
|
|
172
338
|
}
|
|
173
339
|
|
|
340
|
+
// Showing warrnings if extra unknown parameters are found
|
|
341
|
+
const {
|
|
342
|
+
error: warrning,
|
|
343
|
+
} = AnalyticsValidator.getAbandonCartList().validate(
|
|
344
|
+
{
|
|
345
|
+
fromDate,
|
|
346
|
+
toDate,
|
|
347
|
+
pageNo,
|
|
348
|
+
pageSize,
|
|
349
|
+
},
|
|
350
|
+
{ abortEarly: false, allowUnknown: false }
|
|
351
|
+
);
|
|
352
|
+
if (warrning) {
|
|
353
|
+
Logger({
|
|
354
|
+
level: "WARN",
|
|
355
|
+
message: "Parameter Validation warrnings for getAbandonCartList",
|
|
356
|
+
});
|
|
357
|
+
Logger({ level: "WARN", message: warrning });
|
|
358
|
+
}
|
|
359
|
+
|
|
174
360
|
const query_params = {};
|
|
175
361
|
query_params["page_no"] = pageNo;
|
|
176
362
|
query_params["page_size"] = pageSize;
|
|
177
363
|
|
|
178
|
-
|
|
364
|
+
const response = await PlatformAPIClient.execute(
|
|
179
365
|
this.config,
|
|
180
366
|
"get",
|
|
181
367
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/from/${fromDate}/to/${toDate}/abandon-cart/`,
|
|
182
368
|
query_params,
|
|
183
369
|
undefined
|
|
184
370
|
);
|
|
371
|
+
|
|
372
|
+
const {
|
|
373
|
+
error: res_error,
|
|
374
|
+
} = AnalyticsModel.AbandonCartsList().validate(response, {
|
|
375
|
+
abortEarly: false,
|
|
376
|
+
allowUnknown: false,
|
|
377
|
+
});
|
|
378
|
+
|
|
379
|
+
if (res_error) {
|
|
380
|
+
Logger({
|
|
381
|
+
level: "WARN",
|
|
382
|
+
message: "Response Validation Warnnings for getAbandonCartList",
|
|
383
|
+
});
|
|
384
|
+
Logger({ level: "WARN", message: res_error });
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
return response;
|
|
185
388
|
}
|
|
186
389
|
|
|
187
390
|
/**
|
|
@@ -228,10 +431,11 @@ class Analytics {
|
|
|
228
431
|
* @param {Object} arg - Arg object.
|
|
229
432
|
* @param {string} arg.fromDate - From date
|
|
230
433
|
* @param {string} arg.toDate - To date
|
|
434
|
+
* @returns {Promise<string>} - Success response
|
|
231
435
|
* @summary: Get abandon carts csv
|
|
232
436
|
* @description: Get abandon carts csv
|
|
233
437
|
*/
|
|
234
|
-
getAbandonCartsCSV({ fromDate, toDate } = {}) {
|
|
438
|
+
async getAbandonCartsCSV({ fromDate, toDate } = {}) {
|
|
235
439
|
const { error } = AnalyticsValidator.getAbandonCartsCSV().validate(
|
|
236
440
|
{
|
|
237
441
|
fromDate,
|
|
@@ -243,24 +447,57 @@ class Analytics {
|
|
|
243
447
|
return Promise.reject(new FDKClientValidationError(error));
|
|
244
448
|
}
|
|
245
449
|
|
|
450
|
+
// Showing warrnings if extra unknown parameters are found
|
|
451
|
+
const {
|
|
452
|
+
error: warrning,
|
|
453
|
+
} = AnalyticsValidator.getAbandonCartsCSV().validate(
|
|
454
|
+
{
|
|
455
|
+
fromDate,
|
|
456
|
+
toDate,
|
|
457
|
+
},
|
|
458
|
+
{ abortEarly: false, allowUnknown: false }
|
|
459
|
+
);
|
|
460
|
+
if (warrning) {
|
|
461
|
+
Logger({
|
|
462
|
+
level: "WARN",
|
|
463
|
+
message: "Parameter Validation warrnings for getAbandonCartsCSV",
|
|
464
|
+
});
|
|
465
|
+
Logger({ level: "WARN", message: warrning });
|
|
466
|
+
}
|
|
467
|
+
|
|
246
468
|
const query_params = {};
|
|
247
469
|
|
|
248
|
-
|
|
470
|
+
const response = await PlatformAPIClient.execute(
|
|
249
471
|
this.config,
|
|
250
472
|
"get",
|
|
251
473
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/${fromDate}/to/${toDate}/abandon-cart.csv`,
|
|
252
474
|
query_params,
|
|
253
475
|
undefined
|
|
254
476
|
);
|
|
477
|
+
|
|
478
|
+
const { error: res_error } = Joi.string()
|
|
479
|
+
.allow("")
|
|
480
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
481
|
+
|
|
482
|
+
if (res_error) {
|
|
483
|
+
Logger({
|
|
484
|
+
level: "WARN",
|
|
485
|
+
message: "Response Validation Warnnings for getAbandonCartsCSV",
|
|
486
|
+
});
|
|
487
|
+
Logger({ level: "WARN", message: res_error });
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
return response;
|
|
255
491
|
}
|
|
256
492
|
|
|
257
493
|
/**
|
|
258
494
|
* @param {Object} arg - Arg object.
|
|
259
495
|
* @param {string} arg.cartId - Cart Id
|
|
496
|
+
* @returns {Promise<AbandonCartDetail>} - Success response
|
|
260
497
|
* @summary: Get abandon carts details
|
|
261
498
|
* @description: Get abandon cart details
|
|
262
499
|
*/
|
|
263
|
-
getAbandonCartDetail({ cartId } = {}) {
|
|
500
|
+
async getAbandonCartDetail({ cartId } = {}) {
|
|
264
501
|
const { error } = AnalyticsValidator.getAbandonCartDetail().validate(
|
|
265
502
|
{
|
|
266
503
|
cartId,
|
|
@@ -271,15 +508,49 @@ class Analytics {
|
|
|
271
508
|
return Promise.reject(new FDKClientValidationError(error));
|
|
272
509
|
}
|
|
273
510
|
|
|
511
|
+
// Showing warrnings if extra unknown parameters are found
|
|
512
|
+
const {
|
|
513
|
+
error: warrning,
|
|
514
|
+
} = AnalyticsValidator.getAbandonCartDetail().validate(
|
|
515
|
+
{
|
|
516
|
+
cartId,
|
|
517
|
+
},
|
|
518
|
+
{ abortEarly: false, allowUnknown: false }
|
|
519
|
+
);
|
|
520
|
+
if (warrning) {
|
|
521
|
+
Logger({
|
|
522
|
+
level: "WARN",
|
|
523
|
+
message: "Parameter Validation warrnings for getAbandonCartDetail",
|
|
524
|
+
});
|
|
525
|
+
Logger({ level: "WARN", message: warrning });
|
|
526
|
+
}
|
|
527
|
+
|
|
274
528
|
const query_params = {};
|
|
275
529
|
|
|
276
|
-
|
|
530
|
+
const response = await PlatformAPIClient.execute(
|
|
277
531
|
this.config,
|
|
278
532
|
"get",
|
|
279
533
|
`/service/platform/analytics/v1.0/company/${this.config.companyId}/application/${this.applicationId}/cart/abandon-cart/${cartId}`,
|
|
280
534
|
query_params,
|
|
281
535
|
undefined
|
|
282
536
|
);
|
|
537
|
+
|
|
538
|
+
const {
|
|
539
|
+
error: res_error,
|
|
540
|
+
} = AnalyticsModel.AbandonCartDetail().validate(response, {
|
|
541
|
+
abortEarly: false,
|
|
542
|
+
allowUnknown: false,
|
|
543
|
+
});
|
|
544
|
+
|
|
545
|
+
if (res_error) {
|
|
546
|
+
Logger({
|
|
547
|
+
level: "WARN",
|
|
548
|
+
message: "Response Validation Warnnings for getAbandonCartDetail",
|
|
549
|
+
});
|
|
550
|
+
Logger({ level: "WARN", message: res_error });
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return response;
|
|
283
554
|
}
|
|
284
555
|
}
|
|
285
556
|
module.exports = Analytics;
|
|
@@ -6,30 +6,33 @@ declare class Analytics {
|
|
|
6
6
|
* @param {Object} arg - Arg object.
|
|
7
7
|
* @param {string} arg.exportType - Export type / format
|
|
8
8
|
* @param {ExportJobReq} arg.body
|
|
9
|
+
* @returns {Promise<ExportJobRes>} - Success response
|
|
9
10
|
* @summary: Create data export job in required format
|
|
10
11
|
* @description: Create data export job in required format
|
|
11
12
|
*/
|
|
12
13
|
createExportJob({ exportType, body }?: {
|
|
13
14
|
exportType: string;
|
|
14
15
|
body: ExportJobReq;
|
|
15
|
-
}): Promise<
|
|
16
|
+
}): Promise<ExportJobRes>;
|
|
16
17
|
/**
|
|
17
18
|
* @param {Object} arg - Arg object.
|
|
18
19
|
* @param {string} arg.exportType - Export type / format
|
|
19
20
|
* @param {string} arg.jobId - Export job id
|
|
21
|
+
* @returns {Promise<ExportJobStatusRes>} - Success response
|
|
20
22
|
* @summary: Get data export job status
|
|
21
23
|
* @description: Get data export job status
|
|
22
24
|
*/
|
|
23
25
|
getExportJobStatus({ exportType, jobId }?: {
|
|
24
26
|
exportType: string;
|
|
25
27
|
jobId: string;
|
|
26
|
-
}): Promise<
|
|
28
|
+
}): Promise<ExportJobStatusRes>;
|
|
27
29
|
/**
|
|
28
30
|
* @param {Object} arg - Arg object.
|
|
29
31
|
* @param {string} arg.logType - Log type
|
|
30
32
|
* @param {number} [arg.pageNo] - Current page number
|
|
31
33
|
* @param {number} [arg.pageSize] - Current page size
|
|
32
34
|
* @param {GetLogsListReq} arg.body
|
|
35
|
+
* @returns {Promise<GetLogsListRes>} - Success response
|
|
33
36
|
* @summary: Get logs list
|
|
34
37
|
* @description: Get logs list
|
|
35
38
|
*/
|
|
@@ -38,7 +41,7 @@ declare class Analytics {
|
|
|
38
41
|
pageNo?: number;
|
|
39
42
|
pageSize?: number;
|
|
40
43
|
body: GetLogsListReq;
|
|
41
|
-
}): Promise<
|
|
44
|
+
}): Promise<GetLogsListRes>;
|
|
42
45
|
/**
|
|
43
46
|
* @param {Object} arg - Arg object.
|
|
44
47
|
* @param {string} arg.logType - Log type
|
|
@@ -58,6 +61,7 @@ declare class Analytics {
|
|
|
58
61
|
* @param {number} [arg.pageSize] - Current page size
|
|
59
62
|
* @param {string} arg.logType - Log type
|
|
60
63
|
* @param {SearchLogReq} arg.body
|
|
64
|
+
* @returns {Promise<SearchLogRes>} - Success response
|
|
61
65
|
* @summary: Search logs
|
|
62
66
|
* @description: Search logs
|
|
63
67
|
*/
|
|
@@ -66,7 +70,7 @@ declare class Analytics {
|
|
|
66
70
|
pageSize?: number;
|
|
67
71
|
logType: string;
|
|
68
72
|
body: SearchLogReq;
|
|
69
|
-
}): Promise<
|
|
73
|
+
}): Promise<SearchLogRes>;
|
|
70
74
|
/**
|
|
71
75
|
* @param {Object} arg - Arg object.
|
|
72
76
|
* @param {number} [arg.pageSize] - Current page size
|