@djust-b2b/djust-front-sdk 1.29.3 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.d.ts +3 -0
- package/lib/index.js +2 -0
- package/lib/interfaces/models/offer.d.ts +29 -1
- package/lib/interfaces/models/product.d.ts +1 -1
- package/lib/services/offer-inventories/definitions.d.ts +72 -0
- package/lib/services/offer-inventories/definitions.js +2 -0
- package/lib/services/offer-inventories/index.d.ts +119 -0
- package/lib/services/offer-inventories/index.js +174 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare const DjustSDK: {
|
|
2
2
|
initialize: (initConfig: import("./settings/fetch-instance").ClientConfig) => void;
|
|
3
3
|
updateConfiguration: (newConfig: Partial<import("./settings/fetch-instance").ClientConfig>) => void;
|
|
4
|
+
getPaginatedOfferInventories({ page, size, sort, productStatus, offerInventoryStatus, variantStatus, offerPriceStatus, supplierId, offersIds, offerPriceIds, currency, hasStock, idType, }: import("./services/offer-inventories/definitions").GetPaginatedOfferInventoriesParameters): Promise<import("./services/offer-inventories/definitions").GetOfferInventoriesResponse>;
|
|
5
|
+
getPaginatedOfferInventoriesV2({ page, size, sort, variantExternalId, }: import("./services/offer-inventories/definitions").GetPaginatedOfferInventoriesV2Parameters): Promise<import("./services/offer-inventories/definitions").GetOfferInventoriesV2Response>;
|
|
6
|
+
getOfferInventoryCustomFields({ externalId, page, size, sort, locale, }: import("./services/offer-inventories/definitions").GetOfferInventoryCustomFieldsParameters): Promise<import("./services/offer-inventories/definitions").GetOfferInventoryCustomFieldsResponse>;
|
|
4
7
|
getIncidents({ customerAccountIds, linkedType, ids, status, idType, page, size, sort, }: import("./services/incident/definitions").getIncidentsParameters): Promise<import("./services/incident/definitions").getIncidentsResponse>;
|
|
5
8
|
getIncident({ incidentId, idType, }: import("./services/incident/definitions").getIncidentParameters): Promise<import("./services/incident/definitions").getIncidentResponse>;
|
|
6
9
|
createOrderLogisticIncident({ logisticOrderId, idType, customField, reasonCode, }: import("./services/incident/definitions").createOrderLogisticIncidentParameters): Promise<import("./services/incident/definitions").createOrderLogisticIncidentResponse>;
|
package/lib/index.js
CHANGED
|
@@ -49,6 +49,7 @@ const SupplierServices = __importStar(require("./services/supplier"));
|
|
|
49
49
|
const CommercialOrderServices = __importStar(require("./services/commercial-order"));
|
|
50
50
|
const LogisticOrderServices = __importStar(require("./services/logistic-order"));
|
|
51
51
|
const IncidentServices = __importStar(require("./services/incident"));
|
|
52
|
+
const OfferServices = __importStar(require("./services/offer-inventories"));
|
|
52
53
|
const fetch_instance_1 = require("./settings/fetch-instance");
|
|
53
54
|
exports.DjustSDK = {
|
|
54
55
|
...AuthServices,
|
|
@@ -63,6 +64,7 @@ exports.DjustSDK = {
|
|
|
63
64
|
...LogisticOrderServices,
|
|
64
65
|
...CommercialOrderServices,
|
|
65
66
|
...IncidentServices,
|
|
67
|
+
...OfferServices,
|
|
66
68
|
initialize: fetch_instance_1.initialize,
|
|
67
69
|
updateConfiguration: fetch_instance_1.updateConfiguration,
|
|
68
70
|
};
|
|
@@ -3,7 +3,8 @@ import { ProductVariantResponse } from "./product";
|
|
|
3
3
|
import { SupplierResponse } from "./supplier";
|
|
4
4
|
import { PriceDto } from "./price";
|
|
5
5
|
export type PackingType = "BOX" | "BOTTLE" | "UNIT";
|
|
6
|
-
export type OfferStatus = "ACTIVE" | "INACTIVE" | "DELETED";
|
|
6
|
+
export type OfferStatus = "ACTIVE" | "INACTIVE" | "DELETED" | "NEW";
|
|
7
|
+
export type OfferInventoryStatus = "ACTIVE" | "INACTIVE";
|
|
7
8
|
export type OfferPriceType = "PUBLIC" | "GROUP" | "ACCOUNT";
|
|
8
9
|
export interface OfferDto {
|
|
9
10
|
currency: string;
|
|
@@ -73,6 +74,33 @@ export interface OfferResponse {
|
|
|
73
74
|
offerPrices: OfferPriceResponse[];
|
|
74
75
|
supplier: SupplierResponse;
|
|
75
76
|
}
|
|
77
|
+
export interface OfferInventories extends OfferResponse {
|
|
78
|
+
}
|
|
79
|
+
export interface OfferInventoriesV2 {
|
|
80
|
+
currency: string;
|
|
81
|
+
externalId: string;
|
|
82
|
+
externalSource: string;
|
|
83
|
+
id: string;
|
|
84
|
+
leadTimeToShip: number;
|
|
85
|
+
maxOrderQuantity: number;
|
|
86
|
+
minOrderQuantity: number;
|
|
87
|
+
minShippingPrice: number;
|
|
88
|
+
minShippingPriceAdditional: number;
|
|
89
|
+
minShippingType: string;
|
|
90
|
+
minShippingZone: string;
|
|
91
|
+
minStockAlert: number;
|
|
92
|
+
packingType: string;
|
|
93
|
+
productUnit: string;
|
|
94
|
+
quantityPerItem: number;
|
|
95
|
+
status: string;
|
|
96
|
+
stock: number;
|
|
97
|
+
}
|
|
98
|
+
export interface OfferInventoryCustomField {
|
|
99
|
+
externalId: string;
|
|
100
|
+
name: string;
|
|
101
|
+
value: string;
|
|
102
|
+
values: string[];
|
|
103
|
+
}
|
|
76
104
|
export interface DeliveryDates {
|
|
77
105
|
code: string;
|
|
78
106
|
deliveryTimeRange: DeliveryTime;
|
|
@@ -3,7 +3,7 @@ import { SimpleUserView } from "./customer-user";
|
|
|
3
3
|
import { BestOffer } from "./offer";
|
|
4
4
|
import { NavigationCategorySimpleView } from "./navigation-category";
|
|
5
5
|
import { ExternalSource, Order, PageableObject } from "./common";
|
|
6
|
-
export type ProductStatus = "ACTIVE" | "INACTIVE" | "DELETED";
|
|
6
|
+
export type ProductStatus = "ACTIVE" | "INACTIVE" | "DELETED" | "NEW";
|
|
7
7
|
export type ProductVariantAttributeType = "TEXT" | "COLOR" | "DATE" | "BOOLEAN";
|
|
8
8
|
export type UnitType = "ITEM" | "WEIGHT_METRIC" | "VOLUME_METRIC" | "LENGTH_METRIC" | "AREA_METRIC" | "WEIGHT_IMPERIAL" | "VOLUME_IMPERIAL" | "LENGTH_IMPERIAL" | "AREA_IMPERIAL";
|
|
9
9
|
export type ProductIdType = "SKU" | "ID" | "EXTERNAL_ID";
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { OfferInventories, OfferInventoriesV2, OfferInventoryCustomField, OfferInventoryStatus } from "../../interfaces/models/offer";
|
|
2
|
+
import { ProductStatus } from "../../interfaces/models/product";
|
|
3
|
+
import { IdType, Order, PageableObject } from "../../interfaces/models/common";
|
|
4
|
+
/**
|
|
5
|
+
* Requests parameters type definitions
|
|
6
|
+
*/
|
|
7
|
+
export interface GetPaginatedOfferInventoriesParameters {
|
|
8
|
+
page?: number;
|
|
9
|
+
size?: number;
|
|
10
|
+
sort?: string;
|
|
11
|
+
productStatus?: ProductStatus;
|
|
12
|
+
offerInventoryStatus?: OfferInventoryStatus;
|
|
13
|
+
variantStatus?: ProductStatus;
|
|
14
|
+
offerPriceStatus?: OfferInventoryStatus;
|
|
15
|
+
supplierId?: string;
|
|
16
|
+
offersIds?: string[];
|
|
17
|
+
offerPriceIds?: string[];
|
|
18
|
+
currency: string;
|
|
19
|
+
hasStock?: string;
|
|
20
|
+
idType?: IdType;
|
|
21
|
+
}
|
|
22
|
+
export interface GetPaginatedOfferInventoriesV2Parameters {
|
|
23
|
+
page?: number;
|
|
24
|
+
size?: number;
|
|
25
|
+
sort?: string;
|
|
26
|
+
variantExternalId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface GetOfferInventoriesResponse {
|
|
29
|
+
content: OfferInventories[];
|
|
30
|
+
empty: boolean;
|
|
31
|
+
first: boolean;
|
|
32
|
+
last: boolean;
|
|
33
|
+
number: number;
|
|
34
|
+
numberOfElements: number;
|
|
35
|
+
pageable: PageableObject;
|
|
36
|
+
size: number;
|
|
37
|
+
sort: Order[];
|
|
38
|
+
totalElements: number;
|
|
39
|
+
totalPages: number;
|
|
40
|
+
}
|
|
41
|
+
export interface GetOfferInventoriesV2Response {
|
|
42
|
+
content: OfferInventoriesV2[];
|
|
43
|
+
empty: boolean;
|
|
44
|
+
first: boolean;
|
|
45
|
+
last: boolean;
|
|
46
|
+
number: number;
|
|
47
|
+
numberOfElements: number;
|
|
48
|
+
pageable: PageableObject;
|
|
49
|
+
size: number;
|
|
50
|
+
sort: Order[];
|
|
51
|
+
totalElements: number;
|
|
52
|
+
}
|
|
53
|
+
export interface GetOfferInventoryCustomFieldsParameters {
|
|
54
|
+
externalId: string;
|
|
55
|
+
locale?: string;
|
|
56
|
+
page?: number;
|
|
57
|
+
size?: number;
|
|
58
|
+
sort?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface GetOfferInventoryCustomFieldsResponse {
|
|
61
|
+
content: OfferInventoryCustomField[];
|
|
62
|
+
empty: boolean;
|
|
63
|
+
first: boolean;
|
|
64
|
+
last: boolean;
|
|
65
|
+
number: number;
|
|
66
|
+
numberOfElements: number;
|
|
67
|
+
pageable: PageableObject;
|
|
68
|
+
size: number;
|
|
69
|
+
sort: Order[];
|
|
70
|
+
totalElements: number;
|
|
71
|
+
totalPages: number;
|
|
72
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { GetOfferInventoriesResponse, GetOfferInventoriesV2Response, GetOfferInventoryCustomFieldsParameters, GetOfferInventoryCustomFieldsResponse, GetPaginatedOfferInventoriesParameters, GetPaginatedOfferInventoriesV2Parameters } from "./definitions";
|
|
2
|
+
/**
|
|
3
|
+
* @deprecated
|
|
4
|
+
* 📄 Gets offer inventories.
|
|
5
|
+
*
|
|
6
|
+
* This function retrieves offer inventories with various filtering options.
|
|
7
|
+
* The `currency` parameter is mandatory and validated before the request is executed.
|
|
8
|
+
*
|
|
9
|
+
* 🛠 **Endpoint**: `GET /v1/offer-inventories` [OFFER-550]
|
|
10
|
+
*
|
|
11
|
+
* | Parameter | Type | Required | Description |
|
|
12
|
+
* |------------------------|--------------|----------|---------------------------------------------|
|
|
13
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
14
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
15
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
16
|
+
* | `productStatus` | `string` | ❌ | Filter by product status. |
|
|
17
|
+
* | `offerInventoryStatus` | `string` | ❌ | Filter by offer inventory status. |
|
|
18
|
+
* | `variantStatus` | `string` | ❌ | Filter by variant status. |
|
|
19
|
+
* | `offerPriceStatus` | `string` | ❌ | Filter by offer price status. |
|
|
20
|
+
* | `supplierId` | `string` | ❌ | Filter by supplier ID. |
|
|
21
|
+
* | `offersIds` | `string[]` | ❌ | Filter by offer IDs. |
|
|
22
|
+
* | `offerPriceIds` | `string[]` | ❌ | Filter by offer price IDs. |
|
|
23
|
+
* | `currency` | `string` | ✅ | The currency for price formatting. |
|
|
24
|
+
* | `hasStock` | `string` | ❌ | Filter by stock availability. |
|
|
25
|
+
* | `idType` | `string` | ❌ | The ID type to use. |
|
|
26
|
+
*
|
|
27
|
+
* 📤 **Returns**:
|
|
28
|
+
* A `Promise` resolving to a `GetOfferInventoriesResponse` containing the offer inventories.
|
|
29
|
+
*
|
|
30
|
+
* 🛠 **Example usage**:
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const inventories = await getOfferInventories({
|
|
33
|
+
* page: 0,
|
|
34
|
+
* size: 20,
|
|
35
|
+
* sort: "createdAt,desc",
|
|
36
|
+
* currency: "EUR",
|
|
37
|
+
* hasStock: "true",
|
|
38
|
+
* });
|
|
39
|
+
* console.log(inventories);
|
|
40
|
+
* ```
|
|
41
|
+
*
|
|
42
|
+
* @deprecated This function is deprecated and will be probably removed in a future version.
|
|
43
|
+
* @param {GetPaginatedOfferInventoriesParameters} params - The parameters for the request
|
|
44
|
+
* @throws {Error} If `currency` is missing
|
|
45
|
+
* @returns {Promise<GetOfferInventoriesResponse>} A promise resolving to the response containing the offer inventories
|
|
46
|
+
*/
|
|
47
|
+
export declare function getPaginatedOfferInventories({ page, size, sort, productStatus, offerInventoryStatus, variantStatus, offerPriceStatus, supplierId, offersIds, offerPriceIds, currency, hasStock, idType, }: GetPaginatedOfferInventoriesParameters): Promise<GetOfferInventoriesResponse>;
|
|
48
|
+
/**
|
|
49
|
+
* 📄 Gets paginated offer inventories V2.
|
|
50
|
+
*
|
|
51
|
+
* This function retrieves paginated offer inventories with filtering by variant external ID.
|
|
52
|
+
* The `variantExternalId` parameter is mandatory and validated before the request is executed.
|
|
53
|
+
*
|
|
54
|
+
* 🛠 **Endpoint**: `GET /v2/offer-inventories` [OFFER-551]
|
|
55
|
+
*
|
|
56
|
+
* | Parameter | Type | Required | Description |
|
|
57
|
+
* |---------------------|----------|----------|------------------------------------------------|
|
|
58
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
59
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
60
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
61
|
+
* | `variantExternalId` | `string` | ✅ | The external ID of the product variant. |
|
|
62
|
+
*
|
|
63
|
+
* 📤 **Returns**:
|
|
64
|
+
* A `Promise` resolving to a `GetOfferInventoriesV2Response` containing the paginated offer inventories.
|
|
65
|
+
*
|
|
66
|
+
* 🛠 **Example usage**:
|
|
67
|
+
* ```typescript
|
|
68
|
+
* const inventories = await getPaginatedOfferInventoriesV2({
|
|
69
|
+
* variantExternalId: "variant123",
|
|
70
|
+
* page: 0,
|
|
71
|
+
* size: 20,
|
|
72
|
+
* sort: "createdAt,desc",
|
|
73
|
+
* });
|
|
74
|
+
* console.log(inventories);
|
|
75
|
+
* ```
|
|
76
|
+
*
|
|
77
|
+
* @param {GetPaginatedOfferInventoriesV2Parameters} params - The parameters for the request
|
|
78
|
+
* @throws {Error} If `variantExternalId` is missing
|
|
79
|
+
* @returns {Promise<GetOfferInventoriesV2Response>} A promise resolving to the response containing the paginated offer inventories
|
|
80
|
+
*/
|
|
81
|
+
export declare function getPaginatedOfferInventoriesV2({ page, size, sort, variantExternalId, }: GetPaginatedOfferInventoriesV2Parameters): Promise<GetOfferInventoriesV2Response>;
|
|
82
|
+
/**
|
|
83
|
+
* @deprecated
|
|
84
|
+
* 📄 Gets offer inventory custom fields.
|
|
85
|
+
*
|
|
86
|
+
* This function retrieves custom fields for a specific offer inventory identified by the `externalId`.
|
|
87
|
+
* The `externalId` parameter is mandatory and validated before the request is executed.
|
|
88
|
+
*
|
|
89
|
+
* 🛠 **Endpoint**: `GET /v1/offer-inventories/${externalId}/custom-fields` [OFFER-552]
|
|
90
|
+
*
|
|
91
|
+
* | Parameter | Type | Required | Description |
|
|
92
|
+
* |-------------|----------|----------|------------------------------------------------|
|
|
93
|
+
* | `externalId`| `string` | ✅ | The external ID of the offer inventory. |
|
|
94
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
95
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
96
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
97
|
+
* | `locale` | `string` | ❌ | The locale for the response data. |
|
|
98
|
+
*
|
|
99
|
+
* 📤 **Returns**:
|
|
100
|
+
* A `Promise` resolving to a `GetOfferInventoryCustomFieldsResponse` containing the custom fields.
|
|
101
|
+
*
|
|
102
|
+
* 🛠 **Example usage**:
|
|
103
|
+
* ```typescript
|
|
104
|
+
* const customFields = await getOfferInventoryCustomFields({
|
|
105
|
+
* externalId: "inventory123",
|
|
106
|
+
* page: 0,
|
|
107
|
+
* size: 20,
|
|
108
|
+
* sort: "name,asc",
|
|
109
|
+
* locale: "en",
|
|
110
|
+
* });
|
|
111
|
+
* console.log(customFields);
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @deprecated This function is deprecated and will be probably removed in a future version.
|
|
115
|
+
* @param {GetOfferInventoryCustomFieldsParameters} params - The parameters for the request
|
|
116
|
+
* @throws {Error} If `externalId` is missing
|
|
117
|
+
* @returns {Promise<GetOfferInventoryCustomFieldsResponse>} A promise resolving to the response containing the custom fields
|
|
118
|
+
*/
|
|
119
|
+
export declare function getOfferInventoryCustomFields({ externalId, page, size, sort, locale, }: GetOfferInventoryCustomFieldsParameters): Promise<GetOfferInventoryCustomFieldsResponse>;
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getPaginatedOfferInventories = getPaginatedOfferInventories;
|
|
4
|
+
exports.getPaginatedOfferInventoriesV2 = getPaginatedOfferInventoriesV2;
|
|
5
|
+
exports.getOfferInventoryCustomFields = getOfferInventoryCustomFields;
|
|
6
|
+
const parameters_validation_1 = require("../../helpers/parameters-validation");
|
|
7
|
+
const fetch_instance_1 = require("../../settings/fetch-instance");
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
* 📄 Gets offer inventories.
|
|
11
|
+
*
|
|
12
|
+
* This function retrieves offer inventories with various filtering options.
|
|
13
|
+
* The `currency` parameter is mandatory and validated before the request is executed.
|
|
14
|
+
*
|
|
15
|
+
* 🛠 **Endpoint**: `GET /v1/offer-inventories` [OFFER-550]
|
|
16
|
+
*
|
|
17
|
+
* | Parameter | Type | Required | Description |
|
|
18
|
+
* |------------------------|--------------|----------|---------------------------------------------|
|
|
19
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
20
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
21
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
22
|
+
* | `productStatus` | `string` | ❌ | Filter by product status. |
|
|
23
|
+
* | `offerInventoryStatus` | `string` | ❌ | Filter by offer inventory status. |
|
|
24
|
+
* | `variantStatus` | `string` | ❌ | Filter by variant status. |
|
|
25
|
+
* | `offerPriceStatus` | `string` | ❌ | Filter by offer price status. |
|
|
26
|
+
* | `supplierId` | `string` | ❌ | Filter by supplier ID. |
|
|
27
|
+
* | `offersIds` | `string[]` | ❌ | Filter by offer IDs. |
|
|
28
|
+
* | `offerPriceIds` | `string[]` | ❌ | Filter by offer price IDs. |
|
|
29
|
+
* | `currency` | `string` | ✅ | The currency for price formatting. |
|
|
30
|
+
* | `hasStock` | `string` | ❌ | Filter by stock availability. |
|
|
31
|
+
* | `idType` | `string` | ❌ | The ID type to use. |
|
|
32
|
+
*
|
|
33
|
+
* 📤 **Returns**:
|
|
34
|
+
* A `Promise` resolving to a `GetOfferInventoriesResponse` containing the offer inventories.
|
|
35
|
+
*
|
|
36
|
+
* 🛠 **Example usage**:
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const inventories = await getOfferInventories({
|
|
39
|
+
* page: 0,
|
|
40
|
+
* size: 20,
|
|
41
|
+
* sort: "createdAt,desc",
|
|
42
|
+
* currency: "EUR",
|
|
43
|
+
* hasStock: "true",
|
|
44
|
+
* });
|
|
45
|
+
* console.log(inventories);
|
|
46
|
+
* ```
|
|
47
|
+
*
|
|
48
|
+
* @deprecated This function is deprecated and will be probably removed in a future version.
|
|
49
|
+
* @param {GetPaginatedOfferInventoriesParameters} params - The parameters for the request
|
|
50
|
+
* @throws {Error} If `currency` is missing
|
|
51
|
+
* @returns {Promise<GetOfferInventoriesResponse>} A promise resolving to the response containing the offer inventories
|
|
52
|
+
*/
|
|
53
|
+
async function getPaginatedOfferInventories({ page, size, sort, productStatus, offerInventoryStatus, variantStatus, offerPriceStatus, supplierId, offersIds, offerPriceIds, currency, hasStock, idType, }) {
|
|
54
|
+
(0, parameters_validation_1.required)({ currency });
|
|
55
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
56
|
+
method: "GET",
|
|
57
|
+
path: `/v1/offer-inventories`,
|
|
58
|
+
params: {
|
|
59
|
+
page,
|
|
60
|
+
size,
|
|
61
|
+
sort,
|
|
62
|
+
productStatus,
|
|
63
|
+
offerInventoryStatus,
|
|
64
|
+
variantStatus,
|
|
65
|
+
offerPriceStatus,
|
|
66
|
+
supplierId,
|
|
67
|
+
offersIds,
|
|
68
|
+
offerPriceIds,
|
|
69
|
+
currency,
|
|
70
|
+
hasStock,
|
|
71
|
+
idType,
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
return data;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* 📄 Gets paginated offer inventories V2.
|
|
78
|
+
*
|
|
79
|
+
* This function retrieves paginated offer inventories with filtering by variant external ID.
|
|
80
|
+
* The `variantExternalId` parameter is mandatory and validated before the request is executed.
|
|
81
|
+
*
|
|
82
|
+
* 🛠 **Endpoint**: `GET /v2/offer-inventories` [OFFER-551]
|
|
83
|
+
*
|
|
84
|
+
* | Parameter | Type | Required | Description |
|
|
85
|
+
* |---------------------|----------|----------|------------------------------------------------|
|
|
86
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
87
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
88
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
89
|
+
* | `variantExternalId` | `string` | ✅ | The external ID of the product variant. |
|
|
90
|
+
*
|
|
91
|
+
* 📤 **Returns**:
|
|
92
|
+
* A `Promise` resolving to a `GetOfferInventoriesV2Response` containing the paginated offer inventories.
|
|
93
|
+
*
|
|
94
|
+
* 🛠 **Example usage**:
|
|
95
|
+
* ```typescript
|
|
96
|
+
* const inventories = await getPaginatedOfferInventoriesV2({
|
|
97
|
+
* variantExternalId: "variant123",
|
|
98
|
+
* page: 0,
|
|
99
|
+
* size: 20,
|
|
100
|
+
* sort: "createdAt,desc",
|
|
101
|
+
* });
|
|
102
|
+
* console.log(inventories);
|
|
103
|
+
* ```
|
|
104
|
+
*
|
|
105
|
+
* @param {GetPaginatedOfferInventoriesV2Parameters} params - The parameters for the request
|
|
106
|
+
* @throws {Error} If `variantExternalId` is missing
|
|
107
|
+
* @returns {Promise<GetOfferInventoriesV2Response>} A promise resolving to the response containing the paginated offer inventories
|
|
108
|
+
*/
|
|
109
|
+
async function getPaginatedOfferInventoriesV2({ page, size, sort, variantExternalId, }) {
|
|
110
|
+
(0, parameters_validation_1.required)({ variantExternalId });
|
|
111
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
112
|
+
method: "GET",
|
|
113
|
+
path: `/v2/offer-inventories`,
|
|
114
|
+
params: {
|
|
115
|
+
variantExternalId,
|
|
116
|
+
page,
|
|
117
|
+
size,
|
|
118
|
+
sort,
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
return data;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* @deprecated
|
|
125
|
+
* 📄 Gets offer inventory custom fields.
|
|
126
|
+
*
|
|
127
|
+
* This function retrieves custom fields for a specific offer inventory identified by the `externalId`.
|
|
128
|
+
* The `externalId` parameter is mandatory and validated before the request is executed.
|
|
129
|
+
*
|
|
130
|
+
* 🛠 **Endpoint**: `GET /v1/offer-inventories/${externalId}/custom-fields` [OFFER-552]
|
|
131
|
+
*
|
|
132
|
+
* | Parameter | Type | Required | Description |
|
|
133
|
+
* |-------------|----------|----------|------------------------------------------------|
|
|
134
|
+
* | `externalId`| `string` | ✅ | The external ID of the offer inventory. |
|
|
135
|
+
* | `page` | `number` | ❌ | The page number to fetch (0-based index). |
|
|
136
|
+
* | `size` | `number` | ❌ | The number of items per page. |
|
|
137
|
+
* | `sort` | `string` | ❌ | The sort to apply to the results. |
|
|
138
|
+
* | `locale` | `string` | ❌ | The locale for the response data. |
|
|
139
|
+
*
|
|
140
|
+
* 📤 **Returns**:
|
|
141
|
+
* A `Promise` resolving to a `GetOfferInventoryCustomFieldsResponse` containing the custom fields.
|
|
142
|
+
*
|
|
143
|
+
* 🛠 **Example usage**:
|
|
144
|
+
* ```typescript
|
|
145
|
+
* const customFields = await getOfferInventoryCustomFields({
|
|
146
|
+
* externalId: "inventory123",
|
|
147
|
+
* page: 0,
|
|
148
|
+
* size: 20,
|
|
149
|
+
* sort: "name,asc",
|
|
150
|
+
* locale: "en",
|
|
151
|
+
* });
|
|
152
|
+
* console.log(customFields);
|
|
153
|
+
* ```
|
|
154
|
+
*
|
|
155
|
+
* @deprecated This function is deprecated and will be probably removed in a future version.
|
|
156
|
+
* @param {GetOfferInventoryCustomFieldsParameters} params - The parameters for the request
|
|
157
|
+
* @throws {Error} If `externalId` is missing
|
|
158
|
+
* @returns {Promise<GetOfferInventoryCustomFieldsResponse>} A promise resolving to the response containing the custom fields
|
|
159
|
+
*/
|
|
160
|
+
async function getOfferInventoryCustomFields({ externalId, page, size, sort, locale, }) {
|
|
161
|
+
(0, parameters_validation_1.required)({ externalId });
|
|
162
|
+
const { data } = await (0, fetch_instance_1.enhancedFetch)({
|
|
163
|
+
method: "GET",
|
|
164
|
+
path: `/v1/offer-inventories/${externalId}/custom-fields`,
|
|
165
|
+
params: {
|
|
166
|
+
externalId,
|
|
167
|
+
page,
|
|
168
|
+
size,
|
|
169
|
+
sort,
|
|
170
|
+
locale,
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
return data;
|
|
174
|
+
}
|