@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
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const LeadValidator = require("./LeadPlatformApplicationValidator");
|
|
5
|
+
const LeadModel = require("./LeadPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Lead {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -19,10 +21,11 @@ class Lead {
|
|
|
19
21
|
* @param {string} [arg.status] - Filter tickets on status
|
|
20
22
|
* @param {PriorityEnum} [arg.priority] - Filter tickets on priority
|
|
21
23
|
* @param {string} [arg.category] - Filter tickets on category
|
|
24
|
+
* @returns {Promise<TicketList>} - Success response
|
|
22
25
|
* @summary: Gets the list of Application level Tickets and/or ticket filters depending on query params
|
|
23
26
|
* @description: Gets the list of Application level Tickets and/or ticket filters
|
|
24
27
|
*/
|
|
25
|
-
getTickets({ items, filters, q, status, priority, category } = {}) {
|
|
28
|
+
async getTickets({ items, filters, q, status, priority, category } = {}) {
|
|
26
29
|
const { error } = LeadValidator.getTickets().validate(
|
|
27
30
|
{
|
|
28
31
|
items,
|
|
@@ -51,8 +54,11 @@ class Lead {
|
|
|
51
54
|
{ abortEarly: false, allowUnknown: false }
|
|
52
55
|
);
|
|
53
56
|
if (warrning) {
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
Logger({
|
|
58
|
+
level: "WARN",
|
|
59
|
+
message: "Parameter Validation warrnings for getTickets",
|
|
60
|
+
});
|
|
61
|
+
Logger({ level: "WARN", message: warrning });
|
|
56
62
|
}
|
|
57
63
|
|
|
58
64
|
const query_params = {};
|
|
@@ -63,22 +69,38 @@ class Lead {
|
|
|
63
69
|
query_params["priority"] = priority;
|
|
64
70
|
query_params["category"] = category;
|
|
65
71
|
|
|
66
|
-
|
|
72
|
+
const response = await PlatformAPIClient.execute(
|
|
67
73
|
this.config,
|
|
68
74
|
"get",
|
|
69
75
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/ticket`,
|
|
70
76
|
query_params,
|
|
71
77
|
undefined
|
|
72
78
|
);
|
|
79
|
+
|
|
80
|
+
const { error: res_error } = LeadModel.TicketList().validate(response, {
|
|
81
|
+
abortEarly: false,
|
|
82
|
+
allowUnknown: false,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (res_error) {
|
|
86
|
+
Logger({
|
|
87
|
+
level: "WARN",
|
|
88
|
+
message: "Response Validation Warnnings for getTickets",
|
|
89
|
+
});
|
|
90
|
+
Logger({ level: "WARN", message: res_error });
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return response;
|
|
73
94
|
}
|
|
74
95
|
|
|
75
96
|
/**
|
|
76
97
|
* @param {Object} arg - Arg object.
|
|
77
98
|
* @param {string} arg.id - Tiket ID of the ticket to be fetched
|
|
99
|
+
* @returns {Promise<Ticket>} - Success response
|
|
78
100
|
* @summary: Retreives ticket details of a application level ticket
|
|
79
101
|
* @description: Retreives ticket details of a application level ticket with ticket ID
|
|
80
102
|
*/
|
|
81
|
-
getTicket({ id } = {}) {
|
|
103
|
+
async getTicket({ id } = {}) {
|
|
82
104
|
const { error } = LeadValidator.getTicket().validate(
|
|
83
105
|
{
|
|
84
106
|
id,
|
|
@@ -97,29 +119,48 @@ class Lead {
|
|
|
97
119
|
{ abortEarly: false, allowUnknown: false }
|
|
98
120
|
);
|
|
99
121
|
if (warrning) {
|
|
100
|
-
|
|
101
|
-
|
|
122
|
+
Logger({
|
|
123
|
+
level: "WARN",
|
|
124
|
+
message: "Parameter Validation warrnings for getTicket",
|
|
125
|
+
});
|
|
126
|
+
Logger({ level: "WARN", message: warrning });
|
|
102
127
|
}
|
|
103
128
|
|
|
104
129
|
const query_params = {};
|
|
105
130
|
|
|
106
|
-
|
|
131
|
+
const response = await PlatformAPIClient.execute(
|
|
107
132
|
this.config,
|
|
108
133
|
"get",
|
|
109
134
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/ticket/${id}`,
|
|
110
135
|
query_params,
|
|
111
136
|
undefined
|
|
112
137
|
);
|
|
138
|
+
|
|
139
|
+
const { error: res_error } = LeadModel.Ticket().validate(response, {
|
|
140
|
+
abortEarly: false,
|
|
141
|
+
allowUnknown: false,
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
if (res_error) {
|
|
145
|
+
Logger({
|
|
146
|
+
level: "WARN",
|
|
147
|
+
message: "Response Validation Warnnings for getTicket",
|
|
148
|
+
});
|
|
149
|
+
Logger({ level: "WARN", message: res_error });
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return response;
|
|
113
153
|
}
|
|
114
154
|
|
|
115
155
|
/**
|
|
116
156
|
* @param {Object} arg - Arg object.
|
|
117
157
|
* @param {string} arg.id - Ticket ID of ticket to be edited
|
|
118
158
|
* @param {EditTicketPayload} arg.body
|
|
159
|
+
* @returns {Promise<Ticket>} - Success response
|
|
119
160
|
* @summary: Edits ticket details of a application level ticket
|
|
120
161
|
* @description: Edits ticket details of a application level ticket such as status, priority, category, tags, attachments, assigne & ticket content changes
|
|
121
162
|
*/
|
|
122
|
-
editTicket({ id, body } = {}) {
|
|
163
|
+
async editTicket({ id, body } = {}) {
|
|
123
164
|
const { error } = LeadValidator.editTicket().validate(
|
|
124
165
|
{
|
|
125
166
|
id,
|
|
@@ -140,29 +181,48 @@ class Lead {
|
|
|
140
181
|
{ abortEarly: false, allowUnknown: false }
|
|
141
182
|
);
|
|
142
183
|
if (warrning) {
|
|
143
|
-
|
|
144
|
-
|
|
184
|
+
Logger({
|
|
185
|
+
level: "WARN",
|
|
186
|
+
message: "Parameter Validation warrnings for editTicket",
|
|
187
|
+
});
|
|
188
|
+
Logger({ level: "WARN", message: warrning });
|
|
145
189
|
}
|
|
146
190
|
|
|
147
191
|
const query_params = {};
|
|
148
192
|
|
|
149
|
-
|
|
193
|
+
const response = await PlatformAPIClient.execute(
|
|
150
194
|
this.config,
|
|
151
195
|
"put",
|
|
152
196
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/ticket/${id}`,
|
|
153
197
|
query_params,
|
|
154
198
|
body
|
|
155
199
|
);
|
|
200
|
+
|
|
201
|
+
const { error: res_error } = LeadModel.Ticket().validate(response, {
|
|
202
|
+
abortEarly: false,
|
|
203
|
+
allowUnknown: false,
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
if (res_error) {
|
|
207
|
+
Logger({
|
|
208
|
+
level: "WARN",
|
|
209
|
+
message: "Response Validation Warnnings for editTicket",
|
|
210
|
+
});
|
|
211
|
+
Logger({ level: "WARN", message: res_error });
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
return response;
|
|
156
215
|
}
|
|
157
216
|
|
|
158
217
|
/**
|
|
159
218
|
* @param {Object} arg - Arg object.
|
|
160
219
|
* @param {string} arg.id - Ticket ID for which history is created
|
|
161
220
|
* @param {TicketHistoryPayload} arg.body
|
|
221
|
+
* @returns {Promise<TicketHistory>} - Success response
|
|
162
222
|
* @summary: Create history for specific application level ticket
|
|
163
223
|
* @description: Create history for specific application level ticket, this history is seen on ticket detail page, this can be comment, log or rating.
|
|
164
224
|
*/
|
|
165
|
-
createHistory({ id, body } = {}) {
|
|
225
|
+
async createHistory({ id, body } = {}) {
|
|
166
226
|
const { error } = LeadValidator.createHistory().validate(
|
|
167
227
|
{
|
|
168
228
|
id,
|
|
@@ -183,28 +243,47 @@ class Lead {
|
|
|
183
243
|
{ abortEarly: false, allowUnknown: false }
|
|
184
244
|
);
|
|
185
245
|
if (warrning) {
|
|
186
|
-
|
|
187
|
-
|
|
246
|
+
Logger({
|
|
247
|
+
level: "WARN",
|
|
248
|
+
message: "Parameter Validation warrnings for createHistory",
|
|
249
|
+
});
|
|
250
|
+
Logger({ level: "WARN", message: warrning });
|
|
188
251
|
}
|
|
189
252
|
|
|
190
253
|
const query_params = {};
|
|
191
254
|
|
|
192
|
-
|
|
255
|
+
const response = await PlatformAPIClient.execute(
|
|
193
256
|
this.config,
|
|
194
257
|
"post",
|
|
195
258
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/ticket/${id}/history`,
|
|
196
259
|
query_params,
|
|
197
260
|
body
|
|
198
261
|
);
|
|
262
|
+
|
|
263
|
+
const { error: res_error } = LeadModel.TicketHistory().validate(response, {
|
|
264
|
+
abortEarly: false,
|
|
265
|
+
allowUnknown: false,
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
if (res_error) {
|
|
269
|
+
Logger({
|
|
270
|
+
level: "WARN",
|
|
271
|
+
message: "Response Validation Warnnings for createHistory",
|
|
272
|
+
});
|
|
273
|
+
Logger({ level: "WARN", message: res_error });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return response;
|
|
199
277
|
}
|
|
200
278
|
|
|
201
279
|
/**
|
|
202
280
|
* @param {Object} arg - Arg object.
|
|
203
281
|
* @param {string} arg.id - Ticket ID for which history is to be fetched
|
|
282
|
+
* @returns {Promise<TicketHistoryList>} - Success response
|
|
204
283
|
* @summary: Gets history list for specific application level ticket
|
|
205
284
|
* @description: Gets history list for specific application level ticket, this history is seen on ticket detail page, this can be comment, log or rating.
|
|
206
285
|
*/
|
|
207
|
-
getTicketHistory({ id } = {}) {
|
|
286
|
+
async getTicketHistory({ id } = {}) {
|
|
208
287
|
const { error } = LeadValidator.getTicketHistory().validate(
|
|
209
288
|
{
|
|
210
289
|
id,
|
|
@@ -223,28 +302,49 @@ class Lead {
|
|
|
223
302
|
{ abortEarly: false, allowUnknown: false }
|
|
224
303
|
);
|
|
225
304
|
if (warrning) {
|
|
226
|
-
|
|
227
|
-
|
|
305
|
+
Logger({
|
|
306
|
+
level: "WARN",
|
|
307
|
+
message: "Parameter Validation warrnings for getTicketHistory",
|
|
308
|
+
});
|
|
309
|
+
Logger({ level: "WARN", message: warrning });
|
|
228
310
|
}
|
|
229
311
|
|
|
230
312
|
const query_params = {};
|
|
231
313
|
|
|
232
|
-
|
|
314
|
+
const response = await PlatformAPIClient.execute(
|
|
233
315
|
this.config,
|
|
234
316
|
"get",
|
|
235
317
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/ticket/${id}/history`,
|
|
236
318
|
query_params,
|
|
237
319
|
undefined
|
|
238
320
|
);
|
|
321
|
+
|
|
322
|
+
const {
|
|
323
|
+
error: res_error,
|
|
324
|
+
} = LeadModel.TicketHistoryList().validate(response, {
|
|
325
|
+
abortEarly: false,
|
|
326
|
+
allowUnknown: false,
|
|
327
|
+
});
|
|
328
|
+
|
|
329
|
+
if (res_error) {
|
|
330
|
+
Logger({
|
|
331
|
+
level: "WARN",
|
|
332
|
+
message: "Response Validation Warnnings for getTicketHistory",
|
|
333
|
+
});
|
|
334
|
+
Logger({ level: "WARN", message: res_error });
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
return response;
|
|
239
338
|
}
|
|
240
339
|
|
|
241
340
|
/**
|
|
242
341
|
* @param {Object} arg - Arg object.
|
|
243
342
|
* @param {string} arg.slug - Slug of form whose response is getting submitted
|
|
343
|
+
* @returns {Promise<CustomForm>} - Success response
|
|
244
344
|
* @summary: Get specific custom form using it's slug
|
|
245
345
|
* @description: Get specific custom form using it's slug, this is used to view the form.
|
|
246
346
|
*/
|
|
247
|
-
getCustomForm({ slug } = {}) {
|
|
347
|
+
async getCustomForm({ slug } = {}) {
|
|
248
348
|
const { error } = LeadValidator.getCustomForm().validate(
|
|
249
349
|
{
|
|
250
350
|
slug,
|
|
@@ -263,29 +363,48 @@ class Lead {
|
|
|
263
363
|
{ abortEarly: false, allowUnknown: false }
|
|
264
364
|
);
|
|
265
365
|
if (warrning) {
|
|
266
|
-
|
|
267
|
-
|
|
366
|
+
Logger({
|
|
367
|
+
level: "WARN",
|
|
368
|
+
message: "Parameter Validation warrnings for getCustomForm",
|
|
369
|
+
});
|
|
370
|
+
Logger({ level: "WARN", message: warrning });
|
|
268
371
|
}
|
|
269
372
|
|
|
270
373
|
const query_params = {};
|
|
271
374
|
|
|
272
|
-
|
|
375
|
+
const response = await PlatformAPIClient.execute(
|
|
273
376
|
this.config,
|
|
274
377
|
"get",
|
|
275
378
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/form/${slug}`,
|
|
276
379
|
query_params,
|
|
277
380
|
undefined
|
|
278
381
|
);
|
|
382
|
+
|
|
383
|
+
const { error: res_error } = LeadModel.CustomForm().validate(response, {
|
|
384
|
+
abortEarly: false,
|
|
385
|
+
allowUnknown: false,
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
if (res_error) {
|
|
389
|
+
Logger({
|
|
390
|
+
level: "WARN",
|
|
391
|
+
message: "Response Validation Warnnings for getCustomForm",
|
|
392
|
+
});
|
|
393
|
+
Logger({ level: "WARN", message: res_error });
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
return response;
|
|
279
397
|
}
|
|
280
398
|
|
|
281
399
|
/**
|
|
282
400
|
* @param {Object} arg - Arg object.
|
|
283
401
|
* @param {string} arg.slug - Slug of form whose response is getting submitted
|
|
284
402
|
* @param {EditCustomFormPayload} arg.body
|
|
403
|
+
* @returns {Promise<CustomForm>} - Success response
|
|
285
404
|
* @summary: Edit the given custom form
|
|
286
405
|
* @description: Edit the given custom form field such as adding or deleting input, assignee, title, decription, notification and polling information.
|
|
287
406
|
*/
|
|
288
|
-
editCustomForm({ slug, body } = {}) {
|
|
407
|
+
async editCustomForm({ slug, body } = {}) {
|
|
289
408
|
const { error } = LeadValidator.editCustomForm().validate(
|
|
290
409
|
{
|
|
291
410
|
slug,
|
|
@@ -306,27 +425,46 @@ class Lead {
|
|
|
306
425
|
{ abortEarly: false, allowUnknown: false }
|
|
307
426
|
);
|
|
308
427
|
if (warrning) {
|
|
309
|
-
|
|
310
|
-
|
|
428
|
+
Logger({
|
|
429
|
+
level: "WARN",
|
|
430
|
+
message: "Parameter Validation warrnings for editCustomForm",
|
|
431
|
+
});
|
|
432
|
+
Logger({ level: "WARN", message: warrning });
|
|
311
433
|
}
|
|
312
434
|
|
|
313
435
|
const query_params = {};
|
|
314
436
|
|
|
315
|
-
|
|
437
|
+
const response = await PlatformAPIClient.execute(
|
|
316
438
|
this.config,
|
|
317
439
|
"put",
|
|
318
440
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/form/${slug}`,
|
|
319
441
|
query_params,
|
|
320
442
|
body
|
|
321
443
|
);
|
|
444
|
+
|
|
445
|
+
const { error: res_error } = LeadModel.CustomForm().validate(response, {
|
|
446
|
+
abortEarly: false,
|
|
447
|
+
allowUnknown: false,
|
|
448
|
+
});
|
|
449
|
+
|
|
450
|
+
if (res_error) {
|
|
451
|
+
Logger({
|
|
452
|
+
level: "WARN",
|
|
453
|
+
message: "Response Validation Warnnings for editCustomForm",
|
|
454
|
+
});
|
|
455
|
+
Logger({ level: "WARN", message: res_error });
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
return response;
|
|
322
459
|
}
|
|
323
460
|
|
|
324
461
|
/**
|
|
325
462
|
* @param {Object} arg - Arg object.
|
|
463
|
+
* @returns {Promise<CustomFormList>} - Success response
|
|
326
464
|
* @summary: Get list of custom form
|
|
327
465
|
* @description: Get list of custom form for given application
|
|
328
466
|
*/
|
|
329
|
-
getCustomForms({} = {}) {
|
|
467
|
+
async getCustomForms({} = {}) {
|
|
330
468
|
const { error } = LeadValidator.getCustomForms().validate(
|
|
331
469
|
{},
|
|
332
470
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -341,28 +479,47 @@ class Lead {
|
|
|
341
479
|
{ abortEarly: false, allowUnknown: false }
|
|
342
480
|
);
|
|
343
481
|
if (warrning) {
|
|
344
|
-
|
|
345
|
-
|
|
482
|
+
Logger({
|
|
483
|
+
level: "WARN",
|
|
484
|
+
message: "Parameter Validation warrnings for getCustomForms",
|
|
485
|
+
});
|
|
486
|
+
Logger({ level: "WARN", message: warrning });
|
|
346
487
|
}
|
|
347
488
|
|
|
348
489
|
const query_params = {};
|
|
349
490
|
|
|
350
|
-
|
|
491
|
+
const response = await PlatformAPIClient.execute(
|
|
351
492
|
this.config,
|
|
352
493
|
"get",
|
|
353
494
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/form`,
|
|
354
495
|
query_params,
|
|
355
496
|
undefined
|
|
356
497
|
);
|
|
498
|
+
|
|
499
|
+
const { error: res_error } = LeadModel.CustomFormList().validate(response, {
|
|
500
|
+
abortEarly: false,
|
|
501
|
+
allowUnknown: false,
|
|
502
|
+
});
|
|
503
|
+
|
|
504
|
+
if (res_error) {
|
|
505
|
+
Logger({
|
|
506
|
+
level: "WARN",
|
|
507
|
+
message: "Response Validation Warnnings for getCustomForms",
|
|
508
|
+
});
|
|
509
|
+
Logger({ level: "WARN", message: res_error });
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
return response;
|
|
357
513
|
}
|
|
358
514
|
|
|
359
515
|
/**
|
|
360
516
|
* @param {Object} arg - Arg object.
|
|
361
517
|
* @param {CreateCustomFormPayload} arg.body
|
|
518
|
+
* @returns {Promise<CustomForm>} - Success response
|
|
362
519
|
* @summary: Creates a new custom form
|
|
363
520
|
* @description: Creates a new custom form for given application
|
|
364
521
|
*/
|
|
365
|
-
createCustomForm({ body } = {}) {
|
|
522
|
+
async createCustomForm({ body } = {}) {
|
|
366
523
|
const { error } = LeadValidator.createCustomForm().validate(
|
|
367
524
|
{
|
|
368
525
|
body,
|
|
@@ -381,28 +538,47 @@ class Lead {
|
|
|
381
538
|
{ abortEarly: false, allowUnknown: false }
|
|
382
539
|
);
|
|
383
540
|
if (warrning) {
|
|
384
|
-
|
|
385
|
-
|
|
541
|
+
Logger({
|
|
542
|
+
level: "WARN",
|
|
543
|
+
message: "Parameter Validation warrnings for createCustomForm",
|
|
544
|
+
});
|
|
545
|
+
Logger({ level: "WARN", message: warrning });
|
|
386
546
|
}
|
|
387
547
|
|
|
388
548
|
const query_params = {};
|
|
389
549
|
|
|
390
|
-
|
|
550
|
+
const response = await PlatformAPIClient.execute(
|
|
391
551
|
this.config,
|
|
392
552
|
"post",
|
|
393
553
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/form`,
|
|
394
554
|
query_params,
|
|
395
555
|
body
|
|
396
556
|
);
|
|
557
|
+
|
|
558
|
+
const { error: res_error } = LeadModel.CustomForm().validate(response, {
|
|
559
|
+
abortEarly: false,
|
|
560
|
+
allowUnknown: false,
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
if (res_error) {
|
|
564
|
+
Logger({
|
|
565
|
+
level: "WARN",
|
|
566
|
+
message: "Response Validation Warnnings for createCustomForm",
|
|
567
|
+
});
|
|
568
|
+
Logger({ level: "WARN", message: res_error });
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
return response;
|
|
397
572
|
}
|
|
398
573
|
|
|
399
574
|
/**
|
|
400
575
|
* @param {Object} arg - Arg object.
|
|
401
576
|
* @param {string} arg.uniqueName - Unique name of video room
|
|
577
|
+
* @returns {Promise<GetTokenForVideoRoomResponse>} - Success response
|
|
402
578
|
* @summary: Get Token to join a specific Video Room using it's unqiue name
|
|
403
579
|
* @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.
|
|
404
580
|
*/
|
|
405
|
-
getTokenForVideoRoom({ uniqueName } = {}) {
|
|
581
|
+
async getTokenForVideoRoom({ uniqueName } = {}) {
|
|
406
582
|
const { error } = LeadValidator.getTokenForVideoRoom().validate(
|
|
407
583
|
{
|
|
408
584
|
uniqueName,
|
|
@@ -421,28 +597,49 @@ class Lead {
|
|
|
421
597
|
{ abortEarly: false, allowUnknown: false }
|
|
422
598
|
);
|
|
423
599
|
if (warrning) {
|
|
424
|
-
|
|
425
|
-
|
|
600
|
+
Logger({
|
|
601
|
+
level: "WARN",
|
|
602
|
+
message: "Parameter Validation warrnings for getTokenForVideoRoom",
|
|
603
|
+
});
|
|
604
|
+
Logger({ level: "WARN", message: warrning });
|
|
426
605
|
}
|
|
427
606
|
|
|
428
607
|
const query_params = {};
|
|
429
608
|
|
|
430
|
-
|
|
609
|
+
const response = await PlatformAPIClient.execute(
|
|
431
610
|
this.config,
|
|
432
611
|
"get",
|
|
433
612
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/video/room/${uniqueName}/token`,
|
|
434
613
|
query_params,
|
|
435
614
|
undefined
|
|
436
615
|
);
|
|
616
|
+
|
|
617
|
+
const {
|
|
618
|
+
error: res_error,
|
|
619
|
+
} = LeadModel.GetTokenForVideoRoomResponse().validate(response, {
|
|
620
|
+
abortEarly: false,
|
|
621
|
+
allowUnknown: false,
|
|
622
|
+
});
|
|
623
|
+
|
|
624
|
+
if (res_error) {
|
|
625
|
+
Logger({
|
|
626
|
+
level: "WARN",
|
|
627
|
+
message: "Response Validation Warnnings for getTokenForVideoRoom",
|
|
628
|
+
});
|
|
629
|
+
Logger({ level: "WARN", message: res_error });
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
return response;
|
|
437
633
|
}
|
|
438
634
|
|
|
439
635
|
/**
|
|
440
636
|
* @param {Object} arg - Arg object.
|
|
441
637
|
* @param {string} arg.uniqueName - Unique name of Video Room
|
|
638
|
+
* @returns {Promise<GetParticipantsInsideVideoRoomResponse>} - Success response
|
|
442
639
|
* @summary: Get participants of a specific Video Room using it's unique name
|
|
443
640
|
* @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.
|
|
444
641
|
*/
|
|
445
|
-
getVideoParticipants({ uniqueName } = {}) {
|
|
642
|
+
async getVideoParticipants({ uniqueName } = {}) {
|
|
446
643
|
const { error } = LeadValidator.getVideoParticipants().validate(
|
|
447
644
|
{
|
|
448
645
|
uniqueName,
|
|
@@ -461,28 +658,49 @@ class Lead {
|
|
|
461
658
|
{ abortEarly: false, allowUnknown: false }
|
|
462
659
|
);
|
|
463
660
|
if (warrning) {
|
|
464
|
-
|
|
465
|
-
|
|
661
|
+
Logger({
|
|
662
|
+
level: "WARN",
|
|
663
|
+
message: "Parameter Validation warrnings for getVideoParticipants",
|
|
664
|
+
});
|
|
665
|
+
Logger({ level: "WARN", message: warrning });
|
|
466
666
|
}
|
|
467
667
|
|
|
468
668
|
const query_params = {};
|
|
469
669
|
|
|
470
|
-
|
|
670
|
+
const response = await PlatformAPIClient.execute(
|
|
471
671
|
this.config,
|
|
472
672
|
"get",
|
|
473
673
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/video/room/${uniqueName}/participants`,
|
|
474
674
|
query_params,
|
|
475
675
|
undefined
|
|
476
676
|
);
|
|
677
|
+
|
|
678
|
+
const {
|
|
679
|
+
error: res_error,
|
|
680
|
+
} = LeadModel.GetParticipantsInsideVideoRoomResponse().validate(response, {
|
|
681
|
+
abortEarly: false,
|
|
682
|
+
allowUnknown: false,
|
|
683
|
+
});
|
|
684
|
+
|
|
685
|
+
if (res_error) {
|
|
686
|
+
Logger({
|
|
687
|
+
level: "WARN",
|
|
688
|
+
message: "Response Validation Warnnings for getVideoParticipants",
|
|
689
|
+
});
|
|
690
|
+
Logger({ level: "WARN", message: res_error });
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
return response;
|
|
477
694
|
}
|
|
478
695
|
|
|
479
696
|
/**
|
|
480
697
|
* @param {Object} arg - Arg object.
|
|
481
698
|
* @param {CreateVideoRoomPayload} arg.body
|
|
699
|
+
* @returns {Promise<CreateVideoRoomResponse>} - Success response
|
|
482
700
|
* @summary: Open a video room.
|
|
483
701
|
* @description: Open a video room.
|
|
484
702
|
*/
|
|
485
|
-
openVideoRoom({ body } = {}) {
|
|
703
|
+
async openVideoRoom({ body } = {}) {
|
|
486
704
|
const { error } = LeadValidator.openVideoRoom().validate(
|
|
487
705
|
{
|
|
488
706
|
body,
|
|
@@ -501,28 +719,49 @@ class Lead {
|
|
|
501
719
|
{ abortEarly: false, allowUnknown: false }
|
|
502
720
|
);
|
|
503
721
|
if (warrning) {
|
|
504
|
-
|
|
505
|
-
|
|
722
|
+
Logger({
|
|
723
|
+
level: "WARN",
|
|
724
|
+
message: "Parameter Validation warrnings for openVideoRoom",
|
|
725
|
+
});
|
|
726
|
+
Logger({ level: "WARN", message: warrning });
|
|
506
727
|
}
|
|
507
728
|
|
|
508
729
|
const query_params = {};
|
|
509
730
|
|
|
510
|
-
|
|
731
|
+
const response = await PlatformAPIClient.execute(
|
|
511
732
|
this.config,
|
|
512
733
|
"post",
|
|
513
734
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/video/room`,
|
|
514
735
|
query_params,
|
|
515
736
|
body
|
|
516
737
|
);
|
|
738
|
+
|
|
739
|
+
const {
|
|
740
|
+
error: res_error,
|
|
741
|
+
} = LeadModel.CreateVideoRoomResponse().validate(response, {
|
|
742
|
+
abortEarly: false,
|
|
743
|
+
allowUnknown: false,
|
|
744
|
+
});
|
|
745
|
+
|
|
746
|
+
if (res_error) {
|
|
747
|
+
Logger({
|
|
748
|
+
level: "WARN",
|
|
749
|
+
message: "Response Validation Warnnings for openVideoRoom",
|
|
750
|
+
});
|
|
751
|
+
Logger({ level: "WARN", message: res_error });
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
return response;
|
|
517
755
|
}
|
|
518
756
|
|
|
519
757
|
/**
|
|
520
758
|
* @param {Object} arg - Arg object.
|
|
521
759
|
* @param {string} arg.uniqueName - Unique name of Video Room
|
|
760
|
+
* @returns {Promise<CloseVideoRoomResponse>} - Success response
|
|
522
761
|
* @summary: Close the video room and force all participants to leave.
|
|
523
762
|
* @description: Close the video room and force all participants to leave.
|
|
524
763
|
*/
|
|
525
|
-
closeVideoRoom({ uniqueName } = {}) {
|
|
764
|
+
async closeVideoRoom({ uniqueName } = {}) {
|
|
526
765
|
const { error } = LeadValidator.closeVideoRoom().validate(
|
|
527
766
|
{
|
|
528
767
|
uniqueName,
|
|
@@ -541,19 +780,39 @@ class Lead {
|
|
|
541
780
|
{ abortEarly: false, allowUnknown: false }
|
|
542
781
|
);
|
|
543
782
|
if (warrning) {
|
|
544
|
-
|
|
545
|
-
|
|
783
|
+
Logger({
|
|
784
|
+
level: "WARN",
|
|
785
|
+
message: "Parameter Validation warrnings for closeVideoRoom",
|
|
786
|
+
});
|
|
787
|
+
Logger({ level: "WARN", message: warrning });
|
|
546
788
|
}
|
|
547
789
|
|
|
548
790
|
const query_params = {};
|
|
549
791
|
|
|
550
|
-
|
|
792
|
+
const response = await PlatformAPIClient.execute(
|
|
551
793
|
this.config,
|
|
552
794
|
"delete",
|
|
553
795
|
`/service/platform/lead/v1.0/company/${this.config.companyId}/application/${this.applicationId}/video/room/${uniqueName}`,
|
|
554
796
|
query_params,
|
|
555
797
|
undefined
|
|
556
798
|
);
|
|
799
|
+
|
|
800
|
+
const {
|
|
801
|
+
error: res_error,
|
|
802
|
+
} = LeadModel.CloseVideoRoomResponse().validate(response, {
|
|
803
|
+
abortEarly: false,
|
|
804
|
+
allowUnknown: false,
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
if (res_error) {
|
|
808
|
+
Logger({
|
|
809
|
+
level: "WARN",
|
|
810
|
+
message: "Response Validation Warnnings for closeVideoRoom",
|
|
811
|
+
});
|
|
812
|
+
Logger({ level: "WARN", message: res_error });
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
return response;
|
|
557
816
|
}
|
|
558
817
|
}
|
|
559
818
|
module.exports = Lead;
|