@djust-b2b/djust-front-sdk 1.11.0 → 1.12.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/lib/index.d.ts +7 -1
- package/lib/index.js +2 -0
- package/lib/interfaces/models/incident.d.ts +29 -0
- package/lib/interfaces/models/incident.js +2 -0
- package/lib/services/cart/index.d.ts +2 -2
- package/lib/services/cart/index.js +3 -2
- package/lib/services/incident/definitions.d.ts +68 -0
- package/lib/services/incident/definitions.js +2 -0
- package/lib/services/incident/index.d.ts +222 -0
- package/lib/services/incident/index.js +311 -0
- package/lib/services/product-variant/definitions.d.ts +145 -0
- package/lib/services/product-variant/definitions.js +7 -0
- package/lib/services/product-variant/index.d.ts +200 -0
- package/lib/services/product-variant/index.js +238 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -21,6 +21,12 @@ export declare const DjustSDK: {
|
|
|
21
21
|
storeId?: string;
|
|
22
22
|
storeViewId?: string;
|
|
23
23
|
}>) => void;
|
|
24
|
+
getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }: import("./services/incident/definitions").getOrderLogisticIncidentsParameters): Promise<import("./services/incident/definitions").getOrderLogisticIncidentsResponse>;
|
|
25
|
+
getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }: import("./services/incident/definitions").getOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").getOrderLogisticIncidentResponse>;
|
|
26
|
+
getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }: import("./services/incident/definitions").getOrderLogisticLineIncidentsParameters): Promise<import("./services/incident/definitions").getOrderLogisticLineIncidentsResponse>;
|
|
27
|
+
createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentResponse>;
|
|
28
|
+
createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: import("./services/incident/definitions").createOrderLogisticLineIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticLineIncidentResponse>;
|
|
29
|
+
getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }: import("./services/incident/definitions").getCustomerAccountIncidentsParameters): Promise<import("./services/incident/definitions").getCustomerAccountIncidentsResponse>;
|
|
24
30
|
getCommercialOrders({ locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrdersParameters): Promise<import("./interfaces").GetCommercialOrdersResponse>;
|
|
25
31
|
createCommercialOrder({ nbPreviewLines, channel, customFields, locale, originId, paymentInfo, }: import("./interfaces").CreateCommercialOrderParameters): Promise<import("./interfaces").CreateCommercialOrderResponse>;
|
|
26
32
|
getCommercialOrder({ orderId, idType, locale, nbPreviewLines, }: import("./interfaces").GetCommercialOrderParameters): Promise<import("./interfaces").GetCommercialOrderResponse>;
|
|
@@ -116,7 +122,7 @@ export declare const DjustSDK: {
|
|
|
116
122
|
updateCustomerAccountOrganisationUser({ organisationId, customerUserId, civility, customFieldValues, firstName, lastName, phone, }: import("./interfaces").UpdateCustomerAccountOrganisationUserParameters): Promise<import("./interfaces").UpdateCustomerAccountOrganisationUserResponse>;
|
|
117
123
|
deleteCarts(): Promise<import("./interfaces").DeleteCartsResponse>;
|
|
118
124
|
getCarts(params: import("./interfaces").GetCartsParameters): Promise<import("./interfaces").GetCartsResponse>;
|
|
119
|
-
createCart(params: import("./interfaces").CreateCartParameters): Promise<
|
|
125
|
+
createCart(params: import("./interfaces").CreateCartParameters): Promise<import("./interfaces").GetCartResponse>;
|
|
120
126
|
deleteCart(params: import("./interfaces").DeleteCartParameters): Promise<void>;
|
|
121
127
|
getCart(params: import("./interfaces").GetCartParameters): Promise<import("./interfaces").GetCartResponse>;
|
|
122
128
|
updateCart(params: import("./interfaces").UpdateCartParameters): Promise<void>;
|
package/lib/index.js
CHANGED
|
@@ -48,6 +48,7 @@ const QuoteServices = __importStar(require("./services/quote"));
|
|
|
48
48
|
const SupplierServices = __importStar(require("./services/supplier"));
|
|
49
49
|
const LogisticOrderServices = __importStar(require("./services/logistic-order"));
|
|
50
50
|
const CommercialOrderServices = __importStar(require("./services/commercial-order"));
|
|
51
|
+
const IncidentServices = __importStar(require("./services/incident"));
|
|
51
52
|
const fetch_instance_1 = require("./settings/fetch-instance");
|
|
52
53
|
exports.DjustSDK = {
|
|
53
54
|
...AuthServices,
|
|
@@ -61,6 +62,7 @@ exports.DjustSDK = {
|
|
|
61
62
|
...SupplierServices,
|
|
62
63
|
...LogisticOrderServices,
|
|
63
64
|
...CommercialOrderServices,
|
|
65
|
+
...IncidentServices,
|
|
64
66
|
initialize: fetch_instance_1.initialize,
|
|
65
67
|
updateConfiguration: fetch_instance_1.updateConfiguration,
|
|
66
68
|
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CustomFieldValueObject } from "./custom-field";
|
|
2
|
+
export type IncidentStatus = "OPEN" | "ON_GOING" | "CLOSED";
|
|
3
|
+
export type IncidentIdType = "DJUST_ID" | "EXTERNAL_ID";
|
|
4
|
+
export interface IncidentLogisticOrder {
|
|
5
|
+
id: string;
|
|
6
|
+
externalId: string;
|
|
7
|
+
customFieldValues: CustomFieldValueObject[];
|
|
8
|
+
}
|
|
9
|
+
export interface IncidentOrderLine {
|
|
10
|
+
id: string;
|
|
11
|
+
externalId: string;
|
|
12
|
+
customFieldValues: CustomFieldValueObject[];
|
|
13
|
+
quantity: number;
|
|
14
|
+
status: IncidentStatus;
|
|
15
|
+
}
|
|
16
|
+
export interface IncidentDto {
|
|
17
|
+
createdAt: string;
|
|
18
|
+
externalId: string;
|
|
19
|
+
id: string;
|
|
20
|
+
logisticOrder: IncidentLogisticOrder;
|
|
21
|
+
orderLines: IncidentOrderLine[];
|
|
22
|
+
reasons: string[];
|
|
23
|
+
status: IncidentStatus;
|
|
24
|
+
threadId: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IncidentCreatedDto {
|
|
27
|
+
externalId: string;
|
|
28
|
+
incidentId: string;
|
|
29
|
+
}
|
|
@@ -93,7 +93,7 @@ export declare function getCarts(params: GetCartsParameters): Promise<GetCartsRe
|
|
|
93
93
|
*
|
|
94
94
|
* The name of the cart to create.
|
|
95
95
|
*
|
|
96
|
-
* @returns {Promise<
|
|
96
|
+
* @returns {Promise<GetCartResponse>} - A promise that resolves when the cart is created.
|
|
97
97
|
*
|
|
98
98
|
* @example
|
|
99
99
|
* #### input
|
|
@@ -107,7 +107,7 @@ export declare function getCarts(params: GetCartsParameters): Promise<GetCartsRe
|
|
|
107
107
|
* }
|
|
108
108
|
* ```
|
|
109
109
|
*/
|
|
110
|
-
export declare function createCart(params: CreateCartParameters): Promise<
|
|
110
|
+
export declare function createCart(params: CreateCartParameters): Promise<GetCartResponse>;
|
|
111
111
|
/**
|
|
112
112
|
* APICODE(cART300)
|
|
113
113
|
* Deletes a specific cart.
|
|
@@ -127,7 +127,7 @@ async function getCarts(params) {
|
|
|
127
127
|
*
|
|
128
128
|
* The name of the cart to create.
|
|
129
129
|
*
|
|
130
|
-
* @returns {Promise<
|
|
130
|
+
* @returns {Promise<GetCartResponse>} - A promise that resolves when the cart is created.
|
|
131
131
|
*
|
|
132
132
|
* @example
|
|
133
133
|
* #### input
|
|
@@ -143,11 +143,12 @@ async function getCarts(params) {
|
|
|
143
143
|
*/
|
|
144
144
|
async function createCart(params) {
|
|
145
145
|
const { name } = params;
|
|
146
|
-
(0, fetch_instance_1.enhancedFetch)({
|
|
146
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
147
147
|
method: "POST",
|
|
148
148
|
path: `/v2/shop/carts`,
|
|
149
149
|
body: JSON.stringify({ name }),
|
|
150
150
|
});
|
|
151
|
+
return data;
|
|
151
152
|
}
|
|
152
153
|
/**
|
|
153
154
|
* APICODE(cART300)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { IncidentDto, IncidentStatus, IncidentIdType, IncidentCreatedDto } from "../../interfaces/models/incident";
|
|
2
|
+
import { CustomFieldValueRequest } from "../../interfaces/models/custom-field";
|
|
3
|
+
/**
|
|
4
|
+
* Request parameters type definitions
|
|
5
|
+
*/
|
|
6
|
+
export interface getOrderLogisticIncidentsParameters {
|
|
7
|
+
logisticOrderId: string;
|
|
8
|
+
status: IncidentStatus[];
|
|
9
|
+
idType: IncidentIdType;
|
|
10
|
+
page: number;
|
|
11
|
+
size: number;
|
|
12
|
+
sort: String[];
|
|
13
|
+
}
|
|
14
|
+
export interface getOrderLogisticIncidentParameters {
|
|
15
|
+
logisticOrderId: string;
|
|
16
|
+
incidentId: string;
|
|
17
|
+
idType: IncidentIdType;
|
|
18
|
+
}
|
|
19
|
+
export interface getOrderLogisticLineIncidentsParameters {
|
|
20
|
+
logisticOrderId: string;
|
|
21
|
+
lineId: string;
|
|
22
|
+
status: IncidentStatus[];
|
|
23
|
+
idType: IncidentIdType;
|
|
24
|
+
page: number;
|
|
25
|
+
size: number;
|
|
26
|
+
sort: String[];
|
|
27
|
+
}
|
|
28
|
+
export interface createOrderLogisticIncidentParameters {
|
|
29
|
+
logisticOrderId: string;
|
|
30
|
+
idType: IncidentIdType;
|
|
31
|
+
customField: {
|
|
32
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
33
|
+
idType: IncidentIdType;
|
|
34
|
+
};
|
|
35
|
+
reasonCode: string[];
|
|
36
|
+
}
|
|
37
|
+
export interface createOrderLogisticLineIncidentParameters {
|
|
38
|
+
logisticOrderId: string;
|
|
39
|
+
idType: IncidentIdType;
|
|
40
|
+
customFieldIdType: IncidentIdType;
|
|
41
|
+
orderLines: {
|
|
42
|
+
customFieldValues: CustomFieldValueRequest[];
|
|
43
|
+
lineId: string;
|
|
44
|
+
quantity: number;
|
|
45
|
+
}[];
|
|
46
|
+
reasonCode: string[];
|
|
47
|
+
}
|
|
48
|
+
export interface getCustomerAccountIncidentsParameters {
|
|
49
|
+
customerAccountId: string;
|
|
50
|
+
status: IncidentStatus[];
|
|
51
|
+
page: number;
|
|
52
|
+
size: number;
|
|
53
|
+
sort: String[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
*/
|
|
57
|
+
export interface getOrderLogisticIncidentsResponse extends Array<IncidentDto> {
|
|
58
|
+
}
|
|
59
|
+
export interface getOrderLogisticIncidentResponse extends IncidentDto {
|
|
60
|
+
}
|
|
61
|
+
export interface getOrderLogisticLineIncidentsResponse extends Array<IncidentDto> {
|
|
62
|
+
}
|
|
63
|
+
export interface createOrderLogisticIncidentResponse extends IncidentCreatedDto {
|
|
64
|
+
}
|
|
65
|
+
export interface createOrderLogisticLineIncidentResponse extends IncidentCreatedDto {
|
|
66
|
+
}
|
|
67
|
+
export interface getCustomerAccountIncidentsResponse extends Array<IncidentDto> {
|
|
68
|
+
}
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
import { getOrderLogisticIncidentsParameters, getOrderLogisticIncidentParameters, getOrderLogisticLineIncidentsParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getCustomerAccountIncidentsParameters, getOrderLogisticIncidentsResponse, getOrderLogisticIncidentResponse, getOrderLogisticLineIncidentsResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse, getCustomerAccountIncidentsResponse } from "./definitions";
|
|
2
|
+
/**
|
|
3
|
+
* 🚚 Fetches logistic order incidents.
|
|
4
|
+
*
|
|
5
|
+
* This function retrieves a paginated list of incidents for a specific logistic order,
|
|
6
|
+
* filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
|
|
7
|
+
* and validated before the request is executed.
|
|
8
|
+
*
|
|
9
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-557]`
|
|
10
|
+
*
|
|
11
|
+
* | Parameter | Type | Required | Description |
|
|
12
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
13
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
14
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
15
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
16
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
17
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
18
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
19
|
+
*
|
|
20
|
+
* 📤 **Returns**:
|
|
21
|
+
* A `Promise` resolving to an array of `IncidentDto` objects representing the incidents.
|
|
22
|
+
*
|
|
23
|
+
* 🛠 **Example usage**:
|
|
24
|
+
* ```ts
|
|
25
|
+
* const incidents = await getOrderLogisticIncidents({
|
|
26
|
+
* logisticOrderId: "12345",
|
|
27
|
+
* status: ["OPEN", "CLOSED"],
|
|
28
|
+
* idType: "EXTERNAL_ID",
|
|
29
|
+
* page: 1,
|
|
30
|
+
* size: 10,
|
|
31
|
+
* sort: ["createdAt,desc"],
|
|
32
|
+
* });
|
|
33
|
+
* ```
|
|
34
|
+
*
|
|
35
|
+
* @param {getOrderLogisticIncidentsParameters} params - The parameters for the request.
|
|
36
|
+
* @throws {Error} If `logisticOrderId` is missing.
|
|
37
|
+
* @returns {Promise<getOrderLogisticIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
38
|
+
*/
|
|
39
|
+
export declare function getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }: getOrderLogisticIncidentsParameters): Promise<getOrderLogisticIncidentsResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* 🚚 Fetches a specific logistic order incident.
|
|
42
|
+
*
|
|
43
|
+
* This function retrieves a specific incident for a logistic order, identified by both
|
|
44
|
+
* the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
|
|
45
|
+
* before the request is executed.
|
|
46
|
+
*
|
|
47
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/{incidentId} [ORDER-503]`
|
|
48
|
+
*
|
|
49
|
+
* | Parameter | Type | Required | Description |
|
|
50
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
51
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch the incident for. |
|
|
52
|
+
* | `incidentId` | `string` | ✅ | The ID of the specific incident to fetch. |
|
|
53
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
54
|
+
*
|
|
55
|
+
* 📤 **Returns**:
|
|
56
|
+
* A `Promise` resolving to a single `getOrderLogisticIncidentResponse` object representing the incident.
|
|
57
|
+
*
|
|
58
|
+
* 🛠 **Example usage**:
|
|
59
|
+
* ```ts
|
|
60
|
+
* const incident = await getOrderLogisticIncident({
|
|
61
|
+
* logisticOrderId: "12345",
|
|
62
|
+
* incidentId: "incident_1",
|
|
63
|
+
* idType: "EXTERNAL_ID",
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*
|
|
67
|
+
* @param {getOrderLogisticIncidentParameters} params - The parameters for the request.
|
|
68
|
+
* @throws {Error} If `logisticOrderId` or `incidentId` is missing.
|
|
69
|
+
* @returns {Promise<getOrderLogisticIncidentResponse>} A promise resolving to the response containing the incident.
|
|
70
|
+
*/
|
|
71
|
+
export declare function getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }: getOrderLogisticIncidentParameters): Promise<getOrderLogisticIncidentResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* 🚚 Fetches incidents for a specific line of a logistic order.
|
|
74
|
+
*
|
|
75
|
+
* This function retrieves a list of incidents for a specific line in a logistic order,
|
|
76
|
+
* filtered by status and other parameters. The `logisticOrderId` and `lineId` parameters
|
|
77
|
+
* are mandatory and validated before the request is executed.
|
|
78
|
+
*
|
|
79
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/lines/{lineId} [ORDER-559]`
|
|
80
|
+
*
|
|
81
|
+
* | Parameter | Type | Required | Description |
|
|
82
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
83
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
84
|
+
* | `lineId` | `string` | ✅ | The ID of the line in the logistic order to fetch incidents for. |
|
|
85
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
86
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
87
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
88
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
89
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
90
|
+
*
|
|
91
|
+
* 📤 **Returns**:
|
|
92
|
+
* A `Promise` resolving to an array of `getOrderLogisticLineIncidentsResponse` objects representing the incidents.
|
|
93
|
+
*
|
|
94
|
+
* 🛠 **Example usage**:
|
|
95
|
+
* ```ts
|
|
96
|
+
* const incidents = await getOrderLogisticLineIncidents({
|
|
97
|
+
* logisticOrderId: "12345",
|
|
98
|
+
* lineId: "line_1",
|
|
99
|
+
* status: ["OPEN"],
|
|
100
|
+
* idType: "EXTERNAL_ID",
|
|
101
|
+
* page: 1,
|
|
102
|
+
* size: 10,
|
|
103
|
+
* sort: ["createdAt,desc"],
|
|
104
|
+
* });
|
|
105
|
+
* ```
|
|
106
|
+
*
|
|
107
|
+
* @param {getOrderLogisticLineIncidentsParameters} params - The parameters for the request.
|
|
108
|
+
* @throws {Error} If `logisticOrderId` or `lineId` is missing.
|
|
109
|
+
* @returns {Promise<getOrderLogisticLineIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
110
|
+
*/
|
|
111
|
+
export declare function getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }: getOrderLogisticLineIncidentsParameters): Promise<getOrderLogisticLineIncidentsResponse>;
|
|
112
|
+
/**
|
|
113
|
+
* 🚚 Creates a new incident for a specific logistic order.
|
|
114
|
+
*
|
|
115
|
+
* This function allows the creation of an incident for a given logistic order,
|
|
116
|
+
* requiring essential parameters like the `logisticOrderId` and `reasonCode`.
|
|
117
|
+
* The `customField` and `idType` are used to provide additional information for the incident creation.
|
|
118
|
+
*
|
|
119
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-101]`
|
|
120
|
+
*
|
|
121
|
+
* | Parameter | Type | Required | Description |
|
|
122
|
+
* |------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
123
|
+
* | `logisticOrderId`| `string` | ✅ | The ID of the logistic order for which the incident is created. |
|
|
124
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
125
|
+
* | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
|
|
126
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
127
|
+
*
|
|
128
|
+
* 📤 **Returns**:
|
|
129
|
+
* A `Promise` resolving to a `createOrderLogisticIncidentResponse` object,
|
|
130
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
131
|
+
*
|
|
132
|
+
* 🛠 **Example usage**:
|
|
133
|
+
* ```ts
|
|
134
|
+
* const incident = await createOrderLogisticIncident({
|
|
135
|
+
* logisticOrderId: "12345",
|
|
136
|
+
* idType: "EXTERNAL_ID",
|
|
137
|
+
* customField: { customFieldValues: [], idType: "EXTERNAL_ID" },
|
|
138
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
139
|
+
* });
|
|
140
|
+
* ```
|
|
141
|
+
*
|
|
142
|
+
* @param {createOrderLogisticIncidentParameters} params - The parameters for creating the incident.
|
|
143
|
+
* @throws {Error} If `logisticOrderId` or `reasonCode` is missing.
|
|
144
|
+
* @returns {Promise<createOrderLogisticIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
145
|
+
*/
|
|
146
|
+
export declare function createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: createOrderLogisticIncidentParameters): Promise<createOrderLogisticIncidentResponse>;
|
|
147
|
+
/**
|
|
148
|
+
* 🚚 Creates a new incident for a specific line within a logistic order.
|
|
149
|
+
*
|
|
150
|
+
* This function allows the creation of an incident for one or more lines within a logistic order.
|
|
151
|
+
* The `logisticOrderId`, `reasonCode`, and `orderLines` are required parameters.
|
|
152
|
+
* The `customFieldIdType` and `idType` are used for specifying additional information about the incident.
|
|
153
|
+
*
|
|
154
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/lines/incidents [ORDER-102]`
|
|
155
|
+
*
|
|
156
|
+
* | Parameter | Type | Required | Description |
|
|
157
|
+
* |--------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
158
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order for which the line incident is created. |
|
|
159
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
160
|
+
* | `customFieldIdType`| `IncidentIdType` | ❌ | The ID type for custom field values (e.g., `EXTERNAL_ID`). |
|
|
161
|
+
* | `orderLines` | `{ customFieldValues: CustomFieldValueRequest[], lineId: string, quantity: number }[]` | ✅ | An array of objects describing the order lines, including custom field values, line ID, and quantity. |
|
|
162
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
163
|
+
*
|
|
164
|
+
* 📤 **Returns**:
|
|
165
|
+
* A `Promise` resolving to a `createOrderLogisticLineIncidentResponse` object,
|
|
166
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
167
|
+
*
|
|
168
|
+
* 🛠 **Example usage**:
|
|
169
|
+
* ```ts
|
|
170
|
+
* const incident = await createOrderLogisticLineIncident({
|
|
171
|
+
* logisticOrderId: "12345",
|
|
172
|
+
* idType: "EXTERNAL_ID",
|
|
173
|
+
* customFieldIdType: "DJUST_ID",
|
|
174
|
+
* orderLines: [
|
|
175
|
+
* { customFieldValues: [], lineId: "line_1", quantity: 2 }
|
|
176
|
+
* ],
|
|
177
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
178
|
+
* });
|
|
179
|
+
* ```
|
|
180
|
+
*
|
|
181
|
+
* @param {createOrderLogisticLineIncidentParameters} params - The parameters for creating the incident.
|
|
182
|
+
* @throws {Error} If `logisticOrderId`, `reasonCode`, or `orderLines` is missing.
|
|
183
|
+
* @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
184
|
+
*/
|
|
185
|
+
export declare function createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }: createOrderLogisticLineIncidentParameters): Promise<createOrderLogisticLineIncidentResponse>;
|
|
186
|
+
/**
|
|
187
|
+
* 🧑💼 Fetches incidents for a specific customer account.
|
|
188
|
+
*
|
|
189
|
+
* This function retrieves incidents associated with a particular customer account,
|
|
190
|
+
* using parameters such as `status`, `page`, `size`, and `sort` to filter and paginate the results.
|
|
191
|
+
* The `customerAccountId` is a mandatory parameter and is validated before making the request.
|
|
192
|
+
*
|
|
193
|
+
* 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/{customerAccountId}/incidents [ACCOUNT-551]`
|
|
194
|
+
*
|
|
195
|
+
* | Parameter | Type | Required | Description |
|
|
196
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
197
|
+
* | `customerAccountId`| `string` | ✅ | The ID of the customer account for which incidents are to be fetched. |
|
|
198
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents by (e.g., `["OPEN"]`). |
|
|
199
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
200
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
201
|
+
* | `sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
202
|
+
*
|
|
203
|
+
* 📤 **Returns**:
|
|
204
|
+
* A `Promise` resolving to an array of `getCustomerAccountIncidentsResponse` objects,
|
|
205
|
+
* representing the incidents for the given customer account.
|
|
206
|
+
*
|
|
207
|
+
* 🛠 **Example usage**:
|
|
208
|
+
* ```ts
|
|
209
|
+
* const incidents = await getCustomerAccountIncidents({
|
|
210
|
+
* customerAccountId: "98765",
|
|
211
|
+
* status: ["OPEN"],
|
|
212
|
+
* page: 1,
|
|
213
|
+
* size: 10,
|
|
214
|
+
* sort: ["createdAt,desc"],
|
|
215
|
+
* });
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* @param {getCustomerAccountIncidentsParameters} params - The parameters for the request.
|
|
219
|
+
* @throws {Error} If `customerAccountId` is missing.
|
|
220
|
+
* @returns {Promise<getCustomerAccountIncidentsResponse>} A promise resolving to the incidents response.
|
|
221
|
+
*/
|
|
222
|
+
export declare function getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }: getCustomerAccountIncidentsParameters): Promise<getCustomerAccountIncidentsResponse>;
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getOrderLogisticIncidents = getOrderLogisticIncidents;
|
|
4
|
+
exports.getOrderLogisticIncident = getOrderLogisticIncident;
|
|
5
|
+
exports.getOrderLogisticLineIncidents = getOrderLogisticLineIncidents;
|
|
6
|
+
exports.createOrderLogisticIncident = createOrderLogisticIncident;
|
|
7
|
+
exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
|
|
8
|
+
exports.getCustomerAccountIncidents = getCustomerAccountIncidents;
|
|
9
|
+
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
10
|
+
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
11
|
+
/**
|
|
12
|
+
* 🚚 Fetches logistic order incidents.
|
|
13
|
+
*
|
|
14
|
+
* This function retrieves a paginated list of incidents for a specific logistic order,
|
|
15
|
+
* filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
|
|
16
|
+
* and validated before the request is executed.
|
|
17
|
+
*
|
|
18
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-557]`
|
|
19
|
+
*
|
|
20
|
+
* | Parameter | Type | Required | Description |
|
|
21
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
22
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
23
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
24
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
25
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
26
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
27
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
28
|
+
*
|
|
29
|
+
* 📤 **Returns**:
|
|
30
|
+
* A `Promise` resolving to an array of `IncidentDto` objects representing the incidents.
|
|
31
|
+
*
|
|
32
|
+
* 🛠 **Example usage**:
|
|
33
|
+
* ```ts
|
|
34
|
+
* const incidents = await getOrderLogisticIncidents({
|
|
35
|
+
* logisticOrderId: "12345",
|
|
36
|
+
* status: ["OPEN", "CLOSED"],
|
|
37
|
+
* idType: "EXTERNAL_ID",
|
|
38
|
+
* page: 1,
|
|
39
|
+
* size: 10,
|
|
40
|
+
* sort: ["createdAt,desc"],
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* @param {getOrderLogisticIncidentsParameters} params - The parameters for the request.
|
|
45
|
+
* @throws {Error} If `logisticOrderId` is missing.
|
|
46
|
+
* @returns {Promise<getOrderLogisticIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
47
|
+
*/
|
|
48
|
+
async function getOrderLogisticIncidents({ logisticOrderId, status, idType, page, size, sort, }) {
|
|
49
|
+
(0, parameters_validation_1.required)({ logisticOrderId });
|
|
50
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
51
|
+
method: "GET",
|
|
52
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents`,
|
|
53
|
+
params: {
|
|
54
|
+
status,
|
|
55
|
+
idType,
|
|
56
|
+
page,
|
|
57
|
+
size,
|
|
58
|
+
sort,
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return data;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* 🚚 Fetches a specific logistic order incident.
|
|
65
|
+
*
|
|
66
|
+
* This function retrieves a specific incident for a logistic order, identified by both
|
|
67
|
+
* the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
|
|
68
|
+
* before the request is executed.
|
|
69
|
+
*
|
|
70
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/{incidentId} [ORDER-503]`
|
|
71
|
+
*
|
|
72
|
+
* | Parameter | Type | Required | Description |
|
|
73
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
74
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch the incident for. |
|
|
75
|
+
* | `incidentId` | `string` | ✅ | The ID of the specific incident to fetch. |
|
|
76
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
77
|
+
*
|
|
78
|
+
* 📤 **Returns**:
|
|
79
|
+
* A `Promise` resolving to a single `getOrderLogisticIncidentResponse` object representing the incident.
|
|
80
|
+
*
|
|
81
|
+
* 🛠 **Example usage**:
|
|
82
|
+
* ```ts
|
|
83
|
+
* const incident = await getOrderLogisticIncident({
|
|
84
|
+
* logisticOrderId: "12345",
|
|
85
|
+
* incidentId: "incident_1",
|
|
86
|
+
* idType: "EXTERNAL_ID",
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @param {getOrderLogisticIncidentParameters} params - The parameters for the request.
|
|
91
|
+
* @throws {Error} If `logisticOrderId` or `incidentId` is missing.
|
|
92
|
+
* @returns {Promise<getOrderLogisticIncidentResponse>} A promise resolving to the response containing the incident.
|
|
93
|
+
*/
|
|
94
|
+
async function getOrderLogisticIncident({ logisticOrderId, incidentId, idType, }) {
|
|
95
|
+
(0, parameters_validation_1.required)({ logisticOrderId, incidentId });
|
|
96
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
97
|
+
method: "GET",
|
|
98
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents/${incidentId}`,
|
|
99
|
+
params: {
|
|
100
|
+
idType,
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
return data;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* 🚚 Fetches incidents for a specific line of a logistic order.
|
|
107
|
+
*
|
|
108
|
+
* This function retrieves a list of incidents for a specific line in a logistic order,
|
|
109
|
+
* filtered by status and other parameters. The `logisticOrderId` and `lineId` parameters
|
|
110
|
+
* are mandatory and validated before the request is executed.
|
|
111
|
+
*
|
|
112
|
+
* 🛠 **Endpoint**: `GET /v1/shop/logistic-orders/{logisticOrderId}/incidents/lines/{lineId} [ORDER-559]`
|
|
113
|
+
*
|
|
114
|
+
* | Parameter | Type | Required | Description |
|
|
115
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
116
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order to fetch incidents for. |
|
|
117
|
+
* | `lineId` | `string` | ✅ | The ID of the line in the logistic order to fetch incidents for. |
|
|
118
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents (e.g., `["OPEN"]`). |
|
|
119
|
+
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
120
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
121
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
122
|
+
* | `sort` | `String[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
123
|
+
*
|
|
124
|
+
* 📤 **Returns**:
|
|
125
|
+
* A `Promise` resolving to an array of `getOrderLogisticLineIncidentsResponse` objects representing the incidents.
|
|
126
|
+
*
|
|
127
|
+
* 🛠 **Example usage**:
|
|
128
|
+
* ```ts
|
|
129
|
+
* const incidents = await getOrderLogisticLineIncidents({
|
|
130
|
+
* logisticOrderId: "12345",
|
|
131
|
+
* lineId: "line_1",
|
|
132
|
+
* status: ["OPEN"],
|
|
133
|
+
* idType: "EXTERNAL_ID",
|
|
134
|
+
* page: 1,
|
|
135
|
+
* size: 10,
|
|
136
|
+
* sort: ["createdAt,desc"],
|
|
137
|
+
* });
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @param {getOrderLogisticLineIncidentsParameters} params - The parameters for the request.
|
|
141
|
+
* @throws {Error} If `logisticOrderId` or `lineId` is missing.
|
|
142
|
+
* @returns {Promise<getOrderLogisticLineIncidentsResponse>} A promise resolving to the response containing the incidents.
|
|
143
|
+
*/
|
|
144
|
+
async function getOrderLogisticLineIncidents({ logisticOrderId, lineId, status, idType, page, size, sort, }) {
|
|
145
|
+
(0, parameters_validation_1.required)({ logisticOrderId, lineId });
|
|
146
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
147
|
+
method: "GET",
|
|
148
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents/lines/${lineId}`,
|
|
149
|
+
params: {
|
|
150
|
+
status,
|
|
151
|
+
idType,
|
|
152
|
+
page,
|
|
153
|
+
size,
|
|
154
|
+
sort,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
return data;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* 🚚 Creates a new incident for a specific logistic order.
|
|
161
|
+
*
|
|
162
|
+
* This function allows the creation of an incident for a given logistic order,
|
|
163
|
+
* requiring essential parameters like the `logisticOrderId` and `reasonCode`.
|
|
164
|
+
* The `customField` and `idType` are used to provide additional information for the incident creation.
|
|
165
|
+
*
|
|
166
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/incidents [ORDER-101]`
|
|
167
|
+
*
|
|
168
|
+
* | Parameter | Type | Required | Description |
|
|
169
|
+
* |------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
170
|
+
* | `logisticOrderId`| `string` | ✅ | The ID of the logistic order for which the incident is created. |
|
|
171
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
172
|
+
* | `customField` | `{ customFieldValues: CustomFieldValueRequest[], idType: IncidentIdType }` | ❌ | The custom field data for the incident, including custom field values and ID type. |
|
|
173
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
174
|
+
*
|
|
175
|
+
* 📤 **Returns**:
|
|
176
|
+
* A `Promise` resolving to a `createOrderLogisticIncidentResponse` object,
|
|
177
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
178
|
+
*
|
|
179
|
+
* 🛠 **Example usage**:
|
|
180
|
+
* ```ts
|
|
181
|
+
* const incident = await createOrderLogisticIncident({
|
|
182
|
+
* logisticOrderId: "12345",
|
|
183
|
+
* idType: "EXTERNAL_ID",
|
|
184
|
+
* customField: { customFieldValues: [], idType: "EXTERNAL_ID" },
|
|
185
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
186
|
+
* });
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
189
|
+
* @param {createOrderLogisticIncidentParameters} params - The parameters for creating the incident.
|
|
190
|
+
* @throws {Error} If `logisticOrderId` or `reasonCode` is missing.
|
|
191
|
+
* @returns {Promise<createOrderLogisticIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
192
|
+
*/
|
|
193
|
+
async function createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }) {
|
|
194
|
+
(0, parameters_validation_1.required)({ logisticOrderId, reasonCode });
|
|
195
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
196
|
+
method: "POST",
|
|
197
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/incidents`,
|
|
198
|
+
params: {
|
|
199
|
+
idType,
|
|
200
|
+
},
|
|
201
|
+
body: JSON.stringify({
|
|
202
|
+
customField,
|
|
203
|
+
reasonCode,
|
|
204
|
+
}),
|
|
205
|
+
});
|
|
206
|
+
return data;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* 🚚 Creates a new incident for a specific line within a logistic order.
|
|
210
|
+
*
|
|
211
|
+
* This function allows the creation of an incident for one or more lines within a logistic order.
|
|
212
|
+
* The `logisticOrderId`, `reasonCode`, and `orderLines` are required parameters.
|
|
213
|
+
* The `customFieldIdType` and `idType` are used for specifying additional information about the incident.
|
|
214
|
+
*
|
|
215
|
+
* 🛠 **Endpoint**: `POST /v1/shop/logistic-orders/{logisticOrderId}/lines/incidents [ORDER-102]`
|
|
216
|
+
*
|
|
217
|
+
* | Parameter | Type | Required | Description |
|
|
218
|
+
* |--------------------|-------------------------------------|------------|----------------------------------------------------------|
|
|
219
|
+
* | `logisticOrderId` | `string` | ✅ | The ID of the logistic order for which the line incident is created. |
|
|
220
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of incident ID (e.g., `DJUST_ID`, `EXTERNAL_ID`). |
|
|
221
|
+
* | `customFieldIdType`| `IncidentIdType` | ❌ | The ID type for custom field values (e.g., `EXTERNAL_ID`). |
|
|
222
|
+
* | `orderLines` | `{ customFieldValues: CustomFieldValueRequest[], lineId: string, quantity: number }[]` | ✅ | An array of objects describing the order lines, including custom field values, line ID, and quantity. |
|
|
223
|
+
* | `reasonCode` | `string[]` | ✅ | The reason codes for the incident (e.g., `["PRODUCT_DEFECT"]`). |
|
|
224
|
+
*
|
|
225
|
+
* 📤 **Returns**:
|
|
226
|
+
* A `Promise` resolving to a `createOrderLogisticLineIncidentResponse` object,
|
|
227
|
+
* containing the `incidentId` and `externalId` of the created incident.
|
|
228
|
+
*
|
|
229
|
+
* 🛠 **Example usage**:
|
|
230
|
+
* ```ts
|
|
231
|
+
* const incident = await createOrderLogisticLineIncident({
|
|
232
|
+
* logisticOrderId: "12345",
|
|
233
|
+
* idType: "EXTERNAL_ID",
|
|
234
|
+
* customFieldIdType: "DJUST_ID",
|
|
235
|
+
* orderLines: [
|
|
236
|
+
* { customFieldValues: [], lineId: "line_1", quantity: 2 }
|
|
237
|
+
* ],
|
|
238
|
+
* reasonCode: ["PRODUCT_DEFECT"]
|
|
239
|
+
* });
|
|
240
|
+
* ```
|
|
241
|
+
*
|
|
242
|
+
* @param {createOrderLogisticLineIncidentParameters} params - The parameters for creating the incident.
|
|
243
|
+
* @throws {Error} If `logisticOrderId`, `reasonCode`, or `orderLines` is missing.
|
|
244
|
+
* @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
245
|
+
*/
|
|
246
|
+
async function createOrderLogisticLineIncident({ logisticOrderId, idType, customFieldIdType, orderLines, reasonCode, }) {
|
|
247
|
+
(0, parameters_validation_1.required)({ logisticOrderId, reasonCode, orderLines });
|
|
248
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
249
|
+
method: "POST",
|
|
250
|
+
path: `/v1/shop/logistic-orders/${logisticOrderId}/lines/incidents`,
|
|
251
|
+
params: {
|
|
252
|
+
idType,
|
|
253
|
+
},
|
|
254
|
+
body: JSON.stringify({
|
|
255
|
+
customFieldIdType,
|
|
256
|
+
orderLines,
|
|
257
|
+
reasonCode,
|
|
258
|
+
}),
|
|
259
|
+
});
|
|
260
|
+
return data;
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* 🧑💼 Fetches incidents for a specific customer account.
|
|
264
|
+
*
|
|
265
|
+
* This function retrieves incidents associated with a particular customer account,
|
|
266
|
+
* using parameters such as `status`, `page`, `size`, and `sort` to filter and paginate the results.
|
|
267
|
+
* The `customerAccountId` is a mandatory parameter and is validated before making the request.
|
|
268
|
+
*
|
|
269
|
+
* 🛠 **Endpoint**: `GET /v1/shop/customer-accounts/{customerAccountId}/incidents [ACCOUNT-551]`
|
|
270
|
+
*
|
|
271
|
+
* | Parameter | Type | Required | Description |
|
|
272
|
+
* |-------------------|---------------------------------|------------|------------------------------------------|
|
|
273
|
+
* | `customerAccountId`| `string` | ✅ | The ID of the customer account for which incidents are to be fetched. |
|
|
274
|
+
* | `status` | `IncidentStatus[]` | ❌ | Array of statuses to filter incidents by (e.g., `["OPEN"]`). |
|
|
275
|
+
* | `page` | `number` | ❌ | The page number for pagination. |
|
|
276
|
+
* | `size` | `number` | ❌ | The number of results per page. |
|
|
277
|
+
* | `sort` | `string[]` | ❌ | Sorting criteria (e.g., `["createdAt,desc"]`). |
|
|
278
|
+
*
|
|
279
|
+
* 📤 **Returns**:
|
|
280
|
+
* A `Promise` resolving to an array of `getCustomerAccountIncidentsResponse` objects,
|
|
281
|
+
* representing the incidents for the given customer account.
|
|
282
|
+
*
|
|
283
|
+
* 🛠 **Example usage**:
|
|
284
|
+
* ```ts
|
|
285
|
+
* const incidents = await getCustomerAccountIncidents({
|
|
286
|
+
* customerAccountId: "98765",
|
|
287
|
+
* status: ["OPEN"],
|
|
288
|
+
* page: 1,
|
|
289
|
+
* size: 10,
|
|
290
|
+
* sort: ["createdAt,desc"],
|
|
291
|
+
* });
|
|
292
|
+
* ```
|
|
293
|
+
*
|
|
294
|
+
* @param {getCustomerAccountIncidentsParameters} params - The parameters for the request.
|
|
295
|
+
* @throws {Error} If `customerAccountId` is missing.
|
|
296
|
+
* @returns {Promise<getCustomerAccountIncidentsResponse>} A promise resolving to the incidents response.
|
|
297
|
+
*/
|
|
298
|
+
async function getCustomerAccountIncidents({ customerAccountId, status, page, size, sort, }) {
|
|
299
|
+
(0, parameters_validation_1.required)({ customerAccountId });
|
|
300
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
301
|
+
method: "GET",
|
|
302
|
+
path: `/v1/shop/customer-accounts/${customerAccountId}/incidents`,
|
|
303
|
+
params: {
|
|
304
|
+
status,
|
|
305
|
+
page,
|
|
306
|
+
size,
|
|
307
|
+
sort,
|
|
308
|
+
},
|
|
309
|
+
});
|
|
310
|
+
return data;
|
|
311
|
+
}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { AttributeObject } from "../../interfaces/models/attribute";
|
|
2
|
+
import { PageableParameters } from "../../interfaces/models/common";
|
|
3
|
+
import { OfferResponse } from "../../interfaces/models/offer";
|
|
4
|
+
import { PageProductVariantResponse, Product, ProductAutocomplete, ProductReviewDto, ProductReviewRatings, ProductReviewsSummary, SearchThumbnailsAndAggregation } from "../../interfaces/models/product";
|
|
5
|
+
import { SearchProduct } from "../../interfaces/models/searchProduct";
|
|
6
|
+
import { SupplierSimpleView } from "../../interfaces/models/supplier";
|
|
7
|
+
import { Order, PageableObject } from "../../interfaces/models/common";
|
|
8
|
+
/**
|
|
9
|
+
* Requests parameters type definitions
|
|
10
|
+
*/
|
|
11
|
+
export interface CreateProductReviewParameters {
|
|
12
|
+
message: string;
|
|
13
|
+
productSku: string;
|
|
14
|
+
rating: number;
|
|
15
|
+
}
|
|
16
|
+
export interface UpdateProductReviewParameters {
|
|
17
|
+
productReviewId: string;
|
|
18
|
+
message: string;
|
|
19
|
+
rating: number;
|
|
20
|
+
}
|
|
21
|
+
declare enum AggregationType {
|
|
22
|
+
PRODUCT = "PRODUCT",
|
|
23
|
+
VARIANT = "VARIANT"
|
|
24
|
+
}
|
|
25
|
+
export interface GetProductsListParameters {
|
|
26
|
+
locale: string;
|
|
27
|
+
filters?: {
|
|
28
|
+
currency: string;
|
|
29
|
+
categoryIds?: string[];
|
|
30
|
+
skus?: string[];
|
|
31
|
+
brand?: string[];
|
|
32
|
+
query?: string;
|
|
33
|
+
productTags?: string[];
|
|
34
|
+
aggregation?: AggregationType;
|
|
35
|
+
attributes?: string[];
|
|
36
|
+
suppliers?: string[];
|
|
37
|
+
customFields?: string[];
|
|
38
|
+
offerUpdatedTime?: string;
|
|
39
|
+
productUpdatedTime?: string;
|
|
40
|
+
};
|
|
41
|
+
pageable?: PageableParameters;
|
|
42
|
+
}
|
|
43
|
+
export interface GetProductStatReviewsParameters {
|
|
44
|
+
productIdentifier: string;
|
|
45
|
+
productIdType: string;
|
|
46
|
+
}
|
|
47
|
+
export interface GetProductReviewsParameters {
|
|
48
|
+
productIdentifier: string;
|
|
49
|
+
productIdType: string;
|
|
50
|
+
}
|
|
51
|
+
export interface GetProductParameters {
|
|
52
|
+
productIdentifier: string;
|
|
53
|
+
productIdType: string;
|
|
54
|
+
locale?: string;
|
|
55
|
+
}
|
|
56
|
+
export interface GetProductOffersParameters {
|
|
57
|
+
productIdentifier: string;
|
|
58
|
+
productIdType: string;
|
|
59
|
+
locale?: string;
|
|
60
|
+
currency?: string;
|
|
61
|
+
}
|
|
62
|
+
export interface GetProductVariantsListParameters {
|
|
63
|
+
productSku: string;
|
|
64
|
+
locale?: string;
|
|
65
|
+
pageable?: PageableParameters;
|
|
66
|
+
}
|
|
67
|
+
export interface GetProductVariantAttributesParameters {
|
|
68
|
+
productIdentifier: string;
|
|
69
|
+
productIdType: string;
|
|
70
|
+
locale?: string;
|
|
71
|
+
}
|
|
72
|
+
export interface AutoCompleteSearchProductsParameters {
|
|
73
|
+
input: string;
|
|
74
|
+
locale: string;
|
|
75
|
+
currency: string;
|
|
76
|
+
aggregation?: AggregationType;
|
|
77
|
+
productTags?: string[];
|
|
78
|
+
pageable?: PageableParameters;
|
|
79
|
+
}
|
|
80
|
+
export interface GetProductVariantSuppliersParameters {
|
|
81
|
+
productVariantId: string;
|
|
82
|
+
}
|
|
83
|
+
export interface GetProductVariantOffersParameters {
|
|
84
|
+
productIdentifier: string;
|
|
85
|
+
productIdType: string;
|
|
86
|
+
currency?: string;
|
|
87
|
+
}
|
|
88
|
+
export interface GetRelatedProductsParameters {
|
|
89
|
+
productIdentifier: string;
|
|
90
|
+
productIdType: string;
|
|
91
|
+
locale?: string;
|
|
92
|
+
currency?: string;
|
|
93
|
+
pageable?: PageableParameters;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Responses type definitions
|
|
97
|
+
*/
|
|
98
|
+
export interface CreateProductReviewResponse extends ProductReviewsSummary {
|
|
99
|
+
}
|
|
100
|
+
export interface UpdateProductReviewResponse extends ProductReviewDto {
|
|
101
|
+
}
|
|
102
|
+
export interface GetProductsListResponse extends SearchProduct {
|
|
103
|
+
}
|
|
104
|
+
export interface GetProductStatReviewsResponse extends ProductReviewRatings {
|
|
105
|
+
}
|
|
106
|
+
export interface GetProductReviewsResponse extends Array<ProductReviewsSummary> {
|
|
107
|
+
}
|
|
108
|
+
export interface GetProductResponse extends Product {
|
|
109
|
+
}
|
|
110
|
+
export interface GetProductOffersResponse extends Array<OfferResponse> {
|
|
111
|
+
}
|
|
112
|
+
export interface GetProductVariantsListResponse extends PageProductVariantResponse {
|
|
113
|
+
}
|
|
114
|
+
export interface GetProductVariantAttributesResponse extends Array<AttributeObject> {
|
|
115
|
+
}
|
|
116
|
+
export interface SearchProductsResponse extends Array<ProductAutocomplete> {
|
|
117
|
+
}
|
|
118
|
+
export interface GetProductVariantSuppliersResponse extends Array<SupplierSimpleView> {
|
|
119
|
+
}
|
|
120
|
+
export interface GetProductVariantOffersResponse extends Array<OfferResponse> {
|
|
121
|
+
}
|
|
122
|
+
export interface GetRelatedProductsResponse extends SearchThumbnailsAndAggregation {
|
|
123
|
+
}
|
|
124
|
+
export interface GetProductPaginatedOffersParameters {
|
|
125
|
+
productIdentifier: string;
|
|
126
|
+
productIdType?: string;
|
|
127
|
+
locale?: string;
|
|
128
|
+
currency?: string;
|
|
129
|
+
withoutPrices?: boolean;
|
|
130
|
+
pageable?: PageableParameters;
|
|
131
|
+
}
|
|
132
|
+
export interface GetProductPaginatedOffersResponse {
|
|
133
|
+
content: OfferResponse[];
|
|
134
|
+
empty: boolean;
|
|
135
|
+
first: boolean;
|
|
136
|
+
last: boolean;
|
|
137
|
+
number: number;
|
|
138
|
+
numberOfElements: number;
|
|
139
|
+
pageable: PageableObject;
|
|
140
|
+
size: number;
|
|
141
|
+
sort: Order[];
|
|
142
|
+
totalElements: number;
|
|
143
|
+
totalPages: number;
|
|
144
|
+
}
|
|
145
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { GetProductVariantAttributesParameters, GetProductVariantAttributesResponse, GetProductVariantSuppliersParameters, GetProductVariantSuppliersResponse, GetProductVariantsListParameters, GetProductVariantsListResponse } from "./definitions";
|
|
2
|
+
/**
|
|
3
|
+
* APICODE(pVAR300)
|
|
4
|
+
* Retrieves a paginated list of product variants.
|
|
5
|
+
*
|
|
6
|
+
* This function fetches a list of product variants associated with a specific product SKU.
|
|
7
|
+
*
|
|
8
|
+
* @param {GetProductVariantsListParameters} params - The parameters to filter the product variants list, including:
|
|
9
|
+
* #### productSku - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
10
|
+
* The SKU of the product to fetch variants for.
|
|
11
|
+
*
|
|
12
|
+
* #### locale - `string` | optional
|
|
13
|
+
* The locale for the product variants.
|
|
14
|
+
*
|
|
15
|
+
* #### pageable - `object` | optional
|
|
16
|
+
* Pagination details, including:
|
|
17
|
+
* - `page`: The page number.
|
|
18
|
+
* - `size`: The number of items per page.
|
|
19
|
+
* - `sort`: Sorting criteria.
|
|
20
|
+
*
|
|
21
|
+
* @returns {Promise<GetProductVariantsListResponse>} - A promise that resolves with the paginated list of product variants.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* #### input
|
|
25
|
+
* ```typescript
|
|
26
|
+
* await getProductVariantsList({
|
|
27
|
+
* productSku: 'product123',
|
|
28
|
+
* locale: 'en-US',
|
|
29
|
+
* pageable: { page: 1, size: 10, sort: 'name,asc' },
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
* #### output
|
|
33
|
+
* ```json
|
|
34
|
+
* {
|
|
35
|
+
* "content": [
|
|
36
|
+
* { "id": "variant1", "name": "Variant 1" },
|
|
37
|
+
* { "id": "variant2", "name": "Variant 2" }
|
|
38
|
+
* ],
|
|
39
|
+
* "pageable": {
|
|
40
|
+
* "page": 1,
|
|
41
|
+
* "size": 10,
|
|
42
|
+
* "totalPages": 5
|
|
43
|
+
* }
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function getProductVariantsList({ productSku, locale, pageable, }: GetProductVariantsListParameters): Promise<GetProductVariantsListResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* APICODE(vSUP300)
|
|
50
|
+
* Retrieves suppliers of a specific product variant.
|
|
51
|
+
*
|
|
52
|
+
* This function fetches a list of suppliers associated with a product variant.
|
|
53
|
+
*
|
|
54
|
+
* @param {GetProductVariantSuppliersParameters} params - The parameters to identify the product variant, including:
|
|
55
|
+
* #### productVariantId - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
56
|
+
* The ID of the product variant to fetch suppliers for.
|
|
57
|
+
*
|
|
58
|
+
* @returns {Promise<GetProductVariantSuppliersResponse>} - A promise that resolves with the suppliers of the product variant.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* #### input
|
|
62
|
+
* ```typescript
|
|
63
|
+
* await getProductVariantSuppliers({ productVariantId: 'variant123' });
|
|
64
|
+
* ```
|
|
65
|
+
* #### output
|
|
66
|
+
* ```json
|
|
67
|
+
* {
|
|
68
|
+
* "suppliers": [
|
|
69
|
+
* { "id": "supplier1", "name": "Supplier 1" },
|
|
70
|
+
* { "id": "supplier2", "name": "Supplier 2" }
|
|
71
|
+
* ]
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare function getProductVariantSuppliers({ productVariantId, }: GetProductVariantSuppliersParameters): Promise<GetProductVariantSuppliersResponse>;
|
|
76
|
+
/**
|
|
77
|
+
* ## 🛒 APICODE(vATT300) - Fetch Product Variant Attributes
|
|
78
|
+
*
|
|
79
|
+
* Retrieves detailed attributes of a product variant identified by SKU, ID, or external ID.
|
|
80
|
+
* This metadata includes key details such as **color**, **size**, and **material**, making it easier to describe the variant.
|
|
81
|
+
*
|
|
82
|
+
* ---
|
|
83
|
+
*
|
|
84
|
+
* ### 📥 Parameters
|
|
85
|
+
*
|
|
86
|
+
* | Parameter | Type | Required | Description |
|
|
87
|
+
* |---------------------|----------|----------|-----------------------------------------------------------------------------|
|
|
88
|
+
* | `productIdentifier` | `string` | ✅ Yes | The unique identifier of the product variant (e.g., SKU, ID, external ID). |
|
|
89
|
+
* | `productIdType` | `string` | ✅ Yes | The type of the identifier: `"sku"`, `"id"`, or `"externalId"`. |
|
|
90
|
+
* | `locale` | `string` | ❌ No | The locale for localized data (e.g., `"en-US"`, `"fr-FR"`). Defaults to the system locale. |
|
|
91
|
+
*
|
|
92
|
+
* ---
|
|
93
|
+
*
|
|
94
|
+
* ### 📤 Returns
|
|
95
|
+
* **Type:** `Promise<GetProductVariantAttributesResponse>`
|
|
96
|
+
* Resolves with the following structure:
|
|
97
|
+
*
|
|
98
|
+
* ```typescript
|
|
99
|
+
* {
|
|
100
|
+
* attributes: Array<{
|
|
101
|
+
* id: string;
|
|
102
|
+
* name: string;
|
|
103
|
+
* value: string | number;
|
|
104
|
+
* type: string;
|
|
105
|
+
* isRequired: boolean;
|
|
106
|
+
* description: string;
|
|
107
|
+
* }>;
|
|
108
|
+
* locale: string;
|
|
109
|
+
* productIdentifier: string;
|
|
110
|
+
* }
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
113
|
+
* ---
|
|
114
|
+
*
|
|
115
|
+
* ### 🧑💻 Example Usage
|
|
116
|
+
*
|
|
117
|
+
* **Basic Example:**
|
|
118
|
+
* ```typescript
|
|
119
|
+
* const attributes = await getProductVariantAttributes({
|
|
120
|
+
* productIdentifier: 'sku123',
|
|
121
|
+
* productIdType: 'sku',
|
|
122
|
+
* locale: 'en-US',
|
|
123
|
+
* });
|
|
124
|
+
* console.log(attributes);
|
|
125
|
+
* ```
|
|
126
|
+
*
|
|
127
|
+
* **Alternative Locale:**
|
|
128
|
+
* ```typescript
|
|
129
|
+
* const attributes = await getProductVariantAttributes({
|
|
130
|
+
* productIdentifier: 'prod789',
|
|
131
|
+
* productIdType: 'externalId',
|
|
132
|
+
* locale: 'fr-FR',
|
|
133
|
+
* });
|
|
134
|
+
* console.log(attributes);
|
|
135
|
+
* ```
|
|
136
|
+
*
|
|
137
|
+
* ---
|
|
138
|
+
*
|
|
139
|
+
* ### 📝 Example Input
|
|
140
|
+
* ```json
|
|
141
|
+
* {
|
|
142
|
+
* "productIdentifier": "sku123",
|
|
143
|
+
* "productIdType": "sku",
|
|
144
|
+
* "locale": "en-US"
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*
|
|
148
|
+
* ---
|
|
149
|
+
*
|
|
150
|
+
* ### 📦 Example Output
|
|
151
|
+
* ```json
|
|
152
|
+
* {
|
|
153
|
+
* "attributes": [
|
|
154
|
+
* {
|
|
155
|
+
* "id": "attr1",
|
|
156
|
+
* "name": "Color",
|
|
157
|
+
* "value": "Red",
|
|
158
|
+
* "type": "text",
|
|
159
|
+
* "isRequired": true,
|
|
160
|
+
* "description": "The color of the product variant."
|
|
161
|
+
* },
|
|
162
|
+
* {
|
|
163
|
+
* "id": "attr2",
|
|
164
|
+
* "name": "Size",
|
|
165
|
+
* "value": "M",
|
|
166
|
+
* "type": "text",
|
|
167
|
+
* "isRequired": false,
|
|
168
|
+
* "description": "The size of the product variant."
|
|
169
|
+
* }
|
|
170
|
+
* ],
|
|
171
|
+
* "locale": "en-US",
|
|
172
|
+
* "productIdentifier": "sku123"
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*
|
|
176
|
+
* ---
|
|
177
|
+
*
|
|
178
|
+
* ### 🚨 Error Responses
|
|
179
|
+
*
|
|
180
|
+
* | Code | Message | Description |
|
|
181
|
+
* |-------|------------------------------------------|------------------------------------------------------|
|
|
182
|
+
* | `400` | `Bad Request` | Missing or invalid `productIdentifier` or `productIdType`. |
|
|
183
|
+
* | `404` | `Not Found` | The specified product variant does not exist. |
|
|
184
|
+
* | `500` | `Internal Server Error` | Unexpected error on the server. |
|
|
185
|
+
*
|
|
186
|
+
* ---
|
|
187
|
+
*
|
|
188
|
+
* ### 📚 Notes
|
|
189
|
+
* - Ensure the `productIdType` matches the `productIdentifier` value to avoid mismatched requests.
|
|
190
|
+
* - Providing a valid `locale` is recommended for fetching localized attribute data when applicable.
|
|
191
|
+
* - This API version supports strict versioning; ensure compatibility with your application's requirements.
|
|
192
|
+
*
|
|
193
|
+
* ---
|
|
194
|
+
*
|
|
195
|
+
* ### 🔗 Additional Resources
|
|
196
|
+
* - [API Authentication Guide](https://docs.example.com/api-authentication)
|
|
197
|
+
* - [Product Variants Documentation](https://docs.example.com/product-variants)
|
|
198
|
+
* - [Common Error Codes](https://docs.example.com/error-codes)
|
|
199
|
+
*/
|
|
200
|
+
export declare function getProductVariantAttributes({ productIdentifier, productIdType, locale, }: GetProductVariantAttributesParameters): Promise<GetProductVariantAttributesResponse>;
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getProductVariantsList = getProductVariantsList;
|
|
4
|
+
exports.getProductVariantSuppliers = getProductVariantSuppliers;
|
|
5
|
+
exports.getProductVariantAttributes = getProductVariantAttributes;
|
|
6
|
+
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
7
|
+
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
8
|
+
/**
|
|
9
|
+
* APICODE(pVAR300)
|
|
10
|
+
* Retrieves a paginated list of product variants.
|
|
11
|
+
*
|
|
12
|
+
* This function fetches a list of product variants associated with a specific product SKU.
|
|
13
|
+
*
|
|
14
|
+
* @param {GetProductVariantsListParameters} params - The parameters to filter the product variants list, including:
|
|
15
|
+
* #### productSku - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
16
|
+
* The SKU of the product to fetch variants for.
|
|
17
|
+
*
|
|
18
|
+
* #### locale - `string` | optional
|
|
19
|
+
* The locale for the product variants.
|
|
20
|
+
*
|
|
21
|
+
* #### pageable - `object` | optional
|
|
22
|
+
* Pagination details, including:
|
|
23
|
+
* - `page`: The page number.
|
|
24
|
+
* - `size`: The number of items per page.
|
|
25
|
+
* - `sort`: Sorting criteria.
|
|
26
|
+
*
|
|
27
|
+
* @returns {Promise<GetProductVariantsListResponse>} - A promise that resolves with the paginated list of product variants.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* #### input
|
|
31
|
+
* ```typescript
|
|
32
|
+
* await getProductVariantsList({
|
|
33
|
+
* productSku: 'product123',
|
|
34
|
+
* locale: 'en-US',
|
|
35
|
+
* pageable: { page: 1, size: 10, sort: 'name,asc' },
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
* #### output
|
|
39
|
+
* ```json
|
|
40
|
+
* {
|
|
41
|
+
* "content": [
|
|
42
|
+
* { "id": "variant1", "name": "Variant 1" },
|
|
43
|
+
* { "id": "variant2", "name": "Variant 2" }
|
|
44
|
+
* ],
|
|
45
|
+
* "pageable": {
|
|
46
|
+
* "page": 1,
|
|
47
|
+
* "size": 10,
|
|
48
|
+
* "totalPages": 5
|
|
49
|
+
* }
|
|
50
|
+
* }
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
async function getProductVariantsList({ productSku, locale, pageable, }) {
|
|
54
|
+
(0, parameters_validation_1.required)({ productSku });
|
|
55
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: `/v1/shop/product-variants`,
|
|
58
|
+
params: {
|
|
59
|
+
productSku,
|
|
60
|
+
locale,
|
|
61
|
+
page: pageable === null || pageable === void 0 ? void 0 : pageable.page,
|
|
62
|
+
size: pageable === null || pageable === void 0 ? void 0 : pageable.size,
|
|
63
|
+
sort: pageable === null || pageable === void 0 ? void 0 : pageable.sort,
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
return data;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* APICODE(vSUP300)
|
|
70
|
+
* Retrieves suppliers of a specific product variant.
|
|
71
|
+
*
|
|
72
|
+
* This function fetches a list of suppliers associated with a product variant.
|
|
73
|
+
*
|
|
74
|
+
* @param {GetProductVariantSuppliersParameters} params - The parameters to identify the product variant, including:
|
|
75
|
+
* #### productVariantId - `string` | <strong style={{ color: 'red' }}>required</strong>
|
|
76
|
+
* The ID of the product variant to fetch suppliers for.
|
|
77
|
+
*
|
|
78
|
+
* @returns {Promise<GetProductVariantSuppliersResponse>} - A promise that resolves with the suppliers of the product variant.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* #### input
|
|
82
|
+
* ```typescript
|
|
83
|
+
* await getProductVariantSuppliers({ productVariantId: 'variant123' });
|
|
84
|
+
* ```
|
|
85
|
+
* #### output
|
|
86
|
+
* ```json
|
|
87
|
+
* {
|
|
88
|
+
* "suppliers": [
|
|
89
|
+
* { "id": "supplier1", "name": "Supplier 1" },
|
|
90
|
+
* { "id": "supplier2", "name": "Supplier 2" }
|
|
91
|
+
* ]
|
|
92
|
+
* }
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
async function getProductVariantSuppliers({ productVariantId, }) {
|
|
96
|
+
(0, parameters_validation_1.required)({ productVariantId });
|
|
97
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
98
|
+
method: "GET",
|
|
99
|
+
path: `/v1/shop/product-variants/${productVariantId}/suppliers`,
|
|
100
|
+
});
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* ## 🛒 APICODE(vATT300) - Fetch Product Variant Attributes
|
|
105
|
+
*
|
|
106
|
+
* Retrieves detailed attributes of a product variant identified by SKU, ID, or external ID.
|
|
107
|
+
* This metadata includes key details such as **color**, **size**, and **material**, making it easier to describe the variant.
|
|
108
|
+
*
|
|
109
|
+
* ---
|
|
110
|
+
*
|
|
111
|
+
* ### 📥 Parameters
|
|
112
|
+
*
|
|
113
|
+
* | Parameter | Type | Required | Description |
|
|
114
|
+
* |---------------------|----------|----------|-----------------------------------------------------------------------------|
|
|
115
|
+
* | `productIdentifier` | `string` | ✅ Yes | The unique identifier of the product variant (e.g., SKU, ID, external ID). |
|
|
116
|
+
* | `productIdType` | `string` | ✅ Yes | The type of the identifier: `"sku"`, `"id"`, or `"externalId"`. |
|
|
117
|
+
* | `locale` | `string` | ❌ No | The locale for localized data (e.g., `"en-US"`, `"fr-FR"`). Defaults to the system locale. |
|
|
118
|
+
*
|
|
119
|
+
* ---
|
|
120
|
+
*
|
|
121
|
+
* ### 📤 Returns
|
|
122
|
+
* **Type:** `Promise<GetProductVariantAttributesResponse>`
|
|
123
|
+
* Resolves with the following structure:
|
|
124
|
+
*
|
|
125
|
+
* ```typescript
|
|
126
|
+
* {
|
|
127
|
+
* attributes: Array<{
|
|
128
|
+
* id: string;
|
|
129
|
+
* name: string;
|
|
130
|
+
* value: string | number;
|
|
131
|
+
* type: string;
|
|
132
|
+
* isRequired: boolean;
|
|
133
|
+
* description: string;
|
|
134
|
+
* }>;
|
|
135
|
+
* locale: string;
|
|
136
|
+
* productIdentifier: string;
|
|
137
|
+
* }
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* ---
|
|
141
|
+
*
|
|
142
|
+
* ### 🧑💻 Example Usage
|
|
143
|
+
*
|
|
144
|
+
* **Basic Example:**
|
|
145
|
+
* ```typescript
|
|
146
|
+
* const attributes = await getProductVariantAttributes({
|
|
147
|
+
* productIdentifier: 'sku123',
|
|
148
|
+
* productIdType: 'sku',
|
|
149
|
+
* locale: 'en-US',
|
|
150
|
+
* });
|
|
151
|
+
* console.log(attributes);
|
|
152
|
+
* ```
|
|
153
|
+
*
|
|
154
|
+
* **Alternative Locale:**
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const attributes = await getProductVariantAttributes({
|
|
157
|
+
* productIdentifier: 'prod789',
|
|
158
|
+
* productIdType: 'externalId',
|
|
159
|
+
* locale: 'fr-FR',
|
|
160
|
+
* });
|
|
161
|
+
* console.log(attributes);
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* ---
|
|
165
|
+
*
|
|
166
|
+
* ### 📝 Example Input
|
|
167
|
+
* ```json
|
|
168
|
+
* {
|
|
169
|
+
* "productIdentifier": "sku123",
|
|
170
|
+
* "productIdType": "sku",
|
|
171
|
+
* "locale": "en-US"
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*
|
|
175
|
+
* ---
|
|
176
|
+
*
|
|
177
|
+
* ### 📦 Example Output
|
|
178
|
+
* ```json
|
|
179
|
+
* {
|
|
180
|
+
* "attributes": [
|
|
181
|
+
* {
|
|
182
|
+
* "id": "attr1",
|
|
183
|
+
* "name": "Color",
|
|
184
|
+
* "value": "Red",
|
|
185
|
+
* "type": "text",
|
|
186
|
+
* "isRequired": true,
|
|
187
|
+
* "description": "The color of the product variant."
|
|
188
|
+
* },
|
|
189
|
+
* {
|
|
190
|
+
* "id": "attr2",
|
|
191
|
+
* "name": "Size",
|
|
192
|
+
* "value": "M",
|
|
193
|
+
* "type": "text",
|
|
194
|
+
* "isRequired": false,
|
|
195
|
+
* "description": "The size of the product variant."
|
|
196
|
+
* }
|
|
197
|
+
* ],
|
|
198
|
+
* "locale": "en-US",
|
|
199
|
+
* "productIdentifier": "sku123"
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* ---
|
|
204
|
+
*
|
|
205
|
+
* ### 🚨 Error Responses
|
|
206
|
+
*
|
|
207
|
+
* | Code | Message | Description |
|
|
208
|
+
* |-------|------------------------------------------|------------------------------------------------------|
|
|
209
|
+
* | `400` | `Bad Request` | Missing or invalid `productIdentifier` or `productIdType`. |
|
|
210
|
+
* | `404` | `Not Found` | The specified product variant does not exist. |
|
|
211
|
+
* | `500` | `Internal Server Error` | Unexpected error on the server. |
|
|
212
|
+
*
|
|
213
|
+
* ---
|
|
214
|
+
*
|
|
215
|
+
* ### 📚 Notes
|
|
216
|
+
* - Ensure the `productIdType` matches the `productIdentifier` value to avoid mismatched requests.
|
|
217
|
+
* - Providing a valid `locale` is recommended for fetching localized attribute data when applicable.
|
|
218
|
+
* - This API version supports strict versioning; ensure compatibility with your application's requirements.
|
|
219
|
+
*
|
|
220
|
+
* ---
|
|
221
|
+
*
|
|
222
|
+
* ### 🔗 Additional Resources
|
|
223
|
+
* - [API Authentication Guide](https://docs.example.com/api-authentication)
|
|
224
|
+
* - [Product Variants Documentation](https://docs.example.com/product-variants)
|
|
225
|
+
* - [Common Error Codes](https://docs.example.com/error-codes)
|
|
226
|
+
*/
|
|
227
|
+
async function getProductVariantAttributes({ productIdentifier, productIdType, locale, }) {
|
|
228
|
+
(0, parameters_validation_1.required)({ productIdentifier, productIdType });
|
|
229
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
230
|
+
method: "GET",
|
|
231
|
+
path: `/v1/shop/products/${productIdentifier}/variant-attributes`,
|
|
232
|
+
params: {
|
|
233
|
+
productIdType,
|
|
234
|
+
locale,
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
return data;
|
|
238
|
+
}
|