@gofynd/fdk-client-javascript 1.6.3 → 2.0.0
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/README.md +1 -1
- package/package.json +1 -1
- package/sdk/application/Cart/CartApplicationClient.d.ts +5 -5
- package/sdk/application/Cart/CartApplicationClient.js +26 -268
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +20 -20
- package/sdk/application/Catalog/CatalogApplicationClient.js +98 -347
- package/sdk/application/Common/CommonApplicationClient.js +1 -16
- package/sdk/application/Communication/CommunicationApplicationClient.js +1 -24
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +24 -2
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +58 -137
- package/sdk/application/Content/ContentApplicationClient.d.ts +47 -7
- package/sdk/application/Content/ContentApplicationClient.js +222 -191
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +2 -2
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +11 -30
- package/sdk/application/Finance/FinanceApplicationClient.js +1 -16
- package/sdk/application/Lead/LeadApplicationClient.d.ts +4 -4
- package/sdk/application/Lead/LeadApplicationClient.js +21 -52
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +16 -56
- package/sdk/application/Logistic/LogisticApplicationClient.js +57 -332
- package/sdk/application/Order/OrderApplicationClient.d.ts +11 -11
- package/sdk/application/Order/OrderApplicationClient.js +68 -153
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +2 -12
- package/sdk/application/Payment/PaymentApplicationClient.js +7 -487
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +1 -1
- package/sdk/application/Rewards/RewardsApplicationClient.js +6 -59
- package/sdk/application/Share/ShareApplicationClient.d.ts +4 -4
- package/sdk/application/Share/ShareApplicationClient.js +21 -75
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +3 -3
- package/sdk/application/Theme/ThemeApplicationClient.js +19 -47
- package/sdk/application/User/UserApplicationClient.js +1 -407
- package/sdk/application/Webhook/WebhookApplicationClient.js +1 -8
- package/sdk/common/Utility.d.ts +1 -1
- package/sdk/common/Utility.js +4 -4
- package/sdk/common/Validator.d.ts +1 -0
- package/sdk/common/Validator.js +20 -0
- package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +1 -55
- package/sdk/partner/FileStorage/FileStoragePartnerClient.js +1 -408
- package/sdk/partner/FileStorage/FileStoragePartnerValidator.d.ts +0 -5
- package/sdk/partner/FileStorage/FileStoragePartnerValidator.js +0 -37
- package/sdk/partner/Lead/LeadPartnerModel.d.ts +5 -0
- package/sdk/partner/Lead/LeadPartnerModel.js +2 -0
- package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +29 -25
- package/sdk/partner/Logistics/LogisticsPartnerClient.js +65 -42
- package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +1008 -794
- package/sdk/partner/Logistics/LogisticsPartnerModel.js +573 -460
- package/sdk/partner/Logistics/LogisticsPartnerValidator.js +10 -5
- package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +64 -1
- package/sdk/partner/Webhook/WebhookPartnerModel.js +36 -0
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +5 -0
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +2 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +67 -9
- package/sdk/platform/Cart/CartPlatformModel.js +38 -5
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformClient.js +4 -4
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +47 -13
- package/sdk/platform/Catalog/CatalogPlatformModel.js +29 -7
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +2 -2
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +7 -4
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +71 -7
- package/sdk/platform/Communication/CommunicationPlatformModel.js +70 -6
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +0 -27
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +8 -60
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +31 -20
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +18 -18
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +1 -1
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -3
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +13 -0
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +30 -1
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +68 -11
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +49 -7
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +169 -0
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1279 -132
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +156 -1
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +180 -0
- package/sdk/platform/Content/ContentPlatformClient.d.ts +162 -0
- package/sdk/platform/Content/ContentPlatformClient.js +1697 -497
- package/sdk/platform/Content/ContentPlatformModel.d.ts +1053 -35
- package/sdk/platform/Content/ContentPlatformModel.js +717 -34
- package/sdk/platform/Content/ContentPlatformValidator.d.ts +127 -1
- package/sdk/platform/Content/ContentPlatformValidator.js +171 -0
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +34 -0
- package/sdk/platform/Discount/DiscountPlatformClient.js +59 -0
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +365 -93
- package/sdk/platform/Discount/DiscountPlatformModel.js +98 -93
- package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +54 -34
- package/sdk/platform/Discount/DiscountPlatformValidator.js +27 -17
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +0 -156
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +0 -1072
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -137
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +0 -173
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +1 -1105
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +0 -1125
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +5 -0
- package/sdk/platform/Lead/LeadPlatformModel.js +2 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
- package/sdk/platform/Order/OrderPlatformClient.d.ts +212 -0
- package/sdk/platform/Order/OrderPlatformClient.js +397 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +66 -10
- package/sdk/platform/Order/OrderPlatformModel.js +39 -7
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +58 -10
- package/sdk/platform/Partner/PartnerPlatformModel.js +19 -10
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +12 -2
- package/sdk/platform/Payment/PaymentPlatformModel.js +8 -2
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +5 -0
- package/sdk/platform/Rewards/RewardsPlatformModel.js +2 -0
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +240 -24
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +1753 -277
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +320 -22
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +269 -19
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +53 -104
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +201 -629
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +5720 -2891
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +3414 -2181
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +138 -216
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +81 -148
- package/sdk/platform/Share/SharePlatformModel.d.ts +5 -0
- package/sdk/platform/Share/SharePlatformModel.js +2 -0
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +73 -0
- package/sdk/platform/User/UserPlatformApplicationClient.js +543 -0
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +129 -1
- package/sdk/platform/User/UserPlatformApplicationValidator.js +97 -0
- package/sdk/platform/User/UserPlatformModel.d.ts +269 -6
- package/sdk/platform/User/UserPlatformModel.js +187 -5
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +64 -1
- package/sdk/platform/Webhook/WebhookPlatformModel.js +36 -0
- package/sdk/public/Catalog/CatalogPublicClient.d.ts +1 -1
- package/sdk/public/Catalog/CatalogPublicClient.js +6 -11
- package/sdk/public/Configuration/ConfigurationPublicClient.js +1 -16
- package/sdk/public/Content/ContentPublicClient.d.ts +36 -3
- package/sdk/public/Content/ContentPublicClient.js +261 -104
- package/sdk/public/Content/ContentPublicModel.d.ts +155 -1
- package/sdk/public/Content/ContentPublicModel.js +102 -0
- package/sdk/public/Content/ContentPublicValidator.d.ts +18 -1
- package/sdk/public/Content/ContentPublicValidator.js +26 -0
- package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
- package/sdk/public/Partner/PartnerPublicClient.js +6 -11
- package/sdk/public/Partner/PartnerPublicModel.d.ts +248 -72
- package/sdk/public/Partner/PartnerPublicModel.js +81 -71
- package/sdk/public/Partner/PartnerPublicValidator.d.ts +2 -2
- package/sdk/public/Partner/PartnerPublicValidator.js +1 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +1 -40
|
@@ -6,6 +6,7 @@ const {
|
|
|
6
6
|
const PublicAPIClient = require("../PublicAPIClient");
|
|
7
7
|
const constructUrl = require("../constructUrl");
|
|
8
8
|
const Paginator = require("../../common/Paginator");
|
|
9
|
+
const { validateRequiredParams } = require("../../common/Validator");
|
|
9
10
|
|
|
10
11
|
const ContentPublicValidator = require("./ContentPublicValidator");
|
|
11
12
|
const ContentPublicModel = require("./ContentPublicModel");
|
|
@@ -16,7 +17,10 @@ class Content {
|
|
|
16
17
|
constructor(_conf) {
|
|
17
18
|
this._conf = _conf;
|
|
18
19
|
this._relativeUrls = {
|
|
20
|
+
getAllLanguages: "/service/public/content/languages",
|
|
19
21
|
getAllTags: "/service/public/content/tags",
|
|
22
|
+
getAllTranslatableResources:
|
|
23
|
+
"/service/public/content/translatable/resources",
|
|
20
24
|
getAnalyticsTags: "/service/public/content/analytics-tags",
|
|
21
25
|
getBasicDetails: "/service/public/content/basic-details",
|
|
22
26
|
getCredentialsByEntity:
|
|
@@ -24,6 +28,7 @@ class Content {
|
|
|
24
28
|
getCustomPage: "/service/public/content/custom-pages/{slug}",
|
|
25
29
|
getFooterContent: "/service/public/content/footer",
|
|
26
30
|
getHomePageContent: "/service/public/content/home-page",
|
|
31
|
+
getLanguageByLocale: "/service/public/content/languages/{locale}",
|
|
27
32
|
getMenuContent: "/service/public/content/menu",
|
|
28
33
|
getMenuContentByType: "/service/public/content/menu/{type}",
|
|
29
34
|
getNavbar: "/service/public/content/navbar",
|
|
@@ -45,6 +50,82 @@ class Content {
|
|
|
45
50
|
};
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
/**
|
|
54
|
+
* @param {ContentPublicValidator.GetAllLanguagesParam} arg - Arg object.
|
|
55
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
56
|
+
* @param {import("../PublicAPIClient").Options} - Options
|
|
57
|
+
* @returns {Promise<Object>} - Success response
|
|
58
|
+
* @name getAllLanguages
|
|
59
|
+
* @summary: Get All Languages
|
|
60
|
+
* @description: Fetches complete list of languages supported by the platform with their locale codes and text directions. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/content/getAllLanguages/).
|
|
61
|
+
*/
|
|
62
|
+
async getAllLanguages(
|
|
63
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
64
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
65
|
+
) {
|
|
66
|
+
const { error } = ContentPublicValidator.getAllLanguages().validate(
|
|
67
|
+
{},
|
|
68
|
+
{ abortEarly: false, allowUnknown: true }
|
|
69
|
+
);
|
|
70
|
+
if (error) {
|
|
71
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Showing warrnings if extra unknown parameters are found
|
|
75
|
+
const {
|
|
76
|
+
error: warrning,
|
|
77
|
+
} = ContentPublicValidator.getAllLanguages().validate(
|
|
78
|
+
{},
|
|
79
|
+
{ abortEarly: false, allowUnknown: false }
|
|
80
|
+
);
|
|
81
|
+
if (warrning) {
|
|
82
|
+
Logger({
|
|
83
|
+
level: "WARN",
|
|
84
|
+
message: `Parameter Validation warrnings for public > Content > getAllLanguages \n ${warrning}`,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const query_params = {};
|
|
89
|
+
|
|
90
|
+
const xHeaders = {};
|
|
91
|
+
|
|
92
|
+
const response = await PublicAPIClient.execute(
|
|
93
|
+
this._conf,
|
|
94
|
+
"get",
|
|
95
|
+
constructUrl({
|
|
96
|
+
url: this._urls["getAllLanguages"],
|
|
97
|
+
params: {},
|
|
98
|
+
}),
|
|
99
|
+
query_params,
|
|
100
|
+
undefined,
|
|
101
|
+
{ ...xHeaders, ...requestHeaders },
|
|
102
|
+
{ responseHeaders }
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
let responseData = response;
|
|
106
|
+
if (responseHeaders) {
|
|
107
|
+
responseData = response[0];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
111
|
+
abortEarly: false,
|
|
112
|
+
allowUnknown: true,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (res_error) {
|
|
116
|
+
if (this._conf.options.strictResponseCheck === true) {
|
|
117
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
118
|
+
} else {
|
|
119
|
+
Logger({
|
|
120
|
+
level: "WARN",
|
|
121
|
+
message: `Response Validation Warnings for public > Content > getAllLanguages \n ${res_error}`,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
return response;
|
|
127
|
+
}
|
|
128
|
+
|
|
48
129
|
/**
|
|
49
130
|
* @param {ContentPublicValidator.GetAllTagsParam} arg - Arg object.
|
|
50
131
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -58,14 +139,6 @@ class Content {
|
|
|
58
139
|
{ requestHeaders } = { requestHeaders: {} },
|
|
59
140
|
{ responseHeaders } = { responseHeaders: false }
|
|
60
141
|
) {
|
|
61
|
-
let invalidInput = [];
|
|
62
|
-
if (invalidInput.length) {
|
|
63
|
-
const error = new Error();
|
|
64
|
-
error.message = "Missing required field";
|
|
65
|
-
error.details = invalidInput;
|
|
66
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
142
|
const { error } = ContentPublicValidator.getAllTags().validate(
|
|
70
143
|
{},
|
|
71
144
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -129,6 +202,84 @@ class Content {
|
|
|
129
202
|
return response;
|
|
130
203
|
}
|
|
131
204
|
|
|
205
|
+
/**
|
|
206
|
+
* @param {ContentPublicValidator.GetAllTranslatableResourcesParam} arg - Arg object.
|
|
207
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
208
|
+
* @param {import("../PublicAPIClient").Options} - Options
|
|
209
|
+
* @returns {Promise<Object>} - Success response
|
|
210
|
+
* @name getAllTranslatableResources
|
|
211
|
+
* @summary: Get Translatable Items
|
|
212
|
+
* @description: Retrieves all resources that can be translated across different languages in the system. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/content/getAllTranslatableResources/).
|
|
213
|
+
*/
|
|
214
|
+
async getAllTranslatableResources(
|
|
215
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
216
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
217
|
+
) {
|
|
218
|
+
const {
|
|
219
|
+
error,
|
|
220
|
+
} = ContentPublicValidator.getAllTranslatableResources().validate(
|
|
221
|
+
{},
|
|
222
|
+
{ abortEarly: false, allowUnknown: true }
|
|
223
|
+
);
|
|
224
|
+
if (error) {
|
|
225
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// Showing warrnings if extra unknown parameters are found
|
|
229
|
+
const {
|
|
230
|
+
error: warrning,
|
|
231
|
+
} = ContentPublicValidator.getAllTranslatableResources().validate(
|
|
232
|
+
{},
|
|
233
|
+
{ abortEarly: false, allowUnknown: false }
|
|
234
|
+
);
|
|
235
|
+
if (warrning) {
|
|
236
|
+
Logger({
|
|
237
|
+
level: "WARN",
|
|
238
|
+
message: `Parameter Validation warrnings for public > Content > getAllTranslatableResources \n ${warrning}`,
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
const query_params = {};
|
|
243
|
+
|
|
244
|
+
const xHeaders = {};
|
|
245
|
+
|
|
246
|
+
const response = await PublicAPIClient.execute(
|
|
247
|
+
this._conf,
|
|
248
|
+
"get",
|
|
249
|
+
constructUrl({
|
|
250
|
+
url: this._urls["getAllTranslatableResources"],
|
|
251
|
+
params: {},
|
|
252
|
+
}),
|
|
253
|
+
query_params,
|
|
254
|
+
undefined,
|
|
255
|
+
{ ...xHeaders, ...requestHeaders },
|
|
256
|
+
{ responseHeaders }
|
|
257
|
+
);
|
|
258
|
+
|
|
259
|
+
let responseData = response;
|
|
260
|
+
if (responseHeaders) {
|
|
261
|
+
responseData = response[0];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
265
|
+
abortEarly: false,
|
|
266
|
+
allowUnknown: true,
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
if (res_error) {
|
|
270
|
+
if (this._conf.options.strictResponseCheck === true) {
|
|
271
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
272
|
+
} else {
|
|
273
|
+
Logger({
|
|
274
|
+
level: "WARN",
|
|
275
|
+
message: `Response Validation Warnings for public > Content > getAllTranslatableResources \n ${res_error}`,
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
return response;
|
|
281
|
+
}
|
|
282
|
+
|
|
132
283
|
/**
|
|
133
284
|
* @param {ContentPublicValidator.GetAnalyticsTagsParam} arg - Arg object.
|
|
134
285
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -142,14 +293,6 @@ class Content {
|
|
|
142
293
|
{ requestHeaders } = { requestHeaders: {} },
|
|
143
294
|
{ responseHeaders } = { responseHeaders: false }
|
|
144
295
|
) {
|
|
145
|
-
let invalidInput = [];
|
|
146
|
-
if (invalidInput.length) {
|
|
147
|
-
const error = new Error();
|
|
148
|
-
error.message = "Missing required field";
|
|
149
|
-
error.details = invalidInput;
|
|
150
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
151
|
-
}
|
|
152
|
-
|
|
153
296
|
const { error } = ContentPublicValidator.getAnalyticsTags().validate(
|
|
154
297
|
{},
|
|
155
298
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -228,14 +371,6 @@ class Content {
|
|
|
228
371
|
{ requestHeaders } = { requestHeaders: {} },
|
|
229
372
|
{ responseHeaders } = { responseHeaders: false }
|
|
230
373
|
) {
|
|
231
|
-
let invalidInput = [];
|
|
232
|
-
if (invalidInput.length) {
|
|
233
|
-
const error = new Error();
|
|
234
|
-
error.message = "Missing required field";
|
|
235
|
-
error.details = invalidInput;
|
|
236
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
237
|
-
}
|
|
238
|
-
|
|
239
374
|
const { error } = ContentPublicValidator.getBasicDetails().validate(
|
|
240
375
|
{},
|
|
241
376
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -314,18 +449,12 @@ class Content {
|
|
|
314
449
|
{ entityType, requestHeaders } = { requestHeaders: {} },
|
|
315
450
|
{ responseHeaders } = { responseHeaders: false }
|
|
316
451
|
) {
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
path: ["entityType"],
|
|
452
|
+
const errors = validateRequiredParams(arguments[0], ["entityType"]);
|
|
453
|
+
if (errors.length > 0) {
|
|
454
|
+
const error = new FDKClientValidationError({
|
|
455
|
+
message: "Missing required field",
|
|
456
|
+
details: errors,
|
|
323
457
|
});
|
|
324
|
-
}
|
|
325
|
-
if (invalidInput.length) {
|
|
326
|
-
const error = new Error();
|
|
327
|
-
error.message = "Missing required field";
|
|
328
|
-
error.details = invalidInput;
|
|
329
458
|
return Promise.reject(new FDKClientValidationError(error));
|
|
330
459
|
}
|
|
331
460
|
|
|
@@ -407,18 +536,12 @@ class Content {
|
|
|
407
536
|
{ slug, requestHeaders } = { requestHeaders: {} },
|
|
408
537
|
{ responseHeaders } = { responseHeaders: false }
|
|
409
538
|
) {
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
path: ["slug"],
|
|
539
|
+
const errors = validateRequiredParams(arguments[0], ["slug"]);
|
|
540
|
+
if (errors.length > 0) {
|
|
541
|
+
const error = new FDKClientValidationError({
|
|
542
|
+
message: "Missing required field",
|
|
543
|
+
details: errors,
|
|
416
544
|
});
|
|
417
|
-
}
|
|
418
|
-
if (invalidInput.length) {
|
|
419
|
-
const error = new Error();
|
|
420
|
-
error.message = "Missing required field";
|
|
421
|
-
error.details = invalidInput;
|
|
422
545
|
return Promise.reject(new FDKClientValidationError(error));
|
|
423
546
|
}
|
|
424
547
|
|
|
@@ -498,14 +621,6 @@ class Content {
|
|
|
498
621
|
{ requestHeaders } = { requestHeaders: {} },
|
|
499
622
|
{ responseHeaders } = { responseHeaders: false }
|
|
500
623
|
) {
|
|
501
|
-
let invalidInput = [];
|
|
502
|
-
if (invalidInput.length) {
|
|
503
|
-
const error = new Error();
|
|
504
|
-
error.message = "Missing required field";
|
|
505
|
-
error.details = invalidInput;
|
|
506
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
507
|
-
}
|
|
508
|
-
|
|
509
624
|
const { error } = ContentPublicValidator.getFooterContent().validate(
|
|
510
625
|
{},
|
|
511
626
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -584,21 +699,6 @@ class Content {
|
|
|
584
699
|
{ pageType, requestHeaders } = { requestHeaders: {} },
|
|
585
700
|
{ responseHeaders } = { responseHeaders: false }
|
|
586
701
|
) {
|
|
587
|
-
let invalidInput = [];
|
|
588
|
-
|
|
589
|
-
if (!pageType) {
|
|
590
|
-
invalidInput.push({
|
|
591
|
-
message: `The 'pageType' field is required.`,
|
|
592
|
-
path: ["pageType"],
|
|
593
|
-
});
|
|
594
|
-
}
|
|
595
|
-
if (invalidInput.length) {
|
|
596
|
-
const error = new Error();
|
|
597
|
-
error.message = "Missing required field";
|
|
598
|
-
error.details = invalidInput;
|
|
599
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
600
|
-
}
|
|
601
|
-
|
|
602
702
|
const { error } = ContentPublicValidator.getHomePageContent().validate(
|
|
603
703
|
{ pageType },
|
|
604
704
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -665,6 +765,93 @@ class Content {
|
|
|
665
765
|
return response;
|
|
666
766
|
}
|
|
667
767
|
|
|
768
|
+
/**
|
|
769
|
+
* @param {ContentPublicValidator.GetLanguageByLocaleParam} arg - Arg object.
|
|
770
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
771
|
+
* @param {import("../PublicAPIClient").Options} - Options
|
|
772
|
+
* @returns {Promise<ContentPublicModel.Language>} - Success response
|
|
773
|
+
* @name getLanguageByLocale
|
|
774
|
+
* @summary: Get Single Language
|
|
775
|
+
* @description: Retrieves detailed information about a specific language using its locale identifier. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/content/getLanguageByLocale/).
|
|
776
|
+
*/
|
|
777
|
+
async getLanguageByLocale(
|
|
778
|
+
{ locale, requestHeaders } = { requestHeaders: {} },
|
|
779
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
780
|
+
) {
|
|
781
|
+
const errors = validateRequiredParams(arguments[0], ["locale"]);
|
|
782
|
+
if (errors.length > 0) {
|
|
783
|
+
const error = new FDKClientValidationError({
|
|
784
|
+
message: "Missing required field",
|
|
785
|
+
details: errors,
|
|
786
|
+
});
|
|
787
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
const { error } = ContentPublicValidator.getLanguageByLocale().validate(
|
|
791
|
+
{ locale },
|
|
792
|
+
{ abortEarly: false, allowUnknown: true }
|
|
793
|
+
);
|
|
794
|
+
if (error) {
|
|
795
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
// Showing warrnings if extra unknown parameters are found
|
|
799
|
+
const {
|
|
800
|
+
error: warrning,
|
|
801
|
+
} = ContentPublicValidator.getLanguageByLocale().validate(
|
|
802
|
+
{ locale },
|
|
803
|
+
{ abortEarly: false, allowUnknown: false }
|
|
804
|
+
);
|
|
805
|
+
if (warrning) {
|
|
806
|
+
Logger({
|
|
807
|
+
level: "WARN",
|
|
808
|
+
message: `Parameter Validation warrnings for public > Content > getLanguageByLocale \n ${warrning}`,
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
const query_params = {};
|
|
813
|
+
|
|
814
|
+
const xHeaders = {};
|
|
815
|
+
|
|
816
|
+
const response = await PublicAPIClient.execute(
|
|
817
|
+
this._conf,
|
|
818
|
+
"get",
|
|
819
|
+
constructUrl({
|
|
820
|
+
url: this._urls["getLanguageByLocale"],
|
|
821
|
+
params: { locale },
|
|
822
|
+
}),
|
|
823
|
+
query_params,
|
|
824
|
+
undefined,
|
|
825
|
+
{ ...xHeaders, ...requestHeaders },
|
|
826
|
+
{ responseHeaders }
|
|
827
|
+
);
|
|
828
|
+
|
|
829
|
+
let responseData = response;
|
|
830
|
+
if (responseHeaders) {
|
|
831
|
+
responseData = response[0];
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const {
|
|
835
|
+
error: res_error,
|
|
836
|
+
} = ContentPublicModel.Language().validate(responseData, {
|
|
837
|
+
abortEarly: false,
|
|
838
|
+
allowUnknown: true,
|
|
839
|
+
});
|
|
840
|
+
|
|
841
|
+
if (res_error) {
|
|
842
|
+
if (this._conf.options.strictResponseCheck === true) {
|
|
843
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
844
|
+
} else {
|
|
845
|
+
Logger({
|
|
846
|
+
level: "WARN",
|
|
847
|
+
message: `Response Validation Warnings for public > Content > getLanguageByLocale \n ${res_error}`,
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
return response;
|
|
853
|
+
}
|
|
854
|
+
|
|
668
855
|
/**
|
|
669
856
|
* @param {ContentPublicValidator.GetMenuContentParam} arg - Arg object.
|
|
670
857
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -678,14 +865,6 @@ class Content {
|
|
|
678
865
|
{ requestHeaders } = { requestHeaders: {} },
|
|
679
866
|
{ responseHeaders } = { responseHeaders: false }
|
|
680
867
|
) {
|
|
681
|
-
let invalidInput = [];
|
|
682
|
-
if (invalidInput.length) {
|
|
683
|
-
const error = new Error();
|
|
684
|
-
error.message = "Missing required field";
|
|
685
|
-
error.details = invalidInput;
|
|
686
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
687
|
-
}
|
|
688
|
-
|
|
689
868
|
const { error } = ContentPublicValidator.getMenuContent().validate(
|
|
690
869
|
{},
|
|
691
870
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -764,18 +943,12 @@ class Content {
|
|
|
764
943
|
{ type, requestHeaders } = { requestHeaders: {} },
|
|
765
944
|
{ responseHeaders } = { responseHeaders: false }
|
|
766
945
|
) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
path: ["type"],
|
|
946
|
+
const errors = validateRequiredParams(arguments[0], ["type"]);
|
|
947
|
+
if (errors.length > 0) {
|
|
948
|
+
const error = new FDKClientValidationError({
|
|
949
|
+
message: "Missing required field",
|
|
950
|
+
details: errors,
|
|
773
951
|
});
|
|
774
|
-
}
|
|
775
|
-
if (invalidInput.length) {
|
|
776
|
-
const error = new Error();
|
|
777
|
-
error.message = "Missing required field";
|
|
778
|
-
error.details = invalidInput;
|
|
779
952
|
return Promise.reject(new FDKClientValidationError(error));
|
|
780
953
|
}
|
|
781
954
|
|
|
@@ -857,14 +1030,6 @@ class Content {
|
|
|
857
1030
|
{ requestHeaders } = { requestHeaders: {} },
|
|
858
1031
|
{ responseHeaders } = { responseHeaders: false }
|
|
859
1032
|
) {
|
|
860
|
-
let invalidInput = [];
|
|
861
|
-
if (invalidInput.length) {
|
|
862
|
-
const error = new Error();
|
|
863
|
-
error.message = "Missing required field";
|
|
864
|
-
error.details = invalidInput;
|
|
865
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
866
|
-
}
|
|
867
|
-
|
|
868
1033
|
const { error } = ContentPublicValidator.getNavbar().validate(
|
|
869
1034
|
{},
|
|
870
1035
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -941,14 +1106,6 @@ class Content {
|
|
|
941
1106
|
{ requestHeaders } = { requestHeaders: {} },
|
|
942
1107
|
{ responseHeaders } = { responseHeaders: false }
|
|
943
1108
|
) {
|
|
944
|
-
let invalidInput = [];
|
|
945
|
-
if (invalidInput.length) {
|
|
946
|
-
const error = new Error();
|
|
947
|
-
error.message = "Missing required field";
|
|
948
|
-
error.details = invalidInput;
|
|
949
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
950
|
-
}
|
|
951
|
-
|
|
952
1109
|
const { error } = ContentPublicValidator.getPricingBanner().validate(
|
|
953
1110
|
{},
|
|
954
1111
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -278,10 +278,59 @@ export = ContentPublicModel;
|
|
|
278
278
|
* @property {string} [stack_trace]
|
|
279
279
|
* @property {Object} [meta]
|
|
280
280
|
*/
|
|
281
|
+
/**
|
|
282
|
+
* @typedef Language
|
|
283
|
+
* @property {string} [_id] - Unique identifier for the language entry in the
|
|
284
|
+
* system database.
|
|
285
|
+
* @property {string} locale - Standard language code following ISO 639-1 format
|
|
286
|
+
* for language identification.
|
|
287
|
+
* @property {string} direction - Text direction specification for proper
|
|
288
|
+
* content rendering in the language.
|
|
289
|
+
* @property {string} name - Full name of the language in English for easy
|
|
290
|
+
* reference and display at the merchant panel.
|
|
291
|
+
* @property {string} [display_name] - Translated name of the language in
|
|
292
|
+
* English for easy reference and display at the website.
|
|
293
|
+
*/
|
|
294
|
+
/**
|
|
295
|
+
* @typedef Error
|
|
296
|
+
* @property {string} [error] - Detailed error message explaining the nature of
|
|
297
|
+
* the failure or invalid request.
|
|
298
|
+
*/
|
|
299
|
+
/**
|
|
300
|
+
* @typedef TranslatableResource
|
|
301
|
+
* @property {string} [_id] - Unique identifier for the translatable resource in
|
|
302
|
+
* the system.
|
|
303
|
+
* @property {string} type - Categorization of the resource indicating its
|
|
304
|
+
* context and ownership level
|
|
305
|
+
* @property {string} name - Primary identifier or title of the resource in its
|
|
306
|
+
* default language.
|
|
307
|
+
* @property {string} description - Detailed explanation of the resource's
|
|
308
|
+
* purpose and content scope.
|
|
309
|
+
* @property {Meta} meta
|
|
310
|
+
*/
|
|
311
|
+
/**
|
|
312
|
+
* @typedef Meta
|
|
313
|
+
* @property {string} [created_by] - MongoDB ObjectId of the user who initially
|
|
314
|
+
* created the resource.
|
|
315
|
+
* @property {string} [updated_by] - MongoDB ObjectId of the user who last
|
|
316
|
+
* modified the resource.
|
|
317
|
+
* @property {string} [created_at] - Timestamp indicating when the resource was
|
|
318
|
+
* first created.
|
|
319
|
+
* @property {string} [updated_at] - Timestamp indicating when the resource was
|
|
320
|
+
* last modified.
|
|
321
|
+
*/
|
|
322
|
+
/**
|
|
323
|
+
* @typedef ResourceTranslation
|
|
324
|
+
* @property {string} [_id] - Unique identifier for the translation entry in the system.
|
|
325
|
+
* @property {string} [locale] - Language code indicating the target language of
|
|
326
|
+
* the translation.
|
|
327
|
+
* @property {Object} [value] - Contains the translated content with flexible
|
|
328
|
+
* schema based on resource type.
|
|
329
|
+
*/
|
|
281
330
|
declare class ContentPublicModel {
|
|
282
331
|
}
|
|
283
332
|
declare namespace ContentPublicModel {
|
|
284
|
-
export { BasicDetailsPayloadSchema, WhatsNew, Features, BusinessAccount, SellerSupport, MenuSchema, MenusSchema, MenuTypeSchema, CompanyLevelMenuItemSchema, ApplicationLevelMenuItemSchema, VisibleOnSchema, SalesChannelSchema, OtherSellerSchema, FooterContentSchema, AnalyticsTagsSchema, CustomPageBySlugSchema, ItemSchema, CreateCustomPageSeoSchema, RawHtmlContentSchema, FooterSchema, HomePageContentSchema, NavItemSchema, NavbarSchema, MediaSchema, CreatedBySchema, PricingBannerSchema, SdkReadmeSchema, TagsSchema, CustomItemSchema, PageSchema, UserSchema, CredentialSchema, ConfigurationSchema, CredentialsSchema, ContentAPIError };
|
|
333
|
+
export { BasicDetailsPayloadSchema, WhatsNew, Features, BusinessAccount, SellerSupport, MenuSchema, MenusSchema, MenuTypeSchema, CompanyLevelMenuItemSchema, ApplicationLevelMenuItemSchema, VisibleOnSchema, SalesChannelSchema, OtherSellerSchema, FooterContentSchema, AnalyticsTagsSchema, CustomPageBySlugSchema, ItemSchema, CreateCustomPageSeoSchema, RawHtmlContentSchema, FooterSchema, HomePageContentSchema, NavItemSchema, NavbarSchema, MediaSchema, CreatedBySchema, PricingBannerSchema, SdkReadmeSchema, TagsSchema, CustomItemSchema, PageSchema, UserSchema, CredentialSchema, ConfigurationSchema, CredentialsSchema, ContentAPIError, Language, Error, TranslatableResource, Meta, ResourceTranslation };
|
|
285
334
|
}
|
|
286
335
|
/** @returns {BasicDetailsPayloadSchema} */
|
|
287
336
|
declare function BasicDetailsPayloadSchema(): BasicDetailsPayloadSchema;
|
|
@@ -597,3 +646,108 @@ type ContentAPIError = {
|
|
|
597
646
|
stack_trace?: string;
|
|
598
647
|
meta?: any;
|
|
599
648
|
};
|
|
649
|
+
/** @returns {Language} */
|
|
650
|
+
declare function Language(): Language;
|
|
651
|
+
type Language = {
|
|
652
|
+
/**
|
|
653
|
+
* - Unique identifier for the language entry in the
|
|
654
|
+
* system database.
|
|
655
|
+
*/
|
|
656
|
+
_id?: string;
|
|
657
|
+
/**
|
|
658
|
+
* - Standard language code following ISO 639-1 format
|
|
659
|
+
* for language identification.
|
|
660
|
+
*/
|
|
661
|
+
locale: string;
|
|
662
|
+
/**
|
|
663
|
+
* - Text direction specification for proper
|
|
664
|
+
* content rendering in the language.
|
|
665
|
+
*/
|
|
666
|
+
direction: string;
|
|
667
|
+
/**
|
|
668
|
+
* - Full name of the language in English for easy
|
|
669
|
+
* reference and display at the merchant panel.
|
|
670
|
+
*/
|
|
671
|
+
name: string;
|
|
672
|
+
/**
|
|
673
|
+
* - Translated name of the language in
|
|
674
|
+
* English for easy reference and display at the website.
|
|
675
|
+
*/
|
|
676
|
+
display_name?: string;
|
|
677
|
+
};
|
|
678
|
+
/** @returns {Error} */
|
|
679
|
+
declare function Error(): Error;
|
|
680
|
+
type Error = {
|
|
681
|
+
/**
|
|
682
|
+
* - Detailed error message explaining the nature of
|
|
683
|
+
* the failure or invalid request.
|
|
684
|
+
*/
|
|
685
|
+
error?: string;
|
|
686
|
+
};
|
|
687
|
+
/** @returns {TranslatableResource} */
|
|
688
|
+
declare function TranslatableResource(): TranslatableResource;
|
|
689
|
+
type TranslatableResource = {
|
|
690
|
+
/**
|
|
691
|
+
* - Unique identifier for the translatable resource in
|
|
692
|
+
* the system.
|
|
693
|
+
*/
|
|
694
|
+
_id?: string;
|
|
695
|
+
/**
|
|
696
|
+
* - Categorization of the resource indicating its
|
|
697
|
+
* context and ownership level
|
|
698
|
+
*/
|
|
699
|
+
type: string;
|
|
700
|
+
/**
|
|
701
|
+
* - Primary identifier or title of the resource in its
|
|
702
|
+
* default language.
|
|
703
|
+
*/
|
|
704
|
+
name: string;
|
|
705
|
+
/**
|
|
706
|
+
* - Detailed explanation of the resource's
|
|
707
|
+
* purpose and content scope.
|
|
708
|
+
*/
|
|
709
|
+
description: string;
|
|
710
|
+
meta: Meta;
|
|
711
|
+
};
|
|
712
|
+
/** @returns {Meta} */
|
|
713
|
+
declare function Meta(): Meta;
|
|
714
|
+
type Meta = {
|
|
715
|
+
/**
|
|
716
|
+
* - MongoDB ObjectId of the user who initially
|
|
717
|
+
* created the resource.
|
|
718
|
+
*/
|
|
719
|
+
created_by?: string;
|
|
720
|
+
/**
|
|
721
|
+
* - MongoDB ObjectId of the user who last
|
|
722
|
+
* modified the resource.
|
|
723
|
+
*/
|
|
724
|
+
updated_by?: string;
|
|
725
|
+
/**
|
|
726
|
+
* - Timestamp indicating when the resource was
|
|
727
|
+
* first created.
|
|
728
|
+
*/
|
|
729
|
+
created_at?: string;
|
|
730
|
+
/**
|
|
731
|
+
* - Timestamp indicating when the resource was
|
|
732
|
+
* last modified.
|
|
733
|
+
*/
|
|
734
|
+
updated_at?: string;
|
|
735
|
+
};
|
|
736
|
+
/** @returns {ResourceTranslation} */
|
|
737
|
+
declare function ResourceTranslation(): ResourceTranslation;
|
|
738
|
+
type ResourceTranslation = {
|
|
739
|
+
/**
|
|
740
|
+
* - Unique identifier for the translation entry in the system.
|
|
741
|
+
*/
|
|
742
|
+
_id?: string;
|
|
743
|
+
/**
|
|
744
|
+
* - Language code indicating the target language of
|
|
745
|
+
* the translation.
|
|
746
|
+
*/
|
|
747
|
+
locale?: string;
|
|
748
|
+
/**
|
|
749
|
+
* - Contains the translated content with flexible
|
|
750
|
+
* schema based on resource type.
|
|
751
|
+
*/
|
|
752
|
+
value?: any;
|
|
753
|
+
};
|