@djust-b2b/djust-front-sdk 1.14.0 → 1.15.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 +4 -6
- package/lib/interfaces/models/incident.d.ts +1 -0
- package/lib/services/custom-field/definitions.d.ts +100 -0
- package/lib/services/custom-field/definitions.js +60 -0
- package/lib/services/custom-field/index.d.ts +121 -0
- package/lib/services/custom-field/index.js +145 -0
- package/lib/services/incident/definitions.d.ts +9 -27
- package/lib/services/incident/index.d.ts +38 -119
- package/lib/services/incident/index.js +46 -153
- package/lib/services/product/definitions.d.ts +1 -1
- package/lib/services/product/index.d.ts +1762 -19
- package/lib/services/product/index.js +1777 -34
- package/package.json +1 -1
|
@@ -1,114 +1,70 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getIncidentsParameters, getIncidentParameters, createOrderLogisticIncidentParameters, createOrderLogisticLineIncidentParameters, getIncidentsResponse, getIncidentResponse, createOrderLogisticIncidentResponse, createOrderLogisticLineIncidentResponse } from "./definitions";
|
|
2
2
|
/**
|
|
3
|
-
* 🚚
|
|
3
|
+
* 🚚 Retrieves a list of incidents based on various filter criteria.
|
|
4
4
|
*
|
|
5
|
-
* This function
|
|
6
|
-
* filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
|
|
7
|
-
* and validated before the request is executed.
|
|
5
|
+
* This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
|
|
8
6
|
*
|
|
9
|
-
* 🛠 **Endpoint**: `GET /v1/shop/
|
|
7
|
+
* 🛠 **Endpoint**: `GET /v1/shop/incidents [ORDER-559]`
|
|
10
8
|
*
|
|
11
|
-
* | Parameter
|
|
12
|
-
*
|
|
13
|
-
* | `
|
|
14
|
-
* | `
|
|
15
|
-
* | `
|
|
16
|
-
* | `
|
|
17
|
-
* | `
|
|
18
|
-
* | `
|
|
9
|
+
* | Parameter | Type | Required | Description |
|
|
10
|
+
* |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
|
|
11
|
+
* | `customerAccountIds` | `string[]` | ❌ | List of customer account IDs to filter incidents by. |
|
|
12
|
+
* | `linkedType` | `string` | ✅ | Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
|
|
13
|
+
* | `ids` | `string[]` | ❌ | Specific incident IDs to retrieve. |
|
|
14
|
+
* | `status` | `IncidentStatus[]`| ❌ | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
|
|
15
|
+
* | `idType` | `IncidentIdType` | ❌ | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
|
|
16
|
+
* | `page` | `number` | ❌ | Page number for paginated results (starting at 0). |
|
|
17
|
+
* | `size` | `number` | ❌ | Number of incidents per page. |
|
|
18
|
+
* | `sort` | `string[]` | ❌ | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
|
|
19
19
|
*
|
|
20
20
|
* 📤 **Returns**:
|
|
21
|
-
* A `Promise
|
|
21
|
+
* A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
|
|
22
22
|
*
|
|
23
23
|
* 🛠 **Example usage**:
|
|
24
24
|
* ```ts
|
|
25
|
-
* const incidents = await
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* page:
|
|
25
|
+
* const incidents = await getIncidents({
|
|
26
|
+
* customerAccountIds: ["acc123", "acc456"],
|
|
27
|
+
* linkedType: "ORDER",
|
|
28
|
+
* status: ["OPEN", "ON_GOING"],
|
|
29
|
+
* page: 0,
|
|
30
30
|
* size: 10,
|
|
31
31
|
* sort: ["createdAt,desc"],
|
|
32
32
|
* });
|
|
33
33
|
* ```
|
|
34
34
|
*
|
|
35
|
-
* @param {
|
|
36
|
-
* @throws {Error} If `
|
|
37
|
-
* @returns {Promise<
|
|
35
|
+
* @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
|
|
36
|
+
* @throws {Error} If the required `linkedType` is missing.
|
|
37
|
+
* @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
|
|
38
38
|
*/
|
|
39
|
-
export declare function
|
|
39
|
+
export declare function getIncidents({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, }: getIncidentsParameters): Promise<getIncidentsResponse>;
|
|
40
40
|
/**
|
|
41
|
-
* 🚚
|
|
41
|
+
* 🚚 Retrieves details of a specific incident.
|
|
42
42
|
*
|
|
43
|
-
* This function
|
|
44
|
-
* the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
|
|
45
|
-
* before the request is executed.
|
|
43
|
+
* This function fetches detailed information about an incident identified by its ID, with an optional ID type for filtering.
|
|
46
44
|
*
|
|
47
|
-
* 🛠 **Endpoint**: `GET /v1/shop/
|
|
45
|
+
* 🛠 **Endpoint**: `GET /v1/shop/incidents/{incidentId} [ORDER-503]`
|
|
48
46
|
*
|
|
49
|
-
* | Parameter
|
|
50
|
-
*
|
|
51
|
-
* | `
|
|
52
|
-
* | `
|
|
53
|
-
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
47
|
+
* | Parameter | Type | Required | Description |
|
|
48
|
+
* |--------------|-------------------|----------|------------------------------------------------------------------|
|
|
49
|
+
* | `incidentId` | `string` | ✅ | The unique identifier of the incident to retrieve. |
|
|
50
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of ID used (e.g., DJUST_ID, EXTERNAL_ID) for the incident. |
|
|
54
51
|
*
|
|
55
52
|
* 📤 **Returns**:
|
|
56
|
-
* A `Promise
|
|
53
|
+
* A `Promise<getIncidentResponse>` containing the details of the specified incident.
|
|
57
54
|
*
|
|
58
55
|
* 🛠 **Example usage**:
|
|
59
56
|
* ```ts
|
|
60
|
-
* const incident = await
|
|
61
|
-
*
|
|
62
|
-
* incidentId: "incident_1",
|
|
57
|
+
* const incident = await getIncident({
|
|
58
|
+
* incidentId: "incident123",
|
|
63
59
|
* idType: "EXTERNAL_ID",
|
|
64
60
|
* });
|
|
65
61
|
* ```
|
|
66
62
|
*
|
|
67
|
-
* @param {
|
|
68
|
-
* @throws {Error} If
|
|
69
|
-
* @returns {Promise<
|
|
63
|
+
* @param {getIncidentParameters} params - The parameters for identifying the incident.
|
|
64
|
+
* @throws {Error} If the required `incidentId` is missing.
|
|
65
|
+
* @returns {Promise<getIncidentResponse>} A promise that resolves to the incident details.
|
|
70
66
|
*/
|
|
71
|
-
export declare function
|
|
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>;
|
|
67
|
+
export declare function getIncident({ incidentId, idType, }: getIncidentParameters): Promise<getIncidentResponse>;
|
|
112
68
|
/**
|
|
113
69
|
* 🚚 Creates a new incident for a specific logistic order.
|
|
114
70
|
*
|
|
@@ -183,40 +139,3 @@ export declare function createOrderLogisticIncident({ logisticOrderId, idType, c
|
|
|
183
139
|
* @returns {Promise<createOrderLogisticLineIncidentResponse>} A promise resolving to the response containing the created incident's details.
|
|
184
140
|
*/
|
|
185
141
|
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>;
|
|
@@ -1,56 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.
|
|
5
|
-
exports.getOrderLogisticLineIncidents = getOrderLogisticLineIncidents;
|
|
3
|
+
exports.getIncidents = getIncidents;
|
|
4
|
+
exports.getIncident = getIncident;
|
|
6
5
|
exports.createOrderLogisticIncident = createOrderLogisticIncident;
|
|
7
6
|
exports.createOrderLogisticLineIncident = createOrderLogisticLineIncident;
|
|
8
|
-
exports.getCustomerAccountIncidents = getCustomerAccountIncidents;
|
|
9
7
|
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
10
8
|
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
11
9
|
/**
|
|
12
|
-
* 🚚
|
|
10
|
+
* 🚚 Retrieves a list of incidents based on various filter criteria.
|
|
13
11
|
*
|
|
14
|
-
* This function
|
|
15
|
-
* filtered by status and other parameters. The `logisticOrderId` parameter is mandatory
|
|
16
|
-
* and validated before the request is executed.
|
|
12
|
+
* This function allows you to fetch incidents with detailed filtering options, such as customer account IDs, status, and sorting preferences.
|
|
17
13
|
*
|
|
18
|
-
* 🛠 **Endpoint**: `GET /v1/shop/
|
|
14
|
+
* 🛠 **Endpoint**: `GET /v1/shop/incidents [ORDER-559]`
|
|
19
15
|
*
|
|
20
|
-
* | Parameter
|
|
21
|
-
*
|
|
22
|
-
* | `
|
|
23
|
-
* | `
|
|
24
|
-
* | `
|
|
25
|
-
* | `
|
|
26
|
-
* | `
|
|
27
|
-
* | `
|
|
16
|
+
* | Parameter | Type | Required | Description |
|
|
17
|
+
* |-----------------------|--------------------|----------|-----------------------------------------------------------------------------|
|
|
18
|
+
* | `customerAccountIds` | `string[]` | ❌ | List of customer account IDs to filter incidents by. |
|
|
19
|
+
* | `linkedType` | `string` | ✅ | Type of entity linked to the incident (e.g., ORDER or ORDER_LINES). |
|
|
20
|
+
* | `ids` | `string[]` | ❌ | Specific incident IDs to retrieve. |
|
|
21
|
+
* | `status` | `IncidentStatus[]`| ❌ | List of statuses to filter incidents by (e.g., OPEN, ON_GOING, CLOSED). |
|
|
22
|
+
* | `idType` | `IncidentIdType` | ❌ | Type of ID used for filtering (e.g., DJUST_ID, EXTERNAL_ID). |
|
|
23
|
+
* | `page` | `number` | ❌ | Page number for paginated results (starting at 0). |
|
|
24
|
+
* | `size` | `number` | ❌ | Number of incidents per page. |
|
|
25
|
+
* | `sort` | `string[]` | ❌ | Sorting criteria in the format `field,(asc|desc)` (e.g., `status,desc`). |
|
|
28
26
|
*
|
|
29
27
|
* 📤 **Returns**:
|
|
30
|
-
* A `Promise
|
|
28
|
+
* A `Promise<getIncidentsResponse>` containing a paginated list of incidents matching the filter criteria.
|
|
31
29
|
*
|
|
32
30
|
* 🛠 **Example usage**:
|
|
33
31
|
* ```ts
|
|
34
|
-
* const incidents = await
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
*
|
|
38
|
-
* page:
|
|
32
|
+
* const incidents = await getIncidents({
|
|
33
|
+
* customerAccountIds: ["acc123", "acc456"],
|
|
34
|
+
* linkedType: "ORDER",
|
|
35
|
+
* status: ["OPEN", "ON_GOING"],
|
|
36
|
+
* page: 0,
|
|
39
37
|
* size: 10,
|
|
40
38
|
* sort: ["createdAt,desc"],
|
|
41
39
|
* });
|
|
42
40
|
* ```
|
|
43
41
|
*
|
|
44
|
-
* @param {
|
|
45
|
-
* @throws {Error} If `
|
|
46
|
-
* @returns {Promise<
|
|
42
|
+
* @param {getIncidentsParameters} params - The parameters for filtering and retrieving incidents.
|
|
43
|
+
* @throws {Error} If the required `linkedType` is missing.
|
|
44
|
+
* @returns {Promise<getIncidentsResponse>} A promise that resolves to a response object containing the incidents.
|
|
47
45
|
*/
|
|
48
|
-
async function
|
|
49
|
-
(0, parameters_validation_1.required)({
|
|
46
|
+
async function getIncidents({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, }) {
|
|
47
|
+
(0, parameters_validation_1.required)({ linkedType });
|
|
50
48
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
51
49
|
method: "GET",
|
|
52
|
-
path: `/v1/shop/
|
|
50
|
+
path: `/v1/shop/incidents`,
|
|
53
51
|
params: {
|
|
52
|
+
customerAccountIds,
|
|
53
|
+
linkedType,
|
|
54
|
+
ids,
|
|
54
55
|
status,
|
|
55
56
|
idType,
|
|
56
57
|
page,
|
|
@@ -61,101 +62,43 @@ async function getOrderLogisticIncidents({ logisticOrderId, status, idType, page
|
|
|
61
62
|
return data;
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
|
-
* 🚚
|
|
65
|
+
* 🚚 Retrieves details of a specific incident.
|
|
65
66
|
*
|
|
66
|
-
* This function
|
|
67
|
-
* the `logisticOrderId` and `incidentId`. Both parameters are mandatory and validated
|
|
68
|
-
* before the request is executed.
|
|
67
|
+
* This function fetches detailed information about an incident identified by its ID, with an optional ID type for filtering.
|
|
69
68
|
*
|
|
70
|
-
* 🛠 **Endpoint**: `GET /v1/shop/
|
|
69
|
+
* 🛠 **Endpoint**: `GET /v1/shop/incidents/{incidentId} [ORDER-503]`
|
|
71
70
|
*
|
|
72
|
-
* | Parameter
|
|
73
|
-
*
|
|
74
|
-
* | `
|
|
75
|
-
* | `
|
|
76
|
-
* | `idType` | `IncidentIdType` | ❌ | Specifies whether the ID is internal (`DJUST_ID`) or external (`EXTERNAL_ID`). |
|
|
71
|
+
* | Parameter | Type | Required | Description |
|
|
72
|
+
* |--------------|-------------------|----------|------------------------------------------------------------------|
|
|
73
|
+
* | `incidentId` | `string` | ✅ | The unique identifier of the incident to retrieve. |
|
|
74
|
+
* | `idType` | `IncidentIdType` | ❌ | The type of ID used (e.g., DJUST_ID, EXTERNAL_ID) for the incident. |
|
|
77
75
|
*
|
|
78
76
|
* 📤 **Returns**:
|
|
79
|
-
* A `Promise
|
|
77
|
+
* A `Promise<getIncidentResponse>` containing the details of the specified incident.
|
|
80
78
|
*
|
|
81
79
|
* 🛠 **Example usage**:
|
|
82
80
|
* ```ts
|
|
83
|
-
* const incident = await
|
|
84
|
-
*
|
|
85
|
-
* incidentId: "incident_1",
|
|
81
|
+
* const incident = await getIncident({
|
|
82
|
+
* incidentId: "incident123",
|
|
86
83
|
* idType: "EXTERNAL_ID",
|
|
87
84
|
* });
|
|
88
85
|
* ```
|
|
89
86
|
*
|
|
90
|
-
* @param {
|
|
91
|
-
* @throws {Error} If
|
|
92
|
-
* @returns {Promise<
|
|
87
|
+
* @param {getIncidentParameters} params - The parameters for identifying the incident.
|
|
88
|
+
* @throws {Error} If the required `incidentId` is missing.
|
|
89
|
+
* @returns {Promise<getIncidentResponse>} A promise that resolves to the incident details.
|
|
93
90
|
*/
|
|
94
|
-
async function
|
|
95
|
-
(0, parameters_validation_1.required)({
|
|
91
|
+
async function getIncident({ incidentId, idType, }) {
|
|
92
|
+
(0, parameters_validation_1.required)({ incidentId });
|
|
96
93
|
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
97
94
|
method: "GET",
|
|
98
|
-
path: `/v1/shop/
|
|
95
|
+
path: `/v1/shop/incidents/${incidentId}`,
|
|
99
96
|
params: {
|
|
100
97
|
idType,
|
|
101
98
|
},
|
|
102
99
|
});
|
|
103
100
|
return data;
|
|
104
101
|
}
|
|
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
102
|
/**
|
|
160
103
|
* 🚚 Creates a new incident for a specific logistic order.
|
|
161
104
|
*
|
|
@@ -259,53 +202,3 @@ async function createOrderLogisticLineIncident({ logisticOrderId, idType, custom
|
|
|
259
202
|
});
|
|
260
203
|
return data;
|
|
261
204
|
}
|
|
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
|
-
}
|