@gofynd/fdk-client-javascript 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +414 -414
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +290 -290
- package/documentation/application/PAYMENT.md +255 -255
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3088 -2702
- package/documentation/platform/COMPANYPROFILE.md +201 -201
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1233 -1158
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +83 -83
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +619 -108
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +730 -134
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +21 -21
- package/sdk/application/Catalog/CatalogApplicationModel.js +547 -547
- package/sdk/application/Common/CommonApplicationClient.js +48 -8
- package/sdk/application/Communication/CommunicationApplicationClient.js +75 -14
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +392 -66
- package/sdk/application/Content/ContentApplicationClient.js +444 -76
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +74 -12
- package/sdk/application/Lead/LeadApplicationClient.js +164 -30
- package/sdk/application/Logistic/LogisticApplicationClient.js +98 -16
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +287 -54
- package/sdk/application/Order/OrderApplicationModel.d.ts +19 -19
- package/sdk/application/Order/OrderApplicationModel.js +357 -357
- package/sdk/application/Payment/PaymentApplicationClient.js +961 -186
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +3 -3
- package/sdk/application/Payment/PaymentApplicationModel.js +352 -352
- package/sdk/application/PosCart/PosCartApplicationClient.js +645 -114
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/Rewards/RewardsApplicationClient.js +168 -28
- package/sdk/application/Share/ShareApplicationClient.js +157 -32
- package/sdk/application/Theme/ThemeApplicationClient.js +94 -16
- package/sdk/application/User/UserApplicationClient.js +806 -148
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +191 -34
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +103 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +103 -16
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +299 -54
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +409 -72
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +167 -114
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1562 -453
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +39 -39
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +314 -196
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2459 -718
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +103 -94
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2063 -1797
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +17 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +95 -76
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +51 -8
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1000 -168
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +28 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +335 -54
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +10 -10
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +278 -278
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +702 -118
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +457 -82
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1724 -284
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +270 -44
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +102 -16
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +150 -24
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +316 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +311 -52
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +266 -44
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +78 -14
- package/sdk/platform/Order/OrderPlatformClient.d.ts +95 -43
- package/sdk/platform/Order/OrderPlatformClient.js +1062 -180
- package/sdk/platform/Order/OrderPlatformModel.d.ts +64 -60
- package/sdk/platform/Order/OrderPlatformModel.js +1481 -1425
- package/sdk/platform/Order/OrderPlatformValidator.js +5 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +52 -8
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +287 -56
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +263 -48
- package/sdk/platform/Payment/PaymentPlatformModel.js +122 -122
- package/sdk/platform/PlatformApplicationClient.d.ts +2959 -2787
- package/sdk/platform/PlatformApplicationClient.js +3420 -3212
- package/sdk/platform/PlatformClient.d.ts +2959 -2787
- package/sdk/platform/PlatformClient.js +3420 -3212
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +308 -54
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +94 -16
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +571 -96
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +296 -48
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +157 -30
- package/sdk/public/Configuration/ConfigurationPublicClient.js +51 -8
- package/sdk/public/Inventory/InventoryPublicClient.js +149 -26
- package/sdk/public/Webhook/WebhookPublicClient.js +51 -10
|
@@ -2,6 +2,8 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
3
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
4
4
|
const ThemeValidator = require("./ThemePlatformApplicationValidator");
|
|
5
|
+
const ThemeModel = require("./ThemePlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
5
7
|
|
|
6
8
|
class Theme {
|
|
7
9
|
constructor(config, applicationId) {
|
|
@@ -12,10 +14,11 @@ class Theme {
|
|
|
12
14
|
/**
|
|
13
15
|
* @param {Object} arg - Arg object.
|
|
14
16
|
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
17
|
+
* @returns {Promise<AllAvailablePageSchema>} - Success response
|
|
15
18
|
* @summary: Get all pages of a theme
|
|
16
19
|
* @description: Use this API to retrieve all the available pages of a theme by its ID.
|
|
17
20
|
*/
|
|
18
|
-
getAllPages({ themeId } = {}) {
|
|
21
|
+
async getAllPages({ themeId } = {}) {
|
|
19
22
|
const { error } = ThemeValidator.getAllPages().validate(
|
|
20
23
|
{
|
|
21
24
|
themeId,
|
|
@@ -34,29 +37,50 @@ class Theme {
|
|
|
34
37
|
{ abortEarly: false, allowUnknown: false }
|
|
35
38
|
);
|
|
36
39
|
if (warrning) {
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
Logger({
|
|
41
|
+
level: "WARN",
|
|
42
|
+
message: "Parameter Validation warrnings for getAllPages",
|
|
43
|
+
});
|
|
44
|
+
Logger({ level: "WARN", message: warrning });
|
|
39
45
|
}
|
|
40
46
|
|
|
41
47
|
const query_params = {};
|
|
42
48
|
|
|
43
|
-
|
|
49
|
+
const response = await PlatformAPIClient.execute(
|
|
44
50
|
this.config,
|
|
45
51
|
"get",
|
|
46
52
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/page`,
|
|
47
53
|
query_params,
|
|
48
54
|
undefined
|
|
49
55
|
);
|
|
56
|
+
|
|
57
|
+
const {
|
|
58
|
+
error: res_error,
|
|
59
|
+
} = ThemeModel.AllAvailablePageSchema().validate(response, {
|
|
60
|
+
abortEarly: false,
|
|
61
|
+
allowUnknown: false,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
if (res_error) {
|
|
65
|
+
Logger({
|
|
66
|
+
level: "WARN",
|
|
67
|
+
message: "Response Validation Warnnings for getAllPages",
|
|
68
|
+
});
|
|
69
|
+
Logger({ level: "WARN", message: res_error });
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return response;
|
|
50
73
|
}
|
|
51
74
|
|
|
52
75
|
/**
|
|
53
76
|
* @param {Object} arg - Arg object.
|
|
54
77
|
* @param {string} arg.themeId - ID of the theme
|
|
55
78
|
* @param {AvailablePageSchema} arg.body
|
|
79
|
+
* @returns {Promise<AvailablePageSchema>} - Success response
|
|
56
80
|
* @summary: Create a page
|
|
57
81
|
* @description: Use this API to create a page for a theme by its ID.
|
|
58
82
|
*/
|
|
59
|
-
createPage({ themeId, body } = {}) {
|
|
83
|
+
async createPage({ themeId, body } = {}) {
|
|
60
84
|
const { error } = ThemeValidator.createPage().validate(
|
|
61
85
|
{
|
|
62
86
|
themeId,
|
|
@@ -77,29 +101,50 @@ class Theme {
|
|
|
77
101
|
{ abortEarly: false, allowUnknown: false }
|
|
78
102
|
);
|
|
79
103
|
if (warrning) {
|
|
80
|
-
|
|
81
|
-
|
|
104
|
+
Logger({
|
|
105
|
+
level: "WARN",
|
|
106
|
+
message: "Parameter Validation warrnings for createPage",
|
|
107
|
+
});
|
|
108
|
+
Logger({ level: "WARN", message: warrning });
|
|
82
109
|
}
|
|
83
110
|
|
|
84
111
|
const query_params = {};
|
|
85
112
|
|
|
86
|
-
|
|
113
|
+
const response = await PlatformAPIClient.execute(
|
|
87
114
|
this.config,
|
|
88
115
|
"post",
|
|
89
116
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/page`,
|
|
90
117
|
query_params,
|
|
91
118
|
body
|
|
92
119
|
);
|
|
120
|
+
|
|
121
|
+
const {
|
|
122
|
+
error: res_error,
|
|
123
|
+
} = ThemeModel.AvailablePageSchema().validate(response, {
|
|
124
|
+
abortEarly: false,
|
|
125
|
+
allowUnknown: false,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
if (res_error) {
|
|
129
|
+
Logger({
|
|
130
|
+
level: "WARN",
|
|
131
|
+
message: "Response Validation Warnnings for createPage",
|
|
132
|
+
});
|
|
133
|
+
Logger({ level: "WARN", message: res_error });
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return response;
|
|
93
137
|
}
|
|
94
138
|
|
|
95
139
|
/**
|
|
96
140
|
* @param {Object} arg - Arg object.
|
|
97
141
|
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
98
142
|
* @param {AllAvailablePageSchema} arg.body
|
|
143
|
+
* @returns {Promise<AllAvailablePageSchema>} - Success response
|
|
99
144
|
* @summary: Update multiple pages of a theme
|
|
100
145
|
* @description: Use this API to update multiple pages of a theme by its ID.
|
|
101
146
|
*/
|
|
102
|
-
updateMultiplePages({ themeId, body } = {}) {
|
|
147
|
+
async updateMultiplePages({ themeId, body } = {}) {
|
|
103
148
|
const { error } = ThemeValidator.updateMultiplePages().validate(
|
|
104
149
|
{
|
|
105
150
|
themeId,
|
|
@@ -120,29 +165,50 @@ class Theme {
|
|
|
120
165
|
{ abortEarly: false, allowUnknown: false }
|
|
121
166
|
);
|
|
122
167
|
if (warrning) {
|
|
123
|
-
|
|
124
|
-
|
|
168
|
+
Logger({
|
|
169
|
+
level: "WARN",
|
|
170
|
+
message: "Parameter Validation warrnings for updateMultiplePages",
|
|
171
|
+
});
|
|
172
|
+
Logger({ level: "WARN", message: warrning });
|
|
125
173
|
}
|
|
126
174
|
|
|
127
175
|
const query_params = {};
|
|
128
176
|
|
|
129
|
-
|
|
177
|
+
const response = await PlatformAPIClient.execute(
|
|
130
178
|
this.config,
|
|
131
179
|
"put",
|
|
132
180
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/page`,
|
|
133
181
|
query_params,
|
|
134
182
|
body
|
|
135
183
|
);
|
|
184
|
+
|
|
185
|
+
const {
|
|
186
|
+
error: res_error,
|
|
187
|
+
} = ThemeModel.AllAvailablePageSchema().validate(response, {
|
|
188
|
+
abortEarly: false,
|
|
189
|
+
allowUnknown: false,
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
if (res_error) {
|
|
193
|
+
Logger({
|
|
194
|
+
level: "WARN",
|
|
195
|
+
message: "Response Validation Warnnings for updateMultiplePages",
|
|
196
|
+
});
|
|
197
|
+
Logger({ level: "WARN", message: res_error });
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
return response;
|
|
136
201
|
}
|
|
137
202
|
|
|
138
203
|
/**
|
|
139
204
|
* @param {Object} arg - Arg object.
|
|
140
205
|
* @param {string} arg.themeId - ID of the theme to be retrieved
|
|
141
206
|
* @param {string} arg.pageValue - Value of the page to be retrieved
|
|
207
|
+
* @returns {Promise<AvailablePageSchema>} - Success response
|
|
142
208
|
* @summary: Get page of a theme
|
|
143
209
|
* @description: Use this API to retrieve a page of a theme.
|
|
144
210
|
*/
|
|
145
|
-
getPage({ themeId, pageValue } = {}) {
|
|
211
|
+
async getPage({ themeId, pageValue } = {}) {
|
|
146
212
|
const { error } = ThemeValidator.getPage().validate(
|
|
147
213
|
{
|
|
148
214
|
themeId,
|
|
@@ -163,19 +229,39 @@ class Theme {
|
|
|
163
229
|
{ abortEarly: false, allowUnknown: false }
|
|
164
230
|
);
|
|
165
231
|
if (warrning) {
|
|
166
|
-
|
|
167
|
-
|
|
232
|
+
Logger({
|
|
233
|
+
level: "WARN",
|
|
234
|
+
message: "Parameter Validation warrnings for getPage",
|
|
235
|
+
});
|
|
236
|
+
Logger({ level: "WARN", message: warrning });
|
|
168
237
|
}
|
|
169
238
|
|
|
170
239
|
const query_params = {};
|
|
171
240
|
|
|
172
|
-
|
|
241
|
+
const response = await PlatformAPIClient.execute(
|
|
173
242
|
this.config,
|
|
174
243
|
"get",
|
|
175
244
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/${pageValue}`,
|
|
176
245
|
query_params,
|
|
177
246
|
undefined
|
|
178
247
|
);
|
|
248
|
+
|
|
249
|
+
const {
|
|
250
|
+
error: res_error,
|
|
251
|
+
} = ThemeModel.AvailablePageSchema().validate(response, {
|
|
252
|
+
abortEarly: false,
|
|
253
|
+
allowUnknown: false,
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
if (res_error) {
|
|
257
|
+
Logger({
|
|
258
|
+
level: "WARN",
|
|
259
|
+
message: "Response Validation Warnnings for getPage",
|
|
260
|
+
});
|
|
261
|
+
Logger({ level: "WARN", message: res_error });
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
return response;
|
|
179
265
|
}
|
|
180
266
|
|
|
181
267
|
/**
|
|
@@ -183,10 +269,11 @@ class Theme {
|
|
|
183
269
|
* @param {string} arg.themeId - ID of the theme
|
|
184
270
|
* @param {string} arg.pageValue - Value of the page to be updated
|
|
185
271
|
* @param {AvailablePageSchema} arg.body
|
|
272
|
+
* @returns {Promise<AvailablePageSchema>} - Success response
|
|
186
273
|
* @summary: Updates a page
|
|
187
274
|
* @description: Use this API to update a page for a theme by its ID.
|
|
188
275
|
*/
|
|
189
|
-
updatePage({ themeId, pageValue, body } = {}) {
|
|
276
|
+
async updatePage({ themeId, pageValue, body } = {}) {
|
|
190
277
|
const { error } = ThemeValidator.updatePage().validate(
|
|
191
278
|
{
|
|
192
279
|
themeId,
|
|
@@ -209,29 +296,50 @@ class Theme {
|
|
|
209
296
|
{ abortEarly: false, allowUnknown: false }
|
|
210
297
|
);
|
|
211
298
|
if (warrning) {
|
|
212
|
-
|
|
213
|
-
|
|
299
|
+
Logger({
|
|
300
|
+
level: "WARN",
|
|
301
|
+
message: "Parameter Validation warrnings for updatePage",
|
|
302
|
+
});
|
|
303
|
+
Logger({ level: "WARN", message: warrning });
|
|
214
304
|
}
|
|
215
305
|
|
|
216
306
|
const query_params = {};
|
|
217
307
|
|
|
218
|
-
|
|
308
|
+
const response = await PlatformAPIClient.execute(
|
|
219
309
|
this.config,
|
|
220
310
|
"put",
|
|
221
311
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/${pageValue}`,
|
|
222
312
|
query_params,
|
|
223
313
|
body
|
|
224
314
|
);
|
|
315
|
+
|
|
316
|
+
const {
|
|
317
|
+
error: res_error,
|
|
318
|
+
} = ThemeModel.AvailablePageSchema().validate(response, {
|
|
319
|
+
abortEarly: false,
|
|
320
|
+
allowUnknown: false,
|
|
321
|
+
});
|
|
322
|
+
|
|
323
|
+
if (res_error) {
|
|
324
|
+
Logger({
|
|
325
|
+
level: "WARN",
|
|
326
|
+
message: "Response Validation Warnnings for updatePage",
|
|
327
|
+
});
|
|
328
|
+
Logger({ level: "WARN", message: res_error });
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
return response;
|
|
225
332
|
}
|
|
226
333
|
|
|
227
334
|
/**
|
|
228
335
|
* @param {Object} arg - Arg object.
|
|
229
336
|
* @param {string} arg.themeId - ID of the theme
|
|
230
337
|
* @param {string} arg.pageValue - Value of the page to be updated
|
|
338
|
+
* @returns {Promise<AvailablePageSchema>} - Success response
|
|
231
339
|
* @summary: Deletes a page
|
|
232
340
|
* @description: Use this API to delete a page for a theme by its ID and page_value.
|
|
233
341
|
*/
|
|
234
|
-
deletePage({ themeId, pageValue } = {}) {
|
|
342
|
+
async deletePage({ themeId, pageValue } = {}) {
|
|
235
343
|
const { error } = ThemeValidator.deletePage().validate(
|
|
236
344
|
{
|
|
237
345
|
themeId,
|
|
@@ -252,19 +360,39 @@ class Theme {
|
|
|
252
360
|
{ abortEarly: false, allowUnknown: false }
|
|
253
361
|
);
|
|
254
362
|
if (warrning) {
|
|
255
|
-
|
|
256
|
-
|
|
363
|
+
Logger({
|
|
364
|
+
level: "WARN",
|
|
365
|
+
message: "Parameter Validation warrnings for deletePage",
|
|
366
|
+
});
|
|
367
|
+
Logger({ level: "WARN", message: warrning });
|
|
257
368
|
}
|
|
258
369
|
|
|
259
370
|
const query_params = {};
|
|
260
371
|
|
|
261
|
-
|
|
372
|
+
const response = await PlatformAPIClient.execute(
|
|
262
373
|
this.config,
|
|
263
374
|
"delete",
|
|
264
375
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/${pageValue}`,
|
|
265
376
|
query_params,
|
|
266
377
|
undefined
|
|
267
378
|
);
|
|
379
|
+
|
|
380
|
+
const {
|
|
381
|
+
error: res_error,
|
|
382
|
+
} = ThemeModel.AvailablePageSchema().validate(response, {
|
|
383
|
+
abortEarly: false,
|
|
384
|
+
allowUnknown: false,
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
if (res_error) {
|
|
388
|
+
Logger({
|
|
389
|
+
level: "WARN",
|
|
390
|
+
message: "Response Validation Warnnings for deletePage",
|
|
391
|
+
});
|
|
392
|
+
Logger({ level: "WARN", message: res_error });
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return response;
|
|
268
396
|
}
|
|
269
397
|
|
|
270
398
|
/**
|
|
@@ -273,10 +401,11 @@ class Theme {
|
|
|
273
401
|
* page. Default value is 10.
|
|
274
402
|
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
275
403
|
* given set of results. Default value is 1.
|
|
404
|
+
* @returns {Promise<ThemesListingResponseSchema>} - Success response
|
|
276
405
|
* @summary: Get a list of themes from the theme library
|
|
277
406
|
* @description: Theme library is a personalized collection of themes that are chosen and added from the available themes. Use this API to fetch a list of themes from the library along with their configuration details.
|
|
278
407
|
*/
|
|
279
|
-
getThemeLibrary({ pageSize, pageNo } = {}) {
|
|
408
|
+
async getThemeLibrary({ pageSize, pageNo } = {}) {
|
|
280
409
|
const { error } = ThemeValidator.getThemeLibrary().validate(
|
|
281
410
|
{
|
|
282
411
|
pageSize,
|
|
@@ -297,30 +426,51 @@ class Theme {
|
|
|
297
426
|
{ abortEarly: false, allowUnknown: false }
|
|
298
427
|
);
|
|
299
428
|
if (warrning) {
|
|
300
|
-
|
|
301
|
-
|
|
429
|
+
Logger({
|
|
430
|
+
level: "WARN",
|
|
431
|
+
message: "Parameter Validation warrnings for getThemeLibrary",
|
|
432
|
+
});
|
|
433
|
+
Logger({ level: "WARN", message: warrning });
|
|
302
434
|
}
|
|
303
435
|
|
|
304
436
|
const query_params = {};
|
|
305
437
|
query_params["page_size"] = pageSize;
|
|
306
438
|
query_params["page_no"] = pageNo;
|
|
307
439
|
|
|
308
|
-
|
|
440
|
+
const response = await PlatformAPIClient.execute(
|
|
309
441
|
this.config,
|
|
310
442
|
"get",
|
|
311
443
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/library`,
|
|
312
444
|
query_params,
|
|
313
445
|
undefined
|
|
314
446
|
);
|
|
447
|
+
|
|
448
|
+
const {
|
|
449
|
+
error: res_error,
|
|
450
|
+
} = ThemeModel.ThemesListingResponseSchema().validate(response, {
|
|
451
|
+
abortEarly: false,
|
|
452
|
+
allowUnknown: false,
|
|
453
|
+
});
|
|
454
|
+
|
|
455
|
+
if (res_error) {
|
|
456
|
+
Logger({
|
|
457
|
+
level: "WARN",
|
|
458
|
+
message: "Response Validation Warnnings for getThemeLibrary",
|
|
459
|
+
});
|
|
460
|
+
Logger({ level: "WARN", message: res_error });
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return response;
|
|
315
464
|
}
|
|
316
465
|
|
|
317
466
|
/**
|
|
318
467
|
* @param {Object} arg - Arg object.
|
|
319
468
|
* @param {AddThemeRequestSchema} arg.body
|
|
469
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
320
470
|
* @summary: Add a theme to the theme library
|
|
321
471
|
* @description: Theme library is a personalized collection of themes that are chosen and added from the available themes. Use this API to choose a theme and add it to the theme library.
|
|
322
472
|
*/
|
|
323
|
-
addToThemeLibrary({ body } = {}) {
|
|
473
|
+
async addToThemeLibrary({ body } = {}) {
|
|
324
474
|
const { error } = ThemeValidator.addToThemeLibrary().validate(
|
|
325
475
|
{
|
|
326
476
|
body,
|
|
@@ -339,28 +489,47 @@ class Theme {
|
|
|
339
489
|
{ abortEarly: false, allowUnknown: false }
|
|
340
490
|
);
|
|
341
491
|
if (warrning) {
|
|
342
|
-
|
|
343
|
-
|
|
492
|
+
Logger({
|
|
493
|
+
level: "WARN",
|
|
494
|
+
message: "Parameter Validation warrnings for addToThemeLibrary",
|
|
495
|
+
});
|
|
496
|
+
Logger({ level: "WARN", message: warrning });
|
|
344
497
|
}
|
|
345
498
|
|
|
346
499
|
const query_params = {};
|
|
347
500
|
|
|
348
|
-
|
|
501
|
+
const response = await PlatformAPIClient.execute(
|
|
349
502
|
this.config,
|
|
350
503
|
"post",
|
|
351
504
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/library`,
|
|
352
505
|
query_params,
|
|
353
506
|
body
|
|
354
507
|
);
|
|
508
|
+
|
|
509
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
510
|
+
abortEarly: false,
|
|
511
|
+
allowUnknown: false,
|
|
512
|
+
});
|
|
513
|
+
|
|
514
|
+
if (res_error) {
|
|
515
|
+
Logger({
|
|
516
|
+
level: "WARN",
|
|
517
|
+
message: "Response Validation Warnnings for addToThemeLibrary",
|
|
518
|
+
});
|
|
519
|
+
Logger({ level: "WARN", message: res_error });
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
return response;
|
|
355
523
|
}
|
|
356
524
|
|
|
357
525
|
/**
|
|
358
526
|
* @param {Object} arg - Arg object.
|
|
359
527
|
* @param {AddThemeRequestSchema} arg.body
|
|
528
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
360
529
|
* @summary: Apply a theme
|
|
361
530
|
* @description: Use this API to apply a theme to the website.
|
|
362
531
|
*/
|
|
363
|
-
applyTheme({ body } = {}) {
|
|
532
|
+
async applyTheme({ body } = {}) {
|
|
364
533
|
const { error } = ThemeValidator.applyTheme().validate(
|
|
365
534
|
{
|
|
366
535
|
body,
|
|
@@ -379,28 +548,47 @@ class Theme {
|
|
|
379
548
|
{ abortEarly: false, allowUnknown: false }
|
|
380
549
|
);
|
|
381
550
|
if (warrning) {
|
|
382
|
-
|
|
383
|
-
|
|
551
|
+
Logger({
|
|
552
|
+
level: "WARN",
|
|
553
|
+
message: "Parameter Validation warrnings for applyTheme",
|
|
554
|
+
});
|
|
555
|
+
Logger({ level: "WARN", message: warrning });
|
|
384
556
|
}
|
|
385
557
|
|
|
386
558
|
const query_params = {};
|
|
387
559
|
|
|
388
|
-
|
|
560
|
+
const response = await PlatformAPIClient.execute(
|
|
389
561
|
this.config,
|
|
390
562
|
"post",
|
|
391
563
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/apply`,
|
|
392
564
|
query_params,
|
|
393
565
|
body
|
|
394
566
|
);
|
|
567
|
+
|
|
568
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
569
|
+
abortEarly: false,
|
|
570
|
+
allowUnknown: false,
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
if (res_error) {
|
|
574
|
+
Logger({
|
|
575
|
+
level: "WARN",
|
|
576
|
+
message: "Response Validation Warnnings for applyTheme",
|
|
577
|
+
});
|
|
578
|
+
Logger({ level: "WARN", message: res_error });
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
return response;
|
|
395
582
|
}
|
|
396
583
|
|
|
397
584
|
/**
|
|
398
585
|
* @param {Object} arg - Arg object.
|
|
399
586
|
* @param {string} arg.themeId - Theme ID
|
|
587
|
+
* @returns {Promise<UpgradableThemeSchema>} - Success response
|
|
400
588
|
* @summary: Checks if theme is upgradable
|
|
401
589
|
* @description: There's always a possibility that new features get added to a theme. Use this API to check if the applied theme has an upgrade available.
|
|
402
590
|
*/
|
|
403
|
-
isUpgradable({ themeId } = {}) {
|
|
591
|
+
async isUpgradable({ themeId } = {}) {
|
|
404
592
|
const { error } = ThemeValidator.isUpgradable().validate(
|
|
405
593
|
{
|
|
406
594
|
themeId,
|
|
@@ -419,28 +607,49 @@ class Theme {
|
|
|
419
607
|
{ abortEarly: false, allowUnknown: false }
|
|
420
608
|
);
|
|
421
609
|
if (warrning) {
|
|
422
|
-
|
|
423
|
-
|
|
610
|
+
Logger({
|
|
611
|
+
level: "WARN",
|
|
612
|
+
message: "Parameter Validation warrnings for isUpgradable",
|
|
613
|
+
});
|
|
614
|
+
Logger({ level: "WARN", message: warrning });
|
|
424
615
|
}
|
|
425
616
|
|
|
426
617
|
const query_params = {};
|
|
427
618
|
|
|
428
|
-
|
|
619
|
+
const response = await PlatformAPIClient.execute(
|
|
429
620
|
this.config,
|
|
430
621
|
"get",
|
|
431
622
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/upgradable`,
|
|
432
623
|
query_params,
|
|
433
624
|
undefined
|
|
434
625
|
);
|
|
626
|
+
|
|
627
|
+
const {
|
|
628
|
+
error: res_error,
|
|
629
|
+
} = ThemeModel.UpgradableThemeSchema().validate(response, {
|
|
630
|
+
abortEarly: false,
|
|
631
|
+
allowUnknown: false,
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
if (res_error) {
|
|
635
|
+
Logger({
|
|
636
|
+
level: "WARN",
|
|
637
|
+
message: "Response Validation Warnnings for isUpgradable",
|
|
638
|
+
});
|
|
639
|
+
Logger({ level: "WARN", message: res_error });
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
return response;
|
|
435
643
|
}
|
|
436
644
|
|
|
437
645
|
/**
|
|
438
646
|
* @param {Object} arg - Arg object.
|
|
439
647
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
648
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
440
649
|
* @summary: Upgrade a theme
|
|
441
650
|
* @description: Use this API to upgrade the current theme to its latest version.
|
|
442
651
|
*/
|
|
443
|
-
upgradeTheme({ themeId } = {}) {
|
|
652
|
+
async upgradeTheme({ themeId } = {}) {
|
|
444
653
|
const { error } = ThemeValidator.upgradeTheme().validate(
|
|
445
654
|
{
|
|
446
655
|
themeId,
|
|
@@ -459,19 +668,37 @@ class Theme {
|
|
|
459
668
|
{ abortEarly: false, allowUnknown: false }
|
|
460
669
|
);
|
|
461
670
|
if (warrning) {
|
|
462
|
-
|
|
463
|
-
|
|
671
|
+
Logger({
|
|
672
|
+
level: "WARN",
|
|
673
|
+
message: "Parameter Validation warrnings for upgradeTheme",
|
|
674
|
+
});
|
|
675
|
+
Logger({ level: "WARN", message: warrning });
|
|
464
676
|
}
|
|
465
677
|
|
|
466
678
|
const query_params = {};
|
|
467
679
|
|
|
468
|
-
|
|
680
|
+
const response = await PlatformAPIClient.execute(
|
|
469
681
|
this.config,
|
|
470
682
|
"put",
|
|
471
683
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/upgrade`,
|
|
472
684
|
query_params,
|
|
473
685
|
undefined
|
|
474
686
|
);
|
|
687
|
+
|
|
688
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
689
|
+
abortEarly: false,
|
|
690
|
+
allowUnknown: false,
|
|
691
|
+
});
|
|
692
|
+
|
|
693
|
+
if (res_error) {
|
|
694
|
+
Logger({
|
|
695
|
+
level: "WARN",
|
|
696
|
+
message: "Response Validation Warnnings for upgradeTheme",
|
|
697
|
+
});
|
|
698
|
+
Logger({ level: "WARN", message: res_error });
|
|
699
|
+
}
|
|
700
|
+
|
|
701
|
+
return response;
|
|
475
702
|
}
|
|
476
703
|
|
|
477
704
|
/**
|
|
@@ -480,10 +707,11 @@ class Theme {
|
|
|
480
707
|
* page. Default value is 10.
|
|
481
708
|
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
482
709
|
* given set of results. Default value is 1.
|
|
710
|
+
* @returns {Promise<ThemesListingResponseSchema>} - Success response
|
|
483
711
|
* @summary: Get all public themes
|
|
484
712
|
* @description: Use this API to get a list of free themes that you can apply to your website.
|
|
485
713
|
*/
|
|
486
|
-
getPublicThemes({ pageSize, pageNo } = {}) {
|
|
714
|
+
async getPublicThemes({ pageSize, pageNo } = {}) {
|
|
487
715
|
const { error } = ThemeValidator.getPublicThemes().validate(
|
|
488
716
|
{
|
|
489
717
|
pageSize,
|
|
@@ -504,30 +732,51 @@ class Theme {
|
|
|
504
732
|
{ abortEarly: false, allowUnknown: false }
|
|
505
733
|
);
|
|
506
734
|
if (warrning) {
|
|
507
|
-
|
|
508
|
-
|
|
735
|
+
Logger({
|
|
736
|
+
level: "WARN",
|
|
737
|
+
message: "Parameter Validation warrnings for getPublicThemes",
|
|
738
|
+
});
|
|
739
|
+
Logger({ level: "WARN", message: warrning });
|
|
509
740
|
}
|
|
510
741
|
|
|
511
742
|
const query_params = {};
|
|
512
743
|
query_params["page_size"] = pageSize;
|
|
513
744
|
query_params["page_no"] = pageNo;
|
|
514
745
|
|
|
515
|
-
|
|
746
|
+
const response = await PlatformAPIClient.execute(
|
|
516
747
|
this.config,
|
|
517
748
|
"get",
|
|
518
749
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/list/public`,
|
|
519
750
|
query_params,
|
|
520
751
|
undefined
|
|
521
752
|
);
|
|
753
|
+
|
|
754
|
+
const {
|
|
755
|
+
error: res_error,
|
|
756
|
+
} = ThemeModel.ThemesListingResponseSchema().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 getPublicThemes",
|
|
765
|
+
});
|
|
766
|
+
Logger({ level: "WARN", message: res_error });
|
|
767
|
+
}
|
|
768
|
+
|
|
769
|
+
return response;
|
|
522
770
|
}
|
|
523
771
|
|
|
524
772
|
/**
|
|
525
773
|
* @param {Object} arg - Arg object.
|
|
526
774
|
* @param {ThemesSchema} arg.body
|
|
775
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
527
776
|
* @summary: Create a new theme
|
|
528
777
|
* @description: Themes improve the look and appearance of a website. Use this API to create a theme.
|
|
529
778
|
*/
|
|
530
|
-
createTheme({ body } = {}) {
|
|
779
|
+
async createTheme({ body } = {}) {
|
|
531
780
|
const { error } = ThemeValidator.createTheme().validate(
|
|
532
781
|
{
|
|
533
782
|
body,
|
|
@@ -546,27 +795,46 @@ class Theme {
|
|
|
546
795
|
{ abortEarly: false, allowUnknown: false }
|
|
547
796
|
);
|
|
548
797
|
if (warrning) {
|
|
549
|
-
|
|
550
|
-
|
|
798
|
+
Logger({
|
|
799
|
+
level: "WARN",
|
|
800
|
+
message: "Parameter Validation warrnings for createTheme",
|
|
801
|
+
});
|
|
802
|
+
Logger({ level: "WARN", message: warrning });
|
|
551
803
|
}
|
|
552
804
|
|
|
553
805
|
const query_params = {};
|
|
554
806
|
|
|
555
|
-
|
|
807
|
+
const response = await PlatformAPIClient.execute(
|
|
556
808
|
this.config,
|
|
557
809
|
"post",
|
|
558
810
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/`,
|
|
559
811
|
query_params,
|
|
560
812
|
body
|
|
561
813
|
);
|
|
814
|
+
|
|
815
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
816
|
+
abortEarly: false,
|
|
817
|
+
allowUnknown: false,
|
|
818
|
+
});
|
|
819
|
+
|
|
820
|
+
if (res_error) {
|
|
821
|
+
Logger({
|
|
822
|
+
level: "WARN",
|
|
823
|
+
message: "Response Validation Warnnings for createTheme",
|
|
824
|
+
});
|
|
825
|
+
Logger({ level: "WARN", message: res_error });
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
return response;
|
|
562
829
|
}
|
|
563
830
|
|
|
564
831
|
/**
|
|
565
832
|
* @param {Object} arg - Arg object.
|
|
833
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
566
834
|
* @summary: Get the applied theme
|
|
567
835
|
* @description: Use this API to retrieve the theme that is currently applied to the website along with its details.
|
|
568
836
|
*/
|
|
569
|
-
getAppliedTheme({} = {}) {
|
|
837
|
+
async getAppliedTheme({} = {}) {
|
|
570
838
|
const { error } = ThemeValidator.getAppliedTheme().validate(
|
|
571
839
|
{},
|
|
572
840
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -581,27 +849,46 @@ class Theme {
|
|
|
581
849
|
{ abortEarly: false, allowUnknown: false }
|
|
582
850
|
);
|
|
583
851
|
if (warrning) {
|
|
584
|
-
|
|
585
|
-
|
|
852
|
+
Logger({
|
|
853
|
+
level: "WARN",
|
|
854
|
+
message: "Parameter Validation warrnings for getAppliedTheme",
|
|
855
|
+
});
|
|
856
|
+
Logger({ level: "WARN", message: warrning });
|
|
586
857
|
}
|
|
587
858
|
|
|
588
859
|
const query_params = {};
|
|
589
860
|
|
|
590
|
-
|
|
861
|
+
const response = await PlatformAPIClient.execute(
|
|
591
862
|
this.config,
|
|
592
863
|
"get",
|
|
593
864
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/`,
|
|
594
865
|
query_params,
|
|
595
866
|
undefined
|
|
596
867
|
);
|
|
868
|
+
|
|
869
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
870
|
+
abortEarly: false,
|
|
871
|
+
allowUnknown: false,
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
if (res_error) {
|
|
875
|
+
Logger({
|
|
876
|
+
level: "WARN",
|
|
877
|
+
message: "Response Validation Warnnings for getAppliedTheme",
|
|
878
|
+
});
|
|
879
|
+
Logger({ level: "WARN", message: res_error });
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
return response;
|
|
597
883
|
}
|
|
598
884
|
|
|
599
885
|
/**
|
|
600
886
|
* @param {Object} arg - Arg object.
|
|
887
|
+
* @returns {Promise<FontsSchema>} - Success response
|
|
601
888
|
* @summary: Get all the supported fonts in a theme
|
|
602
889
|
* @description: Font is a collection of characters with a similar design. Use this API to retrieve a list of website fonts.
|
|
603
890
|
*/
|
|
604
|
-
getFonts({} = {}) {
|
|
891
|
+
async getFonts({} = {}) {
|
|
605
892
|
const { error } = ThemeValidator.getFonts().validate(
|
|
606
893
|
{},
|
|
607
894
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -616,28 +903,47 @@ class Theme {
|
|
|
616
903
|
{ abortEarly: false, allowUnknown: false }
|
|
617
904
|
);
|
|
618
905
|
if (warrning) {
|
|
619
|
-
|
|
620
|
-
|
|
906
|
+
Logger({
|
|
907
|
+
level: "WARN",
|
|
908
|
+
message: "Parameter Validation warrnings for getFonts",
|
|
909
|
+
});
|
|
910
|
+
Logger({ level: "WARN", message: warrning });
|
|
621
911
|
}
|
|
622
912
|
|
|
623
913
|
const query_params = {};
|
|
624
914
|
|
|
625
|
-
|
|
915
|
+
const response = await PlatformAPIClient.execute(
|
|
626
916
|
this.config,
|
|
627
917
|
"get",
|
|
628
918
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/fonts`,
|
|
629
919
|
query_params,
|
|
630
920
|
undefined
|
|
631
921
|
);
|
|
922
|
+
|
|
923
|
+
const { error: res_error } = ThemeModel.FontsSchema().validate(response, {
|
|
924
|
+
abortEarly: false,
|
|
925
|
+
allowUnknown: false,
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
if (res_error) {
|
|
929
|
+
Logger({
|
|
930
|
+
level: "WARN",
|
|
931
|
+
message: "Response Validation Warnnings for getFonts",
|
|
932
|
+
});
|
|
933
|
+
Logger({ level: "WARN", message: res_error });
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
return response;
|
|
632
937
|
}
|
|
633
938
|
|
|
634
939
|
/**
|
|
635
940
|
* @param {Object} arg - Arg object.
|
|
636
941
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
942
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
637
943
|
* @summary: Gets theme by id
|
|
638
944
|
* @description: Use this API to retrieve the details of a specific theme by using its ID.
|
|
639
945
|
*/
|
|
640
|
-
getThemeById({ themeId } = {}) {
|
|
946
|
+
async getThemeById({ themeId } = {}) {
|
|
641
947
|
const { error } = ThemeValidator.getThemeById().validate(
|
|
642
948
|
{
|
|
643
949
|
themeId,
|
|
@@ -656,29 +962,48 @@ class Theme {
|
|
|
656
962
|
{ abortEarly: false, allowUnknown: false }
|
|
657
963
|
);
|
|
658
964
|
if (warrning) {
|
|
659
|
-
|
|
660
|
-
|
|
965
|
+
Logger({
|
|
966
|
+
level: "WARN",
|
|
967
|
+
message: "Parameter Validation warrnings for getThemeById",
|
|
968
|
+
});
|
|
969
|
+
Logger({ level: "WARN", message: warrning });
|
|
661
970
|
}
|
|
662
971
|
|
|
663
972
|
const query_params = {};
|
|
664
973
|
|
|
665
|
-
|
|
974
|
+
const response = await PlatformAPIClient.execute(
|
|
666
975
|
this.config,
|
|
667
976
|
"get",
|
|
668
977
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}`,
|
|
669
978
|
query_params,
|
|
670
979
|
undefined
|
|
671
980
|
);
|
|
981
|
+
|
|
982
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
983
|
+
abortEarly: false,
|
|
984
|
+
allowUnknown: false,
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
if (res_error) {
|
|
988
|
+
Logger({
|
|
989
|
+
level: "WARN",
|
|
990
|
+
message: "Response Validation Warnnings for getThemeById",
|
|
991
|
+
});
|
|
992
|
+
Logger({ level: "WARN", message: res_error });
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
return response;
|
|
672
996
|
}
|
|
673
997
|
|
|
674
998
|
/**
|
|
675
999
|
* @param {Object} arg - Arg object.
|
|
676
1000
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
677
1001
|
* @param {ThemesSchema} arg.body
|
|
1002
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
678
1003
|
* @summary: Update a theme
|
|
679
1004
|
* @description: Use this API to edit an existing theme. You can customize the website font, sections, images, styles, and many more.
|
|
680
1005
|
*/
|
|
681
|
-
updateTheme({ themeId, body } = {}) {
|
|
1006
|
+
async updateTheme({ themeId, body } = {}) {
|
|
682
1007
|
const { error } = ThemeValidator.updateTheme().validate(
|
|
683
1008
|
{
|
|
684
1009
|
themeId,
|
|
@@ -699,28 +1024,47 @@ class Theme {
|
|
|
699
1024
|
{ abortEarly: false, allowUnknown: false }
|
|
700
1025
|
);
|
|
701
1026
|
if (warrning) {
|
|
702
|
-
|
|
703
|
-
|
|
1027
|
+
Logger({
|
|
1028
|
+
level: "WARN",
|
|
1029
|
+
message: "Parameter Validation warrnings for updateTheme",
|
|
1030
|
+
});
|
|
1031
|
+
Logger({ level: "WARN", message: warrning });
|
|
704
1032
|
}
|
|
705
1033
|
|
|
706
1034
|
const query_params = {};
|
|
707
1035
|
|
|
708
|
-
|
|
1036
|
+
const response = await PlatformAPIClient.execute(
|
|
709
1037
|
this.config,
|
|
710
1038
|
"put",
|
|
711
1039
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}`,
|
|
712
1040
|
query_params,
|
|
713
1041
|
body
|
|
714
1042
|
);
|
|
1043
|
+
|
|
1044
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1045
|
+
abortEarly: false,
|
|
1046
|
+
allowUnknown: false,
|
|
1047
|
+
});
|
|
1048
|
+
|
|
1049
|
+
if (res_error) {
|
|
1050
|
+
Logger({
|
|
1051
|
+
level: "WARN",
|
|
1052
|
+
message: "Response Validation Warnnings for updateTheme",
|
|
1053
|
+
});
|
|
1054
|
+
Logger({ level: "WARN", message: res_error });
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
return response;
|
|
715
1058
|
}
|
|
716
1059
|
|
|
717
1060
|
/**
|
|
718
1061
|
* @param {Object} arg - Arg object.
|
|
719
1062
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1063
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
720
1064
|
* @summary: Delete a theme
|
|
721
1065
|
* @description: Use this API to delete a theme from the theme library.
|
|
722
1066
|
*/
|
|
723
|
-
deleteTheme({ themeId } = {}) {
|
|
1067
|
+
async deleteTheme({ themeId } = {}) {
|
|
724
1068
|
const { error } = ThemeValidator.deleteTheme().validate(
|
|
725
1069
|
{
|
|
726
1070
|
themeId,
|
|
@@ -739,28 +1083,47 @@ class Theme {
|
|
|
739
1083
|
{ abortEarly: false, allowUnknown: false }
|
|
740
1084
|
);
|
|
741
1085
|
if (warrning) {
|
|
742
|
-
|
|
743
|
-
|
|
1086
|
+
Logger({
|
|
1087
|
+
level: "WARN",
|
|
1088
|
+
message: "Parameter Validation warrnings for deleteTheme",
|
|
1089
|
+
});
|
|
1090
|
+
Logger({ level: "WARN", message: warrning });
|
|
744
1091
|
}
|
|
745
1092
|
|
|
746
1093
|
const query_params = {};
|
|
747
1094
|
|
|
748
|
-
|
|
1095
|
+
const response = await PlatformAPIClient.execute(
|
|
749
1096
|
this.config,
|
|
750
1097
|
"delete",
|
|
751
1098
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}`,
|
|
752
1099
|
query_params,
|
|
753
1100
|
undefined
|
|
754
1101
|
);
|
|
1102
|
+
|
|
1103
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1104
|
+
abortEarly: false,
|
|
1105
|
+
allowUnknown: false,
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1108
|
+
if (res_error) {
|
|
1109
|
+
Logger({
|
|
1110
|
+
level: "WARN",
|
|
1111
|
+
message: "Response Validation Warnnings for deleteTheme",
|
|
1112
|
+
});
|
|
1113
|
+
Logger({ level: "WARN", message: res_error });
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
return response;
|
|
755
1117
|
}
|
|
756
1118
|
|
|
757
1119
|
/**
|
|
758
1120
|
* @param {Object} arg - Arg object.
|
|
759
1121
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1122
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
760
1123
|
* @summary: Get a theme preview
|
|
761
1124
|
* @description: A theme can be previewed before applying it. Use this API to retrieve the theme preview by using its ID.
|
|
762
1125
|
*/
|
|
763
|
-
getThemeForPreview({ themeId } = {}) {
|
|
1126
|
+
async getThemeForPreview({ themeId } = {}) {
|
|
764
1127
|
const { error } = ThemeValidator.getThemeForPreview().validate(
|
|
765
1128
|
{
|
|
766
1129
|
themeId,
|
|
@@ -779,28 +1142,47 @@ class Theme {
|
|
|
779
1142
|
{ abortEarly: false, allowUnknown: false }
|
|
780
1143
|
);
|
|
781
1144
|
if (warrning) {
|
|
782
|
-
|
|
783
|
-
|
|
1145
|
+
Logger({
|
|
1146
|
+
level: "WARN",
|
|
1147
|
+
message: "Parameter Validation warrnings for getThemeForPreview",
|
|
1148
|
+
});
|
|
1149
|
+
Logger({ level: "WARN", message: warrning });
|
|
784
1150
|
}
|
|
785
1151
|
|
|
786
1152
|
const query_params = {};
|
|
787
1153
|
|
|
788
|
-
|
|
1154
|
+
const response = await PlatformAPIClient.execute(
|
|
789
1155
|
this.config,
|
|
790
1156
|
"get",
|
|
791
1157
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/preview`,
|
|
792
1158
|
query_params,
|
|
793
1159
|
undefined
|
|
794
1160
|
);
|
|
1161
|
+
|
|
1162
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1163
|
+
abortEarly: false,
|
|
1164
|
+
allowUnknown: false,
|
|
1165
|
+
});
|
|
1166
|
+
|
|
1167
|
+
if (res_error) {
|
|
1168
|
+
Logger({
|
|
1169
|
+
level: "WARN",
|
|
1170
|
+
message: "Response Validation Warnnings for getThemeForPreview",
|
|
1171
|
+
});
|
|
1172
|
+
Logger({ level: "WARN", message: res_error });
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
return response;
|
|
795
1176
|
}
|
|
796
1177
|
|
|
797
1178
|
/**
|
|
798
1179
|
* @param {Object} arg - Arg object.
|
|
799
1180
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1181
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
800
1182
|
* @summary: Publish a theme
|
|
801
1183
|
* @description: Use this API to publish a theme that is either newly created or edited.
|
|
802
1184
|
*/
|
|
803
|
-
publishTheme({ themeId } = {}) {
|
|
1185
|
+
async publishTheme({ themeId } = {}) {
|
|
804
1186
|
const { error } = ThemeValidator.publishTheme().validate(
|
|
805
1187
|
{
|
|
806
1188
|
themeId,
|
|
@@ -819,28 +1201,47 @@ class Theme {
|
|
|
819
1201
|
{ abortEarly: false, allowUnknown: false }
|
|
820
1202
|
);
|
|
821
1203
|
if (warrning) {
|
|
822
|
-
|
|
823
|
-
|
|
1204
|
+
Logger({
|
|
1205
|
+
level: "WARN",
|
|
1206
|
+
message: "Parameter Validation warrnings for publishTheme",
|
|
1207
|
+
});
|
|
1208
|
+
Logger({ level: "WARN", message: warrning });
|
|
824
1209
|
}
|
|
825
1210
|
|
|
826
1211
|
const query_params = {};
|
|
827
1212
|
|
|
828
|
-
|
|
1213
|
+
const response = await PlatformAPIClient.execute(
|
|
829
1214
|
this.config,
|
|
830
1215
|
"put",
|
|
831
1216
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/publish`,
|
|
832
1217
|
query_params,
|
|
833
1218
|
undefined
|
|
834
1219
|
);
|
|
1220
|
+
|
|
1221
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1222
|
+
abortEarly: false,
|
|
1223
|
+
allowUnknown: false,
|
|
1224
|
+
});
|
|
1225
|
+
|
|
1226
|
+
if (res_error) {
|
|
1227
|
+
Logger({
|
|
1228
|
+
level: "WARN",
|
|
1229
|
+
message: "Response Validation Warnnings for publishTheme",
|
|
1230
|
+
});
|
|
1231
|
+
Logger({ level: "WARN", message: res_error });
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
return response;
|
|
835
1235
|
}
|
|
836
1236
|
|
|
837
1237
|
/**
|
|
838
1238
|
* @param {Object} arg - Arg object.
|
|
839
1239
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1240
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
840
1241
|
* @summary: Unpublish a theme
|
|
841
1242
|
* @description: Use this API to remove an existing theme from the list of available themes.
|
|
842
1243
|
*/
|
|
843
|
-
unpublishTheme({ themeId } = {}) {
|
|
1244
|
+
async unpublishTheme({ themeId } = {}) {
|
|
844
1245
|
const { error } = ThemeValidator.unpublishTheme().validate(
|
|
845
1246
|
{
|
|
846
1247
|
themeId,
|
|
@@ -859,28 +1260,47 @@ class Theme {
|
|
|
859
1260
|
{ abortEarly: false, allowUnknown: false }
|
|
860
1261
|
);
|
|
861
1262
|
if (warrning) {
|
|
862
|
-
|
|
863
|
-
|
|
1263
|
+
Logger({
|
|
1264
|
+
level: "WARN",
|
|
1265
|
+
message: "Parameter Validation warrnings for unpublishTheme",
|
|
1266
|
+
});
|
|
1267
|
+
Logger({ level: "WARN", message: warrning });
|
|
864
1268
|
}
|
|
865
1269
|
|
|
866
1270
|
const query_params = {};
|
|
867
1271
|
|
|
868
|
-
|
|
1272
|
+
const response = await PlatformAPIClient.execute(
|
|
869
1273
|
this.config,
|
|
870
1274
|
"put",
|
|
871
1275
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/unpublish`,
|
|
872
1276
|
query_params,
|
|
873
1277
|
undefined
|
|
874
1278
|
);
|
|
1279
|
+
|
|
1280
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1281
|
+
abortEarly: false,
|
|
1282
|
+
allowUnknown: false,
|
|
1283
|
+
});
|
|
1284
|
+
|
|
1285
|
+
if (res_error) {
|
|
1286
|
+
Logger({
|
|
1287
|
+
level: "WARN",
|
|
1288
|
+
message: "Response Validation Warnnings for unpublishTheme",
|
|
1289
|
+
});
|
|
1290
|
+
Logger({ level: "WARN", message: res_error });
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
return response;
|
|
875
1294
|
}
|
|
876
1295
|
|
|
877
1296
|
/**
|
|
878
1297
|
* @param {Object} arg - Arg object.
|
|
879
1298
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1299
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
880
1300
|
* @summary: Archive a theme
|
|
881
1301
|
* @description: Use this API to store an existing theme but not delete it so that it can be used in future if required.
|
|
882
1302
|
*/
|
|
883
|
-
archiveTheme({ themeId } = {}) {
|
|
1303
|
+
async archiveTheme({ themeId } = {}) {
|
|
884
1304
|
const { error } = ThemeValidator.archiveTheme().validate(
|
|
885
1305
|
{
|
|
886
1306
|
themeId,
|
|
@@ -899,28 +1319,47 @@ class Theme {
|
|
|
899
1319
|
{ abortEarly: false, allowUnknown: false }
|
|
900
1320
|
);
|
|
901
1321
|
if (warrning) {
|
|
902
|
-
|
|
903
|
-
|
|
1322
|
+
Logger({
|
|
1323
|
+
level: "WARN",
|
|
1324
|
+
message: "Parameter Validation warrnings for archiveTheme",
|
|
1325
|
+
});
|
|
1326
|
+
Logger({ level: "WARN", message: warrning });
|
|
904
1327
|
}
|
|
905
1328
|
|
|
906
1329
|
const query_params = {};
|
|
907
1330
|
|
|
908
|
-
|
|
1331
|
+
const response = await PlatformAPIClient.execute(
|
|
909
1332
|
this.config,
|
|
910
1333
|
"put",
|
|
911
1334
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/archive`,
|
|
912
1335
|
query_params,
|
|
913
1336
|
undefined
|
|
914
1337
|
);
|
|
1338
|
+
|
|
1339
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1340
|
+
abortEarly: false,
|
|
1341
|
+
allowUnknown: false,
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
if (res_error) {
|
|
1345
|
+
Logger({
|
|
1346
|
+
level: "WARN",
|
|
1347
|
+
message: "Response Validation Warnnings for archiveTheme",
|
|
1348
|
+
});
|
|
1349
|
+
Logger({ level: "WARN", message: res_error });
|
|
1350
|
+
}
|
|
1351
|
+
|
|
1352
|
+
return response;
|
|
915
1353
|
}
|
|
916
1354
|
|
|
917
1355
|
/**
|
|
918
1356
|
* @param {Object} arg - Arg object.
|
|
919
1357
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1358
|
+
* @returns {Promise<ThemesSchema>} - Success response
|
|
920
1359
|
* @summary: Unarchive a theme
|
|
921
1360
|
* @description: Use this API to restore an archived theme and bring it back for editing or publishing.
|
|
922
1361
|
*/
|
|
923
|
-
unarchiveTheme({ themeId } = {}) {
|
|
1362
|
+
async unarchiveTheme({ themeId } = {}) {
|
|
924
1363
|
const { error } = ThemeValidator.unarchiveTheme().validate(
|
|
925
1364
|
{
|
|
926
1365
|
themeId,
|
|
@@ -939,28 +1378,47 @@ class Theme {
|
|
|
939
1378
|
{ abortEarly: false, allowUnknown: false }
|
|
940
1379
|
);
|
|
941
1380
|
if (warrning) {
|
|
942
|
-
|
|
943
|
-
|
|
1381
|
+
Logger({
|
|
1382
|
+
level: "WARN",
|
|
1383
|
+
message: "Parameter Validation warrnings for unarchiveTheme",
|
|
1384
|
+
});
|
|
1385
|
+
Logger({ level: "WARN", message: warrning });
|
|
944
1386
|
}
|
|
945
1387
|
|
|
946
1388
|
const query_params = {};
|
|
947
1389
|
|
|
948
|
-
|
|
1390
|
+
const response = await PlatformAPIClient.execute(
|
|
949
1391
|
this.config,
|
|
950
1392
|
"put",
|
|
951
1393
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/unarchive`,
|
|
952
1394
|
query_params,
|
|
953
1395
|
undefined
|
|
954
1396
|
);
|
|
1397
|
+
|
|
1398
|
+
const { error: res_error } = ThemeModel.ThemesSchema().validate(response, {
|
|
1399
|
+
abortEarly: false,
|
|
1400
|
+
allowUnknown: false,
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
if (res_error) {
|
|
1404
|
+
Logger({
|
|
1405
|
+
level: "WARN",
|
|
1406
|
+
message: "Response Validation Warnnings for unarchiveTheme",
|
|
1407
|
+
});
|
|
1408
|
+
Logger({ level: "WARN", message: res_error });
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
return response;
|
|
955
1412
|
}
|
|
956
1413
|
|
|
957
1414
|
/**
|
|
958
1415
|
* @param {Object} arg - Arg object.
|
|
959
1416
|
* @param {string} arg.themeId - ID allotted to the theme.
|
|
1417
|
+
* @returns {Promise<any>} - Success response
|
|
960
1418
|
* @summary: Fetch last modified timestamp
|
|
961
1419
|
* @description: Use this API to fetch Last-Modified timestamp in header metadata.
|
|
962
1420
|
*/
|
|
963
|
-
getThemeLastModified({ themeId } = {}) {
|
|
1421
|
+
async getThemeLastModified({ themeId } = {}) {
|
|
964
1422
|
const { error } = ThemeValidator.getThemeLastModified().validate(
|
|
965
1423
|
{
|
|
966
1424
|
themeId,
|
|
@@ -979,19 +1437,36 @@ class Theme {
|
|
|
979
1437
|
{ abortEarly: false, allowUnknown: false }
|
|
980
1438
|
);
|
|
981
1439
|
if (warrning) {
|
|
982
|
-
|
|
983
|
-
|
|
1440
|
+
Logger({
|
|
1441
|
+
level: "WARN",
|
|
1442
|
+
message: "Parameter Validation warrnings for getThemeLastModified",
|
|
1443
|
+
});
|
|
1444
|
+
Logger({ level: "WARN", message: warrning });
|
|
984
1445
|
}
|
|
985
1446
|
|
|
986
1447
|
const query_params = {};
|
|
987
1448
|
|
|
988
|
-
|
|
1449
|
+
const response = await PlatformAPIClient.execute(
|
|
989
1450
|
this.config,
|
|
990
1451
|
"head",
|
|
991
1452
|
`/service/platform/theme/v1.0/company/${this.config.companyId}/application/${this.applicationId}/${themeId}/polling`,
|
|
992
1453
|
query_params,
|
|
993
1454
|
undefined
|
|
994
1455
|
);
|
|
1456
|
+
|
|
1457
|
+
const { error: res_error } = Joi.string()
|
|
1458
|
+
.allow("")
|
|
1459
|
+
.validate(response, { abortEarly: false, allowUnknown: false });
|
|
1460
|
+
|
|
1461
|
+
if (res_error) {
|
|
1462
|
+
Logger({
|
|
1463
|
+
level: "WARN",
|
|
1464
|
+
message: "Response Validation Warnnings for getThemeLastModified",
|
|
1465
|
+
});
|
|
1466
|
+
Logger({ level: "WARN", message: res_error });
|
|
1467
|
+
}
|
|
1468
|
+
|
|
1469
|
+
return response;
|
|
995
1470
|
}
|
|
996
1471
|
}
|
|
997
1472
|
module.exports = Theme;
|