@gofynd/fdk-client-javascript 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -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,
|
|
@@ -40,8 +44,11 @@ class Webhook {
|
|
|
40
44
|
{ abortEarly: false, allowUnknown: false }
|
|
41
45
|
);
|
|
42
46
|
if (warrning) {
|
|
43
|
-
|
|
44
|
-
|
|
47
|
+
Logger({
|
|
48
|
+
level: "WARN",
|
|
49
|
+
message: "Parameter Validation warrnings for getSubscribersByCompany",
|
|
50
|
+
});
|
|
51
|
+
Logger({ level: "WARN", message: warrning });
|
|
45
52
|
}
|
|
46
53
|
|
|
47
54
|
const query_params = {};
|
|
@@ -51,7 +58,7 @@ class Webhook {
|
|
|
51
58
|
|
|
52
59
|
const xHeaders = {};
|
|
53
60
|
|
|
54
|
-
|
|
61
|
+
const response = await PlatformAPIClient.execute(
|
|
55
62
|
this.config,
|
|
56
63
|
"get",
|
|
57
64
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber`,
|
|
@@ -59,15 +66,33 @@ class Webhook {
|
|
|
59
66
|
undefined,
|
|
60
67
|
xHeaders
|
|
61
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;
|
|
62
86
|
}
|
|
63
87
|
|
|
64
88
|
/**
|
|
65
89
|
* @param {Object} arg - Arg object.
|
|
66
90
|
* @param {SubscriberConfig} arg.body
|
|
91
|
+
* @returns {Promise<SubscriberConfig>} - Success response
|
|
67
92
|
* @summary: Register Subscriber
|
|
68
93
|
* @description: Register Subscriber
|
|
69
94
|
*/
|
|
70
|
-
registerSubscriberToEvent({ body } = {}) {
|
|
95
|
+
async registerSubscriberToEvent({ body } = {}) {
|
|
71
96
|
const { error } = WebhookValidator.registerSubscriberToEvent().validate(
|
|
72
97
|
{
|
|
73
98
|
body,
|
|
@@ -88,17 +113,18 @@ class Webhook {
|
|
|
88
113
|
{ abortEarly: false, allowUnknown: false }
|
|
89
114
|
);
|
|
90
115
|
if (warrning) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
116
|
+
Logger({
|
|
117
|
+
level: "WARN",
|
|
118
|
+
message: "Parameter Validation warrnings for registerSubscriberToEvent",
|
|
119
|
+
});
|
|
120
|
+
Logger({ level: "WARN", message: warrning });
|
|
95
121
|
}
|
|
96
122
|
|
|
97
123
|
const query_params = {};
|
|
98
124
|
|
|
99
125
|
const xHeaders = {};
|
|
100
126
|
|
|
101
|
-
|
|
127
|
+
const response = await PlatformAPIClient.execute(
|
|
102
128
|
this.config,
|
|
103
129
|
"post",
|
|
104
130
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber`,
|
|
@@ -106,15 +132,33 @@ class Webhook {
|
|
|
106
132
|
body,
|
|
107
133
|
xHeaders
|
|
108
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;
|
|
109
152
|
}
|
|
110
153
|
|
|
111
154
|
/**
|
|
112
155
|
* @param {Object} arg - Arg object.
|
|
113
156
|
* @param {SubscriberConfig} arg.body
|
|
157
|
+
* @returns {Promise<SubscriberConfig>} - Success response
|
|
114
158
|
* @summary: Update Subscriber
|
|
115
159
|
* @description: Update Subscriber
|
|
116
160
|
*/
|
|
117
|
-
updateSubscriberConfig({ body } = {}) {
|
|
161
|
+
async updateSubscriberConfig({ body } = {}) {
|
|
118
162
|
const { error } = WebhookValidator.updateSubscriberConfig().validate(
|
|
119
163
|
{
|
|
120
164
|
body,
|
|
@@ -135,15 +179,18 @@ class Webhook {
|
|
|
135
179
|
{ abortEarly: false, allowUnknown: false }
|
|
136
180
|
);
|
|
137
181
|
if (warrning) {
|
|
138
|
-
|
|
139
|
-
|
|
182
|
+
Logger({
|
|
183
|
+
level: "WARN",
|
|
184
|
+
message: "Parameter Validation warrnings for updateSubscriberConfig",
|
|
185
|
+
});
|
|
186
|
+
Logger({ level: "WARN", message: warrning });
|
|
140
187
|
}
|
|
141
188
|
|
|
142
189
|
const query_params = {};
|
|
143
190
|
|
|
144
191
|
const xHeaders = {};
|
|
145
192
|
|
|
146
|
-
|
|
193
|
+
const response = await PlatformAPIClient.execute(
|
|
147
194
|
this.config,
|
|
148
195
|
"put",
|
|
149
196
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber`,
|
|
@@ -151,6 +198,23 @@ class Webhook {
|
|
|
151
198
|
body,
|
|
152
199
|
xHeaders
|
|
153
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;
|
|
154
218
|
}
|
|
155
219
|
|
|
156
220
|
/**
|
|
@@ -158,10 +222,11 @@ class Webhook {
|
|
|
158
222
|
* @param {number} [arg.pageNo] - Page Number
|
|
159
223
|
* @param {number} [arg.pageSize] - Page Size
|
|
160
224
|
* @param {string} arg.extensionId - Extension ID
|
|
225
|
+
* @returns {Promise<SubscriberConfigList>} - Success response
|
|
161
226
|
* @summary: Get Subscribers By Extension ID
|
|
162
227
|
* @description: Get Subscribers By ExtensionID
|
|
163
228
|
*/
|
|
164
|
-
getSubscribersByExtensionId({ extensionId, pageNo, pageSize } = {}) {
|
|
229
|
+
async getSubscribersByExtensionId({ extensionId, pageNo, pageSize } = {}) {
|
|
165
230
|
const { error } = WebhookValidator.getSubscribersByExtensionId().validate(
|
|
166
231
|
{
|
|
167
232
|
extensionId,
|
|
@@ -186,10 +251,12 @@ class Webhook {
|
|
|
186
251
|
{ abortEarly: false, allowUnknown: false }
|
|
187
252
|
);
|
|
188
253
|
if (warrning) {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
254
|
+
Logger({
|
|
255
|
+
level: "WARN",
|
|
256
|
+
message:
|
|
257
|
+
"Parameter Validation warrnings for getSubscribersByExtensionId",
|
|
258
|
+
});
|
|
259
|
+
Logger({ level: "WARN", message: warrning });
|
|
193
260
|
}
|
|
194
261
|
|
|
195
262
|
const query_params = {};
|
|
@@ -198,7 +265,7 @@ class Webhook {
|
|
|
198
265
|
|
|
199
266
|
const xHeaders = {};
|
|
200
267
|
|
|
201
|
-
|
|
268
|
+
const response = await PlatformAPIClient.execute(
|
|
202
269
|
this.config,
|
|
203
270
|
"get",
|
|
204
271
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/extension/${extensionId}/subscriber`,
|
|
@@ -206,15 +273,34 @@ class Webhook {
|
|
|
206
273
|
undefined,
|
|
207
274
|
xHeaders
|
|
208
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;
|
|
209
294
|
}
|
|
210
295
|
|
|
211
296
|
/**
|
|
212
297
|
* @param {Object} arg - Arg object.
|
|
213
298
|
* @param {number} arg.subscriberId - Subscriber ID
|
|
299
|
+
* @returns {Promise<SubscriberResponse>} - Success response
|
|
214
300
|
* @summary: Get Subscriber By Subscriber ID
|
|
215
301
|
* @description: Get Subscriber By Subscriber ID
|
|
216
302
|
*/
|
|
217
|
-
getSubscriberById({ subscriberId } = {}) {
|
|
303
|
+
async getSubscriberById({ subscriberId } = {}) {
|
|
218
304
|
const { error } = WebhookValidator.getSubscriberById().validate(
|
|
219
305
|
{
|
|
220
306
|
subscriberId,
|
|
@@ -233,15 +319,18 @@ class Webhook {
|
|
|
233
319
|
{ abortEarly: false, allowUnknown: false }
|
|
234
320
|
);
|
|
235
321
|
if (warrning) {
|
|
236
|
-
|
|
237
|
-
|
|
322
|
+
Logger({
|
|
323
|
+
level: "WARN",
|
|
324
|
+
message: "Parameter Validation warrnings for getSubscriberById",
|
|
325
|
+
});
|
|
326
|
+
Logger({ level: "WARN", message: warrning });
|
|
238
327
|
}
|
|
239
328
|
|
|
240
329
|
const query_params = {};
|
|
241
330
|
|
|
242
331
|
const xHeaders = {};
|
|
243
332
|
|
|
244
|
-
|
|
333
|
+
const response = await PlatformAPIClient.execute(
|
|
245
334
|
this.config,
|
|
246
335
|
"get",
|
|
247
336
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/subscriber/${subscriberId}`,
|
|
@@ -249,14 +338,32 @@ class Webhook {
|
|
|
249
338
|
undefined,
|
|
250
339
|
xHeaders
|
|
251
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;
|
|
252
358
|
}
|
|
253
359
|
|
|
254
360
|
/**
|
|
255
361
|
* @param {Object} arg - Arg object.
|
|
362
|
+
* @returns {Promise<EventConfigResponse>} - Success response
|
|
256
363
|
* @summary:
|
|
257
364
|
* @description: Get All Webhook Events
|
|
258
365
|
*/
|
|
259
|
-
fetchAllEventConfigurations({} = {}) {
|
|
366
|
+
async fetchAllEventConfigurations({} = {}) {
|
|
260
367
|
const { error } = WebhookValidator.fetchAllEventConfigurations().validate(
|
|
261
368
|
{},
|
|
262
369
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -273,17 +380,19 @@ class Webhook {
|
|
|
273
380
|
{ abortEarly: false, allowUnknown: false }
|
|
274
381
|
);
|
|
275
382
|
if (warrning) {
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
383
|
+
Logger({
|
|
384
|
+
level: "WARN",
|
|
385
|
+
message:
|
|
386
|
+
"Parameter Validation warrnings for fetchAllEventConfigurations",
|
|
387
|
+
});
|
|
388
|
+
Logger({ level: "WARN", message: warrning });
|
|
280
389
|
}
|
|
281
390
|
|
|
282
391
|
const query_params = {};
|
|
283
392
|
|
|
284
393
|
const xHeaders = {};
|
|
285
394
|
|
|
286
|
-
|
|
395
|
+
const response = await PlatformAPIClient.execute(
|
|
287
396
|
this.config,
|
|
288
397
|
"get",
|
|
289
398
|
`/service/platform/webhook/v1.0/company/${this.config.companyId}/events`,
|
|
@@ -291,6 +400,24 @@ class Webhook {
|
|
|
291
400
|
undefined,
|
|
292
401
|
xHeaders
|
|
293
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;
|
|
294
421
|
}
|
|
295
422
|
}
|
|
296
423
|
|
|
@@ -3,6 +3,9 @@ const { FDKClientValidationError } = require("../../common/FDKError");
|
|
|
3
3
|
const constructUrl = require("../constructUrl");
|
|
4
4
|
const Paginator = require("../../common/Paginator");
|
|
5
5
|
const ConfigurationValidator = require("./ConfigurationPublicValidator");
|
|
6
|
+
const ConfigurationModel = require("./ConfigurationPublicModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
8
|
+
|
|
6
9
|
class Configuration {
|
|
7
10
|
constructor(_conf) {
|
|
8
11
|
this._conf = _conf;
|
|
@@ -35,7 +38,7 @@ class Configuration {
|
|
|
35
38
|
* @summary: Search Application
|
|
36
39
|
* @description: Provide application name or domain url
|
|
37
40
|
*/
|
|
38
|
-
searchApplication({ authorization, query } = {}) {
|
|
41
|
+
async searchApplication({ authorization, query } = {}) {
|
|
39
42
|
const { error } = ConfigurationValidator.searchApplication().validate(
|
|
40
43
|
{ authorization, query },
|
|
41
44
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -52,8 +55,11 @@ class Configuration {
|
|
|
52
55
|
{ abortEarly: false, allowUnknown: false }
|
|
53
56
|
);
|
|
54
57
|
if (warrning) {
|
|
55
|
-
|
|
56
|
-
|
|
58
|
+
Logger({
|
|
59
|
+
level: "WARN",
|
|
60
|
+
message: "Parameter Validation warrnings for searchApplication",
|
|
61
|
+
});
|
|
62
|
+
Logger({ level: "WARN", message: warrning });
|
|
57
63
|
}
|
|
58
64
|
|
|
59
65
|
const query_params = {};
|
|
@@ -62,7 +68,7 @@ class Configuration {
|
|
|
62
68
|
const xHeaders = {};
|
|
63
69
|
xHeaders["authorization"] = authorization;
|
|
64
70
|
|
|
65
|
-
|
|
71
|
+
const response = await PublicAPIClient.execute(
|
|
66
72
|
this._conf,
|
|
67
73
|
"get",
|
|
68
74
|
constructUrl({
|
|
@@ -73,6 +79,23 @@ class Configuration {
|
|
|
73
79
|
undefined,
|
|
74
80
|
xHeaders
|
|
75
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;
|
|
76
99
|
}
|
|
77
100
|
|
|
78
101
|
/**
|
|
@@ -86,7 +109,7 @@ class Configuration {
|
|
|
86
109
|
* @summary: Get countries, states, cities
|
|
87
110
|
* @description:
|
|
88
111
|
*/
|
|
89
|
-
getLocations({ locationType, id } = {}) {
|
|
112
|
+
async getLocations({ locationType, id } = {}) {
|
|
90
113
|
const { error } = ConfigurationValidator.getLocations().validate(
|
|
91
114
|
{ locationType, id },
|
|
92
115
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -101,8 +124,11 @@ class Configuration {
|
|
|
101
124
|
{ abortEarly: false, allowUnknown: false }
|
|
102
125
|
);
|
|
103
126
|
if (warrning) {
|
|
104
|
-
|
|
105
|
-
|
|
127
|
+
Logger({
|
|
128
|
+
level: "WARN",
|
|
129
|
+
message: "Parameter Validation warrnings for getLocations",
|
|
130
|
+
});
|
|
131
|
+
Logger({ level: "WARN", message: warrning });
|
|
106
132
|
}
|
|
107
133
|
|
|
108
134
|
const query_params = {};
|
|
@@ -111,7 +137,7 @@ class Configuration {
|
|
|
111
137
|
|
|
112
138
|
const xHeaders = {};
|
|
113
139
|
|
|
114
|
-
|
|
140
|
+
const response = await PublicAPIClient.execute(
|
|
115
141
|
this._conf,
|
|
116
142
|
"get",
|
|
117
143
|
constructUrl({
|
|
@@ -122,6 +148,23 @@ class Configuration {
|
|
|
122
148
|
undefined,
|
|
123
149
|
xHeaders
|
|
124
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;
|
|
125
168
|
}
|
|
126
169
|
}
|
|
127
170
|
module.exports = Configuration;
|