@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.
Files changed (156) hide show
  1. package/documentation/application/CART.md +251 -251
  2. package/documentation/application/CATALOG.md +393 -393
  3. package/documentation/application/CONTENT.md +15 -1
  4. package/documentation/application/ORDER.md +268 -268
  5. package/documentation/application/PAYMENT.md +249 -249
  6. package/documentation/application/POSCART.md +297 -297
  7. package/documentation/platform/CART.md +499 -499
  8. package/documentation/platform/CATALOG.md +3497 -3097
  9. package/documentation/platform/COMPANYPROFILE.md +207 -207
  10. package/documentation/platform/CONTENT.md +123 -1
  11. package/documentation/platform/ORDER.md +1518 -1324
  12. package/documentation/platform/PARTNER.md +7 -7
  13. package/documentation/platform/PAYMENT.md +96 -96
  14. package/index.js +7 -1
  15. package/package.json +1 -1
  16. package/sdk/application/ApplicationConfig.js +1 -1
  17. package/sdk/application/Cart/CartApplicationClient.js +865 -52
  18. package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
  19. package/sdk/application/Cart/CartApplicationModel.js +335 -335
  20. package/sdk/application/Cart/CartApplicationValidator.js +1 -0
  21. package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
  22. package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
  23. package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
  24. package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
  25. package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
  26. package/sdk/application/Common/CommonApplicationClient.js +66 -4
  27. package/sdk/application/Common/CommonApplicationValidator.js +1 -0
  28. package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
  29. package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
  30. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
  31. package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
  32. package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
  33. package/sdk/application/Content/ContentApplicationClient.js +621 -38
  34. package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
  35. package/sdk/application/Content/ContentApplicationModel.js +11 -1
  36. package/sdk/application/Content/ContentApplicationValidator.js +1 -0
  37. package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
  38. package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
  39. package/sdk/application/Lead/LeadApplicationClient.js +229 -14
  40. package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
  41. package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
  42. package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
  43. package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
  44. package/sdk/application/Order/OrderApplicationClient.js +403 -24
  45. package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
  46. package/sdk/application/Order/OrderApplicationModel.js +334 -334
  47. package/sdk/application/Order/OrderApplicationValidator.js +1 -0
  48. package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
  49. package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
  50. package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
  51. package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
  52. package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
  53. package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
  54. package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
  55. package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
  56. package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
  57. package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
  58. package/sdk/application/Share/ShareApplicationClient.js +226 -14
  59. package/sdk/application/Share/ShareApplicationValidator.js +1 -0
  60. package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
  61. package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
  62. package/sdk/application/User/UserApplicationClient.js +1133 -70
  63. package/sdk/application/User/UserApplicationValidator.js +1 -0
  64. package/sdk/common/AxiosHelper.js +1 -1
  65. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
  66. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
  67. package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
  68. package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
  69. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
  70. package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
  71. package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
  72. package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
  73. package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
  74. package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
  75. package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
  76. package/sdk/platform/Cart/CartPlatformModel.js +617 -617
  77. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
  78. package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
  79. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
  80. package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
  81. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
  82. package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
  83. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
  84. package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
  85. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
  86. package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
  87. package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
  88. package/sdk/platform/Common/CommonPlatformClient.js +73 -4
  89. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
  90. package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
  91. package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
  92. package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
  93. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
  94. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
  95. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
  96. package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
  97. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
  98. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
  99. package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
  100. package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
  101. package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
  102. package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
  103. package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
  104. package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
  105. package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
  106. package/sdk/platform/Content/ContentPlatformModel.js +43 -1
  107. package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
  108. package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
  109. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
  110. package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
  111. package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
  112. package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
  113. package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
  114. package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
  115. package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
  116. package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
  117. package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
  118. package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
  119. package/sdk/platform/OAuthClient.js +8 -8
  120. package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
  121. package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
  122. package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
  123. package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
  124. package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
  125. package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
  126. package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
  127. package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
  128. package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
  129. package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
  130. package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
  131. package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
  132. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
  133. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
  134. package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
  135. package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
  136. package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
  137. package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
  138. package/sdk/platform/PlatformApplicationClient.js +3461 -3263
  139. package/sdk/platform/PlatformClient.d.ts +2973 -2827
  140. package/sdk/platform/PlatformClient.js +3461 -3263
  141. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
  142. package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
  143. package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
  144. package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
  145. package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
  146. package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
  147. package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
  148. package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
  149. package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
  150. package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
  151. package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
  152. package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
  153. package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
  154. package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
  155. package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
  156. package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
@@ -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(),
@@ -104,4 +104,5 @@ class ContentValidator {
104
104
  });
105
105
  }
106
106
  }
107
+
107
108
  module.exports = ContentValidator;
@@ -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 }
@@ -64,11 +66,25 @@ class FileStorage {
64
66
  if (error) {
65
67
  return Promise.reject(new FDKClientValidationError(error));
66
68
  }
69
+
70
+ // Showing warrnings if extra unknown parameters are found
71
+ const { error: warrning } = FileStorageValidator.startUpload().validate(
72
+ { namespace, body },
73
+ { abortEarly: false, allowUnknown: false }
74
+ );
75
+ if (warrning) {
76
+ Logger({
77
+ level: "WARN",
78
+ message: "Parameter Validation warrnings for startUpload",
79
+ });
80
+ Logger({ level: "WARN", message: warrning });
81
+ }
82
+
67
83
  const query_params = {};
68
84
 
69
85
  const xHeaders = {};
70
86
 
71
- return APIClient.execute(
87
+ const response = await APIClient.execute(
72
88
  this._conf,
73
89
  "post",
74
90
  constructUrl({
@@ -79,6 +95,23 @@ class FileStorage {
79
95
  body,
80
96
  xHeaders
81
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;
82
115
  }
83
116
 
84
117
  /**
@@ -106,7 +139,7 @@ class FileStorage {
106
139
  * After successfully upload, call the `completeUpload` API to finish the upload process.
107
140
  * This operation will return the URL of the uploaded file.
108
141
  */
109
- completeUpload({ namespace, body } = {}) {
142
+ async completeUpload({ namespace, body } = {}) {
110
143
  const { error } = FileStorageValidator.completeUpload().validate(
111
144
  { namespace, body },
112
145
  { abortEarly: false, allowUnknown: true }
@@ -114,11 +147,25 @@ class FileStorage {
114
147
  if (error) {
115
148
  return Promise.reject(new FDKClientValidationError(error));
116
149
  }
150
+
151
+ // Showing warrnings if extra unknown parameters are found
152
+ const { error: warrning } = FileStorageValidator.completeUpload().validate(
153
+ { namespace, body },
154
+ { abortEarly: false, allowUnknown: false }
155
+ );
156
+ if (warrning) {
157
+ Logger({
158
+ level: "WARN",
159
+ message: "Parameter Validation warrnings for completeUpload",
160
+ });
161
+ Logger({ level: "WARN", message: warrning });
162
+ }
163
+
117
164
  const query_params = {};
118
165
 
119
166
  const xHeaders = {};
120
167
 
121
- return APIClient.execute(
168
+ const response = await APIClient.execute(
122
169
  this._conf,
123
170
  "post",
124
171
  constructUrl({
@@ -129,6 +176,23 @@ class FileStorage {
129
176
  body,
130
177
  xHeaders
131
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;
132
196
  }
133
197
 
134
198
  /**
@@ -138,7 +202,7 @@ class FileStorage {
138
202
  * @summary: Explain here
139
203
  * @description: Describe here
140
204
  */
141
- signUrls({ body } = {}) {
205
+ async signUrls({ body } = {}) {
142
206
  const { error } = FileStorageValidator.signUrls().validate(
143
207
  { body },
144
208
  { abortEarly: false, allowUnknown: true }
@@ -146,11 +210,25 @@ class FileStorage {
146
210
  if (error) {
147
211
  return Promise.reject(new FDKClientValidationError(error));
148
212
  }
213
+
214
+ // Showing warrnings if extra unknown parameters are found
215
+ const { error: warrning } = FileStorageValidator.signUrls().validate(
216
+ { body },
217
+ { abortEarly: false, allowUnknown: false }
218
+ );
219
+ if (warrning) {
220
+ Logger({
221
+ level: "WARN",
222
+ message: "Parameter Validation warrnings for signUrls",
223
+ });
224
+ Logger({ level: "WARN", message: warrning });
225
+ }
226
+
149
227
  const query_params = {};
150
228
 
151
229
  const xHeaders = {};
152
230
 
153
- return APIClient.execute(
231
+ const response = await APIClient.execute(
154
232
  this._conf,
155
233
  "post",
156
234
  constructUrl({
@@ -161,6 +239,23 @@ class FileStorage {
161
239
  body,
162
240
  xHeaders
163
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;
164
259
  }
165
260
  }
166
261
 
@@ -22,4 +22,5 @@ class FileStorageValidator {
22
22
  }).required();
23
23
  }
24
24
  }
25
+
25
26
  module.exports = FileStorageValidator;
@@ -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 }
@@ -49,11 +51,25 @@ class Lead {
49
51
  if (error) {
50
52
  return Promise.reject(new FDKClientValidationError(error));
51
53
  }
54
+
55
+ // Showing warrnings if extra unknown parameters are found
56
+ const { error: warrning } = LeadValidator.getTicket().validate(
57
+ { id },
58
+ { abortEarly: false, allowUnknown: false }
59
+ );
60
+ if (warrning) {
61
+ Logger({
62
+ level: "WARN",
63
+ message: "Parameter Validation warrnings for getTicket",
64
+ });
65
+ Logger({ level: "WARN", message: warrning });
66
+ }
67
+
52
68
  const query_params = {};
53
69
 
54
70
  const xHeaders = {};
55
71
 
56
- return APIClient.execute(
72
+ const response = await APIClient.execute(
57
73
  this._conf,
58
74
  "get",
59
75
  constructUrl({
@@ -64,6 +80,21 @@ class Lead {
64
80
  undefined,
65
81
  xHeaders
66
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;
67
98
  }
68
99
 
69
100
  /**
@@ -74,7 +105,7 @@ class Lead {
74
105
  * @summary: Create history for specific Ticket
75
106
  * @description: Create history for specific Ticket, this history is seen on ticket detail page, this can be comment, log or rating.
76
107
  */
77
- createHistory({ id, body } = {}) {
108
+ async createHistory({ id, body } = {}) {
78
109
  const { error } = LeadValidator.createHistory().validate(
79
110
  { id, body },
80
111
  { abortEarly: false, allowUnknown: true }
@@ -82,11 +113,25 @@ class Lead {
82
113
  if (error) {
83
114
  return Promise.reject(new FDKClientValidationError(error));
84
115
  }
116
+
117
+ // Showing warrnings if extra unknown parameters are found
118
+ const { error: warrning } = LeadValidator.createHistory().validate(
119
+ { id, body },
120
+ { abortEarly: false, allowUnknown: false }
121
+ );
122
+ if (warrning) {
123
+ Logger({
124
+ level: "WARN",
125
+ message: "Parameter Validation warrnings for createHistory",
126
+ });
127
+ Logger({ level: "WARN", message: warrning });
128
+ }
129
+
85
130
  const query_params = {};
86
131
 
87
132
  const xHeaders = {};
88
133
 
89
- return APIClient.execute(
134
+ const response = await APIClient.execute(
90
135
  this._conf,
91
136
  "post",
92
137
  constructUrl({
@@ -97,6 +142,21 @@ class Lead {
97
142
  body,
98
143
  xHeaders
99
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;
100
160
  }
101
161
 
102
162
  /**
@@ -106,7 +166,7 @@ class Lead {
106
166
  * @summary: Create Ticket
107
167
  * @description: This is used to Create Ticket.
108
168
  */
109
- createTicket({ body } = {}) {
169
+ async createTicket({ body } = {}) {
110
170
  const { error } = LeadValidator.createTicket().validate(
111
171
  { body },
112
172
  { abortEarly: false, allowUnknown: true }
@@ -114,11 +174,25 @@ class Lead {
114
174
  if (error) {
115
175
  return Promise.reject(new FDKClientValidationError(error));
116
176
  }
177
+
178
+ // Showing warrnings if extra unknown parameters are found
179
+ const { error: warrning } = LeadValidator.createTicket().validate(
180
+ { body },
181
+ { abortEarly: false, allowUnknown: false }
182
+ );
183
+ if (warrning) {
184
+ Logger({
185
+ level: "WARN",
186
+ message: "Parameter Validation warrnings for createTicket",
187
+ });
188
+ Logger({ level: "WARN", message: warrning });
189
+ }
190
+
117
191
  const query_params = {};
118
192
 
119
193
  const xHeaders = {};
120
194
 
121
- return APIClient.execute(
195
+ const response = await APIClient.execute(
122
196
  this._conf,
123
197
  "post",
124
198
  constructUrl({
@@ -129,6 +203,21 @@ class Lead {
129
203
  body,
130
204
  xHeaders
131
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;
132
221
  }
133
222
 
134
223
  /**
@@ -138,7 +227,7 @@ class Lead {
138
227
  * @summary: Get specific Custom Form using it's slug
139
228
  * @description: Get specific Custom Form using it's slug, this is used to view the form.
140
229
  */
141
- getCustomForm({ slug } = {}) {
230
+ async getCustomForm({ slug } = {}) {
142
231
  const { error } = LeadValidator.getCustomForm().validate(
143
232
  { slug },
144
233
  { abortEarly: false, allowUnknown: true }
@@ -146,11 +235,25 @@ class Lead {
146
235
  if (error) {
147
236
  return Promise.reject(new FDKClientValidationError(error));
148
237
  }
238
+
239
+ // Showing warrnings if extra unknown parameters are found
240
+ const { error: warrning } = LeadValidator.getCustomForm().validate(
241
+ { slug },
242
+ { abortEarly: false, allowUnknown: false }
243
+ );
244
+ if (warrning) {
245
+ Logger({
246
+ level: "WARN",
247
+ message: "Parameter Validation warrnings for getCustomForm",
248
+ });
249
+ Logger({ level: "WARN", message: warrning });
250
+ }
251
+
149
252
  const query_params = {};
150
253
 
151
254
  const xHeaders = {};
152
255
 
153
- return APIClient.execute(
256
+ const response = await APIClient.execute(
154
257
  this._conf,
155
258
  "get",
156
259
  constructUrl({
@@ -161,6 +264,21 @@ class Lead {
161
264
  undefined,
162
265
  xHeaders
163
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;
164
282
  }
165
283
 
166
284
  /**
@@ -171,7 +289,7 @@ class Lead {
171
289
  * @summary: Submit Response for a specific Custom Form using it's slug
172
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.
173
291
  */
174
- submitCustomForm({ slug, body } = {}) {
292
+ async submitCustomForm({ slug, body } = {}) {
175
293
  const { error } = LeadValidator.submitCustomForm().validate(
176
294
  { slug, body },
177
295
  { abortEarly: false, allowUnknown: true }
@@ -179,11 +297,25 @@ class Lead {
179
297
  if (error) {
180
298
  return Promise.reject(new FDKClientValidationError(error));
181
299
  }
300
+
301
+ // Showing warrnings if extra unknown parameters are found
302
+ const { error: warrning } = LeadValidator.submitCustomForm().validate(
303
+ { slug, body },
304
+ { abortEarly: false, allowUnknown: false }
305
+ );
306
+ if (warrning) {
307
+ Logger({
308
+ level: "WARN",
309
+ message: "Parameter Validation warrnings for submitCustomForm",
310
+ });
311
+ Logger({ level: "WARN", message: warrning });
312
+ }
313
+
182
314
  const query_params = {};
183
315
 
184
316
  const xHeaders = {};
185
317
 
186
- return APIClient.execute(
318
+ const response = await APIClient.execute(
187
319
  this._conf,
188
320
  "post",
189
321
  constructUrl({
@@ -194,6 +326,23 @@ class Lead {
194
326
  body,
195
327
  xHeaders
196
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;
197
346
  }
198
347
 
199
348
  /**
@@ -203,7 +352,7 @@ class Lead {
203
352
  * @summary: Get participants of a specific Video Room using it's unique name
204
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.
205
354
  */
206
- getParticipantsInsideVideoRoom({ uniqueName } = {}) {
355
+ async getParticipantsInsideVideoRoom({ uniqueName } = {}) {
207
356
  const { error } = LeadValidator.getParticipantsInsideVideoRoom().validate(
208
357
  { uniqueName },
209
358
  { abortEarly: false, allowUnknown: true }
@@ -211,11 +360,28 @@ class Lead {
211
360
  if (error) {
212
361
  return Promise.reject(new FDKClientValidationError(error));
213
362
  }
363
+
364
+ // Showing warrnings if extra unknown parameters are found
365
+ const {
366
+ error: warrning,
367
+ } = LeadValidator.getParticipantsInsideVideoRoom().validate(
368
+ { uniqueName },
369
+ { abortEarly: false, allowUnknown: false }
370
+ );
371
+ if (warrning) {
372
+ Logger({
373
+ level: "WARN",
374
+ message:
375
+ "Parameter Validation warrnings for getParticipantsInsideVideoRoom",
376
+ });
377
+ Logger({ level: "WARN", message: warrning });
378
+ }
379
+
214
380
  const query_params = {};
215
381
 
216
382
  const xHeaders = {};
217
383
 
218
- return APIClient.execute(
384
+ const response = await APIClient.execute(
219
385
  this._conf,
220
386
  "get",
221
387
  constructUrl({
@@ -226,6 +392,24 @@ class Lead {
226
392
  undefined,
227
393
  xHeaders
228
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;
229
413
  }
230
414
 
231
415
  /**
@@ -235,7 +419,7 @@ class Lead {
235
419
  * @summary: Get Token to join a specific Video Room using it's unqiue name
236
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.
237
421
  */
238
- getTokenForVideoRoom({ uniqueName } = {}) {
422
+ async getTokenForVideoRoom({ uniqueName } = {}) {
239
423
  const { error } = LeadValidator.getTokenForVideoRoom().validate(
240
424
  { uniqueName },
241
425
  { abortEarly: false, allowUnknown: true }
@@ -243,11 +427,25 @@ class Lead {
243
427
  if (error) {
244
428
  return Promise.reject(new FDKClientValidationError(error));
245
429
  }
430
+
431
+ // Showing warrnings if extra unknown parameters are found
432
+ const { error: warrning } = LeadValidator.getTokenForVideoRoom().validate(
433
+ { uniqueName },
434
+ { abortEarly: false, allowUnknown: false }
435
+ );
436
+ if (warrning) {
437
+ Logger({
438
+ level: "WARN",
439
+ message: "Parameter Validation warrnings for getTokenForVideoRoom",
440
+ });
441
+ Logger({ level: "WARN", message: warrning });
442
+ }
443
+
246
444
  const query_params = {};
247
445
 
248
446
  const xHeaders = {};
249
447
 
250
- return APIClient.execute(
448
+ const response = await APIClient.execute(
251
449
  this._conf,
252
450
  "get",
253
451
  constructUrl({
@@ -258,6 +456,23 @@ class Lead {
258
456
  undefined,
259
457
  xHeaders
260
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;
261
476
  }
262
477
  }
263
478
 
@@ -46,4 +46,5 @@ class LeadValidator {
46
46
  }).required();
47
47
  }
48
48
  }
49
+
49
50
  module.exports = LeadValidator;