@gofynd/fdk-client-javascript 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const ContentValidator = require("./ContentPlatformApplicationValidator");
|
|
5
|
+
const ContentModel = require("./ContentPlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Content {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -15,10 +17,11 @@ class Content {
|
|
|
15
17
|
* given set of results. Default value is 1.
|
|
16
18
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
17
19
|
* page. Default value is 10.
|
|
20
|
+
* @returns {Promise<GetAnnouncementListSchema>} - Success response
|
|
18
21
|
* @summary: Get a list of announcements
|
|
19
22
|
* @description: Announcements are useful to highlight a message or information on top of a webpage. Use this API to retrieve a list of announcements.
|
|
20
23
|
*/
|
|
21
|
-
getAnnouncementsList({ pageNo, pageSize } = {}) {
|
|
24
|
+
async getAnnouncementsList({ pageNo, pageSize } = {}) {
|
|
22
25
|
const { error } = ContentValidator.getAnnouncementsList().validate(
|
|
23
26
|
{
|
|
24
27
|
pageNo,
|
|
@@ -30,17 +33,52 @@ class Content {
|
|
|
30
33
|
return Promise.reject(new FDKClientValidationError(error));
|
|
31
34
|
}
|
|
32
35
|
|
|
36
|
+
// Showing warrnings if extra unknown parameters are found
|
|
37
|
+
const {
|
|
38
|
+
error: warrning,
|
|
39
|
+
} = ContentValidator.getAnnouncementsList().validate(
|
|
40
|
+
{
|
|
41
|
+
pageNo,
|
|
42
|
+
pageSize,
|
|
43
|
+
},
|
|
44
|
+
{ abortEarly: false, allowUnknown: false }
|
|
45
|
+
);
|
|
46
|
+
if (warrning) {
|
|
47
|
+
Logger({
|
|
48
|
+
level: "WARN",
|
|
49
|
+
message: "Parameter Validation warrnings for getAnnouncementsList",
|
|
50
|
+
});
|
|
51
|
+
Logger({ level: "WARN", message: warrning });
|
|
52
|
+
}
|
|
53
|
+
|
|
33
54
|
const query_params = {};
|
|
34
55
|
query_params["page_no"] = pageNo;
|
|
35
56
|
query_params["page_size"] = pageSize;
|
|
36
57
|
|
|
37
|
-
|
|
58
|
+
const response = await PlatformAPIClient.execute(
|
|
38
59
|
this.config,
|
|
39
60
|
"get",
|
|
40
61
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements`,
|
|
41
62
|
query_params,
|
|
42
63
|
undefined
|
|
43
64
|
);
|
|
65
|
+
|
|
66
|
+
const {
|
|
67
|
+
error: res_error,
|
|
68
|
+
} = ContentModel.GetAnnouncementListSchema().validate(response, {
|
|
69
|
+
abortEarly: false,
|
|
70
|
+
allowUnknown: false,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (res_error) {
|
|
74
|
+
Logger({
|
|
75
|
+
level: "WARN",
|
|
76
|
+
message: "Response Validation Warnnings for getAnnouncementsList",
|
|
77
|
+
});
|
|
78
|
+
Logger({ level: "WARN", message: res_error });
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return response;
|
|
44
82
|
}
|
|
45
83
|
|
|
46
84
|
/**
|
|
@@ -79,10 +117,11 @@ class Content {
|
|
|
79
117
|
/**
|
|
80
118
|
* @param {Object} arg - Arg object.
|
|
81
119
|
* @param {AdminAnnouncementSchema} arg.body
|
|
120
|
+
* @returns {Promise<CreateAnnouncementSchema>} - Success response
|
|
82
121
|
* @summary: Create an announcement
|
|
83
122
|
* @description: Announcements are useful to highlight a message or information on top of a webpage. Use this API to create an announcement.
|
|
84
123
|
*/
|
|
85
|
-
createAnnouncement({ body } = {}) {
|
|
124
|
+
async createAnnouncement({ body } = {}) {
|
|
86
125
|
const { error } = ContentValidator.createAnnouncement().validate(
|
|
87
126
|
{
|
|
88
127
|
body,
|
|
@@ -93,24 +132,57 @@ class Content {
|
|
|
93
132
|
return Promise.reject(new FDKClientValidationError(error));
|
|
94
133
|
}
|
|
95
134
|
|
|
135
|
+
// Showing warrnings if extra unknown parameters are found
|
|
136
|
+
const { error: warrning } = ContentValidator.createAnnouncement().validate(
|
|
137
|
+
{
|
|
138
|
+
body,
|
|
139
|
+
},
|
|
140
|
+
{ abortEarly: false, allowUnknown: false }
|
|
141
|
+
);
|
|
142
|
+
if (warrning) {
|
|
143
|
+
Logger({
|
|
144
|
+
level: "WARN",
|
|
145
|
+
message: "Parameter Validation warrnings for createAnnouncement",
|
|
146
|
+
});
|
|
147
|
+
Logger({ level: "WARN", message: warrning });
|
|
148
|
+
}
|
|
149
|
+
|
|
96
150
|
const query_params = {};
|
|
97
151
|
|
|
98
|
-
|
|
152
|
+
const response = await PlatformAPIClient.execute(
|
|
99
153
|
this.config,
|
|
100
154
|
"post",
|
|
101
155
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements`,
|
|
102
156
|
query_params,
|
|
103
157
|
body
|
|
104
158
|
);
|
|
159
|
+
|
|
160
|
+
const {
|
|
161
|
+
error: res_error,
|
|
162
|
+
} = ContentModel.CreateAnnouncementSchema().validate(response, {
|
|
163
|
+
abortEarly: false,
|
|
164
|
+
allowUnknown: false,
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
if (res_error) {
|
|
168
|
+
Logger({
|
|
169
|
+
level: "WARN",
|
|
170
|
+
message: "Response Validation Warnnings for createAnnouncement",
|
|
171
|
+
});
|
|
172
|
+
Logger({ level: "WARN", message: res_error });
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
return response;
|
|
105
176
|
}
|
|
106
177
|
|
|
107
178
|
/**
|
|
108
179
|
* @param {Object} arg - Arg object.
|
|
109
180
|
* @param {string} arg.announcementId - ID allotted to the announcement.
|
|
181
|
+
* @returns {Promise<AdminAnnouncementSchema>} - Success response
|
|
110
182
|
* @summary: Get announcement by ID
|
|
111
183
|
* @description: Use this API to retrieve an announcement and its details such as the target platform and pages on which it's applicable
|
|
112
184
|
*/
|
|
113
|
-
getAnnouncementById({ announcementId } = {}) {
|
|
185
|
+
async getAnnouncementById({ announcementId } = {}) {
|
|
114
186
|
const { error } = ContentValidator.getAnnouncementById().validate(
|
|
115
187
|
{
|
|
116
188
|
announcementId,
|
|
@@ -121,25 +193,58 @@ class Content {
|
|
|
121
193
|
return Promise.reject(new FDKClientValidationError(error));
|
|
122
194
|
}
|
|
123
195
|
|
|
196
|
+
// Showing warrnings if extra unknown parameters are found
|
|
197
|
+
const { error: warrning } = ContentValidator.getAnnouncementById().validate(
|
|
198
|
+
{
|
|
199
|
+
announcementId,
|
|
200
|
+
},
|
|
201
|
+
{ abortEarly: false, allowUnknown: false }
|
|
202
|
+
);
|
|
203
|
+
if (warrning) {
|
|
204
|
+
Logger({
|
|
205
|
+
level: "WARN",
|
|
206
|
+
message: "Parameter Validation warrnings for getAnnouncementById",
|
|
207
|
+
});
|
|
208
|
+
Logger({ level: "WARN", message: warrning });
|
|
209
|
+
}
|
|
210
|
+
|
|
124
211
|
const query_params = {};
|
|
125
212
|
|
|
126
|
-
|
|
213
|
+
const response = await PlatformAPIClient.execute(
|
|
127
214
|
this.config,
|
|
128
215
|
"get",
|
|
129
216
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
|
|
130
217
|
query_params,
|
|
131
218
|
undefined
|
|
132
219
|
);
|
|
220
|
+
|
|
221
|
+
const {
|
|
222
|
+
error: res_error,
|
|
223
|
+
} = ContentModel.AdminAnnouncementSchema().validate(response, {
|
|
224
|
+
abortEarly: false,
|
|
225
|
+
allowUnknown: false,
|
|
226
|
+
});
|
|
227
|
+
|
|
228
|
+
if (res_error) {
|
|
229
|
+
Logger({
|
|
230
|
+
level: "WARN",
|
|
231
|
+
message: "Response Validation Warnnings for getAnnouncementById",
|
|
232
|
+
});
|
|
233
|
+
Logger({ level: "WARN", message: res_error });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
return response;
|
|
133
237
|
}
|
|
134
238
|
|
|
135
239
|
/**
|
|
136
240
|
* @param {Object} arg - Arg object.
|
|
137
241
|
* @param {string} arg.announcementId - ID allotted to the announcement.
|
|
138
242
|
* @param {AdminAnnouncementSchema} arg.body
|
|
243
|
+
* @returns {Promise<CreateAnnouncementSchema>} - Success response
|
|
139
244
|
* @summary: Update an announcement
|
|
140
245
|
* @description: Use this API to edit an existing announcement and its details such as the target platform and pages on which it's applicable
|
|
141
246
|
*/
|
|
142
|
-
updateAnnouncement({ announcementId, body } = {}) {
|
|
247
|
+
async updateAnnouncement({ announcementId, body } = {}) {
|
|
143
248
|
const { error } = ContentValidator.updateAnnouncement().validate(
|
|
144
249
|
{
|
|
145
250
|
announcementId,
|
|
@@ -151,25 +256,59 @@ class Content {
|
|
|
151
256
|
return Promise.reject(new FDKClientValidationError(error));
|
|
152
257
|
}
|
|
153
258
|
|
|
259
|
+
// Showing warrnings if extra unknown parameters are found
|
|
260
|
+
const { error: warrning } = ContentValidator.updateAnnouncement().validate(
|
|
261
|
+
{
|
|
262
|
+
announcementId,
|
|
263
|
+
body,
|
|
264
|
+
},
|
|
265
|
+
{ abortEarly: false, allowUnknown: false }
|
|
266
|
+
);
|
|
267
|
+
if (warrning) {
|
|
268
|
+
Logger({
|
|
269
|
+
level: "WARN",
|
|
270
|
+
message: "Parameter Validation warrnings for updateAnnouncement",
|
|
271
|
+
});
|
|
272
|
+
Logger({ level: "WARN", message: warrning });
|
|
273
|
+
}
|
|
274
|
+
|
|
154
275
|
const query_params = {};
|
|
155
276
|
|
|
156
|
-
|
|
277
|
+
const response = await PlatformAPIClient.execute(
|
|
157
278
|
this.config,
|
|
158
279
|
"put",
|
|
159
280
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
|
|
160
281
|
query_params,
|
|
161
282
|
body
|
|
162
283
|
);
|
|
284
|
+
|
|
285
|
+
const {
|
|
286
|
+
error: res_error,
|
|
287
|
+
} = ContentModel.CreateAnnouncementSchema().validate(response, {
|
|
288
|
+
abortEarly: false,
|
|
289
|
+
allowUnknown: false,
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
if (res_error) {
|
|
293
|
+
Logger({
|
|
294
|
+
level: "WARN",
|
|
295
|
+
message: "Response Validation Warnnings for updateAnnouncement",
|
|
296
|
+
});
|
|
297
|
+
Logger({ level: "WARN", message: res_error });
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
return response;
|
|
163
301
|
}
|
|
164
302
|
|
|
165
303
|
/**
|
|
166
304
|
* @param {Object} arg - Arg object.
|
|
167
305
|
* @param {string} arg.announcementId - ID allotted to the announcement.
|
|
168
306
|
* @param {ScheduleSchema} arg.body
|
|
307
|
+
* @returns {Promise<CreateAnnouncementSchema>} - Success response
|
|
169
308
|
* @summary: Update the schedule and the publish status of an announcement
|
|
170
309
|
* @description: Use this API to edit the duration, i.e. start date-time and end date-time of an announcement. Moreover, you can enable/disable an announcement using this API.
|
|
171
310
|
*/
|
|
172
|
-
updateAnnouncementSchedule({ announcementId, body } = {}) {
|
|
311
|
+
async updateAnnouncementSchedule({ announcementId, body } = {}) {
|
|
173
312
|
const { error } = ContentValidator.updateAnnouncementSchedule().validate(
|
|
174
313
|
{
|
|
175
314
|
announcementId,
|
|
@@ -181,24 +320,61 @@ class Content {
|
|
|
181
320
|
return Promise.reject(new FDKClientValidationError(error));
|
|
182
321
|
}
|
|
183
322
|
|
|
323
|
+
// Showing warrnings if extra unknown parameters are found
|
|
324
|
+
const {
|
|
325
|
+
error: warrning,
|
|
326
|
+
} = ContentValidator.updateAnnouncementSchedule().validate(
|
|
327
|
+
{
|
|
328
|
+
announcementId,
|
|
329
|
+
body,
|
|
330
|
+
},
|
|
331
|
+
{ abortEarly: false, allowUnknown: false }
|
|
332
|
+
);
|
|
333
|
+
if (warrning) {
|
|
334
|
+
Logger({
|
|
335
|
+
level: "WARN",
|
|
336
|
+
message:
|
|
337
|
+
"Parameter Validation warrnings for updateAnnouncementSchedule",
|
|
338
|
+
});
|
|
339
|
+
Logger({ level: "WARN", message: warrning });
|
|
340
|
+
}
|
|
341
|
+
|
|
184
342
|
const query_params = {};
|
|
185
343
|
|
|
186
|
-
|
|
344
|
+
const response = await PlatformAPIClient.execute(
|
|
187
345
|
this.config,
|
|
188
346
|
"patch",
|
|
189
347
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
|
|
190
348
|
query_params,
|
|
191
349
|
body
|
|
192
350
|
);
|
|
351
|
+
|
|
352
|
+
const {
|
|
353
|
+
error: res_error,
|
|
354
|
+
} = ContentModel.CreateAnnouncementSchema().validate(response, {
|
|
355
|
+
abortEarly: false,
|
|
356
|
+
allowUnknown: false,
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
if (res_error) {
|
|
360
|
+
Logger({
|
|
361
|
+
level: "WARN",
|
|
362
|
+
message: "Response Validation Warnnings for updateAnnouncementSchedule",
|
|
363
|
+
});
|
|
364
|
+
Logger({ level: "WARN", message: res_error });
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return response;
|
|
193
368
|
}
|
|
194
369
|
|
|
195
370
|
/**
|
|
196
371
|
* @param {Object} arg - Arg object.
|
|
197
372
|
* @param {string} arg.announcementId - ID allotted to the announcement.
|
|
373
|
+
* @returns {Promise<CreateAnnouncementSchema>} - Success response
|
|
198
374
|
* @summary: Delete announcement by id
|
|
199
375
|
* @description: Use this API to delete an existing announcement.
|
|
200
376
|
*/
|
|
201
|
-
deleteAnnouncement({ announcementId } = {}) {
|
|
377
|
+
async deleteAnnouncement({ announcementId } = {}) {
|
|
202
378
|
const { error } = ContentValidator.deleteAnnouncement().validate(
|
|
203
379
|
{
|
|
204
380
|
announcementId,
|
|
@@ -209,24 +385,57 @@ class Content {
|
|
|
209
385
|
return Promise.reject(new FDKClientValidationError(error));
|
|
210
386
|
}
|
|
211
387
|
|
|
388
|
+
// Showing warrnings if extra unknown parameters are found
|
|
389
|
+
const { error: warrning } = ContentValidator.deleteAnnouncement().validate(
|
|
390
|
+
{
|
|
391
|
+
announcementId,
|
|
392
|
+
},
|
|
393
|
+
{ abortEarly: false, allowUnknown: false }
|
|
394
|
+
);
|
|
395
|
+
if (warrning) {
|
|
396
|
+
Logger({
|
|
397
|
+
level: "WARN",
|
|
398
|
+
message: "Parameter Validation warrnings for deleteAnnouncement",
|
|
399
|
+
});
|
|
400
|
+
Logger({ level: "WARN", message: warrning });
|
|
401
|
+
}
|
|
402
|
+
|
|
212
403
|
const query_params = {};
|
|
213
404
|
|
|
214
|
-
|
|
405
|
+
const response = await PlatformAPIClient.execute(
|
|
215
406
|
this.config,
|
|
216
407
|
"delete",
|
|
217
408
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/announcements/${announcementId}`,
|
|
218
409
|
query_params,
|
|
219
410
|
undefined
|
|
220
411
|
);
|
|
412
|
+
|
|
413
|
+
const {
|
|
414
|
+
error: res_error,
|
|
415
|
+
} = ContentModel.CreateAnnouncementSchema().validate(response, {
|
|
416
|
+
abortEarly: false,
|
|
417
|
+
allowUnknown: false,
|
|
418
|
+
});
|
|
419
|
+
|
|
420
|
+
if (res_error) {
|
|
421
|
+
Logger({
|
|
422
|
+
level: "WARN",
|
|
423
|
+
message: "Response Validation Warnnings for deleteAnnouncement",
|
|
424
|
+
});
|
|
425
|
+
Logger({ level: "WARN", message: res_error });
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
return response;
|
|
221
429
|
}
|
|
222
430
|
|
|
223
431
|
/**
|
|
224
432
|
* @param {Object} arg - Arg object.
|
|
225
433
|
* @param {BlogRequest} arg.body
|
|
434
|
+
* @returns {Promise<BlogSchema>} - Success response
|
|
226
435
|
* @summary: Create a blog
|
|
227
436
|
* @description: Use this API to create a blog.
|
|
228
437
|
*/
|
|
229
|
-
createBlog({ body } = {}) {
|
|
438
|
+
async createBlog({ body } = {}) {
|
|
230
439
|
const { error } = ContentValidator.createBlog().validate(
|
|
231
440
|
{
|
|
232
441
|
body,
|
|
@@ -237,15 +446,45 @@ class Content {
|
|
|
237
446
|
return Promise.reject(new FDKClientValidationError(error));
|
|
238
447
|
}
|
|
239
448
|
|
|
449
|
+
// Showing warrnings if extra unknown parameters are found
|
|
450
|
+
const { error: warrning } = ContentValidator.createBlog().validate(
|
|
451
|
+
{
|
|
452
|
+
body,
|
|
453
|
+
},
|
|
454
|
+
{ abortEarly: false, allowUnknown: false }
|
|
455
|
+
);
|
|
456
|
+
if (warrning) {
|
|
457
|
+
Logger({
|
|
458
|
+
level: "WARN",
|
|
459
|
+
message: "Parameter Validation warrnings for createBlog",
|
|
460
|
+
});
|
|
461
|
+
Logger({ level: "WARN", message: warrning });
|
|
462
|
+
}
|
|
463
|
+
|
|
240
464
|
const query_params = {};
|
|
241
465
|
|
|
242
|
-
|
|
466
|
+
const response = await PlatformAPIClient.execute(
|
|
243
467
|
this.config,
|
|
244
468
|
"post",
|
|
245
469
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/`,
|
|
246
470
|
query_params,
|
|
247
471
|
body
|
|
248
472
|
);
|
|
473
|
+
|
|
474
|
+
const { error: res_error } = ContentModel.BlogSchema().validate(response, {
|
|
475
|
+
abortEarly: false,
|
|
476
|
+
allowUnknown: false,
|
|
477
|
+
});
|
|
478
|
+
|
|
479
|
+
if (res_error) {
|
|
480
|
+
Logger({
|
|
481
|
+
level: "WARN",
|
|
482
|
+
message: "Response Validation Warnnings for createBlog",
|
|
483
|
+
});
|
|
484
|
+
Logger({ level: "WARN", message: res_error });
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
return response;
|
|
249
488
|
}
|
|
250
489
|
|
|
251
490
|
/**
|
|
@@ -254,10 +493,11 @@ class Content {
|
|
|
254
493
|
* given set of results. Default value is 1.
|
|
255
494
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
256
495
|
* page. Default value is 10.
|
|
496
|
+
* @returns {Promise<BlogGetResponse>} - Success response
|
|
257
497
|
* @summary: Get blogs
|
|
258
498
|
* @description: Use this API to get a list of blogs along with their details, such as the title, reading time, publish status, feature image, tags, author, etc.
|
|
259
499
|
*/
|
|
260
|
-
getBlogs({ pageNo, pageSize } = {}) {
|
|
500
|
+
async getBlogs({ pageNo, pageSize } = {}) {
|
|
261
501
|
const { error } = ContentValidator.getBlogs().validate(
|
|
262
502
|
{
|
|
263
503
|
pageNo,
|
|
@@ -269,17 +509,50 @@ class Content {
|
|
|
269
509
|
return Promise.reject(new FDKClientValidationError(error));
|
|
270
510
|
}
|
|
271
511
|
|
|
512
|
+
// Showing warrnings if extra unknown parameters are found
|
|
513
|
+
const { error: warrning } = ContentValidator.getBlogs().validate(
|
|
514
|
+
{
|
|
515
|
+
pageNo,
|
|
516
|
+
pageSize,
|
|
517
|
+
},
|
|
518
|
+
{ abortEarly: false, allowUnknown: false }
|
|
519
|
+
);
|
|
520
|
+
if (warrning) {
|
|
521
|
+
Logger({
|
|
522
|
+
level: "WARN",
|
|
523
|
+
message: "Parameter Validation warrnings for getBlogs",
|
|
524
|
+
});
|
|
525
|
+
Logger({ level: "WARN", message: warrning });
|
|
526
|
+
}
|
|
527
|
+
|
|
272
528
|
const query_params = {};
|
|
273
529
|
query_params["page_no"] = pageNo;
|
|
274
530
|
query_params["page_size"] = pageSize;
|
|
275
531
|
|
|
276
|
-
|
|
532
|
+
const response = await PlatformAPIClient.execute(
|
|
277
533
|
this.config,
|
|
278
534
|
"get",
|
|
279
535
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/`,
|
|
280
536
|
query_params,
|
|
281
537
|
undefined
|
|
282
538
|
);
|
|
539
|
+
|
|
540
|
+
const {
|
|
541
|
+
error: res_error,
|
|
542
|
+
} = ContentModel.BlogGetResponse().validate(response, {
|
|
543
|
+
abortEarly: false,
|
|
544
|
+
allowUnknown: false,
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
if (res_error) {
|
|
548
|
+
Logger({
|
|
549
|
+
level: "WARN",
|
|
550
|
+
message: "Response Validation Warnnings for getBlogs",
|
|
551
|
+
});
|
|
552
|
+
Logger({ level: "WARN", message: res_error });
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
return response;
|
|
283
556
|
}
|
|
284
557
|
|
|
285
558
|
/**
|
|
@@ -319,10 +592,11 @@ class Content {
|
|
|
319
592
|
* @param {Object} arg - Arg object.
|
|
320
593
|
* @param {string} arg.id - ID allotted to the blog.
|
|
321
594
|
* @param {BlogRequest} arg.body
|
|
595
|
+
* @returns {Promise<BlogSchema>} - Success response
|
|
322
596
|
* @summary: Update a blog
|
|
323
597
|
* @description: Use this API to update the details of an existing blog which includes title, feature image, content, SEO details, expiry, etc.
|
|
324
598
|
*/
|
|
325
|
-
updateBlog({ id, body } = {}) {
|
|
599
|
+
async updateBlog({ id, body } = {}) {
|
|
326
600
|
const { error } = ContentValidator.updateBlog().validate(
|
|
327
601
|
{
|
|
328
602
|
id,
|
|
@@ -334,24 +608,56 @@ class Content {
|
|
|
334
608
|
return Promise.reject(new FDKClientValidationError(error));
|
|
335
609
|
}
|
|
336
610
|
|
|
611
|
+
// Showing warrnings if extra unknown parameters are found
|
|
612
|
+
const { error: warrning } = ContentValidator.updateBlog().validate(
|
|
613
|
+
{
|
|
614
|
+
id,
|
|
615
|
+
body,
|
|
616
|
+
},
|
|
617
|
+
{ abortEarly: false, allowUnknown: false }
|
|
618
|
+
);
|
|
619
|
+
if (warrning) {
|
|
620
|
+
Logger({
|
|
621
|
+
level: "WARN",
|
|
622
|
+
message: "Parameter Validation warrnings for updateBlog",
|
|
623
|
+
});
|
|
624
|
+
Logger({ level: "WARN", message: warrning });
|
|
625
|
+
}
|
|
626
|
+
|
|
337
627
|
const query_params = {};
|
|
338
628
|
|
|
339
|
-
|
|
629
|
+
const response = await PlatformAPIClient.execute(
|
|
340
630
|
this.config,
|
|
341
631
|
"put",
|
|
342
632
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${id}`,
|
|
343
633
|
query_params,
|
|
344
634
|
body
|
|
345
635
|
);
|
|
636
|
+
|
|
637
|
+
const { error: res_error } = ContentModel.BlogSchema().validate(response, {
|
|
638
|
+
abortEarly: false,
|
|
639
|
+
allowUnknown: false,
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
if (res_error) {
|
|
643
|
+
Logger({
|
|
644
|
+
level: "WARN",
|
|
645
|
+
message: "Response Validation Warnnings for updateBlog",
|
|
646
|
+
});
|
|
647
|
+
Logger({ level: "WARN", message: res_error });
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return response;
|
|
346
651
|
}
|
|
347
652
|
|
|
348
653
|
/**
|
|
349
654
|
* @param {Object} arg - Arg object.
|
|
350
655
|
* @param {string} arg.id - ID allotted to the blog.
|
|
656
|
+
* @returns {Promise<BlogSchema>} - Success response
|
|
351
657
|
* @summary: Delete blogs
|
|
352
658
|
* @description: Use this API to delete a blog.
|
|
353
659
|
*/
|
|
354
|
-
deleteBlog({ id } = {}) {
|
|
660
|
+
async deleteBlog({ id } = {}) {
|
|
355
661
|
const { error } = ContentValidator.deleteBlog().validate(
|
|
356
662
|
{
|
|
357
663
|
id,
|
|
@@ -362,25 +668,56 @@ class Content {
|
|
|
362
668
|
return Promise.reject(new FDKClientValidationError(error));
|
|
363
669
|
}
|
|
364
670
|
|
|
671
|
+
// Showing warrnings if extra unknown parameters are found
|
|
672
|
+
const { error: warrning } = ContentValidator.deleteBlog().validate(
|
|
673
|
+
{
|
|
674
|
+
id,
|
|
675
|
+
},
|
|
676
|
+
{ abortEarly: false, allowUnknown: false }
|
|
677
|
+
);
|
|
678
|
+
if (warrning) {
|
|
679
|
+
Logger({
|
|
680
|
+
level: "WARN",
|
|
681
|
+
message: "Parameter Validation warrnings for deleteBlog",
|
|
682
|
+
});
|
|
683
|
+
Logger({ level: "WARN", message: warrning });
|
|
684
|
+
}
|
|
685
|
+
|
|
365
686
|
const query_params = {};
|
|
366
687
|
|
|
367
|
-
|
|
688
|
+
const response = await PlatformAPIClient.execute(
|
|
368
689
|
this.config,
|
|
369
690
|
"delete",
|
|
370
691
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${id}`,
|
|
371
692
|
query_params,
|
|
372
693
|
undefined
|
|
373
694
|
);
|
|
695
|
+
|
|
696
|
+
const { error: res_error } = ContentModel.BlogSchema().validate(response, {
|
|
697
|
+
abortEarly: false,
|
|
698
|
+
allowUnknown: false,
|
|
699
|
+
});
|
|
700
|
+
|
|
701
|
+
if (res_error) {
|
|
702
|
+
Logger({
|
|
703
|
+
level: "WARN",
|
|
704
|
+
message: "Response Validation Warnnings for deleteBlog",
|
|
705
|
+
});
|
|
706
|
+
Logger({ level: "WARN", message: res_error });
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return response;
|
|
374
710
|
}
|
|
375
711
|
|
|
376
712
|
/**
|
|
377
713
|
* @param {Object} arg - Arg object.
|
|
378
714
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
379
715
|
* identifier of a blog page. You can get slug value of a blog from `getBlogs` API.
|
|
716
|
+
* @returns {Promise<BlogSchema>} - Success response
|
|
380
717
|
* @summary: Get components of a blog
|
|
381
718
|
* @description: Use this API to retrieve the components of a blog, such as title, slug, feature image, content, schedule, publish status, author, etc.
|
|
382
719
|
*/
|
|
383
|
-
getComponentById({ slug } = {}) {
|
|
720
|
+
async getComponentById({ slug } = {}) {
|
|
384
721
|
const { error } = ContentValidator.getComponentById().validate(
|
|
385
722
|
{
|
|
386
723
|
slug,
|
|
@@ -391,24 +728,55 @@ class Content {
|
|
|
391
728
|
return Promise.reject(new FDKClientValidationError(error));
|
|
392
729
|
}
|
|
393
730
|
|
|
731
|
+
// Showing warrnings if extra unknown parameters are found
|
|
732
|
+
const { error: warrning } = ContentValidator.getComponentById().validate(
|
|
733
|
+
{
|
|
734
|
+
slug,
|
|
735
|
+
},
|
|
736
|
+
{ abortEarly: false, allowUnknown: false }
|
|
737
|
+
);
|
|
738
|
+
if (warrning) {
|
|
739
|
+
Logger({
|
|
740
|
+
level: "WARN",
|
|
741
|
+
message: "Parameter Validation warrnings for getComponentById",
|
|
742
|
+
});
|
|
743
|
+
Logger({ level: "WARN", message: warrning });
|
|
744
|
+
}
|
|
745
|
+
|
|
394
746
|
const query_params = {};
|
|
395
747
|
|
|
396
|
-
|
|
748
|
+
const response = await PlatformAPIClient.execute(
|
|
397
749
|
this.config,
|
|
398
750
|
"get",
|
|
399
751
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/blogs/${slug}`,
|
|
400
752
|
query_params,
|
|
401
753
|
undefined
|
|
402
754
|
);
|
|
755
|
+
|
|
756
|
+
const { error: res_error } = ContentModel.BlogSchema().validate(response, {
|
|
757
|
+
abortEarly: false,
|
|
758
|
+
allowUnknown: false,
|
|
759
|
+
});
|
|
760
|
+
|
|
761
|
+
if (res_error) {
|
|
762
|
+
Logger({
|
|
763
|
+
level: "WARN",
|
|
764
|
+
message: "Response Validation Warnnings for getComponentById",
|
|
765
|
+
});
|
|
766
|
+
Logger({ level: "WARN", message: res_error });
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return response;
|
|
403
770
|
}
|
|
404
771
|
|
|
405
772
|
/**
|
|
406
773
|
* @param {Object} arg - Arg object.
|
|
407
774
|
* @param {DataLoaderSchema} arg.body
|
|
775
|
+
* @returns {Promise<DataLoaderResponseSchema>} - Success response
|
|
408
776
|
* @summary: Adds a data loader
|
|
409
777
|
* @description: Use this API to add data loader. This includes the data loader name, operationId, service name and its type (url/function) with corresponding value.
|
|
410
778
|
*/
|
|
411
|
-
addDataLoader({ body } = {}) {
|
|
779
|
+
async addDataLoader({ body } = {}) {
|
|
412
780
|
const { error } = ContentValidator.addDataLoader().validate(
|
|
413
781
|
{
|
|
414
782
|
body,
|
|
@@ -419,23 +787,56 @@ class Content {
|
|
|
419
787
|
return Promise.reject(new FDKClientValidationError(error));
|
|
420
788
|
}
|
|
421
789
|
|
|
790
|
+
// Showing warrnings if extra unknown parameters are found
|
|
791
|
+
const { error: warrning } = ContentValidator.addDataLoader().validate(
|
|
792
|
+
{
|
|
793
|
+
body,
|
|
794
|
+
},
|
|
795
|
+
{ abortEarly: false, allowUnknown: false }
|
|
796
|
+
);
|
|
797
|
+
if (warrning) {
|
|
798
|
+
Logger({
|
|
799
|
+
level: "WARN",
|
|
800
|
+
message: "Parameter Validation warrnings for addDataLoader",
|
|
801
|
+
});
|
|
802
|
+
Logger({ level: "WARN", message: warrning });
|
|
803
|
+
}
|
|
804
|
+
|
|
422
805
|
const query_params = {};
|
|
423
806
|
|
|
424
|
-
|
|
807
|
+
const response = await PlatformAPIClient.execute(
|
|
425
808
|
this.config,
|
|
426
809
|
"post",
|
|
427
810
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader`,
|
|
428
811
|
query_params,
|
|
429
812
|
body
|
|
430
813
|
);
|
|
814
|
+
|
|
815
|
+
const {
|
|
816
|
+
error: res_error,
|
|
817
|
+
} = ContentModel.DataLoaderResponseSchema().validate(response, {
|
|
818
|
+
abortEarly: false,
|
|
819
|
+
allowUnknown: false,
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
if (res_error) {
|
|
823
|
+
Logger({
|
|
824
|
+
level: "WARN",
|
|
825
|
+
message: "Response Validation Warnnings for addDataLoader",
|
|
826
|
+
});
|
|
827
|
+
Logger({ level: "WARN", message: res_error });
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
return response;
|
|
431
831
|
}
|
|
432
832
|
|
|
433
833
|
/**
|
|
434
834
|
* @param {Object} arg - Arg object.
|
|
835
|
+
* @returns {Promise<DataLoadersSchema>} - Success response
|
|
435
836
|
* @summary: Get all the data loaders in an application
|
|
436
837
|
* @description: Use this to get all data loaders of an application
|
|
437
838
|
*/
|
|
438
|
-
getDataLoaders({} = {}) {
|
|
839
|
+
async getDataLoaders({} = {}) {
|
|
439
840
|
const { error } = ContentValidator.getDataLoaders().validate(
|
|
440
841
|
{},
|
|
441
842
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -444,24 +845,55 @@ class Content {
|
|
|
444
845
|
return Promise.reject(new FDKClientValidationError(error));
|
|
445
846
|
}
|
|
446
847
|
|
|
848
|
+
// Showing warrnings if extra unknown parameters are found
|
|
849
|
+
const { error: warrning } = ContentValidator.getDataLoaders().validate(
|
|
850
|
+
{},
|
|
851
|
+
{ abortEarly: false, allowUnknown: false }
|
|
852
|
+
);
|
|
853
|
+
if (warrning) {
|
|
854
|
+
Logger({
|
|
855
|
+
level: "WARN",
|
|
856
|
+
message: "Parameter Validation warrnings for getDataLoaders",
|
|
857
|
+
});
|
|
858
|
+
Logger({ level: "WARN", message: warrning });
|
|
859
|
+
}
|
|
860
|
+
|
|
447
861
|
const query_params = {};
|
|
448
862
|
|
|
449
|
-
|
|
863
|
+
const response = await PlatformAPIClient.execute(
|
|
450
864
|
this.config,
|
|
451
865
|
"get",
|
|
452
866
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader`,
|
|
453
867
|
query_params,
|
|
454
868
|
undefined
|
|
455
869
|
);
|
|
870
|
+
|
|
871
|
+
const {
|
|
872
|
+
error: res_error,
|
|
873
|
+
} = ContentModel.DataLoadersSchema().validate(response, {
|
|
874
|
+
abortEarly: false,
|
|
875
|
+
allowUnknown: false,
|
|
876
|
+
});
|
|
877
|
+
|
|
878
|
+
if (res_error) {
|
|
879
|
+
Logger({
|
|
880
|
+
level: "WARN",
|
|
881
|
+
message: "Response Validation Warnnings for getDataLoaders",
|
|
882
|
+
});
|
|
883
|
+
Logger({ level: "WARN", message: res_error });
|
|
884
|
+
}
|
|
885
|
+
|
|
886
|
+
return response;
|
|
456
887
|
}
|
|
457
888
|
|
|
458
889
|
/**
|
|
459
890
|
* @param {Object} arg - Arg object.
|
|
460
891
|
* @param {string} arg.dataLoaderId - ID allotted to the data loader.
|
|
892
|
+
* @returns {Promise<DataLoaderResponseSchema>} - Success response
|
|
461
893
|
* @summary: Delete data loader in application
|
|
462
894
|
* @description: Use this API to delete data loader.
|
|
463
895
|
*/
|
|
464
|
-
deleteDataLoader({ dataLoaderId } = {}) {
|
|
896
|
+
async deleteDataLoader({ dataLoaderId } = {}) {
|
|
465
897
|
const { error } = ContentValidator.deleteDataLoader().validate(
|
|
466
898
|
{
|
|
467
899
|
dataLoaderId,
|
|
@@ -472,25 +904,58 @@ class Content {
|
|
|
472
904
|
return Promise.reject(new FDKClientValidationError(error));
|
|
473
905
|
}
|
|
474
906
|
|
|
907
|
+
// Showing warrnings if extra unknown parameters are found
|
|
908
|
+
const { error: warrning } = ContentValidator.deleteDataLoader().validate(
|
|
909
|
+
{
|
|
910
|
+
dataLoaderId,
|
|
911
|
+
},
|
|
912
|
+
{ abortEarly: false, allowUnknown: false }
|
|
913
|
+
);
|
|
914
|
+
if (warrning) {
|
|
915
|
+
Logger({
|
|
916
|
+
level: "WARN",
|
|
917
|
+
message: "Parameter Validation warrnings for deleteDataLoader",
|
|
918
|
+
});
|
|
919
|
+
Logger({ level: "WARN", message: warrning });
|
|
920
|
+
}
|
|
921
|
+
|
|
475
922
|
const query_params = {};
|
|
476
923
|
|
|
477
|
-
|
|
924
|
+
const response = await PlatformAPIClient.execute(
|
|
478
925
|
this.config,
|
|
479
926
|
"delete",
|
|
480
927
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${dataLoaderId}`,
|
|
481
928
|
query_params,
|
|
482
929
|
undefined
|
|
483
930
|
);
|
|
931
|
+
|
|
932
|
+
const {
|
|
933
|
+
error: res_error,
|
|
934
|
+
} = ContentModel.DataLoaderResponseSchema().validate(response, {
|
|
935
|
+
abortEarly: false,
|
|
936
|
+
allowUnknown: false,
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
if (res_error) {
|
|
940
|
+
Logger({
|
|
941
|
+
level: "WARN",
|
|
942
|
+
message: "Response Validation Warnnings for deleteDataLoader",
|
|
943
|
+
});
|
|
944
|
+
Logger({ level: "WARN", message: res_error });
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
return response;
|
|
484
948
|
}
|
|
485
949
|
|
|
486
950
|
/**
|
|
487
951
|
* @param {Object} arg - Arg object.
|
|
488
952
|
* @param {string} arg.dataLoaderId - ID allotted to the data loader.
|
|
489
953
|
* @param {DataLoaderSchema} arg.body
|
|
954
|
+
* @returns {Promise<DataLoaderResponseSchema>} - Success response
|
|
490
955
|
* @summary: Edit a data loader by id
|
|
491
956
|
* @description: Use this API to edit the details of an existing data loader by its ID.
|
|
492
957
|
*/
|
|
493
|
-
editDataLoader({ dataLoaderId, body } = {}) {
|
|
958
|
+
async editDataLoader({ dataLoaderId, body } = {}) {
|
|
494
959
|
const { error } = ContentValidator.editDataLoader().validate(
|
|
495
960
|
{
|
|
496
961
|
dataLoaderId,
|
|
@@ -502,24 +967,58 @@ class Content {
|
|
|
502
967
|
return Promise.reject(new FDKClientValidationError(error));
|
|
503
968
|
}
|
|
504
969
|
|
|
970
|
+
// Showing warrnings if extra unknown parameters are found
|
|
971
|
+
const { error: warrning } = ContentValidator.editDataLoader().validate(
|
|
972
|
+
{
|
|
973
|
+
dataLoaderId,
|
|
974
|
+
body,
|
|
975
|
+
},
|
|
976
|
+
{ abortEarly: false, allowUnknown: false }
|
|
977
|
+
);
|
|
978
|
+
if (warrning) {
|
|
979
|
+
Logger({
|
|
980
|
+
level: "WARN",
|
|
981
|
+
message: "Parameter Validation warrnings for editDataLoader",
|
|
982
|
+
});
|
|
983
|
+
Logger({ level: "WARN", message: warrning });
|
|
984
|
+
}
|
|
985
|
+
|
|
505
986
|
const query_params = {};
|
|
506
987
|
|
|
507
|
-
|
|
988
|
+
const response = await PlatformAPIClient.execute(
|
|
508
989
|
this.config,
|
|
509
990
|
"put",
|
|
510
991
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${dataLoaderId}`,
|
|
511
992
|
query_params,
|
|
512
993
|
body
|
|
513
994
|
);
|
|
995
|
+
|
|
996
|
+
const {
|
|
997
|
+
error: res_error,
|
|
998
|
+
} = ContentModel.DataLoaderResponseSchema().validate(response, {
|
|
999
|
+
abortEarly: false,
|
|
1000
|
+
allowUnknown: false,
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
if (res_error) {
|
|
1004
|
+
Logger({
|
|
1005
|
+
level: "WARN",
|
|
1006
|
+
message: "Response Validation Warnnings for editDataLoader",
|
|
1007
|
+
});
|
|
1008
|
+
Logger({ level: "WARN", message: res_error });
|
|
1009
|
+
}
|
|
1010
|
+
|
|
1011
|
+
return response;
|
|
514
1012
|
}
|
|
515
1013
|
|
|
516
1014
|
/**
|
|
517
1015
|
* @param {Object} arg - Arg object.
|
|
518
1016
|
* @param {string} arg.dataLoaderId - ID allotted to the data loader.
|
|
1017
|
+
* @returns {Promise<DataLoaderResponseSchema>} - Success response
|
|
519
1018
|
* @summary: Select a data loader by id
|
|
520
1019
|
* @description: Use this API to select a data loader to be used in applications.
|
|
521
1020
|
*/
|
|
522
|
-
selectDataLoader({ dataLoaderId } = {}) {
|
|
1021
|
+
async selectDataLoader({ dataLoaderId } = {}) {
|
|
523
1022
|
const { error } = ContentValidator.selectDataLoader().validate(
|
|
524
1023
|
{
|
|
525
1024
|
dataLoaderId,
|
|
@@ -530,25 +1029,58 @@ class Content {
|
|
|
530
1029
|
return Promise.reject(new FDKClientValidationError(error));
|
|
531
1030
|
}
|
|
532
1031
|
|
|
1032
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1033
|
+
const { error: warrning } = ContentValidator.selectDataLoader().validate(
|
|
1034
|
+
{
|
|
1035
|
+
dataLoaderId,
|
|
1036
|
+
},
|
|
1037
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1038
|
+
);
|
|
1039
|
+
if (warrning) {
|
|
1040
|
+
Logger({
|
|
1041
|
+
level: "WARN",
|
|
1042
|
+
message: "Parameter Validation warrnings for selectDataLoader",
|
|
1043
|
+
});
|
|
1044
|
+
Logger({ level: "WARN", message: warrning });
|
|
1045
|
+
}
|
|
1046
|
+
|
|
533
1047
|
const query_params = {};
|
|
534
1048
|
|
|
535
|
-
|
|
1049
|
+
const response = await PlatformAPIClient.execute(
|
|
536
1050
|
this.config,
|
|
537
1051
|
"put",
|
|
538
1052
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${dataLoaderId}/select`,
|
|
539
1053
|
query_params,
|
|
540
1054
|
undefined
|
|
541
1055
|
);
|
|
1056
|
+
|
|
1057
|
+
const {
|
|
1058
|
+
error: res_error,
|
|
1059
|
+
} = ContentModel.DataLoaderResponseSchema().validate(response, {
|
|
1060
|
+
abortEarly: false,
|
|
1061
|
+
allowUnknown: false,
|
|
1062
|
+
});
|
|
1063
|
+
|
|
1064
|
+
if (res_error) {
|
|
1065
|
+
Logger({
|
|
1066
|
+
level: "WARN",
|
|
1067
|
+
message: "Response Validation Warnnings for selectDataLoader",
|
|
1068
|
+
});
|
|
1069
|
+
Logger({ level: "WARN", message: res_error });
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
return response;
|
|
542
1073
|
}
|
|
543
1074
|
|
|
544
1075
|
/**
|
|
545
1076
|
* @param {Object} arg - Arg object.
|
|
546
1077
|
* @param {string} arg.service - Name of service.
|
|
547
1078
|
* @param {string} arg.operationId - Name of operation id of the service.
|
|
1079
|
+
* @returns {Promise<DataLoaderResetResponseSchema>} - Success response
|
|
548
1080
|
* @summary: Reset a data loader by serive name and operation Id
|
|
549
1081
|
* @description: Use this API to reselect a data loader.
|
|
550
1082
|
*/
|
|
551
|
-
resetDataLoader({ service, operationId } = {}) {
|
|
1083
|
+
async resetDataLoader({ service, operationId } = {}) {
|
|
552
1084
|
const { error } = ContentValidator.resetDataLoader().validate(
|
|
553
1085
|
{
|
|
554
1086
|
service,
|
|
@@ -560,23 +1092,57 @@ class Content {
|
|
|
560
1092
|
return Promise.reject(new FDKClientValidationError(error));
|
|
561
1093
|
}
|
|
562
1094
|
|
|
1095
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1096
|
+
const { error: warrning } = ContentValidator.resetDataLoader().validate(
|
|
1097
|
+
{
|
|
1098
|
+
service,
|
|
1099
|
+
operationId,
|
|
1100
|
+
},
|
|
1101
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1102
|
+
);
|
|
1103
|
+
if (warrning) {
|
|
1104
|
+
Logger({
|
|
1105
|
+
level: "WARN",
|
|
1106
|
+
message: "Parameter Validation warrnings for resetDataLoader",
|
|
1107
|
+
});
|
|
1108
|
+
Logger({ level: "WARN", message: warrning });
|
|
1109
|
+
}
|
|
1110
|
+
|
|
563
1111
|
const query_params = {};
|
|
564
1112
|
|
|
565
|
-
|
|
1113
|
+
const response = await PlatformAPIClient.execute(
|
|
566
1114
|
this.config,
|
|
567
1115
|
"put",
|
|
568
1116
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/data-loader/${service}/${operationId}/reset`,
|
|
569
1117
|
query_params,
|
|
570
1118
|
undefined
|
|
571
1119
|
);
|
|
1120
|
+
|
|
1121
|
+
const {
|
|
1122
|
+
error: res_error,
|
|
1123
|
+
} = ContentModel.DataLoaderResetResponseSchema().validate(response, {
|
|
1124
|
+
abortEarly: false,
|
|
1125
|
+
allowUnknown: false,
|
|
1126
|
+
});
|
|
1127
|
+
|
|
1128
|
+
if (res_error) {
|
|
1129
|
+
Logger({
|
|
1130
|
+
level: "WARN",
|
|
1131
|
+
message: "Response Validation Warnnings for resetDataLoader",
|
|
1132
|
+
});
|
|
1133
|
+
Logger({ level: "WARN", message: res_error });
|
|
1134
|
+
}
|
|
1135
|
+
|
|
1136
|
+
return response;
|
|
572
1137
|
}
|
|
573
1138
|
|
|
574
1139
|
/**
|
|
575
1140
|
* @param {Object} arg - Arg object.
|
|
1141
|
+
* @returns {Promise<GetFaqCategoriesSchema>} - Success response
|
|
576
1142
|
* @summary: Get a list of FAQ categories
|
|
577
1143
|
* @description: FAQs can be divided into categories. Use this API to get a list of FAQ categories.
|
|
578
1144
|
*/
|
|
579
|
-
getFaqCategories({} = {}) {
|
|
1145
|
+
async getFaqCategories({} = {}) {
|
|
580
1146
|
const { error } = ContentValidator.getFaqCategories().validate(
|
|
581
1147
|
{},
|
|
582
1148
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -585,15 +1151,45 @@ class Content {
|
|
|
585
1151
|
return Promise.reject(new FDKClientValidationError(error));
|
|
586
1152
|
}
|
|
587
1153
|
|
|
1154
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1155
|
+
const { error: warrning } = ContentValidator.getFaqCategories().validate(
|
|
1156
|
+
{},
|
|
1157
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1158
|
+
);
|
|
1159
|
+
if (warrning) {
|
|
1160
|
+
Logger({
|
|
1161
|
+
level: "WARN",
|
|
1162
|
+
message: "Parameter Validation warrnings for getFaqCategories",
|
|
1163
|
+
});
|
|
1164
|
+
Logger({ level: "WARN", message: warrning });
|
|
1165
|
+
}
|
|
1166
|
+
|
|
588
1167
|
const query_params = {};
|
|
589
1168
|
|
|
590
|
-
|
|
1169
|
+
const response = await PlatformAPIClient.execute(
|
|
591
1170
|
this.config,
|
|
592
1171
|
"get",
|
|
593
1172
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/categories`,
|
|
594
1173
|
query_params,
|
|
595
1174
|
undefined
|
|
596
1175
|
);
|
|
1176
|
+
|
|
1177
|
+
const {
|
|
1178
|
+
error: res_error,
|
|
1179
|
+
} = ContentModel.GetFaqCategoriesSchema().validate(response, {
|
|
1180
|
+
abortEarly: false,
|
|
1181
|
+
allowUnknown: false,
|
|
1182
|
+
});
|
|
1183
|
+
|
|
1184
|
+
if (res_error) {
|
|
1185
|
+
Logger({
|
|
1186
|
+
level: "WARN",
|
|
1187
|
+
message: "Response Validation Warnnings for getFaqCategories",
|
|
1188
|
+
});
|
|
1189
|
+
Logger({ level: "WARN", message: res_error });
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
return response;
|
|
597
1193
|
}
|
|
598
1194
|
|
|
599
1195
|
/**
|
|
@@ -602,10 +1198,11 @@ class Content {
|
|
|
602
1198
|
* category. Slug is a short, human-readable, URL-friendly identifier of
|
|
603
1199
|
* an object. You can get slug value of an FAQ category from
|
|
604
1200
|
* `getFaqCategories` API.
|
|
1201
|
+
* @returns {Promise<GetFaqCategoryBySlugSchema>} - Success response
|
|
605
1202
|
* @summary: Get an FAQ category by slug or id
|
|
606
1203
|
* @description: FAQs can be divided into categories. Use this API to get an FAQ categories using its slug or ID.
|
|
607
1204
|
*/
|
|
608
|
-
getFaqCategoryBySlugOrId({ idOrSlug } = {}) {
|
|
1205
|
+
async getFaqCategoryBySlugOrId({ idOrSlug } = {}) {
|
|
609
1206
|
const { error } = ContentValidator.getFaqCategoryBySlugOrId().validate(
|
|
610
1207
|
{
|
|
611
1208
|
idOrSlug,
|
|
@@ -616,24 +1213,59 @@ class Content {
|
|
|
616
1213
|
return Promise.reject(new FDKClientValidationError(error));
|
|
617
1214
|
}
|
|
618
1215
|
|
|
1216
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1217
|
+
const {
|
|
1218
|
+
error: warrning,
|
|
1219
|
+
} = ContentValidator.getFaqCategoryBySlugOrId().validate(
|
|
1220
|
+
{
|
|
1221
|
+
idOrSlug,
|
|
1222
|
+
},
|
|
1223
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1224
|
+
);
|
|
1225
|
+
if (warrning) {
|
|
1226
|
+
Logger({
|
|
1227
|
+
level: "WARN",
|
|
1228
|
+
message: "Parameter Validation warrnings for getFaqCategoryBySlugOrId",
|
|
1229
|
+
});
|
|
1230
|
+
Logger({ level: "WARN", message: warrning });
|
|
1231
|
+
}
|
|
1232
|
+
|
|
619
1233
|
const query_params = {};
|
|
620
1234
|
|
|
621
|
-
|
|
1235
|
+
const response = await PlatformAPIClient.execute(
|
|
622
1236
|
this.config,
|
|
623
1237
|
"get",
|
|
624
1238
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${idOrSlug}`,
|
|
625
1239
|
query_params,
|
|
626
1240
|
undefined
|
|
627
1241
|
);
|
|
1242
|
+
|
|
1243
|
+
const {
|
|
1244
|
+
error: res_error,
|
|
1245
|
+
} = ContentModel.GetFaqCategoryBySlugSchema().validate(response, {
|
|
1246
|
+
abortEarly: false,
|
|
1247
|
+
allowUnknown: false,
|
|
1248
|
+
});
|
|
1249
|
+
|
|
1250
|
+
if (res_error) {
|
|
1251
|
+
Logger({
|
|
1252
|
+
level: "WARN",
|
|
1253
|
+
message: "Response Validation Warnnings for getFaqCategoryBySlugOrId",
|
|
1254
|
+
});
|
|
1255
|
+
Logger({ level: "WARN", message: res_error });
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
return response;
|
|
628
1259
|
}
|
|
629
1260
|
|
|
630
1261
|
/**
|
|
631
1262
|
* @param {Object} arg - Arg object.
|
|
632
1263
|
* @param {CreateFaqCategoryRequestSchema} arg.body
|
|
1264
|
+
* @returns {Promise<CreateFaqCategorySchema>} - Success response
|
|
633
1265
|
* @summary: Create an FAQ category
|
|
634
1266
|
* @description: FAQs help users to solve an issue or know more about a process. FAQs can be categorized separately, for e.g. some questions can be related to payment, some could be related to purchase, shipping, navigating, etc. Use this API to create an FAQ category.
|
|
635
1267
|
*/
|
|
636
|
-
createFaqCategory({ body } = {}) {
|
|
1268
|
+
async createFaqCategory({ body } = {}) {
|
|
637
1269
|
const { error } = ContentValidator.createFaqCategory().validate(
|
|
638
1270
|
{
|
|
639
1271
|
body,
|
|
@@ -644,25 +1276,58 @@ class Content {
|
|
|
644
1276
|
return Promise.reject(new FDKClientValidationError(error));
|
|
645
1277
|
}
|
|
646
1278
|
|
|
1279
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1280
|
+
const { error: warrning } = ContentValidator.createFaqCategory().validate(
|
|
1281
|
+
{
|
|
1282
|
+
body,
|
|
1283
|
+
},
|
|
1284
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1285
|
+
);
|
|
1286
|
+
if (warrning) {
|
|
1287
|
+
Logger({
|
|
1288
|
+
level: "WARN",
|
|
1289
|
+
message: "Parameter Validation warrnings for createFaqCategory",
|
|
1290
|
+
});
|
|
1291
|
+
Logger({ level: "WARN", message: warrning });
|
|
1292
|
+
}
|
|
1293
|
+
|
|
647
1294
|
const query_params = {};
|
|
648
1295
|
|
|
649
|
-
|
|
1296
|
+
const response = await PlatformAPIClient.execute(
|
|
650
1297
|
this.config,
|
|
651
1298
|
"post",
|
|
652
1299
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category`,
|
|
653
1300
|
query_params,
|
|
654
1301
|
body
|
|
655
1302
|
);
|
|
1303
|
+
|
|
1304
|
+
const {
|
|
1305
|
+
error: res_error,
|
|
1306
|
+
} = ContentModel.CreateFaqCategorySchema().validate(response, {
|
|
1307
|
+
abortEarly: false,
|
|
1308
|
+
allowUnknown: false,
|
|
1309
|
+
});
|
|
1310
|
+
|
|
1311
|
+
if (res_error) {
|
|
1312
|
+
Logger({
|
|
1313
|
+
level: "WARN",
|
|
1314
|
+
message: "Response Validation Warnnings for createFaqCategory",
|
|
1315
|
+
});
|
|
1316
|
+
Logger({ level: "WARN", message: res_error });
|
|
1317
|
+
}
|
|
1318
|
+
|
|
1319
|
+
return response;
|
|
656
1320
|
}
|
|
657
1321
|
|
|
658
1322
|
/**
|
|
659
1323
|
* @param {Object} arg - Arg object.
|
|
660
1324
|
* @param {string} arg.id - ID allotted to an FAQ category.
|
|
661
1325
|
* @param {UpdateFaqCategoryRequestSchema} arg.body
|
|
1326
|
+
* @returns {Promise<CreateFaqCategorySchema>} - Success response
|
|
662
1327
|
* @summary: Update an FAQ category
|
|
663
1328
|
* @description: Use this API to edit an existing FAQ category.
|
|
664
1329
|
*/
|
|
665
|
-
updateFaqCategory({ id, body } = {}) {
|
|
1330
|
+
async updateFaqCategory({ id, body } = {}) {
|
|
666
1331
|
const { error } = ContentValidator.updateFaqCategory().validate(
|
|
667
1332
|
{
|
|
668
1333
|
id,
|
|
@@ -674,24 +1339,58 @@ class Content {
|
|
|
674
1339
|
return Promise.reject(new FDKClientValidationError(error));
|
|
675
1340
|
}
|
|
676
1341
|
|
|
1342
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1343
|
+
const { error: warrning } = ContentValidator.updateFaqCategory().validate(
|
|
1344
|
+
{
|
|
1345
|
+
id,
|
|
1346
|
+
body,
|
|
1347
|
+
},
|
|
1348
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1349
|
+
);
|
|
1350
|
+
if (warrning) {
|
|
1351
|
+
Logger({
|
|
1352
|
+
level: "WARN",
|
|
1353
|
+
message: "Parameter Validation warrnings for updateFaqCategory",
|
|
1354
|
+
});
|
|
1355
|
+
Logger({ level: "WARN", message: warrning });
|
|
1356
|
+
}
|
|
1357
|
+
|
|
677
1358
|
const query_params = {};
|
|
678
1359
|
|
|
679
|
-
|
|
1360
|
+
const response = await PlatformAPIClient.execute(
|
|
680
1361
|
this.config,
|
|
681
1362
|
"put",
|
|
682
1363
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${id}`,
|
|
683
1364
|
query_params,
|
|
684
1365
|
body
|
|
685
1366
|
);
|
|
1367
|
+
|
|
1368
|
+
const {
|
|
1369
|
+
error: res_error,
|
|
1370
|
+
} = ContentModel.CreateFaqCategorySchema().validate(response, {
|
|
1371
|
+
abortEarly: false,
|
|
1372
|
+
allowUnknown: false,
|
|
1373
|
+
});
|
|
1374
|
+
|
|
1375
|
+
if (res_error) {
|
|
1376
|
+
Logger({
|
|
1377
|
+
level: "WARN",
|
|
1378
|
+
message: "Response Validation Warnnings for updateFaqCategory",
|
|
1379
|
+
});
|
|
1380
|
+
Logger({ level: "WARN", message: res_error });
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
return response;
|
|
686
1384
|
}
|
|
687
1385
|
|
|
688
1386
|
/**
|
|
689
1387
|
* @param {Object} arg - Arg object.
|
|
690
1388
|
* @param {string} arg.id - ID allotted to an FAQ category.
|
|
1389
|
+
* @returns {Promise<FaqSchema>} - Success response
|
|
691
1390
|
* @summary: Delete an FAQ category
|
|
692
1391
|
* @description: Use this API to delete an FAQ category.
|
|
693
1392
|
*/
|
|
694
|
-
deleteFaqCategory({ id } = {}) {
|
|
1393
|
+
async deleteFaqCategory({ id } = {}) {
|
|
695
1394
|
const { error } = ContentValidator.deleteFaqCategory().validate(
|
|
696
1395
|
{
|
|
697
1396
|
id,
|
|
@@ -702,15 +1401,45 @@ class Content {
|
|
|
702
1401
|
return Promise.reject(new FDKClientValidationError(error));
|
|
703
1402
|
}
|
|
704
1403
|
|
|
1404
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1405
|
+
const { error: warrning } = ContentValidator.deleteFaqCategory().validate(
|
|
1406
|
+
{
|
|
1407
|
+
id,
|
|
1408
|
+
},
|
|
1409
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1410
|
+
);
|
|
1411
|
+
if (warrning) {
|
|
1412
|
+
Logger({
|
|
1413
|
+
level: "WARN",
|
|
1414
|
+
message: "Parameter Validation warrnings for deleteFaqCategory",
|
|
1415
|
+
});
|
|
1416
|
+
Logger({ level: "WARN", message: warrning });
|
|
1417
|
+
}
|
|
1418
|
+
|
|
705
1419
|
const query_params = {};
|
|
706
1420
|
|
|
707
|
-
|
|
1421
|
+
const response = await PlatformAPIClient.execute(
|
|
708
1422
|
this.config,
|
|
709
1423
|
"delete",
|
|
710
1424
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${id}`,
|
|
711
1425
|
query_params,
|
|
712
1426
|
undefined
|
|
713
1427
|
);
|
|
1428
|
+
|
|
1429
|
+
const { error: res_error } = ContentModel.FaqSchema().validate(response, {
|
|
1430
|
+
abortEarly: false,
|
|
1431
|
+
allowUnknown: false,
|
|
1432
|
+
});
|
|
1433
|
+
|
|
1434
|
+
if (res_error) {
|
|
1435
|
+
Logger({
|
|
1436
|
+
level: "WARN",
|
|
1437
|
+
message: "Response Validation Warnnings for deleteFaqCategory",
|
|
1438
|
+
});
|
|
1439
|
+
Logger({ level: "WARN", message: res_error });
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
return response;
|
|
714
1443
|
}
|
|
715
1444
|
|
|
716
1445
|
/**
|
|
@@ -719,10 +1448,11 @@ class Content {
|
|
|
719
1448
|
* category. Slug is a short, human-readable, URL-friendly identifier of
|
|
720
1449
|
* an object. You can get slug value of an FAQ category from
|
|
721
1450
|
* `getFaqCategories` API.
|
|
1451
|
+
* @returns {Promise<GetFaqSchema>} - Success response
|
|
722
1452
|
* @summary: Get question and answers within an FAQ category
|
|
723
1453
|
* @description: Use this API to retrieve all the commonly asked question and answers belonging to an FAQ category.
|
|
724
1454
|
*/
|
|
725
|
-
getFaqsByCategoryIdOrSlug({ idOrSlug } = {}) {
|
|
1455
|
+
async getFaqsByCategoryIdOrSlug({ idOrSlug } = {}) {
|
|
726
1456
|
const { error } = ContentValidator.getFaqsByCategoryIdOrSlug().validate(
|
|
727
1457
|
{
|
|
728
1458
|
idOrSlug,
|
|
@@ -733,25 +1463,58 @@ class Content {
|
|
|
733
1463
|
return Promise.reject(new FDKClientValidationError(error));
|
|
734
1464
|
}
|
|
735
1465
|
|
|
1466
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1467
|
+
const {
|
|
1468
|
+
error: warrning,
|
|
1469
|
+
} = ContentValidator.getFaqsByCategoryIdOrSlug().validate(
|
|
1470
|
+
{
|
|
1471
|
+
idOrSlug,
|
|
1472
|
+
},
|
|
1473
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1474
|
+
);
|
|
1475
|
+
if (warrning) {
|
|
1476
|
+
Logger({
|
|
1477
|
+
level: "WARN",
|
|
1478
|
+
message: "Parameter Validation warrnings for getFaqsByCategoryIdOrSlug",
|
|
1479
|
+
});
|
|
1480
|
+
Logger({ level: "WARN", message: warrning });
|
|
1481
|
+
}
|
|
1482
|
+
|
|
736
1483
|
const query_params = {};
|
|
737
1484
|
|
|
738
|
-
|
|
1485
|
+
const response = await PlatformAPIClient.execute(
|
|
739
1486
|
this.config,
|
|
740
1487
|
"get",
|
|
741
1488
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${idOrSlug}/faqs`,
|
|
742
1489
|
query_params,
|
|
743
1490
|
undefined
|
|
744
1491
|
);
|
|
1492
|
+
|
|
1493
|
+
const { error: res_error } = ContentModel.GetFaqSchema().validate(
|
|
1494
|
+
response,
|
|
1495
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1496
|
+
);
|
|
1497
|
+
|
|
1498
|
+
if (res_error) {
|
|
1499
|
+
Logger({
|
|
1500
|
+
level: "WARN",
|
|
1501
|
+
message: "Response Validation Warnnings for getFaqsByCategoryIdOrSlug",
|
|
1502
|
+
});
|
|
1503
|
+
Logger({ level: "WARN", message: res_error });
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
return response;
|
|
745
1507
|
}
|
|
746
1508
|
|
|
747
1509
|
/**
|
|
748
1510
|
* @param {Object} arg - Arg object.
|
|
749
1511
|
* @param {string} arg.categoryId - ID allotted to an FAQ category.
|
|
750
1512
|
* @param {CreateFaqSchema} arg.body
|
|
1513
|
+
* @returns {Promise<CreateFaqResponseSchema>} - Success response
|
|
751
1514
|
* @summary: Create an FAQ
|
|
752
1515
|
* @description: FAQs help users to solve an issue or know more about a process. Use this API to create an FAQ for a given FAQ category.
|
|
753
1516
|
*/
|
|
754
|
-
addFaq({ categoryId, body } = {}) {
|
|
1517
|
+
async addFaq({ categoryId, body } = {}) {
|
|
755
1518
|
const { error } = ContentValidator.addFaq().validate(
|
|
756
1519
|
{
|
|
757
1520
|
categoryId,
|
|
@@ -763,15 +1526,48 @@ class Content {
|
|
|
763
1526
|
return Promise.reject(new FDKClientValidationError(error));
|
|
764
1527
|
}
|
|
765
1528
|
|
|
1529
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1530
|
+
const { error: warrning } = ContentValidator.addFaq().validate(
|
|
1531
|
+
{
|
|
1532
|
+
categoryId,
|
|
1533
|
+
body,
|
|
1534
|
+
},
|
|
1535
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1536
|
+
);
|
|
1537
|
+
if (warrning) {
|
|
1538
|
+
Logger({
|
|
1539
|
+
level: "WARN",
|
|
1540
|
+
message: "Parameter Validation warrnings for addFaq",
|
|
1541
|
+
});
|
|
1542
|
+
Logger({ level: "WARN", message: warrning });
|
|
1543
|
+
}
|
|
1544
|
+
|
|
766
1545
|
const query_params = {};
|
|
767
1546
|
|
|
768
|
-
|
|
1547
|
+
const response = await PlatformAPIClient.execute(
|
|
769
1548
|
this.config,
|
|
770
1549
|
"post",
|
|
771
1550
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faqs`,
|
|
772
1551
|
query_params,
|
|
773
1552
|
body
|
|
774
1553
|
);
|
|
1554
|
+
|
|
1555
|
+
const {
|
|
1556
|
+
error: res_error,
|
|
1557
|
+
} = ContentModel.CreateFaqResponseSchema().validate(response, {
|
|
1558
|
+
abortEarly: false,
|
|
1559
|
+
allowUnknown: false,
|
|
1560
|
+
});
|
|
1561
|
+
|
|
1562
|
+
if (res_error) {
|
|
1563
|
+
Logger({
|
|
1564
|
+
level: "WARN",
|
|
1565
|
+
message: "Response Validation Warnnings for addFaq",
|
|
1566
|
+
});
|
|
1567
|
+
Logger({ level: "WARN", message: res_error });
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
return response;
|
|
775
1571
|
}
|
|
776
1572
|
|
|
777
1573
|
/**
|
|
@@ -779,10 +1575,11 @@ class Content {
|
|
|
779
1575
|
* @param {string} arg.categoryId - ID allotted to an FAQ category.
|
|
780
1576
|
* @param {string} arg.faqId - ID allotted to an FAQ.
|
|
781
1577
|
* @param {CreateFaqSchema} arg.body
|
|
1578
|
+
* @returns {Promise<CreateFaqResponseSchema>} - Success response
|
|
782
1579
|
* @summary: Update an FAQ
|
|
783
1580
|
* @description: Use this API to edit an existing FAQ.
|
|
784
1581
|
*/
|
|
785
|
-
updateFaq({ categoryId, faqId, body } = {}) {
|
|
1582
|
+
async updateFaq({ categoryId, faqId, body } = {}) {
|
|
786
1583
|
const { error } = ContentValidator.updateFaq().validate(
|
|
787
1584
|
{
|
|
788
1585
|
categoryId,
|
|
@@ -795,25 +1592,60 @@ class Content {
|
|
|
795
1592
|
return Promise.reject(new FDKClientValidationError(error));
|
|
796
1593
|
}
|
|
797
1594
|
|
|
1595
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1596
|
+
const { error: warrning } = ContentValidator.updateFaq().validate(
|
|
1597
|
+
{
|
|
1598
|
+
categoryId,
|
|
1599
|
+
faqId,
|
|
1600
|
+
body,
|
|
1601
|
+
},
|
|
1602
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1603
|
+
);
|
|
1604
|
+
if (warrning) {
|
|
1605
|
+
Logger({
|
|
1606
|
+
level: "WARN",
|
|
1607
|
+
message: "Parameter Validation warrnings for updateFaq",
|
|
1608
|
+
});
|
|
1609
|
+
Logger({ level: "WARN", message: warrning });
|
|
1610
|
+
}
|
|
1611
|
+
|
|
798
1612
|
const query_params = {};
|
|
799
1613
|
|
|
800
|
-
|
|
1614
|
+
const response = await PlatformAPIClient.execute(
|
|
801
1615
|
this.config,
|
|
802
1616
|
"put",
|
|
803
1617
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faq/${faqId}`,
|
|
804
1618
|
query_params,
|
|
805
1619
|
body
|
|
806
1620
|
);
|
|
1621
|
+
|
|
1622
|
+
const {
|
|
1623
|
+
error: res_error,
|
|
1624
|
+
} = ContentModel.CreateFaqResponseSchema().validate(response, {
|
|
1625
|
+
abortEarly: false,
|
|
1626
|
+
allowUnknown: false,
|
|
1627
|
+
});
|
|
1628
|
+
|
|
1629
|
+
if (res_error) {
|
|
1630
|
+
Logger({
|
|
1631
|
+
level: "WARN",
|
|
1632
|
+
message: "Response Validation Warnnings for updateFaq",
|
|
1633
|
+
});
|
|
1634
|
+
Logger({ level: "WARN", message: res_error });
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
return response;
|
|
807
1638
|
}
|
|
808
1639
|
|
|
809
1640
|
/**
|
|
810
1641
|
* @param {Object} arg - Arg object.
|
|
811
1642
|
* @param {string} arg.categoryId - ID allotted to an FAQ category.
|
|
812
1643
|
* @param {string} arg.faqId - ID allotted to an FAQ.
|
|
1644
|
+
* @returns {Promise<CreateFaqResponseSchema>} - Success response
|
|
813
1645
|
* @summary: Delete an FAQ
|
|
814
1646
|
* @description: Use this API to delete an existing FAQ.
|
|
815
1647
|
*/
|
|
816
|
-
deleteFaq({ categoryId, faqId } = {}) {
|
|
1648
|
+
async deleteFaq({ categoryId, faqId } = {}) {
|
|
817
1649
|
const { error } = ContentValidator.deleteFaq().validate(
|
|
818
1650
|
{
|
|
819
1651
|
categoryId,
|
|
@@ -825,15 +1657,48 @@ class Content {
|
|
|
825
1657
|
return Promise.reject(new FDKClientValidationError(error));
|
|
826
1658
|
}
|
|
827
1659
|
|
|
1660
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1661
|
+
const { error: warrning } = ContentValidator.deleteFaq().validate(
|
|
1662
|
+
{
|
|
1663
|
+
categoryId,
|
|
1664
|
+
faqId,
|
|
1665
|
+
},
|
|
1666
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1667
|
+
);
|
|
1668
|
+
if (warrning) {
|
|
1669
|
+
Logger({
|
|
1670
|
+
level: "WARN",
|
|
1671
|
+
message: "Parameter Validation warrnings for deleteFaq",
|
|
1672
|
+
});
|
|
1673
|
+
Logger({ level: "WARN", message: warrning });
|
|
1674
|
+
}
|
|
1675
|
+
|
|
828
1676
|
const query_params = {};
|
|
829
1677
|
|
|
830
|
-
|
|
1678
|
+
const response = await PlatformAPIClient.execute(
|
|
831
1679
|
this.config,
|
|
832
1680
|
"delete",
|
|
833
1681
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/category/${categoryId}/faq/${faqId}`,
|
|
834
1682
|
query_params,
|
|
835
1683
|
undefined
|
|
836
1684
|
);
|
|
1685
|
+
|
|
1686
|
+
const {
|
|
1687
|
+
error: res_error,
|
|
1688
|
+
} = ContentModel.CreateFaqResponseSchema().validate(response, {
|
|
1689
|
+
abortEarly: false,
|
|
1690
|
+
allowUnknown: false,
|
|
1691
|
+
});
|
|
1692
|
+
|
|
1693
|
+
if (res_error) {
|
|
1694
|
+
Logger({
|
|
1695
|
+
level: "WARN",
|
|
1696
|
+
message: "Response Validation Warnnings for deleteFaq",
|
|
1697
|
+
});
|
|
1698
|
+
Logger({ level: "WARN", message: res_error });
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
return response;
|
|
837
1702
|
}
|
|
838
1703
|
|
|
839
1704
|
/**
|
|
@@ -842,13 +1707,78 @@ class Content {
|
|
|
842
1707
|
* category. Slug is a short, human-readable, URL-friendly identifier of
|
|
843
1708
|
* an object. You can get slug value of an FAQ category from
|
|
844
1709
|
* `getFaqCategories` API.
|
|
1710
|
+
* @returns {Promise<CreateFaqResponseSchema>} - Success response
|
|
845
1711
|
* @summary: Get an FAQ
|
|
846
1712
|
* @description: Use this API to retrieve a specific FAQ. You will get the question and answer of that FAQ.
|
|
847
1713
|
*/
|
|
848
|
-
getFaqByIdOrSlug({ idOrSlug } = {}) {
|
|
1714
|
+
async getFaqByIdOrSlug({ idOrSlug } = {}) {
|
|
849
1715
|
const { error } = ContentValidator.getFaqByIdOrSlug().validate(
|
|
850
1716
|
{
|
|
851
|
-
idOrSlug,
|
|
1717
|
+
idOrSlug,
|
|
1718
|
+
},
|
|
1719
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1720
|
+
);
|
|
1721
|
+
if (error) {
|
|
1722
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1723
|
+
}
|
|
1724
|
+
|
|
1725
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1726
|
+
const { error: warrning } = ContentValidator.getFaqByIdOrSlug().validate(
|
|
1727
|
+
{
|
|
1728
|
+
idOrSlug,
|
|
1729
|
+
},
|
|
1730
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1731
|
+
);
|
|
1732
|
+
if (warrning) {
|
|
1733
|
+
Logger({
|
|
1734
|
+
level: "WARN",
|
|
1735
|
+
message: "Parameter Validation warrnings for getFaqByIdOrSlug",
|
|
1736
|
+
});
|
|
1737
|
+
Logger({ level: "WARN", message: warrning });
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
const query_params = {};
|
|
1741
|
+
|
|
1742
|
+
const response = await PlatformAPIClient.execute(
|
|
1743
|
+
this.config,
|
|
1744
|
+
"get",
|
|
1745
|
+
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/faq/${idOrSlug}`,
|
|
1746
|
+
query_params,
|
|
1747
|
+
undefined
|
|
1748
|
+
);
|
|
1749
|
+
|
|
1750
|
+
const {
|
|
1751
|
+
error: res_error,
|
|
1752
|
+
} = ContentModel.CreateFaqResponseSchema().validate(response, {
|
|
1753
|
+
abortEarly: false,
|
|
1754
|
+
allowUnknown: false,
|
|
1755
|
+
});
|
|
1756
|
+
|
|
1757
|
+
if (res_error) {
|
|
1758
|
+
Logger({
|
|
1759
|
+
level: "WARN",
|
|
1760
|
+
message: "Response Validation Warnnings for getFaqByIdOrSlug",
|
|
1761
|
+
});
|
|
1762
|
+
Logger({ level: "WARN", message: res_error });
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
return response;
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* @param {Object} arg - Arg object.
|
|
1770
|
+
* @param {GenerationEntityType} arg.type - String representing the type of
|
|
1771
|
+
* SEO content to be generated. Possible values are: title, description
|
|
1772
|
+
* @param {GenerateSEOContent} arg.body
|
|
1773
|
+
* @returns {Promise<GeneratedSEOContent>} - Success response
|
|
1774
|
+
* @summary: Get SEO meta tag title for content
|
|
1775
|
+
* @description: Use this API to get GPT3 generated SEO meta tag title for content
|
|
1776
|
+
*/
|
|
1777
|
+
async generateSEOTitle({ type, body } = {}) {
|
|
1778
|
+
const { error } = ContentValidator.generateSEOTitle().validate(
|
|
1779
|
+
{
|
|
1780
|
+
type,
|
|
1781
|
+
body,
|
|
852
1782
|
},
|
|
853
1783
|
{ abortEarly: false, allowUnknown: true }
|
|
854
1784
|
);
|
|
@@ -856,15 +1786,48 @@ class Content {
|
|
|
856
1786
|
return Promise.reject(new FDKClientValidationError(error));
|
|
857
1787
|
}
|
|
858
1788
|
|
|
1789
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1790
|
+
const { error: warrning } = ContentValidator.generateSEOTitle().validate(
|
|
1791
|
+
{
|
|
1792
|
+
type,
|
|
1793
|
+
body,
|
|
1794
|
+
},
|
|
1795
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1796
|
+
);
|
|
1797
|
+
if (warrning) {
|
|
1798
|
+
Logger({
|
|
1799
|
+
level: "WARN",
|
|
1800
|
+
message: "Parameter Validation warrnings for generateSEOTitle",
|
|
1801
|
+
});
|
|
1802
|
+
Logger({ level: "WARN", message: warrning });
|
|
1803
|
+
}
|
|
1804
|
+
|
|
859
1805
|
const query_params = {};
|
|
860
1806
|
|
|
861
|
-
|
|
1807
|
+
const response = await PlatformAPIClient.execute(
|
|
862
1808
|
this.config,
|
|
863
|
-
"
|
|
864
|
-
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1809
|
+
"post",
|
|
1810
|
+
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/generate-seo/${type}`,
|
|
865
1811
|
query_params,
|
|
866
|
-
|
|
1812
|
+
body
|
|
867
1813
|
);
|
|
1814
|
+
|
|
1815
|
+
const {
|
|
1816
|
+
error: res_error,
|
|
1817
|
+
} = ContentModel.GeneratedSEOContent().validate(response, {
|
|
1818
|
+
abortEarly: false,
|
|
1819
|
+
allowUnknown: false,
|
|
1820
|
+
});
|
|
1821
|
+
|
|
1822
|
+
if (res_error) {
|
|
1823
|
+
Logger({
|
|
1824
|
+
level: "WARN",
|
|
1825
|
+
message: "Response Validation Warnnings for generateSEOTitle",
|
|
1826
|
+
});
|
|
1827
|
+
Logger({ level: "WARN", message: res_error });
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
return response;
|
|
868
1831
|
}
|
|
869
1832
|
|
|
870
1833
|
/**
|
|
@@ -873,10 +1836,11 @@ class Content {
|
|
|
873
1836
|
* given set of results. Default value is 1.
|
|
874
1837
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
875
1838
|
* page. Default value is 10.
|
|
1839
|
+
* @returns {Promise<LandingPageGetResponse>} - Success response
|
|
876
1840
|
* @summary: Get landing pages
|
|
877
1841
|
* @description: Landing page is the first page that a prospect lands upon while visiting a website. Use this API to fetch a list of landing pages.
|
|
878
1842
|
*/
|
|
879
|
-
getLandingPages({ pageNo, pageSize } = {}) {
|
|
1843
|
+
async getLandingPages({ pageNo, pageSize } = {}) {
|
|
880
1844
|
const { error } = ContentValidator.getLandingPages().validate(
|
|
881
1845
|
{
|
|
882
1846
|
pageNo,
|
|
@@ -888,17 +1852,50 @@ class Content {
|
|
|
888
1852
|
return Promise.reject(new FDKClientValidationError(error));
|
|
889
1853
|
}
|
|
890
1854
|
|
|
1855
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1856
|
+
const { error: warrning } = ContentValidator.getLandingPages().validate(
|
|
1857
|
+
{
|
|
1858
|
+
pageNo,
|
|
1859
|
+
pageSize,
|
|
1860
|
+
},
|
|
1861
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1862
|
+
);
|
|
1863
|
+
if (warrning) {
|
|
1864
|
+
Logger({
|
|
1865
|
+
level: "WARN",
|
|
1866
|
+
message: "Parameter Validation warrnings for getLandingPages",
|
|
1867
|
+
});
|
|
1868
|
+
Logger({ level: "WARN", message: warrning });
|
|
1869
|
+
}
|
|
1870
|
+
|
|
891
1871
|
const query_params = {};
|
|
892
1872
|
query_params["page_no"] = pageNo;
|
|
893
1873
|
query_params["page_size"] = pageSize;
|
|
894
1874
|
|
|
895
|
-
|
|
1875
|
+
const response = await PlatformAPIClient.execute(
|
|
896
1876
|
this.config,
|
|
897
1877
|
"get",
|
|
898
1878
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/`,
|
|
899
1879
|
query_params,
|
|
900
1880
|
undefined
|
|
901
1881
|
);
|
|
1882
|
+
|
|
1883
|
+
const {
|
|
1884
|
+
error: res_error,
|
|
1885
|
+
} = ContentModel.LandingPageGetResponse().validate(response, {
|
|
1886
|
+
abortEarly: false,
|
|
1887
|
+
allowUnknown: false,
|
|
1888
|
+
});
|
|
1889
|
+
|
|
1890
|
+
if (res_error) {
|
|
1891
|
+
Logger({
|
|
1892
|
+
level: "WARN",
|
|
1893
|
+
message: "Response Validation Warnnings for getLandingPages",
|
|
1894
|
+
});
|
|
1895
|
+
Logger({ level: "WARN", message: res_error });
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
return response;
|
|
902
1899
|
}
|
|
903
1900
|
|
|
904
1901
|
/**
|
|
@@ -937,10 +1934,11 @@ class Content {
|
|
|
937
1934
|
/**
|
|
938
1935
|
* @param {Object} arg - Arg object.
|
|
939
1936
|
* @param {LandingPageSchema} arg.body
|
|
1937
|
+
* @returns {Promise<LandingPageSchema>} - Success response
|
|
940
1938
|
* @summary: Create a landing page
|
|
941
1939
|
* @description: Landing page is the first page that a prospect lands upon while visiting a website. Use this API to create a landing page.
|
|
942
1940
|
*/
|
|
943
|
-
createLandingPage({ body } = {}) {
|
|
1941
|
+
async createLandingPage({ body } = {}) {
|
|
944
1942
|
const { error } = ContentValidator.createLandingPage().validate(
|
|
945
1943
|
{
|
|
946
1944
|
body,
|
|
@@ -951,25 +1949,58 @@ class Content {
|
|
|
951
1949
|
return Promise.reject(new FDKClientValidationError(error));
|
|
952
1950
|
}
|
|
953
1951
|
|
|
1952
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1953
|
+
const { error: warrning } = ContentValidator.createLandingPage().validate(
|
|
1954
|
+
{
|
|
1955
|
+
body,
|
|
1956
|
+
},
|
|
1957
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1958
|
+
);
|
|
1959
|
+
if (warrning) {
|
|
1960
|
+
Logger({
|
|
1961
|
+
level: "WARN",
|
|
1962
|
+
message: "Parameter Validation warrnings for createLandingPage",
|
|
1963
|
+
});
|
|
1964
|
+
Logger({ level: "WARN", message: warrning });
|
|
1965
|
+
}
|
|
1966
|
+
|
|
954
1967
|
const query_params = {};
|
|
955
1968
|
|
|
956
|
-
|
|
1969
|
+
const response = await PlatformAPIClient.execute(
|
|
957
1970
|
this.config,
|
|
958
1971
|
"post",
|
|
959
1972
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/`,
|
|
960
1973
|
query_params,
|
|
961
1974
|
body
|
|
962
1975
|
);
|
|
1976
|
+
|
|
1977
|
+
const {
|
|
1978
|
+
error: res_error,
|
|
1979
|
+
} = ContentModel.LandingPageSchema().validate(response, {
|
|
1980
|
+
abortEarly: false,
|
|
1981
|
+
allowUnknown: false,
|
|
1982
|
+
});
|
|
1983
|
+
|
|
1984
|
+
if (res_error) {
|
|
1985
|
+
Logger({
|
|
1986
|
+
level: "WARN",
|
|
1987
|
+
message: "Response Validation Warnnings for createLandingPage",
|
|
1988
|
+
});
|
|
1989
|
+
Logger({ level: "WARN", message: res_error });
|
|
1990
|
+
}
|
|
1991
|
+
|
|
1992
|
+
return response;
|
|
963
1993
|
}
|
|
964
1994
|
|
|
965
1995
|
/**
|
|
966
1996
|
* @param {Object} arg - Arg object.
|
|
967
1997
|
* @param {string} arg.id - ID allotted to a landing page.
|
|
968
1998
|
* @param {LandingPageSchema} arg.body
|
|
1999
|
+
* @returns {Promise<LandingPageSchema>} - Success response
|
|
969
2000
|
* @summary: Update a landing page
|
|
970
2001
|
* @description: Use this API to edit the details of an existing landing page.
|
|
971
2002
|
*/
|
|
972
|
-
updateLandingPage({ id, body } = {}) {
|
|
2003
|
+
async updateLandingPage({ id, body } = {}) {
|
|
973
2004
|
const { error } = ContentValidator.updateLandingPage().validate(
|
|
974
2005
|
{
|
|
975
2006
|
id,
|
|
@@ -981,24 +2012,58 @@ class Content {
|
|
|
981
2012
|
return Promise.reject(new FDKClientValidationError(error));
|
|
982
2013
|
}
|
|
983
2014
|
|
|
2015
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2016
|
+
const { error: warrning } = ContentValidator.updateLandingPage().validate(
|
|
2017
|
+
{
|
|
2018
|
+
id,
|
|
2019
|
+
body,
|
|
2020
|
+
},
|
|
2021
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2022
|
+
);
|
|
2023
|
+
if (warrning) {
|
|
2024
|
+
Logger({
|
|
2025
|
+
level: "WARN",
|
|
2026
|
+
message: "Parameter Validation warrnings for updateLandingPage",
|
|
2027
|
+
});
|
|
2028
|
+
Logger({ level: "WARN", message: warrning });
|
|
2029
|
+
}
|
|
2030
|
+
|
|
984
2031
|
const query_params = {};
|
|
985
2032
|
|
|
986
|
-
|
|
2033
|
+
const response = await PlatformAPIClient.execute(
|
|
987
2034
|
this.config,
|
|
988
2035
|
"put",
|
|
989
2036
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/${id}`,
|
|
990
2037
|
query_params,
|
|
991
2038
|
body
|
|
992
2039
|
);
|
|
2040
|
+
|
|
2041
|
+
const {
|
|
2042
|
+
error: res_error,
|
|
2043
|
+
} = ContentModel.LandingPageSchema().validate(response, {
|
|
2044
|
+
abortEarly: false,
|
|
2045
|
+
allowUnknown: false,
|
|
2046
|
+
});
|
|
2047
|
+
|
|
2048
|
+
if (res_error) {
|
|
2049
|
+
Logger({
|
|
2050
|
+
level: "WARN",
|
|
2051
|
+
message: "Response Validation Warnnings for updateLandingPage",
|
|
2052
|
+
});
|
|
2053
|
+
Logger({ level: "WARN", message: res_error });
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
return response;
|
|
993
2057
|
}
|
|
994
2058
|
|
|
995
2059
|
/**
|
|
996
2060
|
* @param {Object} arg - Arg object.
|
|
997
2061
|
* @param {string} arg.id - ID allotted to a landing page.
|
|
2062
|
+
* @returns {Promise<LandingPageSchema>} - Success response
|
|
998
2063
|
* @summary: Delete a landing page
|
|
999
2064
|
* @description: Use this API to delete an existing landing page.
|
|
1000
2065
|
*/
|
|
1001
|
-
deleteLandingPage({ id } = {}) {
|
|
2066
|
+
async deleteLandingPage({ id } = {}) {
|
|
1002
2067
|
const { error } = ContentValidator.deleteLandingPage().validate(
|
|
1003
2068
|
{
|
|
1004
2069
|
id,
|
|
@@ -1009,23 +2074,56 @@ class Content {
|
|
|
1009
2074
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1010
2075
|
}
|
|
1011
2076
|
|
|
2077
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2078
|
+
const { error: warrning } = ContentValidator.deleteLandingPage().validate(
|
|
2079
|
+
{
|
|
2080
|
+
id,
|
|
2081
|
+
},
|
|
2082
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2083
|
+
);
|
|
2084
|
+
if (warrning) {
|
|
2085
|
+
Logger({
|
|
2086
|
+
level: "WARN",
|
|
2087
|
+
message: "Parameter Validation warrnings for deleteLandingPage",
|
|
2088
|
+
});
|
|
2089
|
+
Logger({ level: "WARN", message: warrning });
|
|
2090
|
+
}
|
|
2091
|
+
|
|
1012
2092
|
const query_params = {};
|
|
1013
2093
|
|
|
1014
|
-
|
|
2094
|
+
const response = await PlatformAPIClient.execute(
|
|
1015
2095
|
this.config,
|
|
1016
2096
|
"delete",
|
|
1017
2097
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/landing-page/${id}`,
|
|
1018
2098
|
query_params,
|
|
1019
2099
|
undefined
|
|
1020
2100
|
);
|
|
2101
|
+
|
|
2102
|
+
const {
|
|
2103
|
+
error: res_error,
|
|
2104
|
+
} = ContentModel.LandingPageSchema().validate(response, {
|
|
2105
|
+
abortEarly: false,
|
|
2106
|
+
allowUnknown: false,
|
|
2107
|
+
});
|
|
2108
|
+
|
|
2109
|
+
if (res_error) {
|
|
2110
|
+
Logger({
|
|
2111
|
+
level: "WARN",
|
|
2112
|
+
message: "Response Validation Warnnings for deleteLandingPage",
|
|
2113
|
+
});
|
|
2114
|
+
Logger({ level: "WARN", message: res_error });
|
|
2115
|
+
}
|
|
2116
|
+
|
|
2117
|
+
return response;
|
|
1021
2118
|
}
|
|
1022
2119
|
|
|
1023
2120
|
/**
|
|
1024
2121
|
* @param {Object} arg - Arg object.
|
|
2122
|
+
* @returns {Promise<ApplicationLegal>} - Success response
|
|
1025
2123
|
* @summary: Get legal information
|
|
1026
2124
|
* @description: Use this API to get the legal information of an application, which includes Policy, Terms and Conditions, Shipping Policy and FAQ regarding the application.
|
|
1027
2125
|
*/
|
|
1028
|
-
getLegalInformation({} = {}) {
|
|
2126
|
+
async getLegalInformation({} = {}) {
|
|
1029
2127
|
const { error } = ContentValidator.getLegalInformation().validate(
|
|
1030
2128
|
{},
|
|
1031
2129
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1034,24 +2132,55 @@ class Content {
|
|
|
1034
2132
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1035
2133
|
}
|
|
1036
2134
|
|
|
2135
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2136
|
+
const { error: warrning } = ContentValidator.getLegalInformation().validate(
|
|
2137
|
+
{},
|
|
2138
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2139
|
+
);
|
|
2140
|
+
if (warrning) {
|
|
2141
|
+
Logger({
|
|
2142
|
+
level: "WARN",
|
|
2143
|
+
message: "Parameter Validation warrnings for getLegalInformation",
|
|
2144
|
+
});
|
|
2145
|
+
Logger({ level: "WARN", message: warrning });
|
|
2146
|
+
}
|
|
2147
|
+
|
|
1037
2148
|
const query_params = {};
|
|
1038
2149
|
|
|
1039
|
-
|
|
2150
|
+
const response = await PlatformAPIClient.execute(
|
|
1040
2151
|
this.config,
|
|
1041
2152
|
"get",
|
|
1042
2153
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/legal`,
|
|
1043
2154
|
query_params,
|
|
1044
2155
|
undefined
|
|
1045
2156
|
);
|
|
2157
|
+
|
|
2158
|
+
const {
|
|
2159
|
+
error: res_error,
|
|
2160
|
+
} = ContentModel.ApplicationLegal().validate(response, {
|
|
2161
|
+
abortEarly: false,
|
|
2162
|
+
allowUnknown: false,
|
|
2163
|
+
});
|
|
2164
|
+
|
|
2165
|
+
if (res_error) {
|
|
2166
|
+
Logger({
|
|
2167
|
+
level: "WARN",
|
|
2168
|
+
message: "Response Validation Warnnings for getLegalInformation",
|
|
2169
|
+
});
|
|
2170
|
+
Logger({ level: "WARN", message: res_error });
|
|
2171
|
+
}
|
|
2172
|
+
|
|
2173
|
+
return response;
|
|
1046
2174
|
}
|
|
1047
2175
|
|
|
1048
2176
|
/**
|
|
1049
2177
|
* @param {Object} arg - Arg object.
|
|
1050
2178
|
* @param {ApplicationLegal} arg.body
|
|
2179
|
+
* @returns {Promise<ApplicationLegal>} - Success response
|
|
1051
2180
|
* @summary: Save legal information
|
|
1052
2181
|
* @description: Use this API to edit, update and save the legal information of an application, which includes Policy, Terms and Conditions, Shipping Policy and FAQ regarding the application.
|
|
1053
2182
|
*/
|
|
1054
|
-
updateLegalInformation({ body } = {}) {
|
|
2183
|
+
async updateLegalInformation({ body } = {}) {
|
|
1055
2184
|
const { error } = ContentValidator.updateLegalInformation().validate(
|
|
1056
2185
|
{
|
|
1057
2186
|
body,
|
|
@@ -1062,15 +2191,49 @@ class Content {
|
|
|
1062
2191
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1063
2192
|
}
|
|
1064
2193
|
|
|
2194
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2195
|
+
const {
|
|
2196
|
+
error: warrning,
|
|
2197
|
+
} = ContentValidator.updateLegalInformation().validate(
|
|
2198
|
+
{
|
|
2199
|
+
body,
|
|
2200
|
+
},
|
|
2201
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2202
|
+
);
|
|
2203
|
+
if (warrning) {
|
|
2204
|
+
Logger({
|
|
2205
|
+
level: "WARN",
|
|
2206
|
+
message: "Parameter Validation warrnings for updateLegalInformation",
|
|
2207
|
+
});
|
|
2208
|
+
Logger({ level: "WARN", message: warrning });
|
|
2209
|
+
}
|
|
2210
|
+
|
|
1065
2211
|
const query_params = {};
|
|
1066
2212
|
|
|
1067
|
-
|
|
2213
|
+
const response = await PlatformAPIClient.execute(
|
|
1068
2214
|
this.config,
|
|
1069
2215
|
"post",
|
|
1070
2216
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/legal`,
|
|
1071
2217
|
query_params,
|
|
1072
2218
|
body
|
|
1073
2219
|
);
|
|
2220
|
+
|
|
2221
|
+
const {
|
|
2222
|
+
error: res_error,
|
|
2223
|
+
} = ContentModel.ApplicationLegal().validate(response, {
|
|
2224
|
+
abortEarly: false,
|
|
2225
|
+
allowUnknown: false,
|
|
2226
|
+
});
|
|
2227
|
+
|
|
2228
|
+
if (res_error) {
|
|
2229
|
+
Logger({
|
|
2230
|
+
level: "WARN",
|
|
2231
|
+
message: "Response Validation Warnnings for updateLegalInformation",
|
|
2232
|
+
});
|
|
2233
|
+
Logger({ level: "WARN", message: res_error });
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
return response;
|
|
1074
2237
|
}
|
|
1075
2238
|
|
|
1076
2239
|
/**
|
|
@@ -1081,10 +2244,11 @@ class Content {
|
|
|
1081
2244
|
* given set of results. Default value is 1.
|
|
1082
2245
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
1083
2246
|
* page. Default value is 10.
|
|
2247
|
+
* @returns {Promise<NavigationGetResponse>} - Success response
|
|
1084
2248
|
* @summary: Get navigations
|
|
1085
2249
|
* @description: Use this API to fetch the navigations details which includes the items of the navigation pane. It also shows the orientation, links, sub-navigations, etc.
|
|
1086
2250
|
*/
|
|
1087
|
-
getNavigations({ devicePlatform, pageNo, pageSize } = {}) {
|
|
2251
|
+
async getNavigations({ devicePlatform, pageNo, pageSize } = {}) {
|
|
1088
2252
|
const { error } = ContentValidator.getNavigations().validate(
|
|
1089
2253
|
{
|
|
1090
2254
|
devicePlatform,
|
|
@@ -1097,18 +2261,52 @@ class Content {
|
|
|
1097
2261
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1098
2262
|
}
|
|
1099
2263
|
|
|
2264
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2265
|
+
const { error: warrning } = ContentValidator.getNavigations().validate(
|
|
2266
|
+
{
|
|
2267
|
+
devicePlatform,
|
|
2268
|
+
pageNo,
|
|
2269
|
+
pageSize,
|
|
2270
|
+
},
|
|
2271
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2272
|
+
);
|
|
2273
|
+
if (warrning) {
|
|
2274
|
+
Logger({
|
|
2275
|
+
level: "WARN",
|
|
2276
|
+
message: "Parameter Validation warrnings for getNavigations",
|
|
2277
|
+
});
|
|
2278
|
+
Logger({ level: "WARN", message: warrning });
|
|
2279
|
+
}
|
|
2280
|
+
|
|
1100
2281
|
const query_params = {};
|
|
1101
2282
|
query_params["device_platform"] = devicePlatform;
|
|
1102
2283
|
query_params["page_no"] = pageNo;
|
|
1103
2284
|
query_params["page_size"] = pageSize;
|
|
1104
2285
|
|
|
1105
|
-
|
|
2286
|
+
const response = await PlatformAPIClient.execute(
|
|
1106
2287
|
this.config,
|
|
1107
2288
|
"get",
|
|
1108
2289
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/`,
|
|
1109
2290
|
query_params,
|
|
1110
2291
|
undefined
|
|
1111
2292
|
);
|
|
2293
|
+
|
|
2294
|
+
const {
|
|
2295
|
+
error: res_error,
|
|
2296
|
+
} = ContentModel.NavigationGetResponse().validate(response, {
|
|
2297
|
+
abortEarly: false,
|
|
2298
|
+
allowUnknown: false,
|
|
2299
|
+
});
|
|
2300
|
+
|
|
2301
|
+
if (res_error) {
|
|
2302
|
+
Logger({
|
|
2303
|
+
level: "WARN",
|
|
2304
|
+
message: "Response Validation Warnnings for getNavigations",
|
|
2305
|
+
});
|
|
2306
|
+
Logger({ level: "WARN", message: res_error });
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
return response;
|
|
1112
2310
|
}
|
|
1113
2311
|
|
|
1114
2312
|
/**
|
|
@@ -1155,10 +2353,11 @@ class Content {
|
|
|
1155
2353
|
/**
|
|
1156
2354
|
* @param {Object} arg - Arg object.
|
|
1157
2355
|
* @param {NavigationRequest} arg.body
|
|
2356
|
+
* @returns {Promise<NavigationSchema>} - Success response
|
|
1158
2357
|
* @summary: Create a navigation
|
|
1159
2358
|
* @description: Navigation is the arrangement of navigational items to ease the accessibility of resources for users on a website. Use this API to create a navigation.
|
|
1160
2359
|
*/
|
|
1161
|
-
createNavigation({ body } = {}) {
|
|
2360
|
+
async createNavigation({ body } = {}) {
|
|
1162
2361
|
const { error } = ContentValidator.createNavigation().validate(
|
|
1163
2362
|
{
|
|
1164
2363
|
body,
|
|
@@ -1169,23 +2368,56 @@ class Content {
|
|
|
1169
2368
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1170
2369
|
}
|
|
1171
2370
|
|
|
2371
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2372
|
+
const { error: warrning } = ContentValidator.createNavigation().validate(
|
|
2373
|
+
{
|
|
2374
|
+
body,
|
|
2375
|
+
},
|
|
2376
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2377
|
+
);
|
|
2378
|
+
if (warrning) {
|
|
2379
|
+
Logger({
|
|
2380
|
+
level: "WARN",
|
|
2381
|
+
message: "Parameter Validation warrnings for createNavigation",
|
|
2382
|
+
});
|
|
2383
|
+
Logger({ level: "WARN", message: warrning });
|
|
2384
|
+
}
|
|
2385
|
+
|
|
1172
2386
|
const query_params = {};
|
|
1173
2387
|
|
|
1174
|
-
|
|
2388
|
+
const response = await PlatformAPIClient.execute(
|
|
1175
2389
|
this.config,
|
|
1176
2390
|
"post",
|
|
1177
2391
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/`,
|
|
1178
2392
|
query_params,
|
|
1179
2393
|
body
|
|
1180
2394
|
);
|
|
2395
|
+
|
|
2396
|
+
const {
|
|
2397
|
+
error: res_error,
|
|
2398
|
+
} = ContentModel.NavigationSchema().validate(response, {
|
|
2399
|
+
abortEarly: false,
|
|
2400
|
+
allowUnknown: false,
|
|
2401
|
+
});
|
|
2402
|
+
|
|
2403
|
+
if (res_error) {
|
|
2404
|
+
Logger({
|
|
2405
|
+
level: "WARN",
|
|
2406
|
+
message: "Response Validation Warnnings for createNavigation",
|
|
2407
|
+
});
|
|
2408
|
+
Logger({ level: "WARN", message: res_error });
|
|
2409
|
+
}
|
|
2410
|
+
|
|
2411
|
+
return response;
|
|
1181
2412
|
}
|
|
1182
2413
|
|
|
1183
2414
|
/**
|
|
1184
2415
|
* @param {Object} arg - Arg object.
|
|
2416
|
+
* @returns {Promise<DefaultNavigationResponse>} - Success response
|
|
1185
2417
|
* @summary: Get default navigations
|
|
1186
2418
|
* @description: On any website (application), there are navigations that are present by default. Use this API to retrieve those default navigations.
|
|
1187
2419
|
*/
|
|
1188
|
-
getDefaultNavigations({} = {}) {
|
|
2420
|
+
async getDefaultNavigations({} = {}) {
|
|
1189
2421
|
const { error } = ContentValidator.getDefaultNavigations().validate(
|
|
1190
2422
|
{},
|
|
1191
2423
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1194,15 +2426,47 @@ class Content {
|
|
|
1194
2426
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1195
2427
|
}
|
|
1196
2428
|
|
|
2429
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2430
|
+
const {
|
|
2431
|
+
error: warrning,
|
|
2432
|
+
} = ContentValidator.getDefaultNavigations().validate(
|
|
2433
|
+
{},
|
|
2434
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2435
|
+
);
|
|
2436
|
+
if (warrning) {
|
|
2437
|
+
Logger({
|
|
2438
|
+
level: "WARN",
|
|
2439
|
+
message: "Parameter Validation warrnings for getDefaultNavigations",
|
|
2440
|
+
});
|
|
2441
|
+
Logger({ level: "WARN", message: warrning });
|
|
2442
|
+
}
|
|
2443
|
+
|
|
1197
2444
|
const query_params = {};
|
|
1198
2445
|
|
|
1199
|
-
|
|
2446
|
+
const response = await PlatformAPIClient.execute(
|
|
1200
2447
|
this.config,
|
|
1201
2448
|
"get",
|
|
1202
2449
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/default`,
|
|
1203
2450
|
query_params,
|
|
1204
2451
|
undefined
|
|
1205
2452
|
);
|
|
2453
|
+
|
|
2454
|
+
const {
|
|
2455
|
+
error: res_error,
|
|
2456
|
+
} = ContentModel.DefaultNavigationResponse().validate(response, {
|
|
2457
|
+
abortEarly: false,
|
|
2458
|
+
allowUnknown: false,
|
|
2459
|
+
});
|
|
2460
|
+
|
|
2461
|
+
if (res_error) {
|
|
2462
|
+
Logger({
|
|
2463
|
+
level: "WARN",
|
|
2464
|
+
message: "Response Validation Warnnings for getDefaultNavigations",
|
|
2465
|
+
});
|
|
2466
|
+
Logger({ level: "WARN", message: res_error });
|
|
2467
|
+
}
|
|
2468
|
+
|
|
2469
|
+
return response;
|
|
1206
2470
|
}
|
|
1207
2471
|
|
|
1208
2472
|
/**
|
|
@@ -1212,10 +2476,11 @@ class Content {
|
|
|
1212
2476
|
* `getNavigations` API.
|
|
1213
2477
|
* @param {string} arg.devicePlatform - Filter navigations by platform.
|
|
1214
2478
|
* Acceptable values are: web, android, ios, all
|
|
2479
|
+
* @returns {Promise<NavigationSchema>} - Success response
|
|
1215
2480
|
* @summary: Get a navigation by slug
|
|
1216
2481
|
* @description: Use this API to retrieve a navigation by its slug.
|
|
1217
2482
|
*/
|
|
1218
|
-
getNavigationBySlug({ slug, devicePlatform } = {}) {
|
|
2483
|
+
async getNavigationBySlug({ slug, devicePlatform } = {}) {
|
|
1219
2484
|
const { error } = ContentValidator.getNavigationBySlug().validate(
|
|
1220
2485
|
{
|
|
1221
2486
|
slug,
|
|
@@ -1227,26 +2492,60 @@ class Content {
|
|
|
1227
2492
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1228
2493
|
}
|
|
1229
2494
|
|
|
2495
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2496
|
+
const { error: warrning } = ContentValidator.getNavigationBySlug().validate(
|
|
2497
|
+
{
|
|
2498
|
+
slug,
|
|
2499
|
+
devicePlatform,
|
|
2500
|
+
},
|
|
2501
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2502
|
+
);
|
|
2503
|
+
if (warrning) {
|
|
2504
|
+
Logger({
|
|
2505
|
+
level: "WARN",
|
|
2506
|
+
message: "Parameter Validation warrnings for getNavigationBySlug",
|
|
2507
|
+
});
|
|
2508
|
+
Logger({ level: "WARN", message: warrning });
|
|
2509
|
+
}
|
|
2510
|
+
|
|
1230
2511
|
const query_params = {};
|
|
1231
2512
|
query_params["device_platform"] = devicePlatform;
|
|
1232
2513
|
|
|
1233
|
-
|
|
2514
|
+
const response = await PlatformAPIClient.execute(
|
|
1234
2515
|
this.config,
|
|
1235
2516
|
"get",
|
|
1236
2517
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/${slug}`,
|
|
1237
2518
|
query_params,
|
|
1238
2519
|
undefined
|
|
1239
2520
|
);
|
|
2521
|
+
|
|
2522
|
+
const {
|
|
2523
|
+
error: res_error,
|
|
2524
|
+
} = ContentModel.NavigationSchema().validate(response, {
|
|
2525
|
+
abortEarly: false,
|
|
2526
|
+
allowUnknown: false,
|
|
2527
|
+
});
|
|
2528
|
+
|
|
2529
|
+
if (res_error) {
|
|
2530
|
+
Logger({
|
|
2531
|
+
level: "WARN",
|
|
2532
|
+
message: "Response Validation Warnnings for getNavigationBySlug",
|
|
2533
|
+
});
|
|
2534
|
+
Logger({ level: "WARN", message: res_error });
|
|
2535
|
+
}
|
|
2536
|
+
|
|
2537
|
+
return response;
|
|
1240
2538
|
}
|
|
1241
2539
|
|
|
1242
2540
|
/**
|
|
1243
2541
|
* @param {Object} arg - Arg object.
|
|
1244
2542
|
* @param {string} arg.id - ID allotted to the navigation.
|
|
1245
2543
|
* @param {NavigationRequest} arg.body
|
|
2544
|
+
* @returns {Promise<NavigationSchema>} - Success response
|
|
1246
2545
|
* @summary: Update a navigation
|
|
1247
2546
|
* @description: Use this API to edit the details of an existing navigation.
|
|
1248
2547
|
*/
|
|
1249
|
-
updateNavigation({ id, body } = {}) {
|
|
2548
|
+
async updateNavigation({ id, body } = {}) {
|
|
1250
2549
|
const { error } = ContentValidator.updateNavigation().validate(
|
|
1251
2550
|
{
|
|
1252
2551
|
id,
|
|
@@ -1258,24 +2557,58 @@ class Content {
|
|
|
1258
2557
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1259
2558
|
}
|
|
1260
2559
|
|
|
2560
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2561
|
+
const { error: warrning } = ContentValidator.updateNavigation().validate(
|
|
2562
|
+
{
|
|
2563
|
+
id,
|
|
2564
|
+
body,
|
|
2565
|
+
},
|
|
2566
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2567
|
+
);
|
|
2568
|
+
if (warrning) {
|
|
2569
|
+
Logger({
|
|
2570
|
+
level: "WARN",
|
|
2571
|
+
message: "Parameter Validation warrnings for updateNavigation",
|
|
2572
|
+
});
|
|
2573
|
+
Logger({ level: "WARN", message: warrning });
|
|
2574
|
+
}
|
|
2575
|
+
|
|
1261
2576
|
const query_params = {};
|
|
1262
2577
|
|
|
1263
|
-
|
|
2578
|
+
const response = await PlatformAPIClient.execute(
|
|
1264
2579
|
this.config,
|
|
1265
2580
|
"put",
|
|
1266
2581
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/${id}`,
|
|
1267
2582
|
query_params,
|
|
1268
2583
|
body
|
|
1269
2584
|
);
|
|
2585
|
+
|
|
2586
|
+
const {
|
|
2587
|
+
error: res_error,
|
|
2588
|
+
} = ContentModel.NavigationSchema().validate(response, {
|
|
2589
|
+
abortEarly: false,
|
|
2590
|
+
allowUnknown: false,
|
|
2591
|
+
});
|
|
2592
|
+
|
|
2593
|
+
if (res_error) {
|
|
2594
|
+
Logger({
|
|
2595
|
+
level: "WARN",
|
|
2596
|
+
message: "Response Validation Warnnings for updateNavigation",
|
|
2597
|
+
});
|
|
2598
|
+
Logger({ level: "WARN", message: res_error });
|
|
2599
|
+
}
|
|
2600
|
+
|
|
2601
|
+
return response;
|
|
1270
2602
|
}
|
|
1271
2603
|
|
|
1272
2604
|
/**
|
|
1273
2605
|
* @param {Object} arg - Arg object.
|
|
1274
2606
|
* @param {string} arg.id - ID allotted to the navigation.
|
|
2607
|
+
* @returns {Promise<NavigationSchema>} - Success response
|
|
1275
2608
|
* @summary: Delete a navigation
|
|
1276
2609
|
* @description: Use this API to delete an existing navigation.
|
|
1277
2610
|
*/
|
|
1278
|
-
deleteNavigation({ id } = {}) {
|
|
2611
|
+
async deleteNavigation({ id } = {}) {
|
|
1279
2612
|
const { error } = ContentValidator.deleteNavigation().validate(
|
|
1280
2613
|
{
|
|
1281
2614
|
id,
|
|
@@ -1286,23 +2619,56 @@ class Content {
|
|
|
1286
2619
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1287
2620
|
}
|
|
1288
2621
|
|
|
2622
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2623
|
+
const { error: warrning } = ContentValidator.deleteNavigation().validate(
|
|
2624
|
+
{
|
|
2625
|
+
id,
|
|
2626
|
+
},
|
|
2627
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2628
|
+
);
|
|
2629
|
+
if (warrning) {
|
|
2630
|
+
Logger({
|
|
2631
|
+
level: "WARN",
|
|
2632
|
+
message: "Parameter Validation warrnings for deleteNavigation",
|
|
2633
|
+
});
|
|
2634
|
+
Logger({ level: "WARN", message: warrning });
|
|
2635
|
+
}
|
|
2636
|
+
|
|
1289
2637
|
const query_params = {};
|
|
1290
2638
|
|
|
1291
|
-
|
|
2639
|
+
const response = await PlatformAPIClient.execute(
|
|
1292
2640
|
this.config,
|
|
1293
2641
|
"delete",
|
|
1294
2642
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/navigations/${id}`,
|
|
1295
2643
|
query_params,
|
|
1296
2644
|
undefined
|
|
1297
2645
|
);
|
|
2646
|
+
|
|
2647
|
+
const {
|
|
2648
|
+
error: res_error,
|
|
2649
|
+
} = ContentModel.NavigationSchema().validate(response, {
|
|
2650
|
+
abortEarly: false,
|
|
2651
|
+
allowUnknown: false,
|
|
2652
|
+
});
|
|
2653
|
+
|
|
2654
|
+
if (res_error) {
|
|
2655
|
+
Logger({
|
|
2656
|
+
level: "WARN",
|
|
2657
|
+
message: "Response Validation Warnnings for deleteNavigation",
|
|
2658
|
+
});
|
|
2659
|
+
Logger({ level: "WARN", message: res_error });
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
return response;
|
|
1298
2663
|
}
|
|
1299
2664
|
|
|
1300
2665
|
/**
|
|
1301
2666
|
* @param {Object} arg - Arg object.
|
|
2667
|
+
* @returns {Promise<PageMetaSchema>} - Success response
|
|
1302
2668
|
* @summary: Get page meta
|
|
1303
2669
|
* @description: Use this API to get the meta of custom pages (blog, page) and default system pages (e.g. home/brand/category/collection).
|
|
1304
2670
|
*/
|
|
1305
|
-
getPageMeta({} = {}) {
|
|
2671
|
+
async getPageMeta({} = {}) {
|
|
1306
2672
|
const { error } = ContentValidator.getPageMeta().validate(
|
|
1307
2673
|
{},
|
|
1308
2674
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1311,23 +2677,54 @@ class Content {
|
|
|
1311
2677
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1312
2678
|
}
|
|
1313
2679
|
|
|
2680
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2681
|
+
const { error: warrning } = ContentValidator.getPageMeta().validate(
|
|
2682
|
+
{},
|
|
2683
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2684
|
+
);
|
|
2685
|
+
if (warrning) {
|
|
2686
|
+
Logger({
|
|
2687
|
+
level: "WARN",
|
|
2688
|
+
message: "Parameter Validation warrnings for getPageMeta",
|
|
2689
|
+
});
|
|
2690
|
+
Logger({ level: "WARN", message: warrning });
|
|
2691
|
+
}
|
|
2692
|
+
|
|
1314
2693
|
const query_params = {};
|
|
1315
2694
|
|
|
1316
|
-
|
|
2695
|
+
const response = await PlatformAPIClient.execute(
|
|
1317
2696
|
this.config,
|
|
1318
2697
|
"get",
|
|
1319
2698
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/meta`,
|
|
1320
2699
|
query_params,
|
|
1321
2700
|
undefined
|
|
1322
2701
|
);
|
|
2702
|
+
|
|
2703
|
+
const {
|
|
2704
|
+
error: res_error,
|
|
2705
|
+
} = ContentModel.PageMetaSchema().validate(response, {
|
|
2706
|
+
abortEarly: false,
|
|
2707
|
+
allowUnknown: false,
|
|
2708
|
+
});
|
|
2709
|
+
|
|
2710
|
+
if (res_error) {
|
|
2711
|
+
Logger({
|
|
2712
|
+
level: "WARN",
|
|
2713
|
+
message: "Response Validation Warnnings for getPageMeta",
|
|
2714
|
+
});
|
|
2715
|
+
Logger({ level: "WARN", message: res_error });
|
|
2716
|
+
}
|
|
2717
|
+
|
|
2718
|
+
return response;
|
|
1323
2719
|
}
|
|
1324
2720
|
|
|
1325
2721
|
/**
|
|
1326
2722
|
* @param {Object} arg - Arg object.
|
|
2723
|
+
* @returns {Promise<PageSpec>} - Success response
|
|
1327
2724
|
* @summary: Get page spec
|
|
1328
2725
|
* @description: Use this API to get the specifications of a page, such as page type, display name, params and query.
|
|
1329
2726
|
*/
|
|
1330
|
-
getPageSpec({} = {}) {
|
|
2727
|
+
async getPageSpec({} = {}) {
|
|
1331
2728
|
const { error } = ContentValidator.getPageSpec().validate(
|
|
1332
2729
|
{},
|
|
1333
2730
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1336,24 +2733,53 @@ class Content {
|
|
|
1336
2733
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1337
2734
|
}
|
|
1338
2735
|
|
|
2736
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2737
|
+
const { error: warrning } = ContentValidator.getPageSpec().validate(
|
|
2738
|
+
{},
|
|
2739
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2740
|
+
);
|
|
2741
|
+
if (warrning) {
|
|
2742
|
+
Logger({
|
|
2743
|
+
level: "WARN",
|
|
2744
|
+
message: "Parameter Validation warrnings for getPageSpec",
|
|
2745
|
+
});
|
|
2746
|
+
Logger({ level: "WARN", message: warrning });
|
|
2747
|
+
}
|
|
2748
|
+
|
|
1339
2749
|
const query_params = {};
|
|
1340
2750
|
|
|
1341
|
-
|
|
2751
|
+
const response = await PlatformAPIClient.execute(
|
|
1342
2752
|
this.config,
|
|
1343
2753
|
"get",
|
|
1344
2754
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/spec`,
|
|
1345
2755
|
query_params,
|
|
1346
2756
|
undefined
|
|
1347
2757
|
);
|
|
2758
|
+
|
|
2759
|
+
const { error: res_error } = ContentModel.PageSpec().validate(response, {
|
|
2760
|
+
abortEarly: false,
|
|
2761
|
+
allowUnknown: false,
|
|
2762
|
+
});
|
|
2763
|
+
|
|
2764
|
+
if (res_error) {
|
|
2765
|
+
Logger({
|
|
2766
|
+
level: "WARN",
|
|
2767
|
+
message: "Response Validation Warnnings for getPageSpec",
|
|
2768
|
+
});
|
|
2769
|
+
Logger({ level: "WARN", message: res_error });
|
|
2770
|
+
}
|
|
2771
|
+
|
|
2772
|
+
return response;
|
|
1348
2773
|
}
|
|
1349
2774
|
|
|
1350
2775
|
/**
|
|
1351
2776
|
* @param {Object} arg - Arg object.
|
|
1352
2777
|
* @param {PageRequest} arg.body
|
|
2778
|
+
* @returns {Promise<PageSchema>} - Success response
|
|
1353
2779
|
* @summary: Create a page preview
|
|
1354
2780
|
* @description: Use this API to create a page preview to check the appearance of a custom page.
|
|
1355
2781
|
*/
|
|
1356
|
-
createPagePreview({ body } = {}) {
|
|
2782
|
+
async createPagePreview({ body } = {}) {
|
|
1357
2783
|
const { error } = ContentValidator.createPagePreview().validate(
|
|
1358
2784
|
{
|
|
1359
2785
|
body,
|
|
@@ -1364,15 +2790,45 @@ class Content {
|
|
|
1364
2790
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1365
2791
|
}
|
|
1366
2792
|
|
|
2793
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2794
|
+
const { error: warrning } = ContentValidator.createPagePreview().validate(
|
|
2795
|
+
{
|
|
2796
|
+
body,
|
|
2797
|
+
},
|
|
2798
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2799
|
+
);
|
|
2800
|
+
if (warrning) {
|
|
2801
|
+
Logger({
|
|
2802
|
+
level: "WARN",
|
|
2803
|
+
message: "Parameter Validation warrnings for createPagePreview",
|
|
2804
|
+
});
|
|
2805
|
+
Logger({ level: "WARN", message: warrning });
|
|
2806
|
+
}
|
|
2807
|
+
|
|
1367
2808
|
const query_params = {};
|
|
1368
2809
|
|
|
1369
|
-
|
|
2810
|
+
const response = await PlatformAPIClient.execute(
|
|
1370
2811
|
this.config,
|
|
1371
2812
|
"post",
|
|
1372
2813
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/preview/`,
|
|
1373
2814
|
query_params,
|
|
1374
2815
|
body
|
|
1375
2816
|
);
|
|
2817
|
+
|
|
2818
|
+
const { error: res_error } = ContentModel.PageSchema().validate(response, {
|
|
2819
|
+
abortEarly: false,
|
|
2820
|
+
allowUnknown: false,
|
|
2821
|
+
});
|
|
2822
|
+
|
|
2823
|
+
if (res_error) {
|
|
2824
|
+
Logger({
|
|
2825
|
+
level: "WARN",
|
|
2826
|
+
message: "Response Validation Warnnings for createPagePreview",
|
|
2827
|
+
});
|
|
2828
|
+
Logger({ level: "WARN", message: res_error });
|
|
2829
|
+
}
|
|
2830
|
+
|
|
2831
|
+
return response;
|
|
1376
2832
|
}
|
|
1377
2833
|
|
|
1378
2834
|
/**
|
|
@@ -1380,10 +2836,11 @@ class Content {
|
|
|
1380
2836
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1381
2837
|
* identifier of a page. You can get slug value of a page from `getPages` API.
|
|
1382
2838
|
* @param {PagePublishRequest} arg.body
|
|
2839
|
+
* @returns {Promise<PageSchema>} - Success response
|
|
1383
2840
|
* @summary: Change the publish status of a page
|
|
1384
2841
|
* @description: Use this API to change the publish status of an existing page. Allows you to publish and unpublish the page.
|
|
1385
2842
|
*/
|
|
1386
|
-
updatePagePreview({ slug, body } = {}) {
|
|
2843
|
+
async updatePagePreview({ slug, body } = {}) {
|
|
1387
2844
|
const { error } = ContentValidator.updatePagePreview().validate(
|
|
1388
2845
|
{
|
|
1389
2846
|
slug,
|
|
@@ -1395,24 +2852,56 @@ class Content {
|
|
|
1395
2852
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1396
2853
|
}
|
|
1397
2854
|
|
|
2855
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2856
|
+
const { error: warrning } = ContentValidator.updatePagePreview().validate(
|
|
2857
|
+
{
|
|
2858
|
+
slug,
|
|
2859
|
+
body,
|
|
2860
|
+
},
|
|
2861
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2862
|
+
);
|
|
2863
|
+
if (warrning) {
|
|
2864
|
+
Logger({
|
|
2865
|
+
level: "WARN",
|
|
2866
|
+
message: "Parameter Validation warrnings for updatePagePreview",
|
|
2867
|
+
});
|
|
2868
|
+
Logger({ level: "WARN", message: warrning });
|
|
2869
|
+
}
|
|
2870
|
+
|
|
1398
2871
|
const query_params = {};
|
|
1399
2872
|
|
|
1400
|
-
|
|
2873
|
+
const response = await PlatformAPIClient.execute(
|
|
1401
2874
|
this.config,
|
|
1402
2875
|
"put",
|
|
1403
2876
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/publish/${slug}`,
|
|
1404
2877
|
query_params,
|
|
1405
2878
|
body
|
|
1406
2879
|
);
|
|
2880
|
+
|
|
2881
|
+
const { error: res_error } = ContentModel.PageSchema().validate(response, {
|
|
2882
|
+
abortEarly: false,
|
|
2883
|
+
allowUnknown: false,
|
|
2884
|
+
});
|
|
2885
|
+
|
|
2886
|
+
if (res_error) {
|
|
2887
|
+
Logger({
|
|
2888
|
+
level: "WARN",
|
|
2889
|
+
message: "Response Validation Warnnings for updatePagePreview",
|
|
2890
|
+
});
|
|
2891
|
+
Logger({ level: "WARN", message: res_error });
|
|
2892
|
+
}
|
|
2893
|
+
|
|
2894
|
+
return response;
|
|
1407
2895
|
}
|
|
1408
2896
|
|
|
1409
2897
|
/**
|
|
1410
2898
|
* @param {Object} arg - Arg object.
|
|
1411
2899
|
* @param {string} arg.id - ID allotted to the page.
|
|
2900
|
+
* @returns {Promise<PageSchema>} - Success response
|
|
1412
2901
|
* @summary: Delete a page
|
|
1413
2902
|
* @description: Use this API to delete an existing page.
|
|
1414
2903
|
*/
|
|
1415
|
-
deletePage({ id } = {}) {
|
|
2904
|
+
async deletePage({ id } = {}) {
|
|
1416
2905
|
const { error } = ContentValidator.deletePage().validate(
|
|
1417
2906
|
{
|
|
1418
2907
|
id,
|
|
@@ -1423,24 +2912,55 @@ class Content {
|
|
|
1423
2912
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1424
2913
|
}
|
|
1425
2914
|
|
|
2915
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2916
|
+
const { error: warrning } = ContentValidator.deletePage().validate(
|
|
2917
|
+
{
|
|
2918
|
+
id,
|
|
2919
|
+
},
|
|
2920
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2921
|
+
);
|
|
2922
|
+
if (warrning) {
|
|
2923
|
+
Logger({
|
|
2924
|
+
level: "WARN",
|
|
2925
|
+
message: "Parameter Validation warrnings for deletePage",
|
|
2926
|
+
});
|
|
2927
|
+
Logger({ level: "WARN", message: warrning });
|
|
2928
|
+
}
|
|
2929
|
+
|
|
1426
2930
|
const query_params = {};
|
|
1427
2931
|
|
|
1428
|
-
|
|
2932
|
+
const response = await PlatformAPIClient.execute(
|
|
1429
2933
|
this.config,
|
|
1430
2934
|
"delete",
|
|
1431
2935
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pages/${id}`,
|
|
1432
2936
|
query_params,
|
|
1433
2937
|
undefined
|
|
1434
2938
|
);
|
|
2939
|
+
|
|
2940
|
+
const { error: res_error } = ContentModel.PageSchema().validate(response, {
|
|
2941
|
+
abortEarly: false,
|
|
2942
|
+
allowUnknown: false,
|
|
2943
|
+
});
|
|
2944
|
+
|
|
2945
|
+
if (res_error) {
|
|
2946
|
+
Logger({
|
|
2947
|
+
level: "WARN",
|
|
2948
|
+
message: "Response Validation Warnnings for deletePage",
|
|
2949
|
+
});
|
|
2950
|
+
Logger({ level: "WARN", message: res_error });
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
return response;
|
|
1435
2954
|
}
|
|
1436
2955
|
|
|
1437
2956
|
/**
|
|
1438
2957
|
* @param {Object} arg - Arg object.
|
|
1439
2958
|
* @param {PathMappingSchema} arg.body
|
|
2959
|
+
* @returns {Promise<PathMappingSchema>} - Success response
|
|
1440
2960
|
* @summary: Save path based redirection rules
|
|
1441
2961
|
* @description: Use this API to add redirection rules
|
|
1442
2962
|
*/
|
|
1443
|
-
addPathRedirectionRules({ body } = {}) {
|
|
2963
|
+
async addPathRedirectionRules({ body } = {}) {
|
|
1444
2964
|
const { error } = ContentValidator.addPathRedirectionRules().validate(
|
|
1445
2965
|
{
|
|
1446
2966
|
body,
|
|
@@ -1451,15 +2971,49 @@ class Content {
|
|
|
1451
2971
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1452
2972
|
}
|
|
1453
2973
|
|
|
2974
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2975
|
+
const {
|
|
2976
|
+
error: warrning,
|
|
2977
|
+
} = ContentValidator.addPathRedirectionRules().validate(
|
|
2978
|
+
{
|
|
2979
|
+
body,
|
|
2980
|
+
},
|
|
2981
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2982
|
+
);
|
|
2983
|
+
if (warrning) {
|
|
2984
|
+
Logger({
|
|
2985
|
+
level: "WARN",
|
|
2986
|
+
message: "Parameter Validation warrnings for addPathRedirectionRules",
|
|
2987
|
+
});
|
|
2988
|
+
Logger({ level: "WARN", message: warrning });
|
|
2989
|
+
}
|
|
2990
|
+
|
|
1454
2991
|
const query_params = {};
|
|
1455
2992
|
|
|
1456
|
-
|
|
2993
|
+
const response = await PlatformAPIClient.execute(
|
|
1457
2994
|
this.config,
|
|
1458
2995
|
"post",
|
|
1459
2996
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings`,
|
|
1460
2997
|
query_params,
|
|
1461
2998
|
body
|
|
1462
2999
|
);
|
|
3000
|
+
|
|
3001
|
+
const {
|
|
3002
|
+
error: res_error,
|
|
3003
|
+
} = ContentModel.PathMappingSchema().validate(response, {
|
|
3004
|
+
abortEarly: false,
|
|
3005
|
+
allowUnknown: false,
|
|
3006
|
+
});
|
|
3007
|
+
|
|
3008
|
+
if (res_error) {
|
|
3009
|
+
Logger({
|
|
3010
|
+
level: "WARN",
|
|
3011
|
+
message: "Response Validation Warnnings for addPathRedirectionRules",
|
|
3012
|
+
});
|
|
3013
|
+
Logger({ level: "WARN", message: res_error });
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
return response;
|
|
1463
3017
|
}
|
|
1464
3018
|
|
|
1465
3019
|
/**
|
|
@@ -1468,10 +3022,11 @@ class Content {
|
|
|
1468
3022
|
* page. Default value is 5.
|
|
1469
3023
|
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
1470
3024
|
* given set of results. Default value is 1.
|
|
3025
|
+
* @returns {Promise<PathMappingSchema>} - Success response
|
|
1471
3026
|
* @summary: Get path based redirection rules
|
|
1472
3027
|
* @description: Use this API to get path based redirection rules.
|
|
1473
3028
|
*/
|
|
1474
|
-
getPathRedirectionRules({ pageSize, pageNo } = {}) {
|
|
3029
|
+
async getPathRedirectionRules({ pageSize, pageNo } = {}) {
|
|
1475
3030
|
const { error } = ContentValidator.getPathRedirectionRules().validate(
|
|
1476
3031
|
{
|
|
1477
3032
|
pageSize,
|
|
@@ -1483,26 +3038,62 @@ class Content {
|
|
|
1483
3038
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1484
3039
|
}
|
|
1485
3040
|
|
|
3041
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3042
|
+
const {
|
|
3043
|
+
error: warrning,
|
|
3044
|
+
} = ContentValidator.getPathRedirectionRules().validate(
|
|
3045
|
+
{
|
|
3046
|
+
pageSize,
|
|
3047
|
+
pageNo,
|
|
3048
|
+
},
|
|
3049
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3050
|
+
);
|
|
3051
|
+
if (warrning) {
|
|
3052
|
+
Logger({
|
|
3053
|
+
level: "WARN",
|
|
3054
|
+
message: "Parameter Validation warrnings for getPathRedirectionRules",
|
|
3055
|
+
});
|
|
3056
|
+
Logger({ level: "WARN", message: warrning });
|
|
3057
|
+
}
|
|
3058
|
+
|
|
1486
3059
|
const query_params = {};
|
|
1487
3060
|
query_params["page_size"] = pageSize;
|
|
1488
3061
|
query_params["page_no"] = pageNo;
|
|
1489
3062
|
|
|
1490
|
-
|
|
3063
|
+
const response = await PlatformAPIClient.execute(
|
|
1491
3064
|
this.config,
|
|
1492
3065
|
"get",
|
|
1493
3066
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings`,
|
|
1494
3067
|
query_params,
|
|
1495
3068
|
undefined
|
|
1496
3069
|
);
|
|
3070
|
+
|
|
3071
|
+
const {
|
|
3072
|
+
error: res_error,
|
|
3073
|
+
} = ContentModel.PathMappingSchema().validate(response, {
|
|
3074
|
+
abortEarly: false,
|
|
3075
|
+
allowUnknown: false,
|
|
3076
|
+
});
|
|
3077
|
+
|
|
3078
|
+
if (res_error) {
|
|
3079
|
+
Logger({
|
|
3080
|
+
level: "WARN",
|
|
3081
|
+
message: "Response Validation Warnnings for getPathRedirectionRules",
|
|
3082
|
+
});
|
|
3083
|
+
Logger({ level: "WARN", message: res_error });
|
|
3084
|
+
}
|
|
3085
|
+
|
|
3086
|
+
return response;
|
|
1497
3087
|
}
|
|
1498
3088
|
|
|
1499
3089
|
/**
|
|
1500
3090
|
* @param {Object} arg - Arg object.
|
|
1501
3091
|
* @param {string} arg.pathId - ID allotted to the path redirection rule.
|
|
3092
|
+
* @returns {Promise<PathMappingSchema>} - Success response
|
|
1502
3093
|
* @summary: Get path based redirection rule
|
|
1503
3094
|
* @description: Use this API to get path based redirection rule.
|
|
1504
3095
|
*/
|
|
1505
|
-
getPathRedirectionRule({ pathId } = {}) {
|
|
3096
|
+
async getPathRedirectionRule({ pathId } = {}) {
|
|
1506
3097
|
const { error } = ContentValidator.getPathRedirectionRule().validate(
|
|
1507
3098
|
{
|
|
1508
3099
|
pathId,
|
|
@@ -1513,25 +3104,60 @@ class Content {
|
|
|
1513
3104
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1514
3105
|
}
|
|
1515
3106
|
|
|
3107
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3108
|
+
const {
|
|
3109
|
+
error: warrning,
|
|
3110
|
+
} = ContentValidator.getPathRedirectionRule().validate(
|
|
3111
|
+
{
|
|
3112
|
+
pathId,
|
|
3113
|
+
},
|
|
3114
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3115
|
+
);
|
|
3116
|
+
if (warrning) {
|
|
3117
|
+
Logger({
|
|
3118
|
+
level: "WARN",
|
|
3119
|
+
message: "Parameter Validation warrnings for getPathRedirectionRule",
|
|
3120
|
+
});
|
|
3121
|
+
Logger({ level: "WARN", message: warrning });
|
|
3122
|
+
}
|
|
3123
|
+
|
|
1516
3124
|
const query_params = {};
|
|
1517
3125
|
|
|
1518
|
-
|
|
3126
|
+
const response = await PlatformAPIClient.execute(
|
|
1519
3127
|
this.config,
|
|
1520
3128
|
"get",
|
|
1521
3129
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings/${pathId}`,
|
|
1522
3130
|
query_params,
|
|
1523
3131
|
undefined
|
|
1524
3132
|
);
|
|
3133
|
+
|
|
3134
|
+
const {
|
|
3135
|
+
error: res_error,
|
|
3136
|
+
} = ContentModel.PathMappingSchema().validate(response, {
|
|
3137
|
+
abortEarly: false,
|
|
3138
|
+
allowUnknown: false,
|
|
3139
|
+
});
|
|
3140
|
+
|
|
3141
|
+
if (res_error) {
|
|
3142
|
+
Logger({
|
|
3143
|
+
level: "WARN",
|
|
3144
|
+
message: "Response Validation Warnnings for getPathRedirectionRule",
|
|
3145
|
+
});
|
|
3146
|
+
Logger({ level: "WARN", message: res_error });
|
|
3147
|
+
}
|
|
3148
|
+
|
|
3149
|
+
return response;
|
|
1525
3150
|
}
|
|
1526
3151
|
|
|
1527
3152
|
/**
|
|
1528
3153
|
* @param {Object} arg - Arg object.
|
|
1529
3154
|
* @param {string} arg.pathId - ID allotted to the path redirection rule.
|
|
1530
3155
|
* @param {PathMappingSchema} arg.body
|
|
3156
|
+
* @returns {Promise<PathMappingSchema>} - Success response
|
|
1531
3157
|
* @summary: Update path based redirection rules
|
|
1532
3158
|
* @description: Use this API to update redirection rules
|
|
1533
3159
|
*/
|
|
1534
|
-
updatePathRedirectionRules({ pathId, body } = {}) {
|
|
3160
|
+
async updatePathRedirectionRules({ pathId, body } = {}) {
|
|
1535
3161
|
const { error } = ContentValidator.updatePathRedirectionRules().validate(
|
|
1536
3162
|
{
|
|
1537
3163
|
pathId,
|
|
@@ -1543,24 +3169,61 @@ class Content {
|
|
|
1543
3169
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1544
3170
|
}
|
|
1545
3171
|
|
|
3172
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3173
|
+
const {
|
|
3174
|
+
error: warrning,
|
|
3175
|
+
} = ContentValidator.updatePathRedirectionRules().validate(
|
|
3176
|
+
{
|
|
3177
|
+
pathId,
|
|
3178
|
+
body,
|
|
3179
|
+
},
|
|
3180
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3181
|
+
);
|
|
3182
|
+
if (warrning) {
|
|
3183
|
+
Logger({
|
|
3184
|
+
level: "WARN",
|
|
3185
|
+
message:
|
|
3186
|
+
"Parameter Validation warrnings for updatePathRedirectionRules",
|
|
3187
|
+
});
|
|
3188
|
+
Logger({ level: "WARN", message: warrning });
|
|
3189
|
+
}
|
|
3190
|
+
|
|
1546
3191
|
const query_params = {};
|
|
1547
3192
|
|
|
1548
|
-
|
|
3193
|
+
const response = await PlatformAPIClient.execute(
|
|
1549
3194
|
this.config,
|
|
1550
3195
|
"put",
|
|
1551
3196
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings/${pathId}`,
|
|
1552
3197
|
query_params,
|
|
1553
3198
|
body
|
|
1554
3199
|
);
|
|
3200
|
+
|
|
3201
|
+
const {
|
|
3202
|
+
error: res_error,
|
|
3203
|
+
} = ContentModel.PathMappingSchema().validate(response, {
|
|
3204
|
+
abortEarly: false,
|
|
3205
|
+
allowUnknown: false,
|
|
3206
|
+
});
|
|
3207
|
+
|
|
3208
|
+
if (res_error) {
|
|
3209
|
+
Logger({
|
|
3210
|
+
level: "WARN",
|
|
3211
|
+
message: "Response Validation Warnnings for updatePathRedirectionRules",
|
|
3212
|
+
});
|
|
3213
|
+
Logger({ level: "WARN", message: res_error });
|
|
3214
|
+
}
|
|
3215
|
+
|
|
3216
|
+
return response;
|
|
1555
3217
|
}
|
|
1556
3218
|
|
|
1557
3219
|
/**
|
|
1558
3220
|
* @param {Object} arg - Arg object.
|
|
1559
3221
|
* @param {string} arg.pathId - ID allotted to the path redirection rule.
|
|
3222
|
+
* @returns {Promise<Object>} - Success response
|
|
1560
3223
|
* @summary: Delete path based redirection rules
|
|
1561
3224
|
* @description: Use this API to delete redirection rules
|
|
1562
3225
|
*/
|
|
1563
|
-
deletePathRedirectionRules({ pathId } = {}) {
|
|
3226
|
+
async deletePathRedirectionRules({ pathId } = {}) {
|
|
1564
3227
|
const { error } = ContentValidator.deletePathRedirectionRules().validate(
|
|
1565
3228
|
{
|
|
1566
3229
|
pathId,
|
|
@@ -1571,23 +3234,57 @@ class Content {
|
|
|
1571
3234
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1572
3235
|
}
|
|
1573
3236
|
|
|
3237
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3238
|
+
const {
|
|
3239
|
+
error: warrning,
|
|
3240
|
+
} = ContentValidator.deletePathRedirectionRules().validate(
|
|
3241
|
+
{
|
|
3242
|
+
pathId,
|
|
3243
|
+
},
|
|
3244
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3245
|
+
);
|
|
3246
|
+
if (warrning) {
|
|
3247
|
+
Logger({
|
|
3248
|
+
level: "WARN",
|
|
3249
|
+
message:
|
|
3250
|
+
"Parameter Validation warrnings for deletePathRedirectionRules",
|
|
3251
|
+
});
|
|
3252
|
+
Logger({ level: "WARN", message: warrning });
|
|
3253
|
+
}
|
|
3254
|
+
|
|
1574
3255
|
const query_params = {};
|
|
1575
3256
|
|
|
1576
|
-
|
|
3257
|
+
const response = await PlatformAPIClient.execute(
|
|
1577
3258
|
this.config,
|
|
1578
3259
|
"delete",
|
|
1579
3260
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/path-mappings/${pathId}`,
|
|
1580
3261
|
query_params,
|
|
1581
3262
|
undefined
|
|
1582
3263
|
);
|
|
3264
|
+
|
|
3265
|
+
const { error: res_error } = Joi.any().validate(response, {
|
|
3266
|
+
abortEarly: false,
|
|
3267
|
+
allowUnknown: false,
|
|
3268
|
+
});
|
|
3269
|
+
|
|
3270
|
+
if (res_error) {
|
|
3271
|
+
Logger({
|
|
3272
|
+
level: "WARN",
|
|
3273
|
+
message: "Response Validation Warnnings for deletePathRedirectionRules",
|
|
3274
|
+
});
|
|
3275
|
+
Logger({ level: "WARN", message: res_error });
|
|
3276
|
+
}
|
|
3277
|
+
|
|
3278
|
+
return response;
|
|
1583
3279
|
}
|
|
1584
3280
|
|
|
1585
3281
|
/**
|
|
1586
3282
|
* @param {Object} arg - Arg object.
|
|
3283
|
+
* @returns {Promise<SeoComponent>} - Success response
|
|
1587
3284
|
* @summary: Get SEO configuration of an application
|
|
1588
3285
|
* @description: Use this API to know how the SEO is configured in the application. This includes the sitemap, robot.txt, custom meta tags, etc.
|
|
1589
3286
|
*/
|
|
1590
|
-
getSEOConfiguration({} = {}) {
|
|
3287
|
+
async getSEOConfiguration({} = {}) {
|
|
1591
3288
|
const { error } = ContentValidator.getSEOConfiguration().validate(
|
|
1592
3289
|
{},
|
|
1593
3290
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1596,24 +3293,53 @@ class Content {
|
|
|
1596
3293
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1597
3294
|
}
|
|
1598
3295
|
|
|
3296
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3297
|
+
const { error: warrning } = ContentValidator.getSEOConfiguration().validate(
|
|
3298
|
+
{},
|
|
3299
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3300
|
+
);
|
|
3301
|
+
if (warrning) {
|
|
3302
|
+
Logger({
|
|
3303
|
+
level: "WARN",
|
|
3304
|
+
message: "Parameter Validation warrnings for getSEOConfiguration",
|
|
3305
|
+
});
|
|
3306
|
+
Logger({ level: "WARN", message: warrning });
|
|
3307
|
+
}
|
|
3308
|
+
|
|
1599
3309
|
const query_params = {};
|
|
1600
3310
|
|
|
1601
|
-
|
|
3311
|
+
const response = await PlatformAPIClient.execute(
|
|
1602
3312
|
this.config,
|
|
1603
3313
|
"get",
|
|
1604
3314
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/seo`,
|
|
1605
3315
|
query_params,
|
|
1606
3316
|
undefined
|
|
1607
3317
|
);
|
|
3318
|
+
|
|
3319
|
+
const { error: res_error } = ContentModel.SeoComponent().validate(
|
|
3320
|
+
response,
|
|
3321
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3322
|
+
);
|
|
3323
|
+
|
|
3324
|
+
if (res_error) {
|
|
3325
|
+
Logger({
|
|
3326
|
+
level: "WARN",
|
|
3327
|
+
message: "Response Validation Warnnings for getSEOConfiguration",
|
|
3328
|
+
});
|
|
3329
|
+
Logger({ level: "WARN", message: res_error });
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3332
|
+
return response;
|
|
1608
3333
|
}
|
|
1609
3334
|
|
|
1610
3335
|
/**
|
|
1611
3336
|
* @param {Object} arg - Arg object.
|
|
1612
3337
|
* @param {SeoComponent} arg.body
|
|
3338
|
+
* @returns {Promise<SeoSchema>} - Success response
|
|
1613
3339
|
* @summary: Update SEO of application
|
|
1614
3340
|
* @description: Use this API to edit the SEO details of an application. This includes the sitemap, robot.txt, custom meta tags, etc.
|
|
1615
3341
|
*/
|
|
1616
|
-
updateSEOConfiguration({ body } = {}) {
|
|
3342
|
+
async updateSEOConfiguration({ body } = {}) {
|
|
1617
3343
|
const { error } = ContentValidator.updateSEOConfiguration().validate(
|
|
1618
3344
|
{
|
|
1619
3345
|
body,
|
|
@@ -1624,15 +3350,47 @@ class Content {
|
|
|
1624
3350
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1625
3351
|
}
|
|
1626
3352
|
|
|
3353
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3354
|
+
const {
|
|
3355
|
+
error: warrning,
|
|
3356
|
+
} = ContentValidator.updateSEOConfiguration().validate(
|
|
3357
|
+
{
|
|
3358
|
+
body,
|
|
3359
|
+
},
|
|
3360
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3361
|
+
);
|
|
3362
|
+
if (warrning) {
|
|
3363
|
+
Logger({
|
|
3364
|
+
level: "WARN",
|
|
3365
|
+
message: "Parameter Validation warrnings for updateSEOConfiguration",
|
|
3366
|
+
});
|
|
3367
|
+
Logger({ level: "WARN", message: warrning });
|
|
3368
|
+
}
|
|
3369
|
+
|
|
1627
3370
|
const query_params = {};
|
|
1628
3371
|
|
|
1629
|
-
|
|
3372
|
+
const response = await PlatformAPIClient.execute(
|
|
1630
3373
|
this.config,
|
|
1631
3374
|
"post",
|
|
1632
3375
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/seo`,
|
|
1633
3376
|
query_params,
|
|
1634
3377
|
body
|
|
1635
3378
|
);
|
|
3379
|
+
|
|
3380
|
+
const { error: res_error } = ContentModel.SeoSchema().validate(response, {
|
|
3381
|
+
abortEarly: false,
|
|
3382
|
+
allowUnknown: false,
|
|
3383
|
+
});
|
|
3384
|
+
|
|
3385
|
+
if (res_error) {
|
|
3386
|
+
Logger({
|
|
3387
|
+
level: "WARN",
|
|
3388
|
+
message: "Response Validation Warnnings for updateSEOConfiguration",
|
|
3389
|
+
});
|
|
3390
|
+
Logger({ level: "WARN", message: res_error });
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
return response;
|
|
1636
3394
|
}
|
|
1637
3395
|
|
|
1638
3396
|
/**
|
|
@@ -1643,10 +3401,11 @@ class Content {
|
|
|
1643
3401
|
* given set of results. Default value is 1.
|
|
1644
3402
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
1645
3403
|
* page. Default value is 10.
|
|
3404
|
+
* @returns {Promise<SlideshowGetResponse>} - Success response
|
|
1646
3405
|
* @summary: Get slideshows
|
|
1647
3406
|
* @description: A slideshow is a group of images, videos or a combination of both that are shown on the website in the form of slides. Use this API to fetch a list of slideshows.
|
|
1648
3407
|
*/
|
|
1649
|
-
getSlideshows({ devicePlatform, pageNo, pageSize } = {}) {
|
|
3408
|
+
async getSlideshows({ devicePlatform, pageNo, pageSize } = {}) {
|
|
1650
3409
|
const { error } = ContentValidator.getSlideshows().validate(
|
|
1651
3410
|
{
|
|
1652
3411
|
devicePlatform,
|
|
@@ -1659,18 +3418,52 @@ class Content {
|
|
|
1659
3418
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1660
3419
|
}
|
|
1661
3420
|
|
|
3421
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3422
|
+
const { error: warrning } = ContentValidator.getSlideshows().validate(
|
|
3423
|
+
{
|
|
3424
|
+
devicePlatform,
|
|
3425
|
+
pageNo,
|
|
3426
|
+
pageSize,
|
|
3427
|
+
},
|
|
3428
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3429
|
+
);
|
|
3430
|
+
if (warrning) {
|
|
3431
|
+
Logger({
|
|
3432
|
+
level: "WARN",
|
|
3433
|
+
message: "Parameter Validation warrnings for getSlideshows",
|
|
3434
|
+
});
|
|
3435
|
+
Logger({ level: "WARN", message: warrning });
|
|
3436
|
+
}
|
|
3437
|
+
|
|
1662
3438
|
const query_params = {};
|
|
1663
3439
|
query_params["device_platform"] = devicePlatform;
|
|
1664
3440
|
query_params["page_no"] = pageNo;
|
|
1665
3441
|
query_params["page_size"] = pageSize;
|
|
1666
3442
|
|
|
1667
|
-
|
|
3443
|
+
const response = await PlatformAPIClient.execute(
|
|
1668
3444
|
this.config,
|
|
1669
3445
|
"get",
|
|
1670
3446
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/`,
|
|
1671
3447
|
query_params,
|
|
1672
3448
|
undefined
|
|
1673
3449
|
);
|
|
3450
|
+
|
|
3451
|
+
const {
|
|
3452
|
+
error: res_error,
|
|
3453
|
+
} = ContentModel.SlideshowGetResponse().validate(response, {
|
|
3454
|
+
abortEarly: false,
|
|
3455
|
+
allowUnknown: false,
|
|
3456
|
+
});
|
|
3457
|
+
|
|
3458
|
+
if (res_error) {
|
|
3459
|
+
Logger({
|
|
3460
|
+
level: "WARN",
|
|
3461
|
+
message: "Response Validation Warnnings for getSlideshows",
|
|
3462
|
+
});
|
|
3463
|
+
Logger({ level: "WARN", message: res_error });
|
|
3464
|
+
}
|
|
3465
|
+
|
|
3466
|
+
return response;
|
|
1674
3467
|
}
|
|
1675
3468
|
|
|
1676
3469
|
/**
|
|
@@ -1717,10 +3510,11 @@ class Content {
|
|
|
1717
3510
|
/**
|
|
1718
3511
|
* @param {Object} arg - Arg object.
|
|
1719
3512
|
* @param {SlideshowRequest} arg.body
|
|
3513
|
+
* @returns {Promise<SlideshowSchema>} - Success response
|
|
1720
3514
|
* @summary: Create a slideshow
|
|
1721
3515
|
* @description: A slideshow is a group of images, videos or a combination of both that are shown on the website in the form of slides. Use this API to create a slideshow.
|
|
1722
3516
|
*/
|
|
1723
|
-
createSlideshow({ body } = {}) {
|
|
3517
|
+
async createSlideshow({ body } = {}) {
|
|
1724
3518
|
const { error } = ContentValidator.createSlideshow().validate(
|
|
1725
3519
|
{
|
|
1726
3520
|
body,
|
|
@@ -1731,15 +3525,47 @@ class Content {
|
|
|
1731
3525
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1732
3526
|
}
|
|
1733
3527
|
|
|
3528
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3529
|
+
const { error: warrning } = ContentValidator.createSlideshow().validate(
|
|
3530
|
+
{
|
|
3531
|
+
body,
|
|
3532
|
+
},
|
|
3533
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3534
|
+
);
|
|
3535
|
+
if (warrning) {
|
|
3536
|
+
Logger({
|
|
3537
|
+
level: "WARN",
|
|
3538
|
+
message: "Parameter Validation warrnings for createSlideshow",
|
|
3539
|
+
});
|
|
3540
|
+
Logger({ level: "WARN", message: warrning });
|
|
3541
|
+
}
|
|
3542
|
+
|
|
1734
3543
|
const query_params = {};
|
|
1735
3544
|
|
|
1736
|
-
|
|
3545
|
+
const response = await PlatformAPIClient.execute(
|
|
1737
3546
|
this.config,
|
|
1738
3547
|
"post",
|
|
1739
3548
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/`,
|
|
1740
3549
|
query_params,
|
|
1741
3550
|
body
|
|
1742
3551
|
);
|
|
3552
|
+
|
|
3553
|
+
const {
|
|
3554
|
+
error: res_error,
|
|
3555
|
+
} = ContentModel.SlideshowSchema().validate(response, {
|
|
3556
|
+
abortEarly: false,
|
|
3557
|
+
allowUnknown: false,
|
|
3558
|
+
});
|
|
3559
|
+
|
|
3560
|
+
if (res_error) {
|
|
3561
|
+
Logger({
|
|
3562
|
+
level: "WARN",
|
|
3563
|
+
message: "Response Validation Warnnings for createSlideshow",
|
|
3564
|
+
});
|
|
3565
|
+
Logger({ level: "WARN", message: res_error });
|
|
3566
|
+
}
|
|
3567
|
+
|
|
3568
|
+
return response;
|
|
1743
3569
|
}
|
|
1744
3570
|
|
|
1745
3571
|
/**
|
|
@@ -1749,10 +3575,11 @@ class Content {
|
|
|
1749
3575
|
* `getSlideshows` API.
|
|
1750
3576
|
* @param {string} arg.devicePlatform - Filter slideshows by platform.
|
|
1751
3577
|
* Acceptable values are: web, android, ios and all
|
|
3578
|
+
* @returns {Promise<SlideshowSchema>} - Success response
|
|
1752
3579
|
* @summary: Get slideshow by slug
|
|
1753
3580
|
* @description: Use this API to retrieve the details of a slideshow by its slug.
|
|
1754
3581
|
*/
|
|
1755
|
-
getSlideshowBySlug({ slug, devicePlatform } = {}) {
|
|
3582
|
+
async getSlideshowBySlug({ slug, devicePlatform } = {}) {
|
|
1756
3583
|
const { error } = ContentValidator.getSlideshowBySlug().validate(
|
|
1757
3584
|
{
|
|
1758
3585
|
slug,
|
|
@@ -1764,26 +3591,60 @@ class Content {
|
|
|
1764
3591
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1765
3592
|
}
|
|
1766
3593
|
|
|
3594
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3595
|
+
const { error: warrning } = ContentValidator.getSlideshowBySlug().validate(
|
|
3596
|
+
{
|
|
3597
|
+
slug,
|
|
3598
|
+
devicePlatform,
|
|
3599
|
+
},
|
|
3600
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3601
|
+
);
|
|
3602
|
+
if (warrning) {
|
|
3603
|
+
Logger({
|
|
3604
|
+
level: "WARN",
|
|
3605
|
+
message: "Parameter Validation warrnings for getSlideshowBySlug",
|
|
3606
|
+
});
|
|
3607
|
+
Logger({ level: "WARN", message: warrning });
|
|
3608
|
+
}
|
|
3609
|
+
|
|
1767
3610
|
const query_params = {};
|
|
1768
3611
|
query_params["device_platform"] = devicePlatform;
|
|
1769
3612
|
|
|
1770
|
-
|
|
3613
|
+
const response = await PlatformAPIClient.execute(
|
|
1771
3614
|
this.config,
|
|
1772
3615
|
"get",
|
|
1773
3616
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/${slug}`,
|
|
1774
3617
|
query_params,
|
|
1775
3618
|
undefined
|
|
1776
3619
|
);
|
|
3620
|
+
|
|
3621
|
+
const {
|
|
3622
|
+
error: res_error,
|
|
3623
|
+
} = ContentModel.SlideshowSchema().validate(response, {
|
|
3624
|
+
abortEarly: false,
|
|
3625
|
+
allowUnknown: false,
|
|
3626
|
+
});
|
|
3627
|
+
|
|
3628
|
+
if (res_error) {
|
|
3629
|
+
Logger({
|
|
3630
|
+
level: "WARN",
|
|
3631
|
+
message: "Response Validation Warnnings for getSlideshowBySlug",
|
|
3632
|
+
});
|
|
3633
|
+
Logger({ level: "WARN", message: res_error });
|
|
3634
|
+
}
|
|
3635
|
+
|
|
3636
|
+
return response;
|
|
1777
3637
|
}
|
|
1778
3638
|
|
|
1779
3639
|
/**
|
|
1780
3640
|
* @param {Object} arg - Arg object.
|
|
1781
3641
|
* @param {string} arg.id - ID allotted to the slideshow.
|
|
1782
3642
|
* @param {SlideshowRequest} arg.body
|
|
3643
|
+
* @returns {Promise<SlideshowSchema>} - Success response
|
|
1783
3644
|
* @summary: Update a slideshow
|
|
1784
3645
|
* @description: Use this API to edit the details of an existing slideshow.
|
|
1785
3646
|
*/
|
|
1786
|
-
updateSlideshow({ id, body } = {}) {
|
|
3647
|
+
async updateSlideshow({ id, body } = {}) {
|
|
1787
3648
|
const { error } = ContentValidator.updateSlideshow().validate(
|
|
1788
3649
|
{
|
|
1789
3650
|
id,
|
|
@@ -1795,24 +3656,58 @@ class Content {
|
|
|
1795
3656
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1796
3657
|
}
|
|
1797
3658
|
|
|
3659
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3660
|
+
const { error: warrning } = ContentValidator.updateSlideshow().validate(
|
|
3661
|
+
{
|
|
3662
|
+
id,
|
|
3663
|
+
body,
|
|
3664
|
+
},
|
|
3665
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3666
|
+
);
|
|
3667
|
+
if (warrning) {
|
|
3668
|
+
Logger({
|
|
3669
|
+
level: "WARN",
|
|
3670
|
+
message: "Parameter Validation warrnings for updateSlideshow",
|
|
3671
|
+
});
|
|
3672
|
+
Logger({ level: "WARN", message: warrning });
|
|
3673
|
+
}
|
|
3674
|
+
|
|
1798
3675
|
const query_params = {};
|
|
1799
3676
|
|
|
1800
|
-
|
|
3677
|
+
const response = await PlatformAPIClient.execute(
|
|
1801
3678
|
this.config,
|
|
1802
3679
|
"put",
|
|
1803
3680
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/${id}`,
|
|
1804
3681
|
query_params,
|
|
1805
3682
|
body
|
|
1806
3683
|
);
|
|
3684
|
+
|
|
3685
|
+
const {
|
|
3686
|
+
error: res_error,
|
|
3687
|
+
} = ContentModel.SlideshowSchema().validate(response, {
|
|
3688
|
+
abortEarly: false,
|
|
3689
|
+
allowUnknown: false,
|
|
3690
|
+
});
|
|
3691
|
+
|
|
3692
|
+
if (res_error) {
|
|
3693
|
+
Logger({
|
|
3694
|
+
level: "WARN",
|
|
3695
|
+
message: "Response Validation Warnnings for updateSlideshow",
|
|
3696
|
+
});
|
|
3697
|
+
Logger({ level: "WARN", message: res_error });
|
|
3698
|
+
}
|
|
3699
|
+
|
|
3700
|
+
return response;
|
|
1807
3701
|
}
|
|
1808
3702
|
|
|
1809
3703
|
/**
|
|
1810
3704
|
* @param {Object} arg - Arg object.
|
|
1811
3705
|
* @param {string} arg.id - ID allotted to the slideshow.
|
|
3706
|
+
* @returns {Promise<SlideshowSchema>} - Success response
|
|
1812
3707
|
* @summary: Delete a slideshow
|
|
1813
3708
|
* @description: Use this API to delete an existing slideshow.
|
|
1814
3709
|
*/
|
|
1815
|
-
deleteSlideshow({ id } = {}) {
|
|
3710
|
+
async deleteSlideshow({ id } = {}) {
|
|
1816
3711
|
const { error } = ContentValidator.deleteSlideshow().validate(
|
|
1817
3712
|
{
|
|
1818
3713
|
id,
|
|
@@ -1823,23 +3718,56 @@ class Content {
|
|
|
1823
3718
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1824
3719
|
}
|
|
1825
3720
|
|
|
3721
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3722
|
+
const { error: warrning } = ContentValidator.deleteSlideshow().validate(
|
|
3723
|
+
{
|
|
3724
|
+
id,
|
|
3725
|
+
},
|
|
3726
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3727
|
+
);
|
|
3728
|
+
if (warrning) {
|
|
3729
|
+
Logger({
|
|
3730
|
+
level: "WARN",
|
|
3731
|
+
message: "Parameter Validation warrnings for deleteSlideshow",
|
|
3732
|
+
});
|
|
3733
|
+
Logger({ level: "WARN", message: warrning });
|
|
3734
|
+
}
|
|
3735
|
+
|
|
1826
3736
|
const query_params = {};
|
|
1827
3737
|
|
|
1828
|
-
|
|
3738
|
+
const response = await PlatformAPIClient.execute(
|
|
1829
3739
|
this.config,
|
|
1830
3740
|
"delete",
|
|
1831
3741
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/slideshows/${id}`,
|
|
1832
3742
|
query_params,
|
|
1833
3743
|
undefined
|
|
1834
3744
|
);
|
|
3745
|
+
|
|
3746
|
+
const {
|
|
3747
|
+
error: res_error,
|
|
3748
|
+
} = ContentModel.SlideshowSchema().validate(response, {
|
|
3749
|
+
abortEarly: false,
|
|
3750
|
+
allowUnknown: false,
|
|
3751
|
+
});
|
|
3752
|
+
|
|
3753
|
+
if (res_error) {
|
|
3754
|
+
Logger({
|
|
3755
|
+
level: "WARN",
|
|
3756
|
+
message: "Response Validation Warnnings for deleteSlideshow",
|
|
3757
|
+
});
|
|
3758
|
+
Logger({ level: "WARN", message: res_error });
|
|
3759
|
+
}
|
|
3760
|
+
|
|
3761
|
+
return response;
|
|
1835
3762
|
}
|
|
1836
3763
|
|
|
1837
3764
|
/**
|
|
1838
3765
|
* @param {Object} arg - Arg object.
|
|
3766
|
+
* @returns {Promise<Support>} - Success response
|
|
1839
3767
|
* @summary: Get support information
|
|
1840
3768
|
* @description: Use this API to get the contact details for customer support, including emails and phone numbers.
|
|
1841
3769
|
*/
|
|
1842
|
-
getSupportInformation({} = {}) {
|
|
3770
|
+
async getSupportInformation({} = {}) {
|
|
1843
3771
|
const { error } = ContentValidator.getSupportInformation().validate(
|
|
1844
3772
|
{},
|
|
1845
3773
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1848,24 +3776,55 @@ class Content {
|
|
|
1848
3776
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1849
3777
|
}
|
|
1850
3778
|
|
|
3779
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3780
|
+
const {
|
|
3781
|
+
error: warrning,
|
|
3782
|
+
} = ContentValidator.getSupportInformation().validate(
|
|
3783
|
+
{},
|
|
3784
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3785
|
+
);
|
|
3786
|
+
if (warrning) {
|
|
3787
|
+
Logger({
|
|
3788
|
+
level: "WARN",
|
|
3789
|
+
message: "Parameter Validation warrnings for getSupportInformation",
|
|
3790
|
+
});
|
|
3791
|
+
Logger({ level: "WARN", message: warrning });
|
|
3792
|
+
}
|
|
3793
|
+
|
|
1851
3794
|
const query_params = {};
|
|
1852
3795
|
|
|
1853
|
-
|
|
3796
|
+
const response = await PlatformAPIClient.execute(
|
|
1854
3797
|
this.config,
|
|
1855
3798
|
"get",
|
|
1856
3799
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/support`,
|
|
1857
3800
|
query_params,
|
|
1858
3801
|
undefined
|
|
1859
3802
|
);
|
|
3803
|
+
|
|
3804
|
+
const { error: res_error } = ContentModel.Support().validate(response, {
|
|
3805
|
+
abortEarly: false,
|
|
3806
|
+
allowUnknown: false,
|
|
3807
|
+
});
|
|
3808
|
+
|
|
3809
|
+
if (res_error) {
|
|
3810
|
+
Logger({
|
|
3811
|
+
level: "WARN",
|
|
3812
|
+
message: "Response Validation Warnnings for getSupportInformation",
|
|
3813
|
+
});
|
|
3814
|
+
Logger({ level: "WARN", message: res_error });
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
return response;
|
|
1860
3818
|
}
|
|
1861
3819
|
|
|
1862
3820
|
/**
|
|
1863
3821
|
* @param {Object} arg - Arg object.
|
|
1864
3822
|
* @param {Support} arg.body
|
|
3823
|
+
* @returns {Promise<Support>} - Success response
|
|
1865
3824
|
* @summary: Update the support data of an application
|
|
1866
3825
|
* @description: Use this API to edit the existing contact details for customer support, including emails and phone numbers.
|
|
1867
3826
|
*/
|
|
1868
|
-
updateSupportInformation({ body } = {}) {
|
|
3827
|
+
async updateSupportInformation({ body } = {}) {
|
|
1869
3828
|
const { error } = ContentValidator.updateSupportInformation().validate(
|
|
1870
3829
|
{
|
|
1871
3830
|
body,
|
|
@@ -1876,24 +3835,57 @@ class Content {
|
|
|
1876
3835
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1877
3836
|
}
|
|
1878
3837
|
|
|
3838
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3839
|
+
const {
|
|
3840
|
+
error: warrning,
|
|
3841
|
+
} = ContentValidator.updateSupportInformation().validate(
|
|
3842
|
+
{
|
|
3843
|
+
body,
|
|
3844
|
+
},
|
|
3845
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3846
|
+
);
|
|
3847
|
+
if (warrning) {
|
|
3848
|
+
Logger({
|
|
3849
|
+
level: "WARN",
|
|
3850
|
+
message: "Parameter Validation warrnings for updateSupportInformation",
|
|
3851
|
+
});
|
|
3852
|
+
Logger({ level: "WARN", message: warrning });
|
|
3853
|
+
}
|
|
3854
|
+
|
|
1879
3855
|
const query_params = {};
|
|
1880
3856
|
|
|
1881
|
-
|
|
3857
|
+
const response = await PlatformAPIClient.execute(
|
|
1882
3858
|
this.config,
|
|
1883
3859
|
"post",
|
|
1884
3860
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/support`,
|
|
1885
3861
|
query_params,
|
|
1886
3862
|
body
|
|
1887
3863
|
);
|
|
3864
|
+
|
|
3865
|
+
const { error: res_error } = ContentModel.Support().validate(response, {
|
|
3866
|
+
abortEarly: false,
|
|
3867
|
+
allowUnknown: false,
|
|
3868
|
+
});
|
|
3869
|
+
|
|
3870
|
+
if (res_error) {
|
|
3871
|
+
Logger({
|
|
3872
|
+
level: "WARN",
|
|
3873
|
+
message: "Response Validation Warnnings for updateSupportInformation",
|
|
3874
|
+
});
|
|
3875
|
+
Logger({ level: "WARN", message: res_error });
|
|
3876
|
+
}
|
|
3877
|
+
|
|
3878
|
+
return response;
|
|
1888
3879
|
}
|
|
1889
3880
|
|
|
1890
3881
|
/**
|
|
1891
3882
|
* @param {Object} arg - Arg object.
|
|
1892
3883
|
* @param {CreateTagRequestSchema} arg.body
|
|
3884
|
+
* @returns {Promise<TagsSchema>} - Success response
|
|
1893
3885
|
* @summary: Update a tag
|
|
1894
3886
|
* @description: Use this API to edit the details of an existing tag. This includes the tag name, tag type (css/js), url and position of the tag.
|
|
1895
3887
|
*/
|
|
1896
|
-
updateInjectableTag({ body } = {}) {
|
|
3888
|
+
async updateInjectableTag({ body } = {}) {
|
|
1897
3889
|
const { error } = ContentValidator.updateInjectableTag().validate(
|
|
1898
3890
|
{
|
|
1899
3891
|
body,
|
|
@@ -1904,23 +3896,54 @@ class Content {
|
|
|
1904
3896
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1905
3897
|
}
|
|
1906
3898
|
|
|
3899
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3900
|
+
const { error: warrning } = ContentValidator.updateInjectableTag().validate(
|
|
3901
|
+
{
|
|
3902
|
+
body,
|
|
3903
|
+
},
|
|
3904
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3905
|
+
);
|
|
3906
|
+
if (warrning) {
|
|
3907
|
+
Logger({
|
|
3908
|
+
level: "WARN",
|
|
3909
|
+
message: "Parameter Validation warrnings for updateInjectableTag",
|
|
3910
|
+
});
|
|
3911
|
+
Logger({ level: "WARN", message: warrning });
|
|
3912
|
+
}
|
|
3913
|
+
|
|
1907
3914
|
const query_params = {};
|
|
1908
3915
|
|
|
1909
|
-
|
|
3916
|
+
const response = await PlatformAPIClient.execute(
|
|
1910
3917
|
this.config,
|
|
1911
3918
|
"put",
|
|
1912
3919
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags`,
|
|
1913
3920
|
query_params,
|
|
1914
3921
|
body
|
|
1915
3922
|
);
|
|
3923
|
+
|
|
3924
|
+
const { error: res_error } = ContentModel.TagsSchema().validate(response, {
|
|
3925
|
+
abortEarly: false,
|
|
3926
|
+
allowUnknown: false,
|
|
3927
|
+
});
|
|
3928
|
+
|
|
3929
|
+
if (res_error) {
|
|
3930
|
+
Logger({
|
|
3931
|
+
level: "WARN",
|
|
3932
|
+
message: "Response Validation Warnnings for updateInjectableTag",
|
|
3933
|
+
});
|
|
3934
|
+
Logger({ level: "WARN", message: res_error });
|
|
3935
|
+
}
|
|
3936
|
+
|
|
3937
|
+
return response;
|
|
1916
3938
|
}
|
|
1917
3939
|
|
|
1918
3940
|
/**
|
|
1919
3941
|
* @param {Object} arg - Arg object.
|
|
3942
|
+
* @returns {Promise<TagsSchema>} - Success response
|
|
1920
3943
|
* @summary: Delete tags in application
|
|
1921
3944
|
* @description: Use this API to delete all the existing tags at once.
|
|
1922
3945
|
*/
|
|
1923
|
-
deleteAllInjectableTags({} = {}) {
|
|
3946
|
+
async deleteAllInjectableTags({} = {}) {
|
|
1924
3947
|
const { error } = ContentValidator.deleteAllInjectableTags().validate(
|
|
1925
3948
|
{},
|
|
1926
3949
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1929,23 +3952,54 @@ class Content {
|
|
|
1929
3952
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1930
3953
|
}
|
|
1931
3954
|
|
|
3955
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3956
|
+
const {
|
|
3957
|
+
error: warrning,
|
|
3958
|
+
} = ContentValidator.deleteAllInjectableTags().validate(
|
|
3959
|
+
{},
|
|
3960
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3961
|
+
);
|
|
3962
|
+
if (warrning) {
|
|
3963
|
+
Logger({
|
|
3964
|
+
level: "WARN",
|
|
3965
|
+
message: "Parameter Validation warrnings for deleteAllInjectableTags",
|
|
3966
|
+
});
|
|
3967
|
+
Logger({ level: "WARN", message: warrning });
|
|
3968
|
+
}
|
|
3969
|
+
|
|
1932
3970
|
const query_params = {};
|
|
1933
3971
|
|
|
1934
|
-
|
|
3972
|
+
const response = await PlatformAPIClient.execute(
|
|
1935
3973
|
this.config,
|
|
1936
3974
|
"delete",
|
|
1937
3975
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags`,
|
|
1938
3976
|
query_params,
|
|
1939
3977
|
undefined
|
|
1940
3978
|
);
|
|
3979
|
+
|
|
3980
|
+
const { error: res_error } = ContentModel.TagsSchema().validate(response, {
|
|
3981
|
+
abortEarly: false,
|
|
3982
|
+
allowUnknown: false,
|
|
3983
|
+
});
|
|
3984
|
+
|
|
3985
|
+
if (res_error) {
|
|
3986
|
+
Logger({
|
|
3987
|
+
level: "WARN",
|
|
3988
|
+
message: "Response Validation Warnnings for deleteAllInjectableTags",
|
|
3989
|
+
});
|
|
3990
|
+
Logger({ level: "WARN", message: res_error });
|
|
3991
|
+
}
|
|
3992
|
+
|
|
3993
|
+
return response;
|
|
1941
3994
|
}
|
|
1942
3995
|
|
|
1943
3996
|
/**
|
|
1944
3997
|
* @param {Object} arg - Arg object.
|
|
3998
|
+
* @returns {Promise<TagsSchema>} - Success response
|
|
1945
3999
|
* @summary: Get all the tags in an application
|
|
1946
4000
|
* @description: Use this API to get all the CSS and JS injected in the application in the form of tags.
|
|
1947
4001
|
*/
|
|
1948
|
-
getInjectableTags({} = {}) {
|
|
4002
|
+
async getInjectableTags({} = {}) {
|
|
1949
4003
|
const { error } = ContentValidator.getInjectableTags().validate(
|
|
1950
4004
|
{},
|
|
1951
4005
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -1954,24 +4008,53 @@ class Content {
|
|
|
1954
4008
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1955
4009
|
}
|
|
1956
4010
|
|
|
4011
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4012
|
+
const { error: warrning } = ContentValidator.getInjectableTags().validate(
|
|
4013
|
+
{},
|
|
4014
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4015
|
+
);
|
|
4016
|
+
if (warrning) {
|
|
4017
|
+
Logger({
|
|
4018
|
+
level: "WARN",
|
|
4019
|
+
message: "Parameter Validation warrnings for getInjectableTags",
|
|
4020
|
+
});
|
|
4021
|
+
Logger({ level: "WARN", message: warrning });
|
|
4022
|
+
}
|
|
4023
|
+
|
|
1957
4024
|
const query_params = {};
|
|
1958
4025
|
|
|
1959
|
-
|
|
4026
|
+
const response = await PlatformAPIClient.execute(
|
|
1960
4027
|
this.config,
|
|
1961
4028
|
"get",
|
|
1962
4029
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags`,
|
|
1963
4030
|
query_params,
|
|
1964
4031
|
undefined
|
|
1965
4032
|
);
|
|
4033
|
+
|
|
4034
|
+
const { error: res_error } = ContentModel.TagsSchema().validate(response, {
|
|
4035
|
+
abortEarly: false,
|
|
4036
|
+
allowUnknown: false,
|
|
4037
|
+
});
|
|
4038
|
+
|
|
4039
|
+
if (res_error) {
|
|
4040
|
+
Logger({
|
|
4041
|
+
level: "WARN",
|
|
4042
|
+
message: "Response Validation Warnnings for getInjectableTags",
|
|
4043
|
+
});
|
|
4044
|
+
Logger({ level: "WARN", message: res_error });
|
|
4045
|
+
}
|
|
4046
|
+
|
|
4047
|
+
return response;
|
|
1966
4048
|
}
|
|
1967
4049
|
|
|
1968
4050
|
/**
|
|
1969
4051
|
* @param {Object} arg - Arg object.
|
|
1970
4052
|
* @param {CreateTagRequestSchema} arg.body
|
|
4053
|
+
* @returns {Promise<TagsSchema>} - Success response
|
|
1971
4054
|
* @summary: Add a tag
|
|
1972
4055
|
* @description: CSS and JS can be injected in the application (website) with the help of tags. Use this API to create such tags by entering the tag name, tag type (css/js), url and position of the tag.
|
|
1973
4056
|
*/
|
|
1974
|
-
addInjectableTag({ body } = {}) {
|
|
4057
|
+
async addInjectableTag({ body } = {}) {
|
|
1975
4058
|
const { error } = ContentValidator.addInjectableTag().validate(
|
|
1976
4059
|
{
|
|
1977
4060
|
body,
|
|
@@ -1982,24 +4065,55 @@ class Content {
|
|
|
1982
4065
|
return Promise.reject(new FDKClientValidationError(error));
|
|
1983
4066
|
}
|
|
1984
4067
|
|
|
4068
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4069
|
+
const { error: warrning } = ContentValidator.addInjectableTag().validate(
|
|
4070
|
+
{
|
|
4071
|
+
body,
|
|
4072
|
+
},
|
|
4073
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4074
|
+
);
|
|
4075
|
+
if (warrning) {
|
|
4076
|
+
Logger({
|
|
4077
|
+
level: "WARN",
|
|
4078
|
+
message: "Parameter Validation warrnings for addInjectableTag",
|
|
4079
|
+
});
|
|
4080
|
+
Logger({ level: "WARN", message: warrning });
|
|
4081
|
+
}
|
|
4082
|
+
|
|
1985
4083
|
const query_params = {};
|
|
1986
4084
|
|
|
1987
|
-
|
|
4085
|
+
const response = await PlatformAPIClient.execute(
|
|
1988
4086
|
this.config,
|
|
1989
4087
|
"put",
|
|
1990
4088
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags/add`,
|
|
1991
4089
|
query_params,
|
|
1992
4090
|
body
|
|
1993
4091
|
);
|
|
4092
|
+
|
|
4093
|
+
const { error: res_error } = ContentModel.TagsSchema().validate(response, {
|
|
4094
|
+
abortEarly: false,
|
|
4095
|
+
allowUnknown: false,
|
|
4096
|
+
});
|
|
4097
|
+
|
|
4098
|
+
if (res_error) {
|
|
4099
|
+
Logger({
|
|
4100
|
+
level: "WARN",
|
|
4101
|
+
message: "Response Validation Warnnings for addInjectableTag",
|
|
4102
|
+
});
|
|
4103
|
+
Logger({ level: "WARN", message: res_error });
|
|
4104
|
+
}
|
|
4105
|
+
|
|
4106
|
+
return response;
|
|
1994
4107
|
}
|
|
1995
4108
|
|
|
1996
4109
|
/**
|
|
1997
4110
|
* @param {Object} arg - Arg object.
|
|
1998
4111
|
* @param {RemoveHandpickedSchema} arg.body
|
|
4112
|
+
* @returns {Promise<TagDeleteSuccessResponse>} - Success response
|
|
1999
4113
|
* @summary: Remove a tag
|
|
2000
4114
|
* @description: Use this API to delete an existing tag.
|
|
2001
4115
|
*/
|
|
2002
|
-
removeInjectableTag({ body } = {}) {
|
|
4116
|
+
async removeInjectableTag({ body } = {}) {
|
|
2003
4117
|
const { error } = ContentValidator.removeInjectableTag().validate(
|
|
2004
4118
|
{
|
|
2005
4119
|
body,
|
|
@@ -2010,25 +4124,58 @@ class Content {
|
|
|
2010
4124
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2011
4125
|
}
|
|
2012
4126
|
|
|
4127
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4128
|
+
const { error: warrning } = ContentValidator.removeInjectableTag().validate(
|
|
4129
|
+
{
|
|
4130
|
+
body,
|
|
4131
|
+
},
|
|
4132
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4133
|
+
);
|
|
4134
|
+
if (warrning) {
|
|
4135
|
+
Logger({
|
|
4136
|
+
level: "WARN",
|
|
4137
|
+
message: "Parameter Validation warrnings for removeInjectableTag",
|
|
4138
|
+
});
|
|
4139
|
+
Logger({ level: "WARN", message: warrning });
|
|
4140
|
+
}
|
|
4141
|
+
|
|
2013
4142
|
const query_params = {};
|
|
2014
4143
|
|
|
2015
|
-
|
|
4144
|
+
const response = await PlatformAPIClient.execute(
|
|
2016
4145
|
this.config,
|
|
2017
4146
|
"put",
|
|
2018
4147
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags/remove/handpicked`,
|
|
2019
4148
|
query_params,
|
|
2020
4149
|
body
|
|
2021
4150
|
);
|
|
4151
|
+
|
|
4152
|
+
const {
|
|
4153
|
+
error: res_error,
|
|
4154
|
+
} = ContentModel.TagDeleteSuccessResponse().validate(response, {
|
|
4155
|
+
abortEarly: false,
|
|
4156
|
+
allowUnknown: false,
|
|
4157
|
+
});
|
|
4158
|
+
|
|
4159
|
+
if (res_error) {
|
|
4160
|
+
Logger({
|
|
4161
|
+
level: "WARN",
|
|
4162
|
+
message: "Response Validation Warnnings for removeInjectableTag",
|
|
4163
|
+
});
|
|
4164
|
+
Logger({ level: "WARN", message: res_error });
|
|
4165
|
+
}
|
|
4166
|
+
|
|
4167
|
+
return response;
|
|
2022
4168
|
}
|
|
2023
4169
|
|
|
2024
4170
|
/**
|
|
2025
4171
|
* @param {Object} arg - Arg object.
|
|
2026
4172
|
* @param {string} arg.tagId - ID allotted to the tag.
|
|
2027
4173
|
* @param {UpdateHandpickedSchema} arg.body
|
|
4174
|
+
* @returns {Promise<TagsSchema>} - Success response
|
|
2028
4175
|
* @summary: Edit a tag by id
|
|
2029
4176
|
* @description: Use this API to edit the details of an existing tag by its ID.
|
|
2030
4177
|
*/
|
|
2031
|
-
editInjectableTag({ tagId, body } = {}) {
|
|
4178
|
+
async editInjectableTag({ tagId, body } = {}) {
|
|
2032
4179
|
const { error } = ContentValidator.editInjectableTag().validate(
|
|
2033
4180
|
{
|
|
2034
4181
|
tagId,
|
|
@@ -2040,24 +4187,56 @@ class Content {
|
|
|
2040
4187
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2041
4188
|
}
|
|
2042
4189
|
|
|
4190
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4191
|
+
const { error: warrning } = ContentValidator.editInjectableTag().validate(
|
|
4192
|
+
{
|
|
4193
|
+
tagId,
|
|
4194
|
+
body,
|
|
4195
|
+
},
|
|
4196
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4197
|
+
);
|
|
4198
|
+
if (warrning) {
|
|
4199
|
+
Logger({
|
|
4200
|
+
level: "WARN",
|
|
4201
|
+
message: "Parameter Validation warrnings for editInjectableTag",
|
|
4202
|
+
});
|
|
4203
|
+
Logger({ level: "WARN", message: warrning });
|
|
4204
|
+
}
|
|
4205
|
+
|
|
2043
4206
|
const query_params = {};
|
|
2044
4207
|
|
|
2045
|
-
|
|
4208
|
+
const response = await PlatformAPIClient.execute(
|
|
2046
4209
|
this.config,
|
|
2047
4210
|
"put",
|
|
2048
4211
|
`/service/platform/content/v1.0/company/${this.config.companyId}/application/${this.applicationId}/tags/edit/handpicked/${tagId}`,
|
|
2049
4212
|
query_params,
|
|
2050
4213
|
body
|
|
2051
4214
|
);
|
|
4215
|
+
|
|
4216
|
+
const { error: res_error } = ContentModel.TagsSchema().validate(response, {
|
|
4217
|
+
abortEarly: false,
|
|
4218
|
+
allowUnknown: false,
|
|
4219
|
+
});
|
|
4220
|
+
|
|
4221
|
+
if (res_error) {
|
|
4222
|
+
Logger({
|
|
4223
|
+
level: "WARN",
|
|
4224
|
+
message: "Response Validation Warnnings for editInjectableTag",
|
|
4225
|
+
});
|
|
4226
|
+
Logger({ level: "WARN", message: res_error });
|
|
4227
|
+
}
|
|
4228
|
+
|
|
4229
|
+
return response;
|
|
2052
4230
|
}
|
|
2053
4231
|
|
|
2054
4232
|
/**
|
|
2055
4233
|
* @param {Object} arg - Arg object.
|
|
2056
4234
|
* @param {PageRequest} arg.body
|
|
4235
|
+
* @returns {Promise<PageSchema>} - Success response
|
|
2057
4236
|
* @summary: Create a page
|
|
2058
4237
|
* @description: Use this API to create a custom page using a title, seo, publish status, feature image, tags, meta, etc.
|
|
2059
4238
|
*/
|
|
2060
|
-
createPage({ body } = {}) {
|
|
4239
|
+
async createPage({ body } = {}) {
|
|
2061
4240
|
const { error } = ContentValidator.createPage().validate(
|
|
2062
4241
|
{
|
|
2063
4242
|
body,
|
|
@@ -2068,15 +4247,45 @@ class Content {
|
|
|
2068
4247
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2069
4248
|
}
|
|
2070
4249
|
|
|
4250
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4251
|
+
const { error: warrning } = ContentValidator.createPage().validate(
|
|
4252
|
+
{
|
|
4253
|
+
body,
|
|
4254
|
+
},
|
|
4255
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4256
|
+
);
|
|
4257
|
+
if (warrning) {
|
|
4258
|
+
Logger({
|
|
4259
|
+
level: "WARN",
|
|
4260
|
+
message: "Parameter Validation warrnings for createPage",
|
|
4261
|
+
});
|
|
4262
|
+
Logger({ level: "WARN", message: warrning });
|
|
4263
|
+
}
|
|
4264
|
+
|
|
2071
4265
|
const query_params = {};
|
|
2072
4266
|
|
|
2073
|
-
|
|
4267
|
+
const response = await PlatformAPIClient.execute(
|
|
2074
4268
|
this.config,
|
|
2075
4269
|
"post",
|
|
2076
4270
|
`/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/`,
|
|
2077
4271
|
query_params,
|
|
2078
4272
|
body
|
|
2079
4273
|
);
|
|
4274
|
+
|
|
4275
|
+
const { error: res_error } = ContentModel.PageSchema().validate(response, {
|
|
4276
|
+
abortEarly: false,
|
|
4277
|
+
allowUnknown: false,
|
|
4278
|
+
});
|
|
4279
|
+
|
|
4280
|
+
if (res_error) {
|
|
4281
|
+
Logger({
|
|
4282
|
+
level: "WARN",
|
|
4283
|
+
message: "Response Validation Warnnings for createPage",
|
|
4284
|
+
});
|
|
4285
|
+
Logger({ level: "WARN", message: res_error });
|
|
4286
|
+
}
|
|
4287
|
+
|
|
4288
|
+
return response;
|
|
2080
4289
|
}
|
|
2081
4290
|
|
|
2082
4291
|
/**
|
|
@@ -2085,10 +4294,11 @@ class Content {
|
|
|
2085
4294
|
* given set of results. Default value is 1.
|
|
2086
4295
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
2087
4296
|
* page. Default value is 10.
|
|
4297
|
+
* @returns {Promise<PageGetResponse>} - Success response
|
|
2088
4298
|
* @summary: Get a list of pages
|
|
2089
4299
|
* @description: Use this API to retrieve a list of pages.
|
|
2090
4300
|
*/
|
|
2091
|
-
getPages({ pageNo, pageSize } = {}) {
|
|
4301
|
+
async getPages({ pageNo, pageSize } = {}) {
|
|
2092
4302
|
const { error } = ContentValidator.getPages().validate(
|
|
2093
4303
|
{
|
|
2094
4304
|
pageNo,
|
|
@@ -2100,17 +4310,50 @@ class Content {
|
|
|
2100
4310
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2101
4311
|
}
|
|
2102
4312
|
|
|
4313
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4314
|
+
const { error: warrning } = ContentValidator.getPages().validate(
|
|
4315
|
+
{
|
|
4316
|
+
pageNo,
|
|
4317
|
+
pageSize,
|
|
4318
|
+
},
|
|
4319
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4320
|
+
);
|
|
4321
|
+
if (warrning) {
|
|
4322
|
+
Logger({
|
|
4323
|
+
level: "WARN",
|
|
4324
|
+
message: "Parameter Validation warrnings for getPages",
|
|
4325
|
+
});
|
|
4326
|
+
Logger({ level: "WARN", message: warrning });
|
|
4327
|
+
}
|
|
4328
|
+
|
|
2103
4329
|
const query_params = {};
|
|
2104
4330
|
query_params["page_no"] = pageNo;
|
|
2105
4331
|
query_params["page_size"] = pageSize;
|
|
2106
4332
|
|
|
2107
|
-
|
|
4333
|
+
const response = await PlatformAPIClient.execute(
|
|
2108
4334
|
this.config,
|
|
2109
4335
|
"get",
|
|
2110
4336
|
`/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/`,
|
|
2111
4337
|
query_params,
|
|
2112
4338
|
undefined
|
|
2113
4339
|
);
|
|
4340
|
+
|
|
4341
|
+
const {
|
|
4342
|
+
error: res_error,
|
|
4343
|
+
} = ContentModel.PageGetResponse().validate(response, {
|
|
4344
|
+
abortEarly: false,
|
|
4345
|
+
allowUnknown: false,
|
|
4346
|
+
});
|
|
4347
|
+
|
|
4348
|
+
if (res_error) {
|
|
4349
|
+
Logger({
|
|
4350
|
+
level: "WARN",
|
|
4351
|
+
message: "Response Validation Warnnings for getPages",
|
|
4352
|
+
});
|
|
4353
|
+
Logger({ level: "WARN", message: res_error });
|
|
4354
|
+
}
|
|
4355
|
+
|
|
4356
|
+
return response;
|
|
2114
4357
|
}
|
|
2115
4358
|
|
|
2116
4359
|
/**
|
|
@@ -2150,10 +4393,11 @@ class Content {
|
|
|
2150
4393
|
* @param {Object} arg - Arg object.
|
|
2151
4394
|
* @param {string} arg.id - ID allotted to the page.
|
|
2152
4395
|
* @param {PageSchema} arg.body
|
|
4396
|
+
* @returns {Promise<PageSchema>} - Success response
|
|
2153
4397
|
* @summary: Update a page
|
|
2154
4398
|
* @description: Use this API to edit the details of an existing page, such as its title, seo, publish status, feature image, tags, schedule, etc.
|
|
2155
4399
|
*/
|
|
2156
|
-
updatePage({ id, body } = {}) {
|
|
4400
|
+
async updatePage({ id, body } = {}) {
|
|
2157
4401
|
const { error } = ContentValidator.updatePage().validate(
|
|
2158
4402
|
{
|
|
2159
4403
|
id,
|
|
@@ -2165,25 +4409,57 @@ class Content {
|
|
|
2165
4409
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2166
4410
|
}
|
|
2167
4411
|
|
|
4412
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4413
|
+
const { error: warrning } = ContentValidator.updatePage().validate(
|
|
4414
|
+
{
|
|
4415
|
+
id,
|
|
4416
|
+
body,
|
|
4417
|
+
},
|
|
4418
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4419
|
+
);
|
|
4420
|
+
if (warrning) {
|
|
4421
|
+
Logger({
|
|
4422
|
+
level: "WARN",
|
|
4423
|
+
message: "Parameter Validation warrnings for updatePage",
|
|
4424
|
+
});
|
|
4425
|
+
Logger({ level: "WARN", message: warrning });
|
|
4426
|
+
}
|
|
4427
|
+
|
|
2168
4428
|
const query_params = {};
|
|
2169
4429
|
|
|
2170
|
-
|
|
4430
|
+
const response = await PlatformAPIClient.execute(
|
|
2171
4431
|
this.config,
|
|
2172
4432
|
"put",
|
|
2173
4433
|
`/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/${id}`,
|
|
2174
4434
|
query_params,
|
|
2175
4435
|
body
|
|
2176
4436
|
);
|
|
4437
|
+
|
|
4438
|
+
const { error: res_error } = ContentModel.PageSchema().validate(response, {
|
|
4439
|
+
abortEarly: false,
|
|
4440
|
+
allowUnknown: false,
|
|
4441
|
+
});
|
|
4442
|
+
|
|
4443
|
+
if (res_error) {
|
|
4444
|
+
Logger({
|
|
4445
|
+
level: "WARN",
|
|
4446
|
+
message: "Response Validation Warnnings for updatePage",
|
|
4447
|
+
});
|
|
4448
|
+
Logger({ level: "WARN", message: res_error });
|
|
4449
|
+
}
|
|
4450
|
+
|
|
4451
|
+
return response;
|
|
2177
4452
|
}
|
|
2178
4453
|
|
|
2179
4454
|
/**
|
|
2180
4455
|
* @param {Object} arg - Arg object.
|
|
2181
4456
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
2182
4457
|
* identifier of a page. You can get slug value of a page from `getPages` API.
|
|
4458
|
+
* @returns {Promise<PageSchema>} - Success response
|
|
2183
4459
|
* @summary: Get pages by component Id
|
|
2184
4460
|
* @description: Use this API to retrieve the components of a page, such as its title, seo, publish status, feature image, tags, schedule, etc.
|
|
2185
4461
|
*/
|
|
2186
|
-
getPageBySlug({ slug } = {}) {
|
|
4462
|
+
async getPageBySlug({ slug } = {}) {
|
|
2187
4463
|
const { error } = ContentValidator.getPageBySlug().validate(
|
|
2188
4464
|
{
|
|
2189
4465
|
slug,
|
|
@@ -2194,15 +4470,45 @@ class Content {
|
|
|
2194
4470
|
return Promise.reject(new FDKClientValidationError(error));
|
|
2195
4471
|
}
|
|
2196
4472
|
|
|
4473
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4474
|
+
const { error: warrning } = ContentValidator.getPageBySlug().validate(
|
|
4475
|
+
{
|
|
4476
|
+
slug,
|
|
4477
|
+
},
|
|
4478
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4479
|
+
);
|
|
4480
|
+
if (warrning) {
|
|
4481
|
+
Logger({
|
|
4482
|
+
level: "WARN",
|
|
4483
|
+
message: "Parameter Validation warrnings for getPageBySlug",
|
|
4484
|
+
});
|
|
4485
|
+
Logger({ level: "WARN", message: warrning });
|
|
4486
|
+
}
|
|
4487
|
+
|
|
2197
4488
|
const query_params = {};
|
|
2198
4489
|
|
|
2199
|
-
|
|
4490
|
+
const response = await PlatformAPIClient.execute(
|
|
2200
4491
|
this.config,
|
|
2201
4492
|
"get",
|
|
2202
4493
|
`/service/platform/content/v2.0/company/${this.config.companyId}/application/${this.applicationId}/pages/${slug}`,
|
|
2203
4494
|
query_params,
|
|
2204
4495
|
undefined
|
|
2205
4496
|
);
|
|
4497
|
+
|
|
4498
|
+
const { error: res_error } = ContentModel.PageSchema().validate(response, {
|
|
4499
|
+
abortEarly: false,
|
|
4500
|
+
allowUnknown: false,
|
|
4501
|
+
});
|
|
4502
|
+
|
|
4503
|
+
if (res_error) {
|
|
4504
|
+
Logger({
|
|
4505
|
+
level: "WARN",
|
|
4506
|
+
message: "Response Validation Warnnings for getPageBySlug",
|
|
4507
|
+
});
|
|
4508
|
+
Logger({ level: "WARN", message: res_error });
|
|
4509
|
+
}
|
|
4510
|
+
|
|
4511
|
+
return response;
|
|
2206
4512
|
}
|
|
2207
4513
|
}
|
|
2208
4514
|
module.exports = Content;
|