@gofynd/fdk-client-javascript 1.5.1 → 1.5.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/README.md +1 -1
- package/package.json +1 -1
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +22 -1
- package/sdk/platform/Payment/PaymentPlatformModel.js +17 -0
- package/sdk/public/Catalog/CatalogPublicClient.d.ts +22 -0
- package/sdk/public/Catalog/CatalogPublicClient.js +123 -0
- package/sdk/public/Catalog/CatalogPublicModel.d.ts +155 -0
- package/sdk/public/Catalog/CatalogPublicModel.js +116 -0
- package/sdk/public/Catalog/CatalogPublicValidator.d.ts +55 -0
- package/sdk/public/Catalog/CatalogPublicValidator.js +35 -0
- package/sdk/public/PublicClient.d.ts +2 -0
- package/sdk/public/PublicClient.js +4 -0
- package/sdk/public/index.d.ts +1 -0
- package/sdk/public/index.js +2 -0
package/README.md
CHANGED
|
@@ -237,7 +237,7 @@ console.log("Active Theme: ", response.information.name);
|
|
|
237
237
|
The above code will log the curl command in the console
|
|
238
238
|
|
|
239
239
|
```bash
|
|
240
|
-
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.5.
|
|
240
|
+
curl --request GET "https://api.fynd.com/service/application/theme/v1.0/applied-theme" --header 'authorization: Bearer <authorization-token>' --header 'x-fp-sdk-version: 1.5.2' --header 'x-fp-date: 20230222T115108Z' --header 'x-fp-signature: v1.1:1e3ab3b02b5bc626e3c32a37ee844266ade02bbcbaafc28fc7a0e46a76a7a1a8'
|
|
241
241
|
Active Theme: Emerge
|
|
242
242
|
```
|
|
243
243
|
|
package/package.json
CHANGED
|
@@ -893,6 +893,12 @@ export = PaymentPlatformModel;
|
|
|
893
893
|
* @property {string} city - City name
|
|
894
894
|
* @property {Object[]} [tags] - Optional address tag
|
|
895
895
|
*/
|
|
896
|
+
/**
|
|
897
|
+
* @typedef ReasonDetail
|
|
898
|
+
* @property {string} [code] - The code indicating the type of reason.
|
|
899
|
+
* @property {string} [description] - A detailed description of the payment
|
|
900
|
+
* reason or error.
|
|
901
|
+
*/
|
|
896
902
|
/**
|
|
897
903
|
* @typedef PaymentSessionDetail
|
|
898
904
|
* @property {string} payment_id - Unique transaction id generated by payment gateway
|
|
@@ -929,6 +935,7 @@ export = PaymentPlatformModel;
|
|
|
929
935
|
* merchant account) by payment gateway.
|
|
930
936
|
* @property {Object} [meta] - Extra meta data specific to extension
|
|
931
937
|
* @property {string} status - Status of the payment
|
|
938
|
+
* @property {ReasonDetail} [reason]
|
|
932
939
|
*/
|
|
933
940
|
/**
|
|
934
941
|
* @typedef PaymentSessionCreation
|
|
@@ -1221,7 +1228,7 @@ export = PaymentPlatformModel;
|
|
|
1221
1228
|
declare class PaymentPlatformModel {
|
|
1222
1229
|
}
|
|
1223
1230
|
declare namespace PaymentPlatformModel {
|
|
1224
|
-
export { PaymentGatewayConfigDetails, ErrorCodeDescription, PaymentGatewayConfig, PaymentGatewayConfigCreation, PaymentGatewayToBeReviewed, ErrorCodeAndDescription, HttpErrorDetails, IntentAppErrorList, ProductCODData, CODChargesLimitsDetails, PaymentModeLogo, IntentApp, PaymentModeList, RootPaymentMode, PaymentOptions, AggregatorRoute, PaymentDefaultSelection, PaymentFlow, PaymentOptionAndFlow, AdvanceObject, SplitObject, AdvancePaymentObject, PaymentModeRouteDetails, PaymentOptionsDetails, PayoutCustomer, PayoutMoreAttributes, PayoutAggregator, Payout, PayoutsDetails, PayoutBankDetails, PayoutCreation, PayoutDetails, UpdatePayoutDetails, UpdatePayoutCreation, DeletePayoutDetails, SubscriptionPaymentMethodDetails, DeleteSubscriptionPaymentMethodDetails, SubscriptionConfigDetails, SaveSubscriptionSetupIntentCreation, SaveSubscriptionSetupIntentDetails, RefundAccountDetails, NotFoundResourceError, BankDetailsForOTP, AddBeneficiaryDetailsOTPCreation, IfscCodeDetails, OrderBeneficiaryDetails, OrderBeneficiaryFetchResults, MultiTenderPaymentMeta, MultiTenderPaymentMethod, PaymentConfirmationCreation, PaymentConfirmationDetails, CODdata, CODLimitConfig, CODPaymentLimitConfig, GetUserBULimitResponseSchema, GetUserCODLimitDetails, SetCODForUserCreation, SetCODOptionDetails, EdcModelData, EdcAggregatorAndModelListDetails, StatisticsData, EdcDeviceStatsDetails, EdcAddCreation, EdcDevice, EdcDeviceAddDetails, EdcDeviceDetails, EdcUpdate, EdcDeviceUpdateDetails, Page, EdcDeviceListDetails, PaymentInitializationCreation, PaymentInitializationDetails, PaymentStatusUpdateCreation, PaymentStatusUpdateDetails, ResendOrCancelPaymentCreation, LinkStatus, ResendOrCancelPaymentDetails, PaymentStatusBulkHandlerCreation, PaymentObjectList, PaymentStatusObject, PaymentStatusBulkHandlerDetails, GetOauthUrlDetails, RevokeOAuthToken, RepaymentRequestDetails, RepaymentDetailsSerialiserPayAll, RepaymentDetails, MerchantOnBoardingCreation, MerchantOnBoardingDetails, ValidateCustomerCreation, ValidateCustomerDetails, GetPaymentLinkDetails, ErrorDescription, ErrorDetails, CreatePaymentLinkMeta, CreatePaymentLinkCreation, CreatePaymentLinkDetails, PollingPaymentLinkDetails, CancelOrResendPaymentLinkCreation, ResendPaymentLinkDetails, CancelPaymentLinkDetails, Code, PaymentCode, GetPaymentCode, GetPaymentCodeDetails, PlatformPaymentModeDetails, MerchnatPaymentModeCreation, OrderDetail, AddressDetail, PaymentSessionDetail, PaymentSessionCreation, PaymentSessionPutDetails, RefundSessionDetail, RefundSessionCreation, RefundSessionDetails, PaymentDetails, CartDetails, RefundDetails, PaymentSessionFetchDetails, RefundSourcesPriority, RefundPriorityDetails, RefundPriorityCreation, MerchantPaymentModeCreation, FromConfig, ToConfig, PlatformPaymentModeCopyConfigCreation, PaymentMethodsMetaOrder, PaymentOrderMethods, PaymentOrderCreation, PaymentOrderData, PaymentOrderDetails, AggregatorVersionItemSchema, AggregatorVersionDetails, AggregatorVersionRequestSchema, PatchAggregatorControl, PaymentModeCustomConfigSchema, PaymentCustomConfigDetailsSchema, PaymentCustomConfigCustomerSchema, PaymentCustomConfigModeSchema, PaymentCustomConfigDetailsRequestSchema, PaymentCustomConfigCustomerRequestSchema, PaymentCustomConfigRequestSchema, PaymentCustomConfigResponseSchema };
|
|
1231
|
+
export { PaymentGatewayConfigDetails, ErrorCodeDescription, PaymentGatewayConfig, PaymentGatewayConfigCreation, PaymentGatewayToBeReviewed, ErrorCodeAndDescription, HttpErrorDetails, IntentAppErrorList, ProductCODData, CODChargesLimitsDetails, PaymentModeLogo, IntentApp, PaymentModeList, RootPaymentMode, PaymentOptions, AggregatorRoute, PaymentDefaultSelection, PaymentFlow, PaymentOptionAndFlow, AdvanceObject, SplitObject, AdvancePaymentObject, PaymentModeRouteDetails, PaymentOptionsDetails, PayoutCustomer, PayoutMoreAttributes, PayoutAggregator, Payout, PayoutsDetails, PayoutBankDetails, PayoutCreation, PayoutDetails, UpdatePayoutDetails, UpdatePayoutCreation, DeletePayoutDetails, SubscriptionPaymentMethodDetails, DeleteSubscriptionPaymentMethodDetails, SubscriptionConfigDetails, SaveSubscriptionSetupIntentCreation, SaveSubscriptionSetupIntentDetails, RefundAccountDetails, NotFoundResourceError, BankDetailsForOTP, AddBeneficiaryDetailsOTPCreation, IfscCodeDetails, OrderBeneficiaryDetails, OrderBeneficiaryFetchResults, MultiTenderPaymentMeta, MultiTenderPaymentMethod, PaymentConfirmationCreation, PaymentConfirmationDetails, CODdata, CODLimitConfig, CODPaymentLimitConfig, GetUserBULimitResponseSchema, GetUserCODLimitDetails, SetCODForUserCreation, SetCODOptionDetails, EdcModelData, EdcAggregatorAndModelListDetails, StatisticsData, EdcDeviceStatsDetails, EdcAddCreation, EdcDevice, EdcDeviceAddDetails, EdcDeviceDetails, EdcUpdate, EdcDeviceUpdateDetails, Page, EdcDeviceListDetails, PaymentInitializationCreation, PaymentInitializationDetails, PaymentStatusUpdateCreation, PaymentStatusUpdateDetails, ResendOrCancelPaymentCreation, LinkStatus, ResendOrCancelPaymentDetails, PaymentStatusBulkHandlerCreation, PaymentObjectList, PaymentStatusObject, PaymentStatusBulkHandlerDetails, GetOauthUrlDetails, RevokeOAuthToken, RepaymentRequestDetails, RepaymentDetailsSerialiserPayAll, RepaymentDetails, MerchantOnBoardingCreation, MerchantOnBoardingDetails, ValidateCustomerCreation, ValidateCustomerDetails, GetPaymentLinkDetails, ErrorDescription, ErrorDetails, CreatePaymentLinkMeta, CreatePaymentLinkCreation, CreatePaymentLinkDetails, PollingPaymentLinkDetails, CancelOrResendPaymentLinkCreation, ResendPaymentLinkDetails, CancelPaymentLinkDetails, Code, PaymentCode, GetPaymentCode, GetPaymentCodeDetails, PlatformPaymentModeDetails, MerchnatPaymentModeCreation, OrderDetail, AddressDetail, ReasonDetail, PaymentSessionDetail, PaymentSessionCreation, PaymentSessionPutDetails, RefundSessionDetail, RefundSessionCreation, RefundSessionDetails, PaymentDetails, CartDetails, RefundDetails, PaymentSessionFetchDetails, RefundSourcesPriority, RefundPriorityDetails, RefundPriorityCreation, MerchantPaymentModeCreation, FromConfig, ToConfig, PlatformPaymentModeCopyConfigCreation, PaymentMethodsMetaOrder, PaymentOrderMethods, PaymentOrderCreation, PaymentOrderData, PaymentOrderDetails, AggregatorVersionItemSchema, AggregatorVersionDetails, AggregatorVersionRequestSchema, PatchAggregatorControl, PaymentModeCustomConfigSchema, PaymentCustomConfigDetailsSchema, PaymentCustomConfigCustomerSchema, PaymentCustomConfigModeSchema, PaymentCustomConfigDetailsRequestSchema, PaymentCustomConfigCustomerRequestSchema, PaymentCustomConfigRequestSchema, PaymentCustomConfigResponseSchema };
|
|
1225
1232
|
}
|
|
1226
1233
|
/** @returns {PaymentGatewayConfigDetails} */
|
|
1227
1234
|
declare function PaymentGatewayConfigDetails(): PaymentGatewayConfigDetails;
|
|
@@ -3611,6 +3618,19 @@ type AddressDetail = {
|
|
|
3611
3618
|
*/
|
|
3612
3619
|
tags?: any[];
|
|
3613
3620
|
};
|
|
3621
|
+
/** @returns {ReasonDetail} */
|
|
3622
|
+
declare function ReasonDetail(): ReasonDetail;
|
|
3623
|
+
type ReasonDetail = {
|
|
3624
|
+
/**
|
|
3625
|
+
* - The code indicating the type of reason.
|
|
3626
|
+
*/
|
|
3627
|
+
code?: string;
|
|
3628
|
+
/**
|
|
3629
|
+
* - A detailed description of the payment
|
|
3630
|
+
* reason or error.
|
|
3631
|
+
*/
|
|
3632
|
+
description?: string;
|
|
3633
|
+
};
|
|
3614
3634
|
/** @returns {PaymentSessionDetail} */
|
|
3615
3635
|
declare function PaymentSessionDetail(): PaymentSessionDetail;
|
|
3616
3636
|
type PaymentSessionDetail = {
|
|
@@ -3714,6 +3734,7 @@ type PaymentSessionDetail = {
|
|
|
3714
3734
|
* - Status of the payment
|
|
3715
3735
|
*/
|
|
3716
3736
|
status: string;
|
|
3737
|
+
reason?: ReasonDetail;
|
|
3717
3738
|
};
|
|
3718
3739
|
/** @returns {PaymentSessionCreation} */
|
|
3719
3740
|
declare function PaymentSessionCreation(): PaymentSessionCreation;
|
|
@@ -1002,6 +1002,13 @@ const Joi = require("joi");
|
|
|
1002
1002
|
* @property {Object[]} [tags] - Optional address tag
|
|
1003
1003
|
*/
|
|
1004
1004
|
|
|
1005
|
+
/**
|
|
1006
|
+
* @typedef ReasonDetail
|
|
1007
|
+
* @property {string} [code] - The code indicating the type of reason.
|
|
1008
|
+
* @property {string} [description] - A detailed description of the payment
|
|
1009
|
+
* reason or error.
|
|
1010
|
+
*/
|
|
1011
|
+
|
|
1005
1012
|
/**
|
|
1006
1013
|
* @typedef PaymentSessionDetail
|
|
1007
1014
|
* @property {string} payment_id - Unique transaction id generated by payment gateway
|
|
@@ -1038,6 +1045,7 @@ const Joi = require("joi");
|
|
|
1038
1045
|
* merchant account) by payment gateway.
|
|
1039
1046
|
* @property {Object} [meta] - Extra meta data specific to extension
|
|
1040
1047
|
* @property {string} status - Status of the payment
|
|
1048
|
+
* @property {ReasonDetail} [reason]
|
|
1041
1049
|
*/
|
|
1042
1050
|
|
|
1043
1051
|
/**
|
|
@@ -2587,6 +2595,14 @@ class PaymentPlatformModel {
|
|
|
2587
2595
|
});
|
|
2588
2596
|
}
|
|
2589
2597
|
|
|
2598
|
+
/** @returns {ReasonDetail} */
|
|
2599
|
+
static ReasonDetail() {
|
|
2600
|
+
return Joi.object({
|
|
2601
|
+
code: Joi.string().allow(""),
|
|
2602
|
+
description: Joi.string().allow(""),
|
|
2603
|
+
});
|
|
2604
|
+
}
|
|
2605
|
+
|
|
2590
2606
|
/** @returns {PaymentSessionDetail} */
|
|
2591
2607
|
static PaymentSessionDetail() {
|
|
2592
2608
|
return Joi.object({
|
|
@@ -2612,6 +2628,7 @@ class PaymentPlatformModel {
|
|
|
2612
2628
|
captured: Joi.boolean(),
|
|
2613
2629
|
meta: Joi.object().pattern(/\S/, Joi.any()),
|
|
2614
2630
|
status: Joi.string().allow("").required(),
|
|
2631
|
+
reason: PaymentPlatformModel.ReasonDetail(),
|
|
2615
2632
|
});
|
|
2616
2633
|
}
|
|
2617
2634
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export = Catalog;
|
|
2
|
+
declare class Catalog {
|
|
3
|
+
constructor(_conf: any);
|
|
4
|
+
_conf: any;
|
|
5
|
+
_relativeUrls: {
|
|
6
|
+
getTaxonomyByLevel: string;
|
|
7
|
+
};
|
|
8
|
+
_urls: {};
|
|
9
|
+
updateUrls(urls: any): void;
|
|
10
|
+
/**
|
|
11
|
+
* @param {CatalogPublicValidator.GetTaxonomyByLevelParam} arg - Arg object.
|
|
12
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
13
|
+
* @param {import("../PublicAPIClient").Options} - Options
|
|
14
|
+
* @returns {Promise<CatalogPublicModel.TaxonomyResponseSchema>} - Success response
|
|
15
|
+
* @name getTaxonomyByLevel
|
|
16
|
+
* @summary: Get Taxonomy Information by Level
|
|
17
|
+
* @description: Get Taxonomy Details for a given level - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/catalog/getTaxonomyByLevel/).
|
|
18
|
+
*/
|
|
19
|
+
getTaxonomyByLevel({ level, l0Slug, l1Slug, l2Slug, l3Slug, limit, requestHeaders }?: CatalogPublicValidator.GetTaxonomyByLevelParam, { responseHeaders }?: object): Promise<CatalogPublicModel.TaxonomyResponseSchema>;
|
|
20
|
+
}
|
|
21
|
+
import CatalogPublicValidator = require("./CatalogPublicValidator");
|
|
22
|
+
import CatalogPublicModel = require("./CatalogPublicModel");
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
const {
|
|
2
|
+
FDKClientValidationError,
|
|
3
|
+
FDKResponseValidationError,
|
|
4
|
+
} = require("../../common/FDKError");
|
|
5
|
+
|
|
6
|
+
const PublicAPIClient = require("../PublicAPIClient");
|
|
7
|
+
const constructUrl = require("../constructUrl");
|
|
8
|
+
const Paginator = require("../../common/Paginator");
|
|
9
|
+
|
|
10
|
+
const CatalogPublicValidator = require("./CatalogPublicValidator");
|
|
11
|
+
const CatalogPublicModel = require("./CatalogPublicModel");
|
|
12
|
+
const Joi = require("joi");
|
|
13
|
+
const { Logger } = require("./../../common/Logger");
|
|
14
|
+
|
|
15
|
+
class Catalog {
|
|
16
|
+
constructor(_conf) {
|
|
17
|
+
this._conf = _conf;
|
|
18
|
+
this._relativeUrls = {
|
|
19
|
+
getTaxonomyByLevel: "/service/public/catalog/v1.0/taxonomy/level/{level}",
|
|
20
|
+
};
|
|
21
|
+
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
22
|
+
(urls, [method, relativeUrl]) => {
|
|
23
|
+
urls[method] = `${_conf.domain}${relativeUrl}`;
|
|
24
|
+
return urls;
|
|
25
|
+
},
|
|
26
|
+
{}
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
updateUrls(urls) {
|
|
31
|
+
this._urls = {
|
|
32
|
+
...this._urls,
|
|
33
|
+
...urls,
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* @param {CatalogPublicValidator.GetTaxonomyByLevelParam} arg - Arg object.
|
|
39
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
40
|
+
* @param {import("../PublicAPIClient").Options} - Options
|
|
41
|
+
* @returns {Promise<CatalogPublicModel.TaxonomyResponseSchema>} - Success response
|
|
42
|
+
* @name getTaxonomyByLevel
|
|
43
|
+
* @summary: Get Taxonomy Information by Level
|
|
44
|
+
* @description: Get Taxonomy Details for a given level - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/public/catalog/getTaxonomyByLevel/).
|
|
45
|
+
*/
|
|
46
|
+
async getTaxonomyByLevel(
|
|
47
|
+
{ level, l0Slug, l1Slug, l2Slug, l3Slug, limit, requestHeaders } = {
|
|
48
|
+
requestHeaders: {},
|
|
49
|
+
},
|
|
50
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
51
|
+
) {
|
|
52
|
+
const { error } = CatalogPublicValidator.getTaxonomyByLevel().validate(
|
|
53
|
+
{ level, l0Slug, l1Slug, l2Slug, l3Slug, limit },
|
|
54
|
+
{ abortEarly: false, allowUnknown: true }
|
|
55
|
+
);
|
|
56
|
+
if (error) {
|
|
57
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Showing warrnings if extra unknown parameters are found
|
|
61
|
+
const {
|
|
62
|
+
error: warrning,
|
|
63
|
+
} = CatalogPublicValidator.getTaxonomyByLevel().validate(
|
|
64
|
+
{ level, l0Slug, l1Slug, l2Slug, l3Slug, limit },
|
|
65
|
+
{ abortEarly: false, allowUnknown: false }
|
|
66
|
+
);
|
|
67
|
+
if (warrning) {
|
|
68
|
+
Logger({
|
|
69
|
+
level: "WARN",
|
|
70
|
+
message: `Parameter Validation warrnings for public > Catalog > getTaxonomyByLevel \n ${warrning}`,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const query_params = {};
|
|
75
|
+
query_params["l0_slug"] = l0Slug;
|
|
76
|
+
query_params["l1_slug"] = l1Slug;
|
|
77
|
+
query_params["l2_slug"] = l2Slug;
|
|
78
|
+
query_params["l3_slug"] = l3Slug;
|
|
79
|
+
query_params["limit"] = limit;
|
|
80
|
+
|
|
81
|
+
const xHeaders = {};
|
|
82
|
+
|
|
83
|
+
const response = await PublicAPIClient.execute(
|
|
84
|
+
this._conf,
|
|
85
|
+
"get",
|
|
86
|
+
constructUrl({
|
|
87
|
+
url: this._urls["getTaxonomyByLevel"],
|
|
88
|
+
params: { level },
|
|
89
|
+
}),
|
|
90
|
+
query_params,
|
|
91
|
+
undefined,
|
|
92
|
+
{ ...xHeaders, ...requestHeaders },
|
|
93
|
+
{ responseHeaders }
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
let responseData = response;
|
|
97
|
+
if (responseHeaders) {
|
|
98
|
+
responseData = response[0];
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const {
|
|
102
|
+
error: res_error,
|
|
103
|
+
} = CatalogPublicModel.TaxonomyResponseSchema().validate(responseData, {
|
|
104
|
+
abortEarly: false,
|
|
105
|
+
allowUnknown: true,
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
if (res_error) {
|
|
109
|
+
if (this._conf.options.strictResponseCheck === true) {
|
|
110
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
111
|
+
} else {
|
|
112
|
+
Logger({
|
|
113
|
+
level: "WARN",
|
|
114
|
+
message: `Response Validation Warnings for public > Catalog > getTaxonomyByLevel \n ${res_error}`,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return response;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = Catalog;
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
export = CatalogPublicModel;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef TaxonomyItemAttributeSchemaObject
|
|
4
|
+
* @property {string} [type] - The data type of the attribute".
|
|
5
|
+
* @property {boolean} [mandatory] - Specifies if the attribute is mandatory.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* @typedef TaxonomyItemAttributesResponseSchema
|
|
9
|
+
* @property {string} [id] - Unique identifier for the attribute.
|
|
10
|
+
* @property {string} [name] - The name of the attribute, such as "Color" or "Size".
|
|
11
|
+
* @property {string} [slug] - A URL-friendly identifier for the attribute,
|
|
12
|
+
* which is used for filtering or querying.
|
|
13
|
+
* @property {TaxonomyItemAttributeSchemaObject} [schema]
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef TaxonomyItemResponseSchema
|
|
17
|
+
* @property {number} uid - Unique identifier for the taxonomy item.
|
|
18
|
+
* @property {string} name - The name of the taxonomy item. For example, it
|
|
19
|
+
* could be the name of a department or category.
|
|
20
|
+
* @property {string} slug - A URL-friendly identifier for the taxonomy item.
|
|
21
|
+
* The slug differs based on the level: - At level 0, it refers to the
|
|
22
|
+
* department. - At level 1, it refers to the L1 category. - At level 2, it
|
|
23
|
+
* refers to the L2 category. - At level 3, it refers to the L3 category.
|
|
24
|
+
* @property {number} level - The level level of the taxonomy item in the
|
|
25
|
+
* hierarchy: - 0: Department - 1: L1 category - 2: L2 category - 3: L3 category
|
|
26
|
+
* @property {TaxonomyItemAttributesResponseSchema[]} [attributes] - A list of
|
|
27
|
+
* attributes associated with the taxonomy item, such as color or size. These
|
|
28
|
+
* attributes may differ depending on the level of the taxonomy.
|
|
29
|
+
* @property {string} [product_template_slug] - A slug identifier for the
|
|
30
|
+
* template associated with this taxonomy item. It links the taxonomy to a
|
|
31
|
+
* specific product template.
|
|
32
|
+
* @property {string} [product_template_name] - A Name for the template
|
|
33
|
+
* associated with this taxonomy item. It links the taxonomy to a specific
|
|
34
|
+
* product template.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* @typedef TaxonomyResponseSchema
|
|
38
|
+
* @property {TaxonomyItemResponseSchema[]} [items] - List of taxonomy items for
|
|
39
|
+
* the requested level level. Each item represents a taxonomy node with
|
|
40
|
+
* details about its category, attributes, and associated template.
|
|
41
|
+
*/
|
|
42
|
+
/**
|
|
43
|
+
* @typedef ValidationErrors
|
|
44
|
+
* @property {ValidationError[]} errors
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* @typedef ValidationError
|
|
48
|
+
* @property {string} message - A brief description of the error encountered.
|
|
49
|
+
* @property {string} field - The field in the request that caused the error.
|
|
50
|
+
*/
|
|
51
|
+
declare class CatalogPublicModel {
|
|
52
|
+
}
|
|
53
|
+
declare namespace CatalogPublicModel {
|
|
54
|
+
export { TaxonomyItemAttributeSchemaObject, TaxonomyItemAttributesResponseSchema, TaxonomyItemResponseSchema, TaxonomyResponseSchema, ValidationErrors, ValidationError };
|
|
55
|
+
}
|
|
56
|
+
/** @returns {TaxonomyItemAttributeSchemaObject} */
|
|
57
|
+
declare function TaxonomyItemAttributeSchemaObject(): TaxonomyItemAttributeSchemaObject;
|
|
58
|
+
type TaxonomyItemAttributeSchemaObject = {
|
|
59
|
+
/**
|
|
60
|
+
* - The data type of the attribute".
|
|
61
|
+
*/
|
|
62
|
+
type?: string;
|
|
63
|
+
/**
|
|
64
|
+
* - Specifies if the attribute is mandatory.
|
|
65
|
+
*/
|
|
66
|
+
mandatory?: boolean;
|
|
67
|
+
};
|
|
68
|
+
/** @returns {TaxonomyItemAttributesResponseSchema} */
|
|
69
|
+
declare function TaxonomyItemAttributesResponseSchema(): TaxonomyItemAttributesResponseSchema;
|
|
70
|
+
type TaxonomyItemAttributesResponseSchema = {
|
|
71
|
+
/**
|
|
72
|
+
* - Unique identifier for the attribute.
|
|
73
|
+
*/
|
|
74
|
+
id?: string;
|
|
75
|
+
/**
|
|
76
|
+
* - The name of the attribute, such as "Color" or "Size".
|
|
77
|
+
*/
|
|
78
|
+
name?: string;
|
|
79
|
+
/**
|
|
80
|
+
* - A URL-friendly identifier for the attribute,
|
|
81
|
+
* which is used for filtering or querying.
|
|
82
|
+
*/
|
|
83
|
+
slug?: string;
|
|
84
|
+
schema?: TaxonomyItemAttributeSchemaObject;
|
|
85
|
+
};
|
|
86
|
+
/** @returns {TaxonomyItemResponseSchema} */
|
|
87
|
+
declare function TaxonomyItemResponseSchema(): TaxonomyItemResponseSchema;
|
|
88
|
+
type TaxonomyItemResponseSchema = {
|
|
89
|
+
/**
|
|
90
|
+
* - Unique identifier for the taxonomy item.
|
|
91
|
+
*/
|
|
92
|
+
uid: number;
|
|
93
|
+
/**
|
|
94
|
+
* - The name of the taxonomy item. For example, it
|
|
95
|
+
* could be the name of a department or category.
|
|
96
|
+
*/
|
|
97
|
+
name: string;
|
|
98
|
+
/**
|
|
99
|
+
* - A URL-friendly identifier for the taxonomy item.
|
|
100
|
+
* The slug differs based on the level: - At level 0, it refers to the
|
|
101
|
+
* department. - At level 1, it refers to the L1 category. - At level 2, it
|
|
102
|
+
* refers to the L2 category. - At level 3, it refers to the L3 category.
|
|
103
|
+
*/
|
|
104
|
+
slug: string;
|
|
105
|
+
/**
|
|
106
|
+
* - The level level of the taxonomy item in the
|
|
107
|
+
* hierarchy: - 0: Department - 1: L1 category - 2: L2 category - 3: L3 category
|
|
108
|
+
*/
|
|
109
|
+
level: number;
|
|
110
|
+
/**
|
|
111
|
+
* - A list of
|
|
112
|
+
* attributes associated with the taxonomy item, such as color or size. These
|
|
113
|
+
* attributes may differ depending on the level of the taxonomy.
|
|
114
|
+
*/
|
|
115
|
+
attributes?: TaxonomyItemAttributesResponseSchema[];
|
|
116
|
+
/**
|
|
117
|
+
* - A slug identifier for the
|
|
118
|
+
* template associated with this taxonomy item. It links the taxonomy to a
|
|
119
|
+
* specific product template.
|
|
120
|
+
*/
|
|
121
|
+
product_template_slug?: string;
|
|
122
|
+
/**
|
|
123
|
+
* - A Name for the template
|
|
124
|
+
* associated with this taxonomy item. It links the taxonomy to a specific
|
|
125
|
+
* product template.
|
|
126
|
+
*/
|
|
127
|
+
product_template_name?: string;
|
|
128
|
+
};
|
|
129
|
+
/** @returns {TaxonomyResponseSchema} */
|
|
130
|
+
declare function TaxonomyResponseSchema(): TaxonomyResponseSchema;
|
|
131
|
+
type TaxonomyResponseSchema = {
|
|
132
|
+
/**
|
|
133
|
+
* - List of taxonomy items for
|
|
134
|
+
* the requested level level. Each item represents a taxonomy node with
|
|
135
|
+
* details about its category, attributes, and associated template.
|
|
136
|
+
*/
|
|
137
|
+
items?: TaxonomyItemResponseSchema[];
|
|
138
|
+
};
|
|
139
|
+
/** @returns {ValidationErrors} */
|
|
140
|
+
declare function ValidationErrors(): ValidationErrors;
|
|
141
|
+
type ValidationErrors = {
|
|
142
|
+
errors: ValidationError[];
|
|
143
|
+
};
|
|
144
|
+
/** @returns {ValidationError} */
|
|
145
|
+
declare function ValidationError(): ValidationError;
|
|
146
|
+
type ValidationError = {
|
|
147
|
+
/**
|
|
148
|
+
* - A brief description of the error encountered.
|
|
149
|
+
*/
|
|
150
|
+
message: string;
|
|
151
|
+
/**
|
|
152
|
+
* - The field in the request that caused the error.
|
|
153
|
+
*/
|
|
154
|
+
field: string;
|
|
155
|
+
};
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef TaxonomyItemAttributeSchemaObject
|
|
5
|
+
* @property {string} [type] - The data type of the attribute".
|
|
6
|
+
* @property {boolean} [mandatory] - Specifies if the attribute is mandatory.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @typedef TaxonomyItemAttributesResponseSchema
|
|
11
|
+
* @property {string} [id] - Unique identifier for the attribute.
|
|
12
|
+
* @property {string} [name] - The name of the attribute, such as "Color" or "Size".
|
|
13
|
+
* @property {string} [slug] - A URL-friendly identifier for the attribute,
|
|
14
|
+
* which is used for filtering or querying.
|
|
15
|
+
* @property {TaxonomyItemAttributeSchemaObject} [schema]
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @typedef TaxonomyItemResponseSchema
|
|
20
|
+
* @property {number} uid - Unique identifier for the taxonomy item.
|
|
21
|
+
* @property {string} name - The name of the taxonomy item. For example, it
|
|
22
|
+
* could be the name of a department or category.
|
|
23
|
+
* @property {string} slug - A URL-friendly identifier for the taxonomy item.
|
|
24
|
+
* The slug differs based on the level: - At level 0, it refers to the
|
|
25
|
+
* department. - At level 1, it refers to the L1 category. - At level 2, it
|
|
26
|
+
* refers to the L2 category. - At level 3, it refers to the L3 category.
|
|
27
|
+
* @property {number} level - The level level of the taxonomy item in the
|
|
28
|
+
* hierarchy: - 0: Department - 1: L1 category - 2: L2 category - 3: L3 category
|
|
29
|
+
* @property {TaxonomyItemAttributesResponseSchema[]} [attributes] - A list of
|
|
30
|
+
* attributes associated with the taxonomy item, such as color or size. These
|
|
31
|
+
* attributes may differ depending on the level of the taxonomy.
|
|
32
|
+
* @property {string} [product_template_slug] - A slug identifier for the
|
|
33
|
+
* template associated with this taxonomy item. It links the taxonomy to a
|
|
34
|
+
* specific product template.
|
|
35
|
+
* @property {string} [product_template_name] - A Name for the template
|
|
36
|
+
* associated with this taxonomy item. It links the taxonomy to a specific
|
|
37
|
+
* product template.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @typedef TaxonomyResponseSchema
|
|
42
|
+
* @property {TaxonomyItemResponseSchema[]} [items] - List of taxonomy items for
|
|
43
|
+
* the requested level level. Each item represents a taxonomy node with
|
|
44
|
+
* details about its category, attributes, and associated template.
|
|
45
|
+
*/
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @typedef ValidationErrors
|
|
49
|
+
* @property {ValidationError[]} errors
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* @typedef ValidationError
|
|
54
|
+
* @property {string} message - A brief description of the error encountered.
|
|
55
|
+
* @property {string} field - The field in the request that caused the error.
|
|
56
|
+
*/
|
|
57
|
+
|
|
58
|
+
class CatalogPublicModel {
|
|
59
|
+
/** @returns {TaxonomyItemAttributeSchemaObject} */
|
|
60
|
+
static TaxonomyItemAttributeSchemaObject() {
|
|
61
|
+
return Joi.object({
|
|
62
|
+
type: Joi.string().allow(""),
|
|
63
|
+
mandatory: Joi.boolean(),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** @returns {TaxonomyItemAttributesResponseSchema} */
|
|
68
|
+
static TaxonomyItemAttributesResponseSchema() {
|
|
69
|
+
return Joi.object({
|
|
70
|
+
id: Joi.string().allow(""),
|
|
71
|
+
name: Joi.string().allow(""),
|
|
72
|
+
slug: Joi.string().allow(""),
|
|
73
|
+
schema: CatalogPublicModel.TaxonomyItemAttributeSchemaObject(),
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** @returns {TaxonomyItemResponseSchema} */
|
|
78
|
+
static TaxonomyItemResponseSchema() {
|
|
79
|
+
return Joi.object({
|
|
80
|
+
uid: Joi.number().required(),
|
|
81
|
+
name: Joi.string().allow("").required(),
|
|
82
|
+
slug: Joi.string().allow("").required(),
|
|
83
|
+
level: Joi.number().required(),
|
|
84
|
+
attributes: Joi.array().items(
|
|
85
|
+
CatalogPublicModel.TaxonomyItemAttributesResponseSchema()
|
|
86
|
+
),
|
|
87
|
+
product_template_slug: Joi.string().allow(""),
|
|
88
|
+
product_template_name: Joi.string().allow(""),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** @returns {TaxonomyResponseSchema} */
|
|
93
|
+
static TaxonomyResponseSchema() {
|
|
94
|
+
return Joi.object({
|
|
95
|
+
items: Joi.array().items(CatalogPublicModel.TaxonomyItemResponseSchema()),
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @returns {ValidationErrors} */
|
|
100
|
+
static ValidationErrors() {
|
|
101
|
+
return Joi.object({
|
|
102
|
+
errors: Joi.array()
|
|
103
|
+
.items(CatalogPublicModel.ValidationError())
|
|
104
|
+
.required(),
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** @returns {ValidationError} */
|
|
109
|
+
static ValidationError() {
|
|
110
|
+
return Joi.object({
|
|
111
|
+
message: Joi.string().allow("").required(),
|
|
112
|
+
field: Joi.string().allow("").required(),
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
module.exports = CatalogPublicModel;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export = CatalogPublicValidator;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef GetTaxonomyByLevelParam
|
|
4
|
+
* @property {number} level - The level of taxonomy hierarchy to fetch: 0: Fetch
|
|
5
|
+
* departments. 1: Fetch L1 categories. 2: Fetch L2 categories. 3: Fetch L3 categories.
|
|
6
|
+
* @property {string} [l0Slug] - Level 0 (Department) slug of the taxonomy to
|
|
7
|
+
* filter results.
|
|
8
|
+
* @property {string} [l1Slug] - Level 1 (L1 Category) slug of the taxonomy to
|
|
9
|
+
* filter results.
|
|
10
|
+
* @property {string} [l2Slug] - Level 2 (L2 Category) slug of the taxonomy to
|
|
11
|
+
* filter results.
|
|
12
|
+
* @property {string} [l3Slug] - Level 3 (L3 Category) slug of the taxonomy to
|
|
13
|
+
* filter results.
|
|
14
|
+
* @property {number} [limit] - Applied limit on the number of items to be
|
|
15
|
+
* returned. Default is 5000.
|
|
16
|
+
*/
|
|
17
|
+
declare class CatalogPublicValidator {
|
|
18
|
+
/** @returns {GetTaxonomyByLevelParam} */
|
|
19
|
+
static getTaxonomyByLevel(): GetTaxonomyByLevelParam;
|
|
20
|
+
}
|
|
21
|
+
declare namespace CatalogPublicValidator {
|
|
22
|
+
export { GetTaxonomyByLevelParam };
|
|
23
|
+
}
|
|
24
|
+
type GetTaxonomyByLevelParam = {
|
|
25
|
+
/**
|
|
26
|
+
* - The level of taxonomy hierarchy to fetch: 0: Fetch
|
|
27
|
+
* departments. 1: Fetch L1 categories. 2: Fetch L2 categories. 3: Fetch L3 categories.
|
|
28
|
+
*/
|
|
29
|
+
level: number;
|
|
30
|
+
/**
|
|
31
|
+
* - Level 0 (Department) slug of the taxonomy to
|
|
32
|
+
* filter results.
|
|
33
|
+
*/
|
|
34
|
+
l0Slug?: string;
|
|
35
|
+
/**
|
|
36
|
+
* - Level 1 (L1 Category) slug of the taxonomy to
|
|
37
|
+
* filter results.
|
|
38
|
+
*/
|
|
39
|
+
l1Slug?: string;
|
|
40
|
+
/**
|
|
41
|
+
* - Level 2 (L2 Category) slug of the taxonomy to
|
|
42
|
+
* filter results.
|
|
43
|
+
*/
|
|
44
|
+
l2Slug?: string;
|
|
45
|
+
/**
|
|
46
|
+
* - Level 3 (L3 Category) slug of the taxonomy to
|
|
47
|
+
* filter results.
|
|
48
|
+
*/
|
|
49
|
+
l3Slug?: string;
|
|
50
|
+
/**
|
|
51
|
+
* - Applied limit on the number of items to be
|
|
52
|
+
* returned. Default is 5000.
|
|
53
|
+
*/
|
|
54
|
+
limit?: number;
|
|
55
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
const CatalogPublicModel = require("./CatalogPublicModel");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef GetTaxonomyByLevelParam
|
|
7
|
+
* @property {number} level - The level of taxonomy hierarchy to fetch: 0: Fetch
|
|
8
|
+
* departments. 1: Fetch L1 categories. 2: Fetch L2 categories. 3: Fetch L3 categories.
|
|
9
|
+
* @property {string} [l0Slug] - Level 0 (Department) slug of the taxonomy to
|
|
10
|
+
* filter results.
|
|
11
|
+
* @property {string} [l1Slug] - Level 1 (L1 Category) slug of the taxonomy to
|
|
12
|
+
* filter results.
|
|
13
|
+
* @property {string} [l2Slug] - Level 2 (L2 Category) slug of the taxonomy to
|
|
14
|
+
* filter results.
|
|
15
|
+
* @property {string} [l3Slug] - Level 3 (L3 Category) slug of the taxonomy to
|
|
16
|
+
* filter results.
|
|
17
|
+
* @property {number} [limit] - Applied limit on the number of items to be
|
|
18
|
+
* returned. Default is 5000.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
class CatalogPublicValidator {
|
|
22
|
+
/** @returns {GetTaxonomyByLevelParam} */
|
|
23
|
+
static getTaxonomyByLevel() {
|
|
24
|
+
return Joi.object({
|
|
25
|
+
level: Joi.number().required(),
|
|
26
|
+
l0Slug: Joi.string().allow(""),
|
|
27
|
+
l1Slug: Joi.string().allow(""),
|
|
28
|
+
l2Slug: Joi.string().allow(""),
|
|
29
|
+
l3Slug: Joi.string().allow(""),
|
|
30
|
+
limit: Joi.number(),
|
|
31
|
+
}).required();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = CatalogPublicValidator;
|
|
@@ -12,6 +12,7 @@ declare class PublicClient {
|
|
|
12
12
|
*/
|
|
13
13
|
constructor(config: import("./PublicConfig"));
|
|
14
14
|
config: import("./PublicConfig");
|
|
15
|
+
catalog: Catalog;
|
|
15
16
|
configuration: Configuration;
|
|
16
17
|
content: Content;
|
|
17
18
|
partner: Partner;
|
|
@@ -24,6 +25,7 @@ declare class PublicClient {
|
|
|
24
25
|
*/
|
|
25
26
|
setExtraHeaders(header: object): void;
|
|
26
27
|
}
|
|
28
|
+
import Catalog = require("./Catalog/CatalogPublicClient");
|
|
27
29
|
import Configuration = require("./Configuration/ConfigurationPublicClient");
|
|
28
30
|
import Content = require("./Content/ContentPublicClient");
|
|
29
31
|
import Partner = require("./Partner/PartnerPublicClient");
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const Catalog = require("./Catalog/CatalogPublicClient");
|
|
2
|
+
|
|
1
3
|
const Configuration = require("./Configuration/ConfigurationPublicClient");
|
|
2
4
|
|
|
3
5
|
const Content = require("./Content/ContentPublicClient");
|
|
@@ -22,6 +24,8 @@ class PublicClient {
|
|
|
22
24
|
constructor(config) {
|
|
23
25
|
this.config = config;
|
|
24
26
|
|
|
27
|
+
this.catalog = new Catalog(config);
|
|
28
|
+
|
|
25
29
|
this.configuration = new Configuration(config);
|
|
26
30
|
|
|
27
31
|
this.content = new Content(config);
|
package/sdk/public/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export const PublicConfig: typeof import("./PublicConfig");
|
|
2
2
|
export const PublicClient: typeof import("./PublicClient");
|
|
3
3
|
export namespace PublicModel {
|
|
4
|
+
const CatalogPublicModel: typeof import("./Catalog/CatalogPublicModel");
|
|
4
5
|
const ConfigurationPublicModel: typeof import("./Configuration/ConfigurationPublicModel");
|
|
5
6
|
const ContentPublicModel: typeof import("./Content/ContentPublicModel");
|
|
6
7
|
const PartnerPublicModel: typeof import("./Partner/PartnerPublicModel");
|
package/sdk/public/index.js
CHANGED
|
@@ -2,6 +2,8 @@ module.exports = {
|
|
|
2
2
|
PublicConfig: require("./PublicConfig"),
|
|
3
3
|
PublicClient: require("./PublicClient"),
|
|
4
4
|
PublicModel: {
|
|
5
|
+
CatalogPublicModel: require("./Catalog/CatalogPublicModel"),
|
|
6
|
+
|
|
5
7
|
ConfigurationPublicModel: require("./Configuration/ConfigurationPublicModel"),
|
|
6
8
|
|
|
7
9
|
ContentPublicModel: require("./Content/ContentPublicModel"),
|