@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
|
@@ -7,6 +7,7 @@ declare class Webhook {
|
|
|
7
7
|
* @param {number} [arg.pageNo] - Page Number
|
|
8
8
|
* @param {number} [arg.pageSize] - Page Size
|
|
9
9
|
* @param {string} [arg.extensionId] - Extension ID
|
|
10
|
+
* @returns {Promise<SubscriberResponse>} - Success response
|
|
10
11
|
* @summary: Get Subscribers By Company ID
|
|
11
12
|
* @description: Get Subscribers By CompanyId
|
|
12
13
|
*/
|
|
@@ -14,30 +15,33 @@ declare class Webhook {
|
|
|
14
15
|
pageNo?: number;
|
|
15
16
|
pageSize?: number;
|
|
16
17
|
extensionId?: string;
|
|
17
|
-
}): Promise<
|
|
18
|
+
}): Promise<SubscriberResponse>;
|
|
18
19
|
/**
|
|
19
20
|
* @param {Object} arg - Arg object.
|
|
20
21
|
* @param {SubscriberConfig} arg.body
|
|
22
|
+
* @returns {Promise<SubscriberConfig>} - Success response
|
|
21
23
|
* @summary: Register Subscriber
|
|
22
24
|
* @description: Register Subscriber
|
|
23
25
|
*/
|
|
24
26
|
registerSubscriberToEvent({ body }?: {
|
|
25
27
|
body: SubscriberConfig;
|
|
26
|
-
}): Promise<
|
|
28
|
+
}): Promise<SubscriberConfig>;
|
|
27
29
|
/**
|
|
28
30
|
* @param {Object} arg - Arg object.
|
|
29
31
|
* @param {SubscriberConfig} arg.body
|
|
32
|
+
* @returns {Promise<SubscriberConfig>} - Success response
|
|
30
33
|
* @summary: Update Subscriber
|
|
31
34
|
* @description: Update Subscriber
|
|
32
35
|
*/
|
|
33
36
|
updateSubscriberConfig({ body }?: {
|
|
34
37
|
body: SubscriberConfig;
|
|
35
|
-
}): Promise<
|
|
38
|
+
}): Promise<SubscriberConfig>;
|
|
36
39
|
/**
|
|
37
40
|
* @param {Object} arg - Arg object.
|
|
38
41
|
* @param {number} [arg.pageNo] - Page Number
|
|
39
42
|
* @param {number} [arg.pageSize] - Page Size
|
|
40
43
|
* @param {string} arg.extensionId - Extension ID
|
|
44
|
+
* @returns {Promise<SubscriberConfigList>} - Success response
|
|
41
45
|
* @summary: Get Subscribers By Extension ID
|
|
42
46
|
* @description: Get Subscribers By ExtensionID
|
|
43
47
|
*/
|
|
@@ -45,20 +49,22 @@ declare class Webhook {
|
|
|
45
49
|
pageNo?: number;
|
|
46
50
|
pageSize?: number;
|
|
47
51
|
extensionId: string;
|
|
48
|
-
}): Promise<
|
|
52
|
+
}): Promise<SubscriberConfigList>;
|
|
49
53
|
/**
|
|
50
54
|
* @param {Object} arg - Arg object.
|
|
51
55
|
* @param {number} arg.subscriberId - Subscriber ID
|
|
56
|
+
* @returns {Promise<SubscriberResponse>} - Success response
|
|
52
57
|
* @summary: Get Subscriber By Subscriber ID
|
|
53
58
|
* @description: Get Subscriber By Subscriber ID
|
|
54
59
|
*/
|
|
55
60
|
getSubscriberById({ subscriberId }?: {
|
|
56
61
|
subscriberId: number;
|
|
57
|
-
}): Promise<
|
|
62
|
+
}): Promise<SubscriberResponse>;
|
|
58
63
|
/**
|
|
59
64
|
* @param {Object} arg - Arg object.
|
|
65
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
60
66
|
* @summary:
|
|
61
67
|
* @description: Get All Webhook Events
|
|
62
68
|
*/
|
|
63
|
-
fetchAllEventConfigurations({}?: any): Promise<
|
|
69
|
+
fetchAllEventConfigurations({}?: any): Promise<EventConfigResponse>;
|
|
64
70
|
}
|
|
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
3
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
4
4
|
const WebhookValidator = require("./WebhookPlatformValidator");
|
|
5
|
+
const WebhookModel = require("./WebhookPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
5
8
|
class Webhook {
|
|
6
9
|
constructor(config) {
|
|
7
10
|
this.config = config;
|
|
@@ -12,10 +15,11 @@ class Webhook {
|
|
|
12
15
|
* @param {number} [arg.pageNo] - Page Number
|
|
13
16
|
* @param {number} [arg.pageSize] - Page Size
|
|
14
17
|
* @param {string} [arg.extensionId] - Extension ID
|
|
18
|
+
* @returns {Promise<SubscriberResponse>} - Success response
|
|
15
19
|
* @summary: Get Subscribers By Company ID
|
|
16
20
|
* @description: Get Subscribers By CompanyId
|
|
17
21
|
*/
|
|
18
|
-
getSubscribersByCompany({ pageNo, pageSize, extensionId } = {}) {
|
|
22
|
+
async getSubscribersByCompany({ pageNo, pageSize, extensionId } = {}) {
|
|
19
23
|
const { error } = WebhookValidator.getSubscribersByCompany().validate(
|
|
20
24
|
{
|
|
21
25
|
pageNo,
|
|
@@ -28,6 +32,25 @@ class Webhook {
|
|
|
28
32
|
return Promise.reject(new FDKClientValidationError(error));
|
|
29
33
|
}
|
|
30
34
|
|
|
35
|
+
// Showing warrnings if extra unknown parameters are found
|
|
36
|
+
const {
|
|
37
|
+
error: warrning,
|
|
38
|
+
} = WebhookValidator.getSubscribersByCompany().validate(
|
|
39
|
+
{
|
|
40
|
+
pageNo,
|
|
41
|
+
pageSize,
|
|
42
|
+
extensionId,
|
|
43
|
+
},
|
|
44
|
+
{ abortEarly: false, allowUnknown: false }
|
|
45
|
+
);
|
|
46
|
+
if (warrning) {
|
|
47
|
+
Logger({
|
|
48
|
+
level: "WARN",
|
|
49
|
+
message: "Parameter Validation warrnings for getSubscribersByCompany",
|
|
50
|
+
});
|
|
51
|
+
Logger({ level: "WARN", message: warrning });
|
|
52
|
+
}
|
|
53
|
+
|
|
31
54
|
const query_params = {};
|
|
32
55
|
query_params["page_no"] = pageNo;
|
|
33
56
|
query_params["page_size"] = pageSize;
|
|
@@ -35,7 +58,7 @@ class Webhook {
|
|
|
35
58
|
|
|
36
59
|
const xHeaders = {};
|
|
37
60
|
|
|
38
|
-
|
|
61
|
+
const response = await PlatformAPIClient.execute(
|
|
39
62
|
this.config,
|
|
40
63
|
"get",
|
|
41
64
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber`,
|
|
@@ -43,15 +66,33 @@ class Webhook {
|
|
|
43
66
|
undefined,
|
|
44
67
|
xHeaders
|
|
45
68
|
);
|
|
69
|
+
|
|
70
|
+
const {
|
|
71
|
+
error: res_error,
|
|
72
|
+
} = WebhookModel.SubscriberResponse().validate(response, {
|
|
73
|
+
abortEarly: false,
|
|
74
|
+
allowUnknown: false,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (res_error) {
|
|
78
|
+
Logger({
|
|
79
|
+
level: "WARN",
|
|
80
|
+
message: "Response Validation Warnnings for getSubscribersByCompany",
|
|
81
|
+
});
|
|
82
|
+
Logger({ level: "WARN", message: res_error });
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return response;
|
|
46
86
|
}
|
|
47
87
|
|
|
48
88
|
/**
|
|
49
89
|
* @param {Object} arg - Arg object.
|
|
50
90
|
* @param {SubscriberConfig} arg.body
|
|
91
|
+
* @returns {Promise<SubscriberConfig>} - Success response
|
|
51
92
|
* @summary: Register Subscriber
|
|
52
93
|
* @description: Register Subscriber
|
|
53
94
|
*/
|
|
54
|
-
registerSubscriberToEvent({ body } = {}) {
|
|
95
|
+
async registerSubscriberToEvent({ body } = {}) {
|
|
55
96
|
const { error } = WebhookValidator.registerSubscriberToEvent().validate(
|
|
56
97
|
{
|
|
57
98
|
body,
|
|
@@ -62,11 +103,28 @@ class Webhook {
|
|
|
62
103
|
return Promise.reject(new FDKClientValidationError(error));
|
|
63
104
|
}
|
|
64
105
|
|
|
106
|
+
// Showing warrnings if extra unknown parameters are found
|
|
107
|
+
const {
|
|
108
|
+
error: warrning,
|
|
109
|
+
} = WebhookValidator.registerSubscriberToEvent().validate(
|
|
110
|
+
{
|
|
111
|
+
body,
|
|
112
|
+
},
|
|
113
|
+
{ abortEarly: false, allowUnknown: false }
|
|
114
|
+
);
|
|
115
|
+
if (warrning) {
|
|
116
|
+
Logger({
|
|
117
|
+
level: "WARN",
|
|
118
|
+
message: "Parameter Validation warrnings for registerSubscriberToEvent",
|
|
119
|
+
});
|
|
120
|
+
Logger({ level: "WARN", message: warrning });
|
|
121
|
+
}
|
|
122
|
+
|
|
65
123
|
const query_params = {};
|
|
66
124
|
|
|
67
125
|
const xHeaders = {};
|
|
68
126
|
|
|
69
|
-
|
|
127
|
+
const response = await PlatformAPIClient.execute(
|
|
70
128
|
this.config,
|
|
71
129
|
"post",
|
|
72
130
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber`,
|
|
@@ -74,15 +132,33 @@ class Webhook {
|
|
|
74
132
|
body,
|
|
75
133
|
xHeaders
|
|
76
134
|
);
|
|
135
|
+
|
|
136
|
+
const {
|
|
137
|
+
error: res_error,
|
|
138
|
+
} = WebhookModel.SubscriberConfig().validate(response, {
|
|
139
|
+
abortEarly: false,
|
|
140
|
+
allowUnknown: false,
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
if (res_error) {
|
|
144
|
+
Logger({
|
|
145
|
+
level: "WARN",
|
|
146
|
+
message: "Response Validation Warnnings for registerSubscriberToEvent",
|
|
147
|
+
});
|
|
148
|
+
Logger({ level: "WARN", message: res_error });
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
return response;
|
|
77
152
|
}
|
|
78
153
|
|
|
79
154
|
/**
|
|
80
155
|
* @param {Object} arg - Arg object.
|
|
81
156
|
* @param {SubscriberConfig} arg.body
|
|
157
|
+
* @returns {Promise<SubscriberConfig>} - Success response
|
|
82
158
|
* @summary: Update Subscriber
|
|
83
159
|
* @description: Update Subscriber
|
|
84
160
|
*/
|
|
85
|
-
updateSubscriberConfig({ body } = {}) {
|
|
161
|
+
async updateSubscriberConfig({ body } = {}) {
|
|
86
162
|
const { error } = WebhookValidator.updateSubscriberConfig().validate(
|
|
87
163
|
{
|
|
88
164
|
body,
|
|
@@ -93,11 +169,28 @@ class Webhook {
|
|
|
93
169
|
return Promise.reject(new FDKClientValidationError(error));
|
|
94
170
|
}
|
|
95
171
|
|
|
172
|
+
// Showing warrnings if extra unknown parameters are found
|
|
173
|
+
const {
|
|
174
|
+
error: warrning,
|
|
175
|
+
} = WebhookValidator.updateSubscriberConfig().validate(
|
|
176
|
+
{
|
|
177
|
+
body,
|
|
178
|
+
},
|
|
179
|
+
{ abortEarly: false, allowUnknown: false }
|
|
180
|
+
);
|
|
181
|
+
if (warrning) {
|
|
182
|
+
Logger({
|
|
183
|
+
level: "WARN",
|
|
184
|
+
message: "Parameter Validation warrnings for updateSubscriberConfig",
|
|
185
|
+
});
|
|
186
|
+
Logger({ level: "WARN", message: warrning });
|
|
187
|
+
}
|
|
188
|
+
|
|
96
189
|
const query_params = {};
|
|
97
190
|
|
|
98
191
|
const xHeaders = {};
|
|
99
192
|
|
|
100
|
-
|
|
193
|
+
const response = await PlatformAPIClient.execute(
|
|
101
194
|
this.config,
|
|
102
195
|
"put",
|
|
103
196
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber`,
|
|
@@ -105,6 +198,23 @@ class Webhook {
|
|
|
105
198
|
body,
|
|
106
199
|
xHeaders
|
|
107
200
|
);
|
|
201
|
+
|
|
202
|
+
const {
|
|
203
|
+
error: res_error,
|
|
204
|
+
} = WebhookModel.SubscriberConfig().validate(response, {
|
|
205
|
+
abortEarly: false,
|
|
206
|
+
allowUnknown: false,
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
if (res_error) {
|
|
210
|
+
Logger({
|
|
211
|
+
level: "WARN",
|
|
212
|
+
message: "Response Validation Warnnings for updateSubscriberConfig",
|
|
213
|
+
});
|
|
214
|
+
Logger({ level: "WARN", message: res_error });
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return response;
|
|
108
218
|
}
|
|
109
219
|
|
|
110
220
|
/**
|
|
@@ -112,10 +222,11 @@ class Webhook {
|
|
|
112
222
|
* @param {number} [arg.pageNo] - Page Number
|
|
113
223
|
* @param {number} [arg.pageSize] - Page Size
|
|
114
224
|
* @param {string} arg.extensionId - Extension ID
|
|
225
|
+
* @returns {Promise<SubscriberConfigList>} - Success response
|
|
115
226
|
* @summary: Get Subscribers By Extension ID
|
|
116
227
|
* @description: Get Subscribers By ExtensionID
|
|
117
228
|
*/
|
|
118
|
-
getSubscribersByExtensionId({ extensionId, pageNo, pageSize } = {}) {
|
|
229
|
+
async getSubscribersByExtensionId({ extensionId, pageNo, pageSize } = {}) {
|
|
119
230
|
const { error } = WebhookValidator.getSubscribersByExtensionId().validate(
|
|
120
231
|
{
|
|
121
232
|
extensionId,
|
|
@@ -128,13 +239,33 @@ class Webhook {
|
|
|
128
239
|
return Promise.reject(new FDKClientValidationError(error));
|
|
129
240
|
}
|
|
130
241
|
|
|
242
|
+
// Showing warrnings if extra unknown parameters are found
|
|
243
|
+
const {
|
|
244
|
+
error: warrning,
|
|
245
|
+
} = WebhookValidator.getSubscribersByExtensionId().validate(
|
|
246
|
+
{
|
|
247
|
+
extensionId,
|
|
248
|
+
pageNo,
|
|
249
|
+
pageSize,
|
|
250
|
+
},
|
|
251
|
+
{ abortEarly: false, allowUnknown: false }
|
|
252
|
+
);
|
|
253
|
+
if (warrning) {
|
|
254
|
+
Logger({
|
|
255
|
+
level: "WARN",
|
|
256
|
+
message:
|
|
257
|
+
"Parameter Validation warrnings for getSubscribersByExtensionId",
|
|
258
|
+
});
|
|
259
|
+
Logger({ level: "WARN", message: warrning });
|
|
260
|
+
}
|
|
261
|
+
|
|
131
262
|
const query_params = {};
|
|
132
263
|
query_params["page_no"] = pageNo;
|
|
133
264
|
query_params["page_size"] = pageSize;
|
|
134
265
|
|
|
135
266
|
const xHeaders = {};
|
|
136
267
|
|
|
137
|
-
|
|
268
|
+
const response = await PlatformAPIClient.execute(
|
|
138
269
|
this.config,
|
|
139
270
|
"get",
|
|
140
271
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscriber`,
|
|
@@ -142,15 +273,34 @@ class Webhook {
|
|
|
142
273
|
undefined,
|
|
143
274
|
xHeaders
|
|
144
275
|
);
|
|
276
|
+
|
|
277
|
+
const {
|
|
278
|
+
error: res_error,
|
|
279
|
+
} = WebhookModel.SubscriberConfigList().validate(response, {
|
|
280
|
+
abortEarly: false,
|
|
281
|
+
allowUnknown: false,
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
if (res_error) {
|
|
285
|
+
Logger({
|
|
286
|
+
level: "WARN",
|
|
287
|
+
message:
|
|
288
|
+
"Response Validation Warnnings for getSubscribersByExtensionId",
|
|
289
|
+
});
|
|
290
|
+
Logger({ level: "WARN", message: res_error });
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
return response;
|
|
145
294
|
}
|
|
146
295
|
|
|
147
296
|
/**
|
|
148
297
|
* @param {Object} arg - Arg object.
|
|
149
298
|
* @param {number} arg.subscriberId - Subscriber ID
|
|
299
|
+
* @returns {Promise<SubscriberResponse>} - Success response
|
|
150
300
|
* @summary: Get Subscriber By Subscriber ID
|
|
151
301
|
* @description: Get Subscriber By Subscriber ID
|
|
152
302
|
*/
|
|
153
|
-
getSubscriberById({ subscriberId } = {}) {
|
|
303
|
+
async getSubscriberById({ subscriberId } = {}) {
|
|
154
304
|
const { error } = WebhookValidator.getSubscriberById().validate(
|
|
155
305
|
{
|
|
156
306
|
subscriberId,
|
|
@@ -161,11 +311,26 @@ class Webhook {
|
|
|
161
311
|
return Promise.reject(new FDKClientValidationError(error));
|
|
162
312
|
}
|
|
163
313
|
|
|
314
|
+
// Showing warrnings if extra unknown parameters are found
|
|
315
|
+
const { error: warrning } = WebhookValidator.getSubscriberById().validate(
|
|
316
|
+
{
|
|
317
|
+
subscriberId,
|
|
318
|
+
},
|
|
319
|
+
{ abortEarly: false, allowUnknown: false }
|
|
320
|
+
);
|
|
321
|
+
if (warrning) {
|
|
322
|
+
Logger({
|
|
323
|
+
level: "WARN",
|
|
324
|
+
message: "Parameter Validation warrnings for getSubscriberById",
|
|
325
|
+
});
|
|
326
|
+
Logger({ level: "WARN", message: warrning });
|
|
327
|
+
}
|
|
328
|
+
|
|
164
329
|
const query_params = {};
|
|
165
330
|
|
|
166
331
|
const xHeaders = {};
|
|
167
332
|
|
|
168
|
-
|
|
333
|
+
const response = await PlatformAPIClient.execute(
|
|
169
334
|
this.config,
|
|
170
335
|
"get",
|
|
171
336
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber/${subscriberId}`,
|
|
@@ -173,14 +338,32 @@ class Webhook {
|
|
|
173
338
|
undefined,
|
|
174
339
|
xHeaders
|
|
175
340
|
);
|
|
341
|
+
|
|
342
|
+
const {
|
|
343
|
+
error: res_error,
|
|
344
|
+
} = WebhookModel.SubscriberResponse().validate(response, {
|
|
345
|
+
abortEarly: false,
|
|
346
|
+
allowUnknown: false,
|
|
347
|
+
});
|
|
348
|
+
|
|
349
|
+
if (res_error) {
|
|
350
|
+
Logger({
|
|
351
|
+
level: "WARN",
|
|
352
|
+
message: "Response Validation Warnnings for getSubscriberById",
|
|
353
|
+
});
|
|
354
|
+
Logger({ level: "WARN", message: res_error });
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
return response;
|
|
176
358
|
}
|
|
177
359
|
|
|
178
360
|
/**
|
|
179
361
|
* @param {Object} arg - Arg object.
|
|
362
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
180
363
|
* @summary:
|
|
181
364
|
* @description: Get All Webhook Events
|
|
182
365
|
*/
|
|
183
|
-
fetchAllEventConfigurations({} = {}) {
|
|
366
|
+
async fetchAllEventConfigurations({} = {}) {
|
|
184
367
|
const { error } = WebhookValidator.fetchAllEventConfigurations().validate(
|
|
185
368
|
{},
|
|
186
369
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -189,11 +372,27 @@ class Webhook {
|
|
|
189
372
|
return Promise.reject(new FDKClientValidationError(error));
|
|
190
373
|
}
|
|
191
374
|
|
|
375
|
+
// Showing warrnings if extra unknown parameters are found
|
|
376
|
+
const {
|
|
377
|
+
error: warrning,
|
|
378
|
+
} = WebhookValidator.fetchAllEventConfigurations().validate(
|
|
379
|
+
{},
|
|
380
|
+
{ abortEarly: false, allowUnknown: false }
|
|
381
|
+
);
|
|
382
|
+
if (warrning) {
|
|
383
|
+
Logger({
|
|
384
|
+
level: "WARN",
|
|
385
|
+
message:
|
|
386
|
+
"Parameter Validation warrnings for fetchAllEventConfigurations",
|
|
387
|
+
});
|
|
388
|
+
Logger({ level: "WARN", message: warrning });
|
|
389
|
+
}
|
|
390
|
+
|
|
192
391
|
const query_params = {};
|
|
193
392
|
|
|
194
393
|
const xHeaders = {};
|
|
195
394
|
|
|
196
|
-
|
|
395
|
+
const response = await PlatformAPIClient.execute(
|
|
197
396
|
this.config,
|
|
198
397
|
"get",
|
|
199
398
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/events`,
|
|
@@ -201,6 +400,24 @@ class Webhook {
|
|
|
201
400
|
undefined,
|
|
202
401
|
xHeaders
|
|
203
402
|
);
|
|
403
|
+
|
|
404
|
+
const {
|
|
405
|
+
error: res_error,
|
|
406
|
+
} = WebhookModel.EventConfigResponse().validate(response, {
|
|
407
|
+
abortEarly: false,
|
|
408
|
+
allowUnknown: false,
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
if (res_error) {
|
|
412
|
+
Logger({
|
|
413
|
+
level: "WARN",
|
|
414
|
+
message:
|
|
415
|
+
"Response Validation Warnnings for fetchAllEventConfigurations",
|
|
416
|
+
});
|
|
417
|
+
Logger({ level: "WARN", message: res_error });
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
return response;
|
|
204
421
|
}
|
|
205
422
|
}
|
|
206
423
|
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
const PublicAPIClient = require("../PublicAPIClient");
|
|
2
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
3
|
const constructUrl = require("../constructUrl");
|
|
4
|
+
const Paginator = require("../../common/Paginator");
|
|
4
5
|
const ConfigurationValidator = require("./ConfigurationPublicValidator");
|
|
6
|
+
const ConfigurationModel = require("./ConfigurationPublicModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
8
|
+
|
|
5
9
|
class Configuration {
|
|
6
10
|
constructor(_conf) {
|
|
7
11
|
this._conf = _conf;
|
|
@@ -34,7 +38,7 @@ class Configuration {
|
|
|
34
38
|
* @summary: Search Application
|
|
35
39
|
* @description: Provide application name or domain url
|
|
36
40
|
*/
|
|
37
|
-
searchApplication({ authorization, query } = {}) {
|
|
41
|
+
async searchApplication({ authorization, query } = {}) {
|
|
38
42
|
const { error } = ConfigurationValidator.searchApplication().validate(
|
|
39
43
|
{ authorization, query },
|
|
40
44
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -42,13 +46,29 @@ class Configuration {
|
|
|
42
46
|
if (error) {
|
|
43
47
|
return Promise.reject(new FDKClientValidationError(error));
|
|
44
48
|
}
|
|
49
|
+
|
|
50
|
+
// Showing warrnings if extra unknown parameters are found
|
|
51
|
+
const {
|
|
52
|
+
error: warrning,
|
|
53
|
+
} = ConfigurationValidator.searchApplication().validate(
|
|
54
|
+
{ authorization, query },
|
|
55
|
+
{ abortEarly: false, allowUnknown: false }
|
|
56
|
+
);
|
|
57
|
+
if (warrning) {
|
|
58
|
+
Logger({
|
|
59
|
+
level: "WARN",
|
|
60
|
+
message: "Parameter Validation warrnings for searchApplication",
|
|
61
|
+
});
|
|
62
|
+
Logger({ level: "WARN", message: warrning });
|
|
63
|
+
}
|
|
64
|
+
|
|
45
65
|
const query_params = {};
|
|
46
66
|
query_params["query"] = query;
|
|
47
67
|
|
|
48
68
|
const xHeaders = {};
|
|
49
69
|
xHeaders["authorization"] = authorization;
|
|
50
70
|
|
|
51
|
-
|
|
71
|
+
const response = await PublicAPIClient.execute(
|
|
52
72
|
this._conf,
|
|
53
73
|
"get",
|
|
54
74
|
constructUrl({
|
|
@@ -59,6 +79,23 @@ class Configuration {
|
|
|
59
79
|
undefined,
|
|
60
80
|
xHeaders
|
|
61
81
|
);
|
|
82
|
+
|
|
83
|
+
const {
|
|
84
|
+
error: res_error,
|
|
85
|
+
} = ConfigurationModel.ApplicationResponse().validate(response, {
|
|
86
|
+
abortEarly: false,
|
|
87
|
+
allowUnknown: false,
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
if (res_error) {
|
|
91
|
+
Logger({
|
|
92
|
+
level: "WARN",
|
|
93
|
+
message: "Response Validation Warnnings for searchApplication",
|
|
94
|
+
});
|
|
95
|
+
Logger({ level: "WARN", message: res_error });
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return response;
|
|
62
99
|
}
|
|
63
100
|
|
|
64
101
|
/**
|
|
@@ -72,7 +109,7 @@ class Configuration {
|
|
|
72
109
|
* @summary: Get countries, states, cities
|
|
73
110
|
* @description:
|
|
74
111
|
*/
|
|
75
|
-
getLocations({ locationType, id } = {}) {
|
|
112
|
+
async getLocations({ locationType, id } = {}) {
|
|
76
113
|
const { error } = ConfigurationValidator.getLocations().validate(
|
|
77
114
|
{ locationType, id },
|
|
78
115
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -80,13 +117,27 @@ class Configuration {
|
|
|
80
117
|
if (error) {
|
|
81
118
|
return Promise.reject(new FDKClientValidationError(error));
|
|
82
119
|
}
|
|
120
|
+
|
|
121
|
+
// Showing warrnings if extra unknown parameters are found
|
|
122
|
+
const { error: warrning } = ConfigurationValidator.getLocations().validate(
|
|
123
|
+
{ locationType, id },
|
|
124
|
+
{ abortEarly: false, allowUnknown: false }
|
|
125
|
+
);
|
|
126
|
+
if (warrning) {
|
|
127
|
+
Logger({
|
|
128
|
+
level: "WARN",
|
|
129
|
+
message: "Parameter Validation warrnings for getLocations",
|
|
130
|
+
});
|
|
131
|
+
Logger({ level: "WARN", message: warrning });
|
|
132
|
+
}
|
|
133
|
+
|
|
83
134
|
const query_params = {};
|
|
84
135
|
query_params["location_type"] = locationType;
|
|
85
136
|
query_params["id"] = id;
|
|
86
137
|
|
|
87
138
|
const xHeaders = {};
|
|
88
139
|
|
|
89
|
-
|
|
140
|
+
const response = await PublicAPIClient.execute(
|
|
90
141
|
this._conf,
|
|
91
142
|
"get",
|
|
92
143
|
constructUrl({
|
|
@@ -97,6 +148,23 @@ class Configuration {
|
|
|
97
148
|
undefined,
|
|
98
149
|
xHeaders
|
|
99
150
|
);
|
|
151
|
+
|
|
152
|
+
const {
|
|
153
|
+
error: res_error,
|
|
154
|
+
} = ConfigurationModel.Locations().validate(response, {
|
|
155
|
+
abortEarly: false,
|
|
156
|
+
allowUnknown: false,
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
if (res_error) {
|
|
160
|
+
Logger({
|
|
161
|
+
level: "WARN",
|
|
162
|
+
message: "Response Validation Warnnings for getLocations",
|
|
163
|
+
});
|
|
164
|
+
Logger({ level: "WARN", message: res_error });
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return response;
|
|
100
168
|
}
|
|
101
169
|
}
|
|
102
170
|
module.exports = Configuration;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const ConfigurationModel = require("./ConfigurationPublicModel");
|
|
2
1
|
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
const ConfigurationModel = require("./ConfigurationPublicModel");
|
|
3
4
|
class ConfigurationValidator {
|
|
4
5
|
static searchApplication() {
|
|
5
6
|
return Joi.object({
|
|
@@ -15,4 +16,5 @@ class ConfigurationValidator {
|
|
|
15
16
|
});
|
|
16
17
|
}
|
|
17
18
|
}
|
|
19
|
+
|
|
18
20
|
module.exports = ConfigurationValidator;
|