@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.
Files changed (134) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +414 -414
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +290 -290
  5. package/documentation/application/PAYMENT.md +255 -255
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3088 -2702
  9. package/documentation/platform/COMPANYPROFILE.md +201 -201
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1233 -1158
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +83 -83
  14. package/package.json +1 -1
  15. package/sdk/application/ApplicationConfig.js +1 -1
  16. package/sdk/application/Cart/CartApplicationClient.js +619 -108
  17. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  18. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  19. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  20. package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
  21. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
  22. package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
  23. package/sdk/application/Common/CommonApplicationClient.js +48 -8
  24. package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
  25. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  26. package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
  27. package/sdk/application/Content/ContentApplicationClient.js +444 -76
  28. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  29. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  30. package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
  31. package/sdk/application/Lead/LeadApplicationClient.js +164 -30
  32. package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
  33. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  34. package/sdk/application/Order/OrderApplicationClient.js +287 -54
  35. package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
  36. package/sdk/application/Order/OrderApplicationModel.js +357 -357
  37. package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
  38. package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
  39. package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
  40. package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
  41. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  42. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  43. package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
  44. package/sdk/application/Share/ShareApplicationClient.js +157 -32
  45. package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
  46. package/sdk/application/User/UserApplicationClient.js +806 -148
  47. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  48. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
  49. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  50. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
  51. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  52. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
  53. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  54. package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
  55. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  56. package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
  57. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  58. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  59. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
  60. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
  61. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
  62. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
  63. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
  64. package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
  65. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
  66. package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
  67. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
  68. package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
  69. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  70. package/sdk/platform/Common/CommonPlatformClient.js +51 -8
  71. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  72. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
  73. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  74. package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
  75. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  76. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
  77. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
  78. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
  79. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  80. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
  81. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  82. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
  83. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  84. package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
  85. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  86. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  87. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  88. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  89. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  90. package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
  91. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  92. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
  93. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  94. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
  95. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  96. package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
  97. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  98. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
  99. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  100. package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
  101. package/sdk/platform/OAuthClient.js +8 -8
  102. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  103. package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
  104. package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
  105. package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
  106. package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
  107. package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
  108. package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
  109. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  110. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
  111. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  112. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  113. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  114. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
  115. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  116. package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
  117. package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
  118. package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
  119. package/sdk/platform/PlatformApplicationClient.js +3420 -3212
  120. package/sdk/platform/PlatformClient.d.ts +2959 -2787
  121. package/sdk/platform/PlatformClient.js +3420 -3212
  122. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  123. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
  124. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  125. package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
  126. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  127. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
  128. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  129. package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
  130. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  131. package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
  132. package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
  133. package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
  134. package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
@@ -3,6 +3,7 @@ declare class ContentModel {
3
3
  static ApplicationLegal(): any;
4
4
  static ApplicationLegalFAQ(): any;
5
5
  static PathMappingSchema(): any;
6
+ static PathSourceSchema(): any;
6
7
  static SeoComponent(): any;
7
8
  static SeoSchema(): any;
8
9
  static CustomMetaTag(): any;
@@ -45,7 +45,15 @@ class ContentModel {
45
45
 
46
46
  created_at: Joi.string().allow(""),
47
47
 
48
- __source: ContentModel.TagSourceSchema(),
48
+ __source: ContentModel.PathSourceSchema(),
49
+ });
50
+ }
51
+
52
+ static PathSourceSchema() {
53
+ return Joi.object({
54
+ type: Joi.string().allow(""),
55
+
56
+ id: Joi.string().allow(""),
49
57
  });
50
58
  }
51
59
 
@@ -65,6 +73,8 @@ class ContentModel {
65
73
 
66
74
  sitemap_enabled: Joi.boolean(),
67
75
 
76
+ cannonical_enabled: Joi.boolean(),
77
+
68
78
  custom_meta_tags: Joi.array().items(Joi.any()),
69
79
 
70
80
  details: ContentModel.Detail(),
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const FileStorageValidator = require("./FileStorageApplicationValidator");
6
+ const FileStorageModel = require("./FileStorageApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
  const axios = require("axios");
7
9
 
8
10
  class FileStorage {
@@ -56,7 +58,7 @@ class FileStorage {
56
58
  * After successfully upload, call the `completeUpload` API to finish the upload process.
57
59
  * This operation will return the URL of the uploaded file.
58
60
  */
59
- startUpload({ namespace, body } = {}) {
61
+ async startUpload({ namespace, body } = {}) {
60
62
  const { error } = FileStorageValidator.startUpload().validate(
61
63
  { namespace, body },
62
64
  { abortEarly: false, allowUnknown: true }
@@ -71,15 +73,18 @@ class FileStorage {
71
73
  { abortEarly: false, allowUnknown: false }
72
74
  );
73
75
  if (warrning) {
74
- console.log("Parameter Validation warrnings for startUpload");
75
- console.log(warrning);
76
+ Logger({
77
+ level: "WARN",
78
+ message: "Parameter Validation warrnings for startUpload",
79
+ });
80
+ Logger({ level: "WARN", message: warrning });
76
81
  }
77
82
 
78
83
  const query_params = {};
79
84
 
80
85
  const xHeaders = {};
81
86
 
82
- return APIClient.execute(
87
+ const response = await APIClient.execute(
83
88
  this._conf,
84
89
  "post",
85
90
  constructUrl({
@@ -90,6 +95,23 @@ class FileStorage {
90
95
  body,
91
96
  xHeaders
92
97
  );
98
+
99
+ const {
100
+ error: res_error,
101
+ } = FileStorageModel.StartResponse().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 startUpload",
110
+ });
111
+ Logger({ level: "WARN", message: res_error });
112
+ }
113
+
114
+ return response;
93
115
  }
94
116
 
95
117
  /**
@@ -117,7 +139,7 @@ class FileStorage {
117
139
  * After successfully upload, call the `completeUpload` API to finish the upload process.
118
140
  * This operation will return the URL of the uploaded file.
119
141
  */
120
- completeUpload({ namespace, body } = {}) {
142
+ async completeUpload({ namespace, body } = {}) {
121
143
  const { error } = FileStorageValidator.completeUpload().validate(
122
144
  { namespace, body },
123
145
  { abortEarly: false, allowUnknown: true }
@@ -132,15 +154,18 @@ class FileStorage {
132
154
  { abortEarly: false, allowUnknown: false }
133
155
  );
134
156
  if (warrning) {
135
- console.log("Parameter Validation warrnings for completeUpload");
136
- console.log(warrning);
157
+ Logger({
158
+ level: "WARN",
159
+ message: "Parameter Validation warrnings for completeUpload",
160
+ });
161
+ Logger({ level: "WARN", message: warrning });
137
162
  }
138
163
 
139
164
  const query_params = {};
140
165
 
141
166
  const xHeaders = {};
142
167
 
143
- return APIClient.execute(
168
+ const response = await APIClient.execute(
144
169
  this._conf,
145
170
  "post",
146
171
  constructUrl({
@@ -151,6 +176,23 @@ class FileStorage {
151
176
  body,
152
177
  xHeaders
153
178
  );
179
+
180
+ const {
181
+ error: res_error,
182
+ } = FileStorageModel.CompleteResponse().validate(response, {
183
+ abortEarly: false,
184
+ allowUnknown: false,
185
+ });
186
+
187
+ if (res_error) {
188
+ Logger({
189
+ level: "WARN",
190
+ message: "Response Validation Warnnings for completeUpload",
191
+ });
192
+ Logger({ level: "WARN", message: res_error });
193
+ }
194
+
195
+ return response;
154
196
  }
155
197
 
156
198
  /**
@@ -160,7 +202,7 @@ class FileStorage {
160
202
  * @summary: Explain here
161
203
  * @description: Describe here
162
204
  */
163
- signUrls({ body } = {}) {
205
+ async signUrls({ body } = {}) {
164
206
  const { error } = FileStorageValidator.signUrls().validate(
165
207
  { body },
166
208
  { abortEarly: false, allowUnknown: true }
@@ -175,15 +217,18 @@ class FileStorage {
175
217
  { abortEarly: false, allowUnknown: false }
176
218
  );
177
219
  if (warrning) {
178
- console.log("Parameter Validation warrnings for signUrls");
179
- console.log(warrning);
220
+ Logger({
221
+ level: "WARN",
222
+ message: "Parameter Validation warrnings for signUrls",
223
+ });
224
+ Logger({ level: "WARN", message: warrning });
180
225
  }
181
226
 
182
227
  const query_params = {};
183
228
 
184
229
  const xHeaders = {};
185
230
 
186
- return APIClient.execute(
231
+ const response = await APIClient.execute(
187
232
  this._conf,
188
233
  "post",
189
234
  constructUrl({
@@ -194,6 +239,23 @@ class FileStorage {
194
239
  body,
195
240
  xHeaders
196
241
  );
242
+
243
+ const {
244
+ error: res_error,
245
+ } = FileStorageModel.SignUrlResponse().validate(response, {
246
+ abortEarly: false,
247
+ allowUnknown: false,
248
+ });
249
+
250
+ if (res_error) {
251
+ Logger({
252
+ level: "WARN",
253
+ message: "Response Validation Warnnings for signUrls",
254
+ });
255
+ Logger({ level: "WARN", message: res_error });
256
+ }
257
+
258
+ return response;
197
259
  }
198
260
  }
199
261
 
@@ -3,6 +3,8 @@ const constructUrl = require("../constructUrl");
3
3
  const Paginator = require("../../common/Paginator");
4
4
  const { FDKClientValidationError } = require("../../common/FDKError");
5
5
  const LeadValidator = require("./LeadApplicationValidator");
6
+ const LeadModel = require("./LeadApplicationModel");
7
+ const { Logger } = require("./../../common/Logger");
6
8
 
7
9
  class Lead {
8
10
  constructor(_conf) {
@@ -41,7 +43,7 @@ class Lead {
41
43
  * @summary: Get Ticket with the specific id
42
44
  * @description: Get Ticket with the specific id, this is used to view the ticket details
43
45
  */
44
- getTicket({ id } = {}) {
46
+ async getTicket({ id } = {}) {
45
47
  const { error } = LeadValidator.getTicket().validate(
46
48
  { id },
47
49
  { abortEarly: false, allowUnknown: true }
@@ -56,15 +58,18 @@ class Lead {
56
58
  { abortEarly: false, allowUnknown: false }
57
59
  );
58
60
  if (warrning) {
59
- console.log("Parameter Validation warrnings for getTicket");
60
- console.log(warrning);
61
+ Logger({
62
+ level: "WARN",
63
+ message: "Parameter Validation warrnings for getTicket",
64
+ });
65
+ Logger({ level: "WARN", message: warrning });
61
66
  }
62
67
 
63
68
  const query_params = {};
64
69
 
65
70
  const xHeaders = {};
66
71
 
67
- return APIClient.execute(
72
+ const response = await APIClient.execute(
68
73
  this._conf,
69
74
  "get",
70
75
  constructUrl({
@@ -75,6 +80,21 @@ class Lead {
75
80
  undefined,
76
81
  xHeaders
77
82
  );
83
+
84
+ const { error: res_error } = LeadModel.Ticket().validate(response, {
85
+ abortEarly: false,
86
+ allowUnknown: false,
87
+ });
88
+
89
+ if (res_error) {
90
+ Logger({
91
+ level: "WARN",
92
+ message: "Response Validation Warnnings for getTicket",
93
+ });
94
+ Logger({ level: "WARN", message: res_error });
95
+ }
96
+
97
+ return response;
78
98
  }
79
99
 
80
100
  /**
@@ -85,7 +105,7 @@ class Lead {
85
105
  * @summary: Create history for specific Ticket
86
106
  * @description: Create history for specific Ticket, this history is seen on ticket detail page, this can be comment, log or rating.
87
107
  */
88
- createHistory({ id, body } = {}) {
108
+ async createHistory({ id, body } = {}) {
89
109
  const { error } = LeadValidator.createHistory().validate(
90
110
  { id, body },
91
111
  { abortEarly: false, allowUnknown: true }
@@ -100,15 +120,18 @@ class Lead {
100
120
  { abortEarly: false, allowUnknown: false }
101
121
  );
102
122
  if (warrning) {
103
- console.log("Parameter Validation warrnings for createHistory");
104
- console.log(warrning);
123
+ Logger({
124
+ level: "WARN",
125
+ message: "Parameter Validation warrnings for createHistory",
126
+ });
127
+ Logger({ level: "WARN", message: warrning });
105
128
  }
106
129
 
107
130
  const query_params = {};
108
131
 
109
132
  const xHeaders = {};
110
133
 
111
- return APIClient.execute(
134
+ const response = await APIClient.execute(
112
135
  this._conf,
113
136
  "post",
114
137
  constructUrl({
@@ -119,6 +142,21 @@ class Lead {
119
142
  body,
120
143
  xHeaders
121
144
  );
145
+
146
+ const { error: res_error } = LeadModel.TicketHistory().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 createHistory",
155
+ });
156
+ Logger({ level: "WARN", message: res_error });
157
+ }
158
+
159
+ return response;
122
160
  }
123
161
 
124
162
  /**
@@ -128,7 +166,7 @@ class Lead {
128
166
  * @summary: Create Ticket
129
167
  * @description: This is used to Create Ticket.
130
168
  */
131
- createTicket({ body } = {}) {
169
+ async createTicket({ body } = {}) {
132
170
  const { error } = LeadValidator.createTicket().validate(
133
171
  { body },
134
172
  { abortEarly: false, allowUnknown: true }
@@ -143,15 +181,18 @@ class Lead {
143
181
  { abortEarly: false, allowUnknown: false }
144
182
  );
145
183
  if (warrning) {
146
- console.log("Parameter Validation warrnings for createTicket");
147
- console.log(warrning);
184
+ Logger({
185
+ level: "WARN",
186
+ message: "Parameter Validation warrnings for createTicket",
187
+ });
188
+ Logger({ level: "WARN", message: warrning });
148
189
  }
149
190
 
150
191
  const query_params = {};
151
192
 
152
193
  const xHeaders = {};
153
194
 
154
- return APIClient.execute(
195
+ const response = await APIClient.execute(
155
196
  this._conf,
156
197
  "post",
157
198
  constructUrl({
@@ -162,6 +203,21 @@ class Lead {
162
203
  body,
163
204
  xHeaders
164
205
  );
206
+
207
+ const { error: res_error } = LeadModel.Ticket().validate(response, {
208
+ abortEarly: false,
209
+ allowUnknown: false,
210
+ });
211
+
212
+ if (res_error) {
213
+ Logger({
214
+ level: "WARN",
215
+ message: "Response Validation Warnnings for createTicket",
216
+ });
217
+ Logger({ level: "WARN", message: res_error });
218
+ }
219
+
220
+ return response;
165
221
  }
166
222
 
167
223
  /**
@@ -171,7 +227,7 @@ class Lead {
171
227
  * @summary: Get specific Custom Form using it's slug
172
228
  * @description: Get specific Custom Form using it's slug, this is used to view the form.
173
229
  */
174
- getCustomForm({ slug } = {}) {
230
+ async getCustomForm({ slug } = {}) {
175
231
  const { error } = LeadValidator.getCustomForm().validate(
176
232
  { slug },
177
233
  { abortEarly: false, allowUnknown: true }
@@ -186,15 +242,18 @@ class Lead {
186
242
  { abortEarly: false, allowUnknown: false }
187
243
  );
188
244
  if (warrning) {
189
- console.log("Parameter Validation warrnings for getCustomForm");
190
- console.log(warrning);
245
+ Logger({
246
+ level: "WARN",
247
+ message: "Parameter Validation warrnings for getCustomForm",
248
+ });
249
+ Logger({ level: "WARN", message: warrning });
191
250
  }
192
251
 
193
252
  const query_params = {};
194
253
 
195
254
  const xHeaders = {};
196
255
 
197
- return APIClient.execute(
256
+ const response = await APIClient.execute(
198
257
  this._conf,
199
258
  "get",
200
259
  constructUrl({
@@ -205,6 +264,21 @@ class Lead {
205
264
  undefined,
206
265
  xHeaders
207
266
  );
267
+
268
+ const { error: res_error } = LeadModel.CustomForm().validate(response, {
269
+ abortEarly: false,
270
+ allowUnknown: false,
271
+ });
272
+
273
+ if (res_error) {
274
+ Logger({
275
+ level: "WARN",
276
+ message: "Response Validation Warnnings for getCustomForm",
277
+ });
278
+ Logger({ level: "WARN", message: res_error });
279
+ }
280
+
281
+ return response;
208
282
  }
209
283
 
210
284
  /**
@@ -215,7 +289,7 @@ class Lead {
215
289
  * @summary: Submit Response for a specific Custom Form using it's slug
216
290
  * @description: Submit Response for a specific Custom Form using it's slug, this response is then used to create a ticket on behalf of the user.
217
291
  */
218
- submitCustomForm({ slug, body } = {}) {
292
+ async submitCustomForm({ slug, body } = {}) {
219
293
  const { error } = LeadValidator.submitCustomForm().validate(
220
294
  { slug, body },
221
295
  { abortEarly: false, allowUnknown: true }
@@ -230,15 +304,18 @@ class Lead {
230
304
  { abortEarly: false, allowUnknown: false }
231
305
  );
232
306
  if (warrning) {
233
- console.log("Parameter Validation warrnings for submitCustomForm");
234
- console.log(warrning);
307
+ Logger({
308
+ level: "WARN",
309
+ message: "Parameter Validation warrnings for submitCustomForm",
310
+ });
311
+ Logger({ level: "WARN", message: warrning });
235
312
  }
236
313
 
237
314
  const query_params = {};
238
315
 
239
316
  const xHeaders = {};
240
317
 
241
- return APIClient.execute(
318
+ const response = await APIClient.execute(
242
319
  this._conf,
243
320
  "post",
244
321
  constructUrl({
@@ -249,6 +326,23 @@ class Lead {
249
326
  body,
250
327
  xHeaders
251
328
  );
329
+
330
+ const {
331
+ error: res_error,
332
+ } = LeadModel.SubmitCustomFormResponse().validate(response, {
333
+ abortEarly: false,
334
+ allowUnknown: false,
335
+ });
336
+
337
+ if (res_error) {
338
+ Logger({
339
+ level: "WARN",
340
+ message: "Response Validation Warnnings for submitCustomForm",
341
+ });
342
+ Logger({ level: "WARN", message: res_error });
343
+ }
344
+
345
+ return response;
252
346
  }
253
347
 
254
348
  /**
@@ -258,7 +352,7 @@ class Lead {
258
352
  * @summary: Get participants of a specific Video Room using it's unique name
259
353
  * @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.
260
354
  */
261
- getParticipantsInsideVideoRoom({ uniqueName } = {}) {
355
+ async getParticipantsInsideVideoRoom({ uniqueName } = {}) {
262
356
  const { error } = LeadValidator.getParticipantsInsideVideoRoom().validate(
263
357
  { uniqueName },
264
358
  { abortEarly: false, allowUnknown: true }
@@ -275,17 +369,19 @@ class Lead {
275
369
  { abortEarly: false, allowUnknown: false }
276
370
  );
277
371
  if (warrning) {
278
- console.log(
279
- "Parameter Validation warrnings for getParticipantsInsideVideoRoom"
280
- );
281
- console.log(warrning);
372
+ Logger({
373
+ level: "WARN",
374
+ message:
375
+ "Parameter Validation warrnings for getParticipantsInsideVideoRoom",
376
+ });
377
+ Logger({ level: "WARN", message: warrning });
282
378
  }
283
379
 
284
380
  const query_params = {};
285
381
 
286
382
  const xHeaders = {};
287
383
 
288
- return APIClient.execute(
384
+ const response = await APIClient.execute(
289
385
  this._conf,
290
386
  "get",
291
387
  constructUrl({
@@ -296,6 +392,24 @@ class Lead {
296
392
  undefined,
297
393
  xHeaders
298
394
  );
395
+
396
+ const {
397
+ error: res_error,
398
+ } = LeadModel.GetParticipantsInsideVideoRoomResponse().validate(response, {
399
+ abortEarly: false,
400
+ allowUnknown: false,
401
+ });
402
+
403
+ if (res_error) {
404
+ Logger({
405
+ level: "WARN",
406
+ message:
407
+ "Response Validation Warnnings for getParticipantsInsideVideoRoom",
408
+ });
409
+ Logger({ level: "WARN", message: res_error });
410
+ }
411
+
412
+ return response;
299
413
  }
300
414
 
301
415
  /**
@@ -305,7 +419,7 @@ class Lead {
305
419
  * @summary: Get Token to join a specific Video Room using it's unqiue name
306
420
  * @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.
307
421
  */
308
- getTokenForVideoRoom({ uniqueName } = {}) {
422
+ async getTokenForVideoRoom({ uniqueName } = {}) {
309
423
  const { error } = LeadValidator.getTokenForVideoRoom().validate(
310
424
  { uniqueName },
311
425
  { abortEarly: false, allowUnknown: true }
@@ -320,15 +434,18 @@ class Lead {
320
434
  { abortEarly: false, allowUnknown: false }
321
435
  );
322
436
  if (warrning) {
323
- console.log("Parameter Validation warrnings for getTokenForVideoRoom");
324
- console.log(warrning);
437
+ Logger({
438
+ level: "WARN",
439
+ message: "Parameter Validation warrnings for getTokenForVideoRoom",
440
+ });
441
+ Logger({ level: "WARN", message: warrning });
325
442
  }
326
443
 
327
444
  const query_params = {};
328
445
 
329
446
  const xHeaders = {};
330
447
 
331
- return APIClient.execute(
448
+ const response = await APIClient.execute(
332
449
  this._conf,
333
450
  "get",
334
451
  constructUrl({
@@ -339,6 +456,23 @@ class Lead {
339
456
  undefined,
340
457
  xHeaders
341
458
  );
459
+
460
+ const {
461
+ error: res_error,
462
+ } = LeadModel.GetTokenForVideoRoomResponse().validate(response, {
463
+ abortEarly: false,
464
+ allowUnknown: false,
465
+ });
466
+
467
+ if (res_error) {
468
+ Logger({
469
+ level: "WARN",
470
+ message: "Response Validation Warnnings for getTokenForVideoRoom",
471
+ });
472
+ Logger({ level: "WARN", message: res_error });
473
+ }
474
+
475
+ return response;
342
476
  }
343
477
  }
344
478