@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
|
@@ -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 LeadValidator = require("./LeadPlatformValidator");
|
|
5
|
+
const LeadModel = require("./LeadPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
5
8
|
class Lead {
|
|
6
9
|
constructor(config) {
|
|
7
10
|
this.config = config;
|
|
@@ -21,10 +24,11 @@ class Lead {
|
|
|
21
24
|
* given set of results.
|
|
22
25
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
23
26
|
* page. Default is 12.
|
|
27
|
+
* @returns {Promise<TicketList>} - Success response
|
|
24
28
|
* @summary: Gets the list of company level tickets and/or ticket filters depending on query params
|
|
25
29
|
* @description: Gets the list of company level tickets and/or ticket filters
|
|
26
30
|
*/
|
|
27
|
-
getTickets({
|
|
31
|
+
async getTickets({
|
|
28
32
|
items,
|
|
29
33
|
filters,
|
|
30
34
|
q,
|
|
@@ -51,6 +55,28 @@ class Lead {
|
|
|
51
55
|
return Promise.reject(new FDKClientValidationError(error));
|
|
52
56
|
}
|
|
53
57
|
|
|
58
|
+
// Showing warrnings if extra unknown parameters are found
|
|
59
|
+
const { error: warrning } = LeadValidator.getTickets().validate(
|
|
60
|
+
{
|
|
61
|
+
items,
|
|
62
|
+
filters,
|
|
63
|
+
q,
|
|
64
|
+
status,
|
|
65
|
+
priority,
|
|
66
|
+
category,
|
|
67
|
+
pageNo,
|
|
68
|
+
pageSize,
|
|
69
|
+
},
|
|
70
|
+
{ abortEarly: false, allowUnknown: false }
|
|
71
|
+
);
|
|
72
|
+
if (warrning) {
|
|
73
|
+
Logger({
|
|
74
|
+
level: "WARN",
|
|
75
|
+
message: "Parameter Validation warrnings for getTickets",
|
|
76
|
+
});
|
|
77
|
+
Logger({ level: "WARN", message: warrning });
|
|
78
|
+
}
|
|
79
|
+
|
|
54
80
|
const query_params = {};
|
|
55
81
|
query_params["items"] = items;
|
|
56
82
|
query_params["filters"] = filters;
|
|
@@ -63,7 +89,7 @@ class Lead {
|
|
|
63
89
|
|
|
64
90
|
const xHeaders = {};
|
|
65
91
|
|
|
66
|
-
|
|
92
|
+
const response = await PlatformAPIClient.execute(
|
|
67
93
|
this.config,
|
|
68
94
|
"get",
|
|
69
95
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket`,
|
|
@@ -71,6 +97,21 @@ class Lead {
|
|
|
71
97
|
undefined,
|
|
72
98
|
xHeaders
|
|
73
99
|
);
|
|
100
|
+
|
|
101
|
+
const { error: res_error } = LeadModel.TicketList().validate(response, {
|
|
102
|
+
abortEarly: false,
|
|
103
|
+
allowUnknown: false,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
if (res_error) {
|
|
107
|
+
Logger({
|
|
108
|
+
level: "WARN",
|
|
109
|
+
message: "Response Validation Warnnings for getTickets",
|
|
110
|
+
});
|
|
111
|
+
Logger({ level: "WARN", message: res_error });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return response;
|
|
74
115
|
}
|
|
75
116
|
|
|
76
117
|
/**
|
|
@@ -125,10 +166,11 @@ class Lead {
|
|
|
125
166
|
/**
|
|
126
167
|
* @param {Object} arg - Arg object.
|
|
127
168
|
* @param {AddTicketPayload} arg.body
|
|
169
|
+
* @returns {Promise<Ticket>} - Success response
|
|
128
170
|
* @summary: Creates a company level ticket
|
|
129
171
|
* @description: Creates a company level ticket
|
|
130
172
|
*/
|
|
131
|
-
createTicket({ body } = {}) {
|
|
173
|
+
async createTicket({ body } = {}) {
|
|
132
174
|
const { error } = LeadValidator.createTicket().validate(
|
|
133
175
|
{
|
|
134
176
|
body,
|
|
@@ -139,11 +181,26 @@ class Lead {
|
|
|
139
181
|
return Promise.reject(new FDKClientValidationError(error));
|
|
140
182
|
}
|
|
141
183
|
|
|
184
|
+
// Showing warrnings if extra unknown parameters are found
|
|
185
|
+
const { error: warrning } = LeadValidator.createTicket().validate(
|
|
186
|
+
{
|
|
187
|
+
body,
|
|
188
|
+
},
|
|
189
|
+
{ abortEarly: false, allowUnknown: false }
|
|
190
|
+
);
|
|
191
|
+
if (warrning) {
|
|
192
|
+
Logger({
|
|
193
|
+
level: "WARN",
|
|
194
|
+
message: "Parameter Validation warrnings for createTicket",
|
|
195
|
+
});
|
|
196
|
+
Logger({ level: "WARN", message: warrning });
|
|
197
|
+
}
|
|
198
|
+
|
|
142
199
|
const query_params = {};
|
|
143
200
|
|
|
144
201
|
const xHeaders = {};
|
|
145
202
|
|
|
146
|
-
|
|
203
|
+
const response = await PlatformAPIClient.execute(
|
|
147
204
|
this.config,
|
|
148
205
|
"post",
|
|
149
206
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket`,
|
|
@@ -151,15 +208,31 @@ class Lead {
|
|
|
151
208
|
body,
|
|
152
209
|
xHeaders
|
|
153
210
|
);
|
|
211
|
+
|
|
212
|
+
const { error: res_error } = LeadModel.Ticket().validate(response, {
|
|
213
|
+
abortEarly: false,
|
|
214
|
+
allowUnknown: false,
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
if (res_error) {
|
|
218
|
+
Logger({
|
|
219
|
+
level: "WARN",
|
|
220
|
+
message: "Response Validation Warnnings for createTicket",
|
|
221
|
+
});
|
|
222
|
+
Logger({ level: "WARN", message: res_error });
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return response;
|
|
154
226
|
}
|
|
155
227
|
|
|
156
228
|
/**
|
|
157
229
|
* @param {Object} arg - Arg object.
|
|
158
230
|
* @param {string} arg.id - Tiket ID of the ticket to be fetched
|
|
231
|
+
* @returns {Promise<Ticket>} - Success response
|
|
159
232
|
* @summary: Retreives ticket details of a company level ticket with ticket ID
|
|
160
233
|
* @description: Retreives ticket details of a company level ticket
|
|
161
234
|
*/
|
|
162
|
-
getTicket({ id } = {}) {
|
|
235
|
+
async getTicket({ id } = {}) {
|
|
163
236
|
const { error } = LeadValidator.getTicket().validate(
|
|
164
237
|
{
|
|
165
238
|
id,
|
|
@@ -170,11 +243,26 @@ class Lead {
|
|
|
170
243
|
return Promise.reject(new FDKClientValidationError(error));
|
|
171
244
|
}
|
|
172
245
|
|
|
246
|
+
// Showing warrnings if extra unknown parameters are found
|
|
247
|
+
const { error: warrning } = LeadValidator.getTicket().validate(
|
|
248
|
+
{
|
|
249
|
+
id,
|
|
250
|
+
},
|
|
251
|
+
{ abortEarly: false, allowUnknown: false }
|
|
252
|
+
);
|
|
253
|
+
if (warrning) {
|
|
254
|
+
Logger({
|
|
255
|
+
level: "WARN",
|
|
256
|
+
message: "Parameter Validation warrnings for getTicket",
|
|
257
|
+
});
|
|
258
|
+
Logger({ level: "WARN", message: warrning });
|
|
259
|
+
}
|
|
260
|
+
|
|
173
261
|
const query_params = {};
|
|
174
262
|
|
|
175
263
|
const xHeaders = {};
|
|
176
264
|
|
|
177
|
-
|
|
265
|
+
const response = await PlatformAPIClient.execute(
|
|
178
266
|
this.config,
|
|
179
267
|
"get",
|
|
180
268
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket/${id}`,
|
|
@@ -182,16 +270,32 @@ class Lead {
|
|
|
182
270
|
undefined,
|
|
183
271
|
xHeaders
|
|
184
272
|
);
|
|
273
|
+
|
|
274
|
+
const { error: res_error } = LeadModel.Ticket().validate(response, {
|
|
275
|
+
abortEarly: false,
|
|
276
|
+
allowUnknown: false,
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
if (res_error) {
|
|
280
|
+
Logger({
|
|
281
|
+
level: "WARN",
|
|
282
|
+
message: "Response Validation Warnnings for getTicket",
|
|
283
|
+
});
|
|
284
|
+
Logger({ level: "WARN", message: res_error });
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
return response;
|
|
185
288
|
}
|
|
186
289
|
|
|
187
290
|
/**
|
|
188
291
|
* @param {Object} arg - Arg object.
|
|
189
292
|
* @param {string} arg.id - Ticket ID of ticket to be edited
|
|
190
293
|
* @param {EditTicketPayload} arg.body
|
|
294
|
+
* @returns {Promise<Ticket>} - Success response
|
|
191
295
|
* @summary: Edits ticket details of a company level ticket
|
|
192
296
|
* @description: Edits ticket details of a company level ticket such as status, priority, category, tags, attachments, assigne & ticket content changes
|
|
193
297
|
*/
|
|
194
|
-
editTicket({ id, body } = {}) {
|
|
298
|
+
async editTicket({ id, body } = {}) {
|
|
195
299
|
const { error } = LeadValidator.editTicket().validate(
|
|
196
300
|
{
|
|
197
301
|
id,
|
|
@@ -203,11 +307,27 @@ class Lead {
|
|
|
203
307
|
return Promise.reject(new FDKClientValidationError(error));
|
|
204
308
|
}
|
|
205
309
|
|
|
310
|
+
// Showing warrnings if extra unknown parameters are found
|
|
311
|
+
const { error: warrning } = LeadValidator.editTicket().validate(
|
|
312
|
+
{
|
|
313
|
+
id,
|
|
314
|
+
body,
|
|
315
|
+
},
|
|
316
|
+
{ abortEarly: false, allowUnknown: false }
|
|
317
|
+
);
|
|
318
|
+
if (warrning) {
|
|
319
|
+
Logger({
|
|
320
|
+
level: "WARN",
|
|
321
|
+
message: "Parameter Validation warrnings for editTicket",
|
|
322
|
+
});
|
|
323
|
+
Logger({ level: "WARN", message: warrning });
|
|
324
|
+
}
|
|
325
|
+
|
|
206
326
|
const query_params = {};
|
|
207
327
|
|
|
208
328
|
const xHeaders = {};
|
|
209
329
|
|
|
210
|
-
|
|
330
|
+
const response = await PlatformAPIClient.execute(
|
|
211
331
|
this.config,
|
|
212
332
|
"put",
|
|
213
333
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket/${id}`,
|
|
@@ -215,16 +335,32 @@ class Lead {
|
|
|
215
335
|
body,
|
|
216
336
|
xHeaders
|
|
217
337
|
);
|
|
338
|
+
|
|
339
|
+
const { error: res_error } = LeadModel.Ticket().validate(response, {
|
|
340
|
+
abortEarly: false,
|
|
341
|
+
allowUnknown: false,
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
if (res_error) {
|
|
345
|
+
Logger({
|
|
346
|
+
level: "WARN",
|
|
347
|
+
message: "Response Validation Warnnings for editTicket",
|
|
348
|
+
});
|
|
349
|
+
Logger({ level: "WARN", message: res_error });
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
return response;
|
|
218
353
|
}
|
|
219
354
|
|
|
220
355
|
/**
|
|
221
356
|
* @param {Object} arg - Arg object.
|
|
222
357
|
* @param {string} arg.id - Ticket ID for which history is created
|
|
223
358
|
* @param {TicketHistoryPayload} arg.body
|
|
359
|
+
* @returns {Promise<TicketHistory>} - Success response
|
|
224
360
|
* @summary: Create history for specific company level ticket
|
|
225
361
|
* @description: Create history for specific company level ticket, this history is seen on ticket detail page, this can be comment, log or rating.
|
|
226
362
|
*/
|
|
227
|
-
createHistory({ id, body } = {}) {
|
|
363
|
+
async createHistory({ id, body } = {}) {
|
|
228
364
|
const { error } = LeadValidator.createHistory().validate(
|
|
229
365
|
{
|
|
230
366
|
id,
|
|
@@ -236,11 +372,27 @@ class Lead {
|
|
|
236
372
|
return Promise.reject(new FDKClientValidationError(error));
|
|
237
373
|
}
|
|
238
374
|
|
|
375
|
+
// Showing warrnings if extra unknown parameters are found
|
|
376
|
+
const { error: warrning } = LeadValidator.createHistory().validate(
|
|
377
|
+
{
|
|
378
|
+
id,
|
|
379
|
+
body,
|
|
380
|
+
},
|
|
381
|
+
{ abortEarly: false, allowUnknown: false }
|
|
382
|
+
);
|
|
383
|
+
if (warrning) {
|
|
384
|
+
Logger({
|
|
385
|
+
level: "WARN",
|
|
386
|
+
message: "Parameter Validation warrnings for createHistory",
|
|
387
|
+
});
|
|
388
|
+
Logger({ level: "WARN", message: warrning });
|
|
389
|
+
}
|
|
390
|
+
|
|
239
391
|
const query_params = {};
|
|
240
392
|
|
|
241
393
|
const xHeaders = {};
|
|
242
394
|
|
|
243
|
-
|
|
395
|
+
const response = await PlatformAPIClient.execute(
|
|
244
396
|
this.config,
|
|
245
397
|
"post",
|
|
246
398
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket/${id}/history`,
|
|
@@ -248,15 +400,31 @@ class Lead {
|
|
|
248
400
|
body,
|
|
249
401
|
xHeaders
|
|
250
402
|
);
|
|
403
|
+
|
|
404
|
+
const { error: res_error } = LeadModel.TicketHistory().validate(response, {
|
|
405
|
+
abortEarly: false,
|
|
406
|
+
allowUnknown: false,
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
if (res_error) {
|
|
410
|
+
Logger({
|
|
411
|
+
level: "WARN",
|
|
412
|
+
message: "Response Validation Warnnings for createHistory",
|
|
413
|
+
});
|
|
414
|
+
Logger({ level: "WARN", message: res_error });
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
return response;
|
|
251
418
|
}
|
|
252
419
|
|
|
253
420
|
/**
|
|
254
421
|
* @param {Object} arg - Arg object.
|
|
255
422
|
* @param {string} arg.id - Ticket ID for which history is to be fetched
|
|
423
|
+
* @returns {Promise<TicketHistoryList>} - Success response
|
|
256
424
|
* @summary: Gets history list for specific company level ticket
|
|
257
425
|
* @description: Gets history list for specific company level ticket, this history is seen on ticket detail page, this can be comment, log or rating.
|
|
258
426
|
*/
|
|
259
|
-
getTicketHistory({ id } = {}) {
|
|
427
|
+
async getTicketHistory({ id } = {}) {
|
|
260
428
|
const { error } = LeadValidator.getTicketHistory().validate(
|
|
261
429
|
{
|
|
262
430
|
id,
|
|
@@ -267,11 +435,26 @@ class Lead {
|
|
|
267
435
|
return Promise.reject(new FDKClientValidationError(error));
|
|
268
436
|
}
|
|
269
437
|
|
|
438
|
+
// Showing warrnings if extra unknown parameters are found
|
|
439
|
+
const { error: warrning } = LeadValidator.getTicketHistory().validate(
|
|
440
|
+
{
|
|
441
|
+
id,
|
|
442
|
+
},
|
|
443
|
+
{ abortEarly: false, allowUnknown: false }
|
|
444
|
+
);
|
|
445
|
+
if (warrning) {
|
|
446
|
+
Logger({
|
|
447
|
+
level: "WARN",
|
|
448
|
+
message: "Parameter Validation warrnings for getTicketHistory",
|
|
449
|
+
});
|
|
450
|
+
Logger({ level: "WARN", message: warrning });
|
|
451
|
+
}
|
|
452
|
+
|
|
270
453
|
const query_params = {};
|
|
271
454
|
|
|
272
455
|
const xHeaders = {};
|
|
273
456
|
|
|
274
|
-
|
|
457
|
+
const response = await PlatformAPIClient.execute(
|
|
275
458
|
this.config,
|
|
276
459
|
"get",
|
|
277
460
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket/${id}/history`,
|
|
@@ -279,15 +462,33 @@ class Lead {
|
|
|
279
462
|
undefined,
|
|
280
463
|
xHeaders
|
|
281
464
|
);
|
|
465
|
+
|
|
466
|
+
const {
|
|
467
|
+
error: res_error,
|
|
468
|
+
} = LeadModel.TicketHistoryList().validate(response, {
|
|
469
|
+
abortEarly: false,
|
|
470
|
+
allowUnknown: false,
|
|
471
|
+
});
|
|
472
|
+
|
|
473
|
+
if (res_error) {
|
|
474
|
+
Logger({
|
|
475
|
+
level: "WARN",
|
|
476
|
+
message: "Response Validation Warnnings for getTicketHistory",
|
|
477
|
+
});
|
|
478
|
+
Logger({ level: "WARN", message: res_error });
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
return response;
|
|
282
482
|
}
|
|
283
483
|
|
|
284
484
|
/**
|
|
285
485
|
* @param {Object} arg - Arg object.
|
|
286
486
|
* @param {string} arg.id - Ticket ID for which feedbacks are to be fetched
|
|
487
|
+
* @returns {Promise<TicketFeedbackList>} - Success response
|
|
287
488
|
* @summary: Gets a list of feedback submitted against that ticket
|
|
288
489
|
* @description: Gets a list of feedback submitted against that ticket
|
|
289
490
|
*/
|
|
290
|
-
getFeedbacks({ id } = {}) {
|
|
491
|
+
async getFeedbacks({ id } = {}) {
|
|
291
492
|
const { error } = LeadValidator.getFeedbacks().validate(
|
|
292
493
|
{
|
|
293
494
|
id,
|
|
@@ -298,11 +499,26 @@ class Lead {
|
|
|
298
499
|
return Promise.reject(new FDKClientValidationError(error));
|
|
299
500
|
}
|
|
300
501
|
|
|
502
|
+
// Showing warrnings if extra unknown parameters are found
|
|
503
|
+
const { error: warrning } = LeadValidator.getFeedbacks().validate(
|
|
504
|
+
{
|
|
505
|
+
id,
|
|
506
|
+
},
|
|
507
|
+
{ abortEarly: false, allowUnknown: false }
|
|
508
|
+
);
|
|
509
|
+
if (warrning) {
|
|
510
|
+
Logger({
|
|
511
|
+
level: "WARN",
|
|
512
|
+
message: "Parameter Validation warrnings for getFeedbacks",
|
|
513
|
+
});
|
|
514
|
+
Logger({ level: "WARN", message: warrning });
|
|
515
|
+
}
|
|
516
|
+
|
|
301
517
|
const query_params = {};
|
|
302
518
|
|
|
303
519
|
const xHeaders = {};
|
|
304
520
|
|
|
305
|
-
|
|
521
|
+
const response = await PlatformAPIClient.execute(
|
|
306
522
|
this.config,
|
|
307
523
|
"get",
|
|
308
524
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket/${id}/feedback`,
|
|
@@ -310,16 +526,34 @@ class Lead {
|
|
|
310
526
|
undefined,
|
|
311
527
|
xHeaders
|
|
312
528
|
);
|
|
529
|
+
|
|
530
|
+
const {
|
|
531
|
+
error: res_error,
|
|
532
|
+
} = LeadModel.TicketFeedbackList().validate(response, {
|
|
533
|
+
abortEarly: false,
|
|
534
|
+
allowUnknown: false,
|
|
535
|
+
});
|
|
536
|
+
|
|
537
|
+
if (res_error) {
|
|
538
|
+
Logger({
|
|
539
|
+
level: "WARN",
|
|
540
|
+
message: "Response Validation Warnnings for getFeedbacks",
|
|
541
|
+
});
|
|
542
|
+
Logger({ level: "WARN", message: res_error });
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
return response;
|
|
313
546
|
}
|
|
314
547
|
|
|
315
548
|
/**
|
|
316
549
|
* @param {Object} arg - Arg object.
|
|
317
550
|
* @param {string} arg.id - Ticket ID for which feedback is to be submitted
|
|
318
551
|
* @param {TicketFeedbackPayload} arg.body
|
|
552
|
+
* @returns {Promise<TicketFeedback>} - Success response
|
|
319
553
|
* @summary: Submit a response for feeback form against that ticket
|
|
320
554
|
* @description: Submit a response for feeback form against that ticket
|
|
321
555
|
*/
|
|
322
|
-
submitFeedback({ id, body } = {}) {
|
|
556
|
+
async submitFeedback({ id, body } = {}) {
|
|
323
557
|
const { error } = LeadValidator.submitFeedback().validate(
|
|
324
558
|
{
|
|
325
559
|
id,
|
|
@@ -331,11 +565,27 @@ class Lead {
|
|
|
331
565
|
return Promise.reject(new FDKClientValidationError(error));
|
|
332
566
|
}
|
|
333
567
|
|
|
568
|
+
// Showing warrnings if extra unknown parameters are found
|
|
569
|
+
const { error: warrning } = LeadValidator.submitFeedback().validate(
|
|
570
|
+
{
|
|
571
|
+
id,
|
|
572
|
+
body,
|
|
573
|
+
},
|
|
574
|
+
{ abortEarly: false, allowUnknown: false }
|
|
575
|
+
);
|
|
576
|
+
if (warrning) {
|
|
577
|
+
Logger({
|
|
578
|
+
level: "WARN",
|
|
579
|
+
message: "Parameter Validation warrnings for submitFeedback",
|
|
580
|
+
});
|
|
581
|
+
Logger({ level: "WARN", message: warrning });
|
|
582
|
+
}
|
|
583
|
+
|
|
334
584
|
const query_params = {};
|
|
335
585
|
|
|
336
586
|
const xHeaders = {};
|
|
337
587
|
|
|
338
|
-
|
|
588
|
+
const response = await PlatformAPIClient.execute(
|
|
339
589
|
this.config,
|
|
340
590
|
"post",
|
|
341
591
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/ticket/${id}/feedback`,
|
|
@@ -343,15 +593,31 @@ class Lead {
|
|
|
343
593
|
body,
|
|
344
594
|
xHeaders
|
|
345
595
|
);
|
|
596
|
+
|
|
597
|
+
const { error: res_error } = LeadModel.TicketFeedback().validate(response, {
|
|
598
|
+
abortEarly: false,
|
|
599
|
+
allowUnknown: false,
|
|
600
|
+
});
|
|
601
|
+
|
|
602
|
+
if (res_error) {
|
|
603
|
+
Logger({
|
|
604
|
+
level: "WARN",
|
|
605
|
+
message: "Response Validation Warnnings for submitFeedback",
|
|
606
|
+
});
|
|
607
|
+
Logger({ level: "WARN", message: res_error });
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
return response;
|
|
346
611
|
}
|
|
347
612
|
|
|
348
613
|
/**
|
|
349
614
|
* @param {Object} arg - Arg object.
|
|
350
615
|
* @param {string} arg.uniqueName - Unique name of video room
|
|
616
|
+
* @returns {Promise<GetTokenForVideoRoomResponse>} - Success response
|
|
351
617
|
* @summary: Get Token to join a specific Video Room using it's unqiue name
|
|
352
618
|
* @description: Get Token to join a specific Video Room using it's unqiue name, this Token is your ticket to Room and also creates your identity there.
|
|
353
619
|
*/
|
|
354
|
-
getTokenForVideoRoom({ uniqueName } = {}) {
|
|
620
|
+
async getTokenForVideoRoom({ uniqueName } = {}) {
|
|
355
621
|
const { error } = LeadValidator.getTokenForVideoRoom().validate(
|
|
356
622
|
{
|
|
357
623
|
uniqueName,
|
|
@@ -362,11 +628,26 @@ class Lead {
|
|
|
362
628
|
return Promise.reject(new FDKClientValidationError(error));
|
|
363
629
|
}
|
|
364
630
|
|
|
631
|
+
// Showing warrnings if extra unknown parameters are found
|
|
632
|
+
const { error: warrning } = LeadValidator.getTokenForVideoRoom().validate(
|
|
633
|
+
{
|
|
634
|
+
uniqueName,
|
|
635
|
+
},
|
|
636
|
+
{ abortEarly: false, allowUnknown: false }
|
|
637
|
+
);
|
|
638
|
+
if (warrning) {
|
|
639
|
+
Logger({
|
|
640
|
+
level: "WARN",
|
|
641
|
+
message: "Parameter Validation warrnings for getTokenForVideoRoom",
|
|
642
|
+
});
|
|
643
|
+
Logger({ level: "WARN", message: warrning });
|
|
644
|
+
}
|
|
645
|
+
|
|
365
646
|
const query_params = {};
|
|
366
647
|
|
|
367
648
|
const xHeaders = {};
|
|
368
649
|
|
|
369
|
-
|
|
650
|
+
const response = await PlatformAPIClient.execute(
|
|
370
651
|
this.config,
|
|
371
652
|
"get",
|
|
372
653
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/video/room/${uniqueName}/token`,
|
|
@@ -374,15 +655,33 @@ class Lead {
|
|
|
374
655
|
undefined,
|
|
375
656
|
xHeaders
|
|
376
657
|
);
|
|
658
|
+
|
|
659
|
+
const {
|
|
660
|
+
error: res_error,
|
|
661
|
+
} = LeadModel.GetTokenForVideoRoomResponse().validate(response, {
|
|
662
|
+
abortEarly: false,
|
|
663
|
+
allowUnknown: false,
|
|
664
|
+
});
|
|
665
|
+
|
|
666
|
+
if (res_error) {
|
|
667
|
+
Logger({
|
|
668
|
+
level: "WARN",
|
|
669
|
+
message: "Response Validation Warnnings for getTokenForVideoRoom",
|
|
670
|
+
});
|
|
671
|
+
Logger({ level: "WARN", message: res_error });
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
return response;
|
|
377
675
|
}
|
|
378
676
|
|
|
379
677
|
/**
|
|
380
678
|
* @param {Object} arg - Arg object.
|
|
381
679
|
* @param {string} arg.uniqueName - Unique name of Video Room
|
|
680
|
+
* @returns {Promise<GetParticipantsInsideVideoRoomResponse>} - Success response
|
|
382
681
|
* @summary: Get participants of a specific Video Room using it's unique name
|
|
383
682
|
* @description: Get participants of a specific Video Room using it's unique name, this can be used to check if people are already there in the room and also to show their names.
|
|
384
683
|
*/
|
|
385
|
-
getVideoParticipants({ uniqueName } = {}) {
|
|
684
|
+
async getVideoParticipants({ uniqueName } = {}) {
|
|
386
685
|
const { error } = LeadValidator.getVideoParticipants().validate(
|
|
387
686
|
{
|
|
388
687
|
uniqueName,
|
|
@@ -393,11 +692,26 @@ class Lead {
|
|
|
393
692
|
return Promise.reject(new FDKClientValidationError(error));
|
|
394
693
|
}
|
|
395
694
|
|
|
695
|
+
// Showing warrnings if extra unknown parameters are found
|
|
696
|
+
const { error: warrning } = LeadValidator.getVideoParticipants().validate(
|
|
697
|
+
{
|
|
698
|
+
uniqueName,
|
|
699
|
+
},
|
|
700
|
+
{ abortEarly: false, allowUnknown: false }
|
|
701
|
+
);
|
|
702
|
+
if (warrning) {
|
|
703
|
+
Logger({
|
|
704
|
+
level: "WARN",
|
|
705
|
+
message: "Parameter Validation warrnings for getVideoParticipants",
|
|
706
|
+
});
|
|
707
|
+
Logger({ level: "WARN", message: warrning });
|
|
708
|
+
}
|
|
709
|
+
|
|
396
710
|
const query_params = {};
|
|
397
711
|
|
|
398
712
|
const xHeaders = {};
|
|
399
713
|
|
|
400
|
-
|
|
714
|
+
const response = await PlatformAPIClient.execute(
|
|
401
715
|
this.config,
|
|
402
716
|
"get",
|
|
403
717
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/video/room/${uniqueName}/participants`,
|
|
@@ -405,14 +719,32 @@ class Lead {
|
|
|
405
719
|
undefined,
|
|
406
720
|
xHeaders
|
|
407
721
|
);
|
|
722
|
+
|
|
723
|
+
const {
|
|
724
|
+
error: res_error,
|
|
725
|
+
} = LeadModel.GetParticipantsInsideVideoRoomResponse().validate(response, {
|
|
726
|
+
abortEarly: false,
|
|
727
|
+
allowUnknown: false,
|
|
728
|
+
});
|
|
729
|
+
|
|
730
|
+
if (res_error) {
|
|
731
|
+
Logger({
|
|
732
|
+
level: "WARN",
|
|
733
|
+
message: "Response Validation Warnnings for getVideoParticipants",
|
|
734
|
+
});
|
|
735
|
+
Logger({ level: "WARN", message: res_error });
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
return response;
|
|
408
739
|
}
|
|
409
740
|
|
|
410
741
|
/**
|
|
411
742
|
* @param {Object} arg - Arg object.
|
|
743
|
+
* @returns {Promise<CloseVideoRoomResponse>} - Success response
|
|
412
744
|
* @summary: Get general support configuration.
|
|
413
745
|
* @description: Get general support configuration.
|
|
414
746
|
*/
|
|
415
|
-
getGeneralConfig({} = {}) {
|
|
747
|
+
async getGeneralConfig({} = {}) {
|
|
416
748
|
const { error } = LeadValidator.getGeneralConfig().validate(
|
|
417
749
|
{},
|
|
418
750
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -421,11 +753,24 @@ class Lead {
|
|
|
421
753
|
return Promise.reject(new FDKClientValidationError(error));
|
|
422
754
|
}
|
|
423
755
|
|
|
756
|
+
// Showing warrnings if extra unknown parameters are found
|
|
757
|
+
const { error: warrning } = LeadValidator.getGeneralConfig().validate(
|
|
758
|
+
{},
|
|
759
|
+
{ abortEarly: false, allowUnknown: false }
|
|
760
|
+
);
|
|
761
|
+
if (warrning) {
|
|
762
|
+
Logger({
|
|
763
|
+
level: "WARN",
|
|
764
|
+
message: "Parameter Validation warrnings for getGeneralConfig",
|
|
765
|
+
});
|
|
766
|
+
Logger({ level: "WARN", message: warrning });
|
|
767
|
+
}
|
|
768
|
+
|
|
424
769
|
const query_params = {};
|
|
425
770
|
|
|
426
771
|
const xHeaders = {};
|
|
427
772
|
|
|
428
|
-
|
|
773
|
+
const response = await PlatformAPIClient.execute(
|
|
429
774
|
this.config,
|
|
430
775
|
"get",
|
|
431
776
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/general-config`,
|
|
@@ -433,6 +778,23 @@ class Lead {
|
|
|
433
778
|
undefined,
|
|
434
779
|
xHeaders
|
|
435
780
|
);
|
|
781
|
+
|
|
782
|
+
const {
|
|
783
|
+
error: res_error,
|
|
784
|
+
} = LeadModel.CloseVideoRoomResponse().validate(response, {
|
|
785
|
+
abortEarly: false,
|
|
786
|
+
allowUnknown: false,
|
|
787
|
+
});
|
|
788
|
+
|
|
789
|
+
if (res_error) {
|
|
790
|
+
Logger({
|
|
791
|
+
level: "WARN",
|
|
792
|
+
message: "Response Validation Warnnings for getGeneralConfig",
|
|
793
|
+
});
|
|
794
|
+
Logger({ level: "WARN", message: res_error });
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
return response;
|
|
436
798
|
}
|
|
437
799
|
}
|
|
438
800
|
|