@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
|
@@ -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 InventoryValidator = require("./InventoryPublicValidator");
|
|
6
|
+
const InventoryModel = require("./InventoryPublicModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
8
|
+
|
|
5
9
|
class Inventory {
|
|
6
10
|
constructor(_conf) {
|
|
7
11
|
this._conf = _conf;
|
|
@@ -40,7 +44,7 @@ class Inventory {
|
|
|
40
44
|
* @summary: Find all the JobCodes from Metrics Collection based on the field Values
|
|
41
45
|
* @description: Endpoint to return all JobCodes present in Metrics Collection
|
|
42
46
|
*/
|
|
43
|
-
getJobCodesMetrics({ dailyJob, jobCode } = {}) {
|
|
47
|
+
async getJobCodesMetrics({ dailyJob, jobCode } = {}) {
|
|
44
48
|
const { error } = InventoryValidator.getJobCodesMetrics().validate(
|
|
45
49
|
{ dailyJob, jobCode },
|
|
46
50
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -48,13 +52,29 @@ class Inventory {
|
|
|
48
52
|
if (error) {
|
|
49
53
|
return Promise.reject(new FDKClientValidationError(error));
|
|
50
54
|
}
|
|
55
|
+
|
|
56
|
+
// Showing warrnings if extra unknown parameters are found
|
|
57
|
+
const {
|
|
58
|
+
error: warrning,
|
|
59
|
+
} = InventoryValidator.getJobCodesMetrics().validate(
|
|
60
|
+
{ dailyJob, jobCode },
|
|
61
|
+
{ abortEarly: false, allowUnknown: false }
|
|
62
|
+
);
|
|
63
|
+
if (warrning) {
|
|
64
|
+
Logger({
|
|
65
|
+
level: "WARN",
|
|
66
|
+
message: "Parameter Validation warrnings for getJobCodesMetrics",
|
|
67
|
+
});
|
|
68
|
+
Logger({ level: "WARN", message: warrning });
|
|
69
|
+
}
|
|
70
|
+
|
|
51
71
|
const query_params = {};
|
|
52
72
|
query_params["daily_job"] = dailyJob;
|
|
53
73
|
query_params["job_code"] = jobCode;
|
|
54
74
|
|
|
55
75
|
const xHeaders = {};
|
|
56
76
|
|
|
57
|
-
|
|
77
|
+
const response = await PublicAPIClient.execute(
|
|
58
78
|
this._conf,
|
|
59
79
|
"get",
|
|
60
80
|
constructUrl({
|
|
@@ -65,6 +85,23 @@ class Inventory {
|
|
|
65
85
|
undefined,
|
|
66
86
|
xHeaders
|
|
67
87
|
);
|
|
88
|
+
|
|
89
|
+
const {
|
|
90
|
+
error: res_error,
|
|
91
|
+
} = InventoryModel.ResponseEnvelopeObject().validate(response, {
|
|
92
|
+
abortEarly: false,
|
|
93
|
+
allowUnknown: false,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
if (res_error) {
|
|
97
|
+
Logger({
|
|
98
|
+
level: "WARN",
|
|
99
|
+
message: "Response Validation Warnnings for getJobCodesMetrics",
|
|
100
|
+
});
|
|
101
|
+
Logger({ level: "WARN", message: res_error });
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return response;
|
|
68
105
|
}
|
|
69
106
|
|
|
70
107
|
/**
|
|
@@ -74,7 +111,7 @@ class Inventory {
|
|
|
74
111
|
* @summary: Save JobCode Metrics
|
|
75
112
|
* @description: Endpoint to save JobCode Metrics
|
|
76
113
|
*/
|
|
77
|
-
saveJobCodesMetrics({ body } = {}) {
|
|
114
|
+
async saveJobCodesMetrics({ body } = {}) {
|
|
78
115
|
const { error } = InventoryValidator.saveJobCodesMetrics().validate(
|
|
79
116
|
{ body },
|
|
80
117
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -82,11 +119,27 @@ class Inventory {
|
|
|
82
119
|
if (error) {
|
|
83
120
|
return Promise.reject(new FDKClientValidationError(error));
|
|
84
121
|
}
|
|
122
|
+
|
|
123
|
+
// Showing warrnings if extra unknown parameters are found
|
|
124
|
+
const {
|
|
125
|
+
error: warrning,
|
|
126
|
+
} = InventoryValidator.saveJobCodesMetrics().validate(
|
|
127
|
+
{ body },
|
|
128
|
+
{ abortEarly: false, allowUnknown: false }
|
|
129
|
+
);
|
|
130
|
+
if (warrning) {
|
|
131
|
+
Logger({
|
|
132
|
+
level: "WARN",
|
|
133
|
+
message: "Parameter Validation warrnings for saveJobCodesMetrics",
|
|
134
|
+
});
|
|
135
|
+
Logger({ level: "WARN", message: warrning });
|
|
136
|
+
}
|
|
137
|
+
|
|
85
138
|
const query_params = {};
|
|
86
139
|
|
|
87
140
|
const xHeaders = {};
|
|
88
141
|
|
|
89
|
-
|
|
142
|
+
const response = await PublicAPIClient.execute(
|
|
90
143
|
this._conf,
|
|
91
144
|
"post",
|
|
92
145
|
constructUrl({
|
|
@@ -97,6 +150,23 @@ class Inventory {
|
|
|
97
150
|
body,
|
|
98
151
|
xHeaders
|
|
99
152
|
);
|
|
153
|
+
|
|
154
|
+
const {
|
|
155
|
+
error: res_error,
|
|
156
|
+
} = InventoryModel.ResponseEnvelopeEmailJobMetrics().validate(response, {
|
|
157
|
+
abortEarly: false,
|
|
158
|
+
allowUnknown: false,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
if (res_error) {
|
|
162
|
+
Logger({
|
|
163
|
+
level: "WARN",
|
|
164
|
+
message: "Response Validation Warnnings for saveJobCodesMetrics",
|
|
165
|
+
});
|
|
166
|
+
Logger({ level: "WARN", message: res_error });
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return response;
|
|
100
170
|
}
|
|
101
171
|
|
|
102
172
|
/**
|
|
@@ -106,7 +176,7 @@ class Inventory {
|
|
|
106
176
|
* @summary: Get Slingshot Configuration Of A Company using API key
|
|
107
177
|
* @description: REST Endpoint that returns all configuration detail of a company
|
|
108
178
|
*/
|
|
109
|
-
getConfigByApiKey({ apikey } = {}) {
|
|
179
|
+
async getConfigByApiKey({ apikey } = {}) {
|
|
110
180
|
const { error } = InventoryValidator.getConfigByApiKey().validate(
|
|
111
181
|
{ apikey },
|
|
112
182
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -114,12 +184,26 @@ class Inventory {
|
|
|
114
184
|
if (error) {
|
|
115
185
|
return Promise.reject(new FDKClientValidationError(error));
|
|
116
186
|
}
|
|
187
|
+
|
|
188
|
+
// Showing warrnings if extra unknown parameters are found
|
|
189
|
+
const { error: warrning } = InventoryValidator.getConfigByApiKey().validate(
|
|
190
|
+
{ apikey },
|
|
191
|
+
{ abortEarly: false, allowUnknown: false }
|
|
192
|
+
);
|
|
193
|
+
if (warrning) {
|
|
194
|
+
Logger({
|
|
195
|
+
level: "WARN",
|
|
196
|
+
message: "Parameter Validation warrnings for getConfigByApiKey",
|
|
197
|
+
});
|
|
198
|
+
Logger({ level: "WARN", message: warrning });
|
|
199
|
+
}
|
|
200
|
+
|
|
117
201
|
const query_params = {};
|
|
118
202
|
query_params["apikey"] = apikey;
|
|
119
203
|
|
|
120
204
|
const xHeaders = {};
|
|
121
205
|
|
|
122
|
-
|
|
206
|
+
const response = await PublicAPIClient.execute(
|
|
123
207
|
this._conf,
|
|
124
208
|
"get",
|
|
125
209
|
constructUrl({
|
|
@@ -130,6 +214,23 @@ class Inventory {
|
|
|
130
214
|
undefined,
|
|
131
215
|
xHeaders
|
|
132
216
|
);
|
|
217
|
+
|
|
218
|
+
const {
|
|
219
|
+
error: res_error,
|
|
220
|
+
} = InventoryModel.ResponseEnvelopeSlingshotConfigurationDetail().validate(
|
|
221
|
+
response,
|
|
222
|
+
{ abortEarly: false, allowUnknown: false }
|
|
223
|
+
);
|
|
224
|
+
|
|
225
|
+
if (res_error) {
|
|
226
|
+
Logger({
|
|
227
|
+
level: "WARN",
|
|
228
|
+
message: "Response Validation Warnnings for getConfigByApiKey",
|
|
229
|
+
});
|
|
230
|
+
Logger({ level: "WARN", message: res_error });
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return response;
|
|
133
234
|
}
|
|
134
235
|
|
|
135
236
|
/**
|
|
@@ -140,7 +241,7 @@ class Inventory {
|
|
|
140
241
|
* @summary: Get apikey for Company to call other Slingshot Configuration APIs
|
|
141
242
|
* @description: REST Endpoint that returns apikey by username by password
|
|
142
243
|
*/
|
|
143
|
-
getApiKey({ userName, password } = {}) {
|
|
244
|
+
async getApiKey({ userName, password } = {}) {
|
|
144
245
|
const { error } = InventoryValidator.getApiKey().validate(
|
|
145
246
|
{ userName, password },
|
|
146
247
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -148,13 +249,27 @@ class Inventory {
|
|
|
148
249
|
if (error) {
|
|
149
250
|
return Promise.reject(new FDKClientValidationError(error));
|
|
150
251
|
}
|
|
252
|
+
|
|
253
|
+
// Showing warrnings if extra unknown parameters are found
|
|
254
|
+
const { error: warrning } = InventoryValidator.getApiKey().validate(
|
|
255
|
+
{ userName, password },
|
|
256
|
+
{ abortEarly: false, allowUnknown: false }
|
|
257
|
+
);
|
|
258
|
+
if (warrning) {
|
|
259
|
+
Logger({
|
|
260
|
+
level: "WARN",
|
|
261
|
+
message: "Parameter Validation warrnings for getApiKey",
|
|
262
|
+
});
|
|
263
|
+
Logger({ level: "WARN", message: warrning });
|
|
264
|
+
}
|
|
265
|
+
|
|
151
266
|
const query_params = {};
|
|
152
267
|
query_params["user_name"] = userName;
|
|
153
268
|
query_params["password"] = password;
|
|
154
269
|
|
|
155
270
|
const xHeaders = {};
|
|
156
271
|
|
|
157
|
-
|
|
272
|
+
const response = await PublicAPIClient.execute(
|
|
158
273
|
this._conf,
|
|
159
274
|
"get",
|
|
160
275
|
constructUrl({
|
|
@@ -165,6 +280,23 @@ class Inventory {
|
|
|
165
280
|
undefined,
|
|
166
281
|
xHeaders
|
|
167
282
|
);
|
|
283
|
+
|
|
284
|
+
const {
|
|
285
|
+
error: res_error,
|
|
286
|
+
} = InventoryModel.ResponseEnvelopeApikeyModel().validate(response, {
|
|
287
|
+
abortEarly: false,
|
|
288
|
+
allowUnknown: false,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
if (res_error) {
|
|
292
|
+
Logger({
|
|
293
|
+
level: "WARN",
|
|
294
|
+
message: "Response Validation Warnnings for getApiKey",
|
|
295
|
+
});
|
|
296
|
+
Logger({ level: "WARN", message: res_error });
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return response;
|
|
168
300
|
}
|
|
169
301
|
|
|
170
302
|
/**
|
|
@@ -174,7 +306,7 @@ class Inventory {
|
|
|
174
306
|
* @summary: Get Job Config By Code
|
|
175
307
|
* @description: REST Endpoint that returns job config by code
|
|
176
308
|
*/
|
|
177
|
-
getJobByCode({ code } = {}) {
|
|
309
|
+
async getJobByCode({ code } = {}) {
|
|
178
310
|
const { error } = InventoryValidator.getJobByCode().validate(
|
|
179
311
|
{ code },
|
|
180
312
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -182,11 +314,25 @@ class Inventory {
|
|
|
182
314
|
if (error) {
|
|
183
315
|
return Promise.reject(new FDKClientValidationError(error));
|
|
184
316
|
}
|
|
317
|
+
|
|
318
|
+
// Showing warrnings if extra unknown parameters are found
|
|
319
|
+
const { error: warrning } = InventoryValidator.getJobByCode().validate(
|
|
320
|
+
{ code },
|
|
321
|
+
{ abortEarly: false, allowUnknown: false }
|
|
322
|
+
);
|
|
323
|
+
if (warrning) {
|
|
324
|
+
Logger({
|
|
325
|
+
level: "WARN",
|
|
326
|
+
message: "Parameter Validation warrnings for getJobByCode",
|
|
327
|
+
});
|
|
328
|
+
Logger({ level: "WARN", message: warrning });
|
|
329
|
+
}
|
|
330
|
+
|
|
185
331
|
const query_params = {};
|
|
186
332
|
|
|
187
333
|
const xHeaders = {};
|
|
188
334
|
|
|
189
|
-
|
|
335
|
+
const response = await PublicAPIClient.execute(
|
|
190
336
|
this._conf,
|
|
191
337
|
"get",
|
|
192
338
|
constructUrl({
|
|
@@ -197,6 +343,23 @@ class Inventory {
|
|
|
197
343
|
undefined,
|
|
198
344
|
xHeaders
|
|
199
345
|
);
|
|
346
|
+
|
|
347
|
+
const {
|
|
348
|
+
error: res_error,
|
|
349
|
+
} = InventoryModel.ResponseEnvelopeJobConfigDTO().validate(response, {
|
|
350
|
+
abortEarly: false,
|
|
351
|
+
allowUnknown: false,
|
|
352
|
+
});
|
|
353
|
+
|
|
354
|
+
if (res_error) {
|
|
355
|
+
Logger({
|
|
356
|
+
level: "WARN",
|
|
357
|
+
message: "Response Validation Warnnings for getJobByCode",
|
|
358
|
+
});
|
|
359
|
+
Logger({ level: "WARN", message: res_error });
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
return response;
|
|
200
363
|
}
|
|
201
364
|
|
|
202
365
|
/**
|
|
@@ -207,7 +370,7 @@ class Inventory {
|
|
|
207
370
|
* @summary: Get Job Configs By Integration Type
|
|
208
371
|
* @description: REST Endpoint that returns all job Configs by Integration Type
|
|
209
372
|
*/
|
|
210
|
-
getJobConfigByIntegrationType({ integrationType, disable } = {}) {
|
|
373
|
+
async getJobConfigByIntegrationType({ integrationType, disable } = {}) {
|
|
211
374
|
const {
|
|
212
375
|
error,
|
|
213
376
|
} = InventoryValidator.getJobConfigByIntegrationType().validate(
|
|
@@ -217,13 +380,30 @@ class Inventory {
|
|
|
217
380
|
if (error) {
|
|
218
381
|
return Promise.reject(new FDKClientValidationError(error));
|
|
219
382
|
}
|
|
383
|
+
|
|
384
|
+
// Showing warrnings if extra unknown parameters are found
|
|
385
|
+
const {
|
|
386
|
+
error: warrning,
|
|
387
|
+
} = InventoryValidator.getJobConfigByIntegrationType().validate(
|
|
388
|
+
{ integrationType, disable },
|
|
389
|
+
{ abortEarly: false, allowUnknown: false }
|
|
390
|
+
);
|
|
391
|
+
if (warrning) {
|
|
392
|
+
Logger({
|
|
393
|
+
level: "WARN",
|
|
394
|
+
message:
|
|
395
|
+
"Parameter Validation warrnings for getJobConfigByIntegrationType",
|
|
396
|
+
});
|
|
397
|
+
Logger({ level: "WARN", message: warrning });
|
|
398
|
+
}
|
|
399
|
+
|
|
220
400
|
const query_params = {};
|
|
221
401
|
query_params["integration_type"] = integrationType;
|
|
222
402
|
query_params["disable"] = disable;
|
|
223
403
|
|
|
224
404
|
const xHeaders = {};
|
|
225
405
|
|
|
226
|
-
|
|
406
|
+
const response = await PublicAPIClient.execute(
|
|
227
407
|
this._conf,
|
|
228
408
|
"get",
|
|
229
409
|
constructUrl({
|
|
@@ -234,6 +414,24 @@ class Inventory {
|
|
|
234
414
|
undefined,
|
|
235
415
|
xHeaders
|
|
236
416
|
);
|
|
417
|
+
|
|
418
|
+
const {
|
|
419
|
+
error: res_error,
|
|
420
|
+
} = InventoryModel.ResponseEnvelopeListJobConfigDTO().validate(response, {
|
|
421
|
+
abortEarly: false,
|
|
422
|
+
allowUnknown: false,
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
if (res_error) {
|
|
426
|
+
Logger({
|
|
427
|
+
level: "WARN",
|
|
428
|
+
message:
|
|
429
|
+
"Response Validation Warnnings for getJobConfigByIntegrationType",
|
|
430
|
+
});
|
|
431
|
+
Logger({ level: "WARN", message: res_error });
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return response;
|
|
237
435
|
}
|
|
238
436
|
}
|
|
239
437
|
module.exports = Inventory;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const InventoryModel = require("./InventoryPublicModel");
|
|
2
1
|
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
const InventoryModel = require("./InventoryPublicModel");
|
|
3
4
|
class InventoryValidator {
|
|
4
5
|
static getJobCodesMetrics() {
|
|
5
6
|
return Joi.object({
|
|
@@ -40,4 +41,5 @@ class InventoryValidator {
|
|
|
40
41
|
}).required();
|
|
41
42
|
}
|
|
42
43
|
}
|
|
44
|
+
|
|
43
45
|
module.exports = InventoryValidator;
|
|
@@ -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 WebhookValidator = require("./WebhookPublicValidator");
|
|
6
|
+
const WebhookModel = require("./WebhookPublicModel");
|
|
7
|
+
const { Logger } = require("./../../common/Logger");
|
|
8
|
+
|
|
5
9
|
class Webhook {
|
|
6
10
|
constructor(_conf) {
|
|
7
11
|
this._conf = _conf;
|
|
@@ -32,7 +36,7 @@ class Webhook {
|
|
|
32
36
|
* @summary: Get All Webhook Events
|
|
33
37
|
* @description: Get All Webhook Events
|
|
34
38
|
*/
|
|
35
|
-
fetchAllWebhookEvents({} = {}) {
|
|
39
|
+
async fetchAllWebhookEvents({} = {}) {
|
|
36
40
|
const { error } = WebhookValidator.fetchAllWebhookEvents().validate(
|
|
37
41
|
{},
|
|
38
42
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -40,11 +44,27 @@ class Webhook {
|
|
|
40
44
|
if (error) {
|
|
41
45
|
return Promise.reject(new FDKClientValidationError(error));
|
|
42
46
|
}
|
|
47
|
+
|
|
48
|
+
// Showing warrnings if extra unknown parameters are found
|
|
49
|
+
const {
|
|
50
|
+
error: warrning,
|
|
51
|
+
} = WebhookValidator.fetchAllWebhookEvents().validate(
|
|
52
|
+
{},
|
|
53
|
+
{ abortEarly: false, allowUnknown: false }
|
|
54
|
+
);
|
|
55
|
+
if (warrning) {
|
|
56
|
+
Logger({
|
|
57
|
+
level: "WARN",
|
|
58
|
+
message: "Parameter Validation warrnings for fetchAllWebhookEvents",
|
|
59
|
+
});
|
|
60
|
+
Logger({ level: "WARN", message: warrning });
|
|
61
|
+
}
|
|
62
|
+
|
|
43
63
|
const query_params = {};
|
|
44
64
|
|
|
45
65
|
const xHeaders = {};
|
|
46
66
|
|
|
47
|
-
|
|
67
|
+
const response = await PublicAPIClient.execute(
|
|
48
68
|
this._conf,
|
|
49
69
|
"get",
|
|
50
70
|
constructUrl({
|
|
@@ -55,6 +75,23 @@ class Webhook {
|
|
|
55
75
|
undefined,
|
|
56
76
|
xHeaders
|
|
57
77
|
);
|
|
78
|
+
|
|
79
|
+
const {
|
|
80
|
+
error: res_error,
|
|
81
|
+
} = WebhookModel.EventConfigResponse().validate(response, {
|
|
82
|
+
abortEarly: false,
|
|
83
|
+
allowUnknown: false,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
if (res_error) {
|
|
87
|
+
Logger({
|
|
88
|
+
level: "WARN",
|
|
89
|
+
message: "Response Validation Warnnings for fetchAllWebhookEvents",
|
|
90
|
+
});
|
|
91
|
+
Logger({ level: "WARN", message: res_error });
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return response;
|
|
58
95
|
}
|
|
59
96
|
|
|
60
97
|
/**
|
|
@@ -64,7 +101,7 @@ class Webhook {
|
|
|
64
101
|
* @summary: Send webhook event name, type, version, category in request body to get complete details of event from server
|
|
65
102
|
* @description: Get Webhook Event Details for provided events
|
|
66
103
|
*/
|
|
67
|
-
queryWebhookEventDetails({ body } = {}) {
|
|
104
|
+
async queryWebhookEventDetails({ body } = {}) {
|
|
68
105
|
const { error } = WebhookValidator.queryWebhookEventDetails().validate(
|
|
69
106
|
{ body },
|
|
70
107
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -72,11 +109,27 @@ class Webhook {
|
|
|
72
109
|
if (error) {
|
|
73
110
|
return Promise.reject(new FDKClientValidationError(error));
|
|
74
111
|
}
|
|
112
|
+
|
|
113
|
+
// Showing warrnings if extra unknown parameters are found
|
|
114
|
+
const {
|
|
115
|
+
error: warrning,
|
|
116
|
+
} = WebhookValidator.queryWebhookEventDetails().validate(
|
|
117
|
+
{ body },
|
|
118
|
+
{ abortEarly: false, allowUnknown: false }
|
|
119
|
+
);
|
|
120
|
+
if (warrning) {
|
|
121
|
+
Logger({
|
|
122
|
+
level: "WARN",
|
|
123
|
+
message: "Parameter Validation warrnings for queryWebhookEventDetails",
|
|
124
|
+
});
|
|
125
|
+
Logger({ level: "WARN", message: warrning });
|
|
126
|
+
}
|
|
127
|
+
|
|
75
128
|
const query_params = {};
|
|
76
129
|
|
|
77
130
|
const xHeaders = {};
|
|
78
131
|
|
|
79
|
-
|
|
132
|
+
const response = await PublicAPIClient.execute(
|
|
80
133
|
this._conf,
|
|
81
134
|
"post",
|
|
82
135
|
constructUrl({
|
|
@@ -87,6 +140,23 @@ class Webhook {
|
|
|
87
140
|
body,
|
|
88
141
|
xHeaders
|
|
89
142
|
);
|
|
143
|
+
|
|
144
|
+
const {
|
|
145
|
+
error: res_error,
|
|
146
|
+
} = WebhookModel.EventConfigResponse().validate(response, {
|
|
147
|
+
abortEarly: false,
|
|
148
|
+
allowUnknown: false,
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
if (res_error) {
|
|
152
|
+
Logger({
|
|
153
|
+
level: "WARN",
|
|
154
|
+
message: "Response Validation Warnnings for queryWebhookEventDetails",
|
|
155
|
+
});
|
|
156
|
+
Logger({ level: "WARN", message: res_error });
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return response;
|
|
90
160
|
}
|
|
91
161
|
}
|
|
92
162
|
module.exports = Webhook;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
const WebhookModel = require("./WebhookPublicModel");
|
|
2
1
|
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
const WebhookModel = require("./WebhookPublicModel");
|
|
3
4
|
class WebhookValidator {
|
|
4
5
|
static fetchAllWebhookEvents() {
|
|
5
6
|
return Joi.object({});
|
|
@@ -11,4 +12,5 @@ class WebhookValidator {
|
|
|
11
12
|
}).required();
|
|
12
13
|
}
|
|
13
14
|
}
|
|
15
|
+
|
|
14
16
|
module.exports = WebhookValidator;
|