@medusajs/js-sdk 2.0.0-preview-20241022094107 → 2.0.0-rc-20241022183311
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/admin/api-key.d.ts +144 -1
- package/dist/admin/api-key.d.ts.map +1 -1
- package/dist/admin/api-key.js +143 -0
- package/dist/admin/api-key.js.map +1 -1
- package/dist/admin/campaign.d.ts +135 -0
- package/dist/admin/campaign.d.ts.map +1 -1
- package/dist/admin/campaign.js +135 -0
- package/dist/admin/campaign.js.map +1 -1
- package/dist/admin/claim.d.ts +542 -19
- package/dist/admin/claim.d.ts.map +1 -1
- package/dist/admin/claim.js +523 -0
- package/dist/admin/claim.js.map +1 -1
- package/dist/admin/currency.d.ts +80 -1
- package/dist/admin/currency.d.ts.map +1 -1
- package/dist/admin/currency.js +81 -2
- package/dist/admin/currency.js.map +1 -1
- package/dist/admin/customer-group.d.ts +152 -2
- package/dist/admin/customer-group.d.ts.map +1 -1
- package/dist/admin/customer-group.js +150 -0
- package/dist/admin/customer-group.js.map +1 -1
- package/dist/admin/customer.d.ts +135 -13
- package/dist/admin/customer.d.ts.map +1 -1
- package/dist/admin/customer.js +130 -0
- package/dist/admin/customer.js.map +1 -1
- package/dist/admin/exchange.d.ts +471 -16
- package/dist/admin/exchange.d.ts.map +1 -1
- package/dist/admin/exchange.js +455 -0
- package/dist/admin/exchange.js.map +1 -1
- package/dist/admin/fulfillment-provider.d.ts +47 -0
- package/dist/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/admin/fulfillment-provider.js +47 -0
- package/dist/admin/fulfillment-provider.js.map +1 -1
- package/dist/admin/fulfillment-set.d.ts +122 -0
- package/dist/admin/fulfillment-set.d.ts.map +1 -1
- package/dist/admin/fulfillment-set.js +122 -0
- package/dist/admin/fulfillment-set.js.map +1 -1
- package/dist/admin/fulfillment.d.ts +74 -0
- package/dist/admin/fulfillment.d.ts.map +1 -1
- package/dist/admin/fulfillment.js +75 -0
- package/dist/admin/fulfillment.js.map +1 -1
- package/dist/admin/inventory-item.d.ts +252 -1
- package/dist/admin/inventory-item.d.ts.map +1 -1
- package/dist/admin/inventory-item.js +251 -0
- package/dist/admin/inventory-item.js.map +1 -1
- package/dist/admin/invite.d.ts +170 -15
- package/dist/admin/invite.d.ts.map +1 -1
- package/dist/admin/invite.js +162 -0
- package/dist/admin/invite.js.map +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- package/dist/esm/admin/api-key.d.ts +144 -1
- package/dist/esm/admin/api-key.d.ts.map +1 -1
- package/dist/esm/admin/api-key.js +143 -0
- package/dist/esm/admin/api-key.js.map +1 -1
- package/dist/esm/admin/campaign.d.ts +135 -0
- package/dist/esm/admin/campaign.d.ts.map +1 -1
- package/dist/esm/admin/campaign.js +135 -0
- package/dist/esm/admin/campaign.js.map +1 -1
- package/dist/esm/admin/claim.d.ts +542 -19
- package/dist/esm/admin/claim.d.ts.map +1 -1
- package/dist/esm/admin/claim.js +523 -0
- package/dist/esm/admin/claim.js.map +1 -1
- package/dist/esm/admin/currency.d.ts +80 -1
- package/dist/esm/admin/currency.d.ts.map +1 -1
- package/dist/esm/admin/currency.js +81 -2
- package/dist/esm/admin/currency.js.map +1 -1
- package/dist/esm/admin/customer-group.d.ts +152 -2
- package/dist/esm/admin/customer-group.d.ts.map +1 -1
- package/dist/esm/admin/customer-group.js +150 -0
- package/dist/esm/admin/customer-group.js.map +1 -1
- package/dist/esm/admin/customer.d.ts +135 -13
- package/dist/esm/admin/customer.d.ts.map +1 -1
- package/dist/esm/admin/customer.js +130 -0
- package/dist/esm/admin/customer.js.map +1 -1
- package/dist/esm/admin/exchange.d.ts +471 -16
- package/dist/esm/admin/exchange.d.ts.map +1 -1
- package/dist/esm/admin/exchange.js +455 -0
- package/dist/esm/admin/exchange.js.map +1 -1
- package/dist/esm/admin/fulfillment-provider.d.ts +47 -0
- package/dist/esm/admin/fulfillment-provider.d.ts.map +1 -1
- package/dist/esm/admin/fulfillment-provider.js +47 -0
- package/dist/esm/admin/fulfillment-provider.js.map +1 -1
- package/dist/esm/admin/fulfillment-set.d.ts +122 -0
- package/dist/esm/admin/fulfillment-set.d.ts.map +1 -1
- package/dist/esm/admin/fulfillment-set.js +122 -0
- package/dist/esm/admin/fulfillment-set.js.map +1 -1
- package/dist/esm/admin/fulfillment.d.ts +74 -0
- package/dist/esm/admin/fulfillment.d.ts.map +1 -1
- package/dist/esm/admin/fulfillment.js +75 -0
- package/dist/esm/admin/fulfillment.js.map +1 -1
- package/dist/esm/admin/inventory-item.d.ts +252 -1
- package/dist/esm/admin/inventory-item.d.ts.map +1 -1
- package/dist/esm/admin/inventory-item.js +251 -0
- package/dist/esm/admin/inventory-item.js.map +1 -1
- package/dist/esm/admin/invite.d.ts +170 -15
- package/dist/esm/admin/invite.d.ts.map +1 -1
- package/dist/esm/admin/invite.js +162 -0
- package/dist/esm/admin/invite.js.map +1 -1
- package/dist/esm/client.d.ts +1 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +2 -1
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/store/index.d.ts +1 -1
- package/dist/esm/store/index.js +1 -1
- package/dist/esm/types.d.ts +1 -1
- package/dist/esm/types.d.ts.map +1 -1
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.js +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
@@ -10,14 +10,265 @@ export declare class InventoryItem {
|
|
10
10
|
* @ignore
|
11
11
|
*/
|
12
12
|
constructor(client: Client);
|
13
|
+
/**
|
14
|
+
* This method creates an inventory item. It sends a request to the
|
15
|
+
* [Create Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitems)
|
16
|
+
* API route.
|
17
|
+
*
|
18
|
+
* @param body - The inventory item's details.
|
19
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
20
|
+
* @param headers - Headers to pass in the request.
|
21
|
+
* @returns The inventory item's details.
|
22
|
+
*
|
23
|
+
* @example
|
24
|
+
* sdk.admin.inventoryItem.create({
|
25
|
+
* sku: "SHIRT"
|
26
|
+
* })
|
27
|
+
* .then(({ inventory_item }) => {
|
28
|
+
* console.log(inventory_item)
|
29
|
+
* })
|
30
|
+
*/
|
13
31
|
create(body: HttpTypes.AdminCreateInventoryItem, query?: HttpTypes.SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemResponse>;
|
32
|
+
/**
|
33
|
+
* This method updates an inventory level. It sends a request to the
|
34
|
+
* [Update Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsid)
|
35
|
+
* API route.
|
36
|
+
*
|
37
|
+
* @param id - The inventory item's ID.
|
38
|
+
* @param body - The data to update.
|
39
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
40
|
+
* @param headers - Headers to pass in the request.
|
41
|
+
* @returns The inventory item's details.
|
42
|
+
*
|
43
|
+
* @example
|
44
|
+
* sdk.admin.inventoryItem.update("iitem_123", {
|
45
|
+
* sku: "SHIRT"
|
46
|
+
* })
|
47
|
+
* .then(({ inventory_item }) => {
|
48
|
+
* console.log(inventory_item)
|
49
|
+
* })
|
50
|
+
*/
|
14
51
|
update(id: string, body: HttpTypes.AdminUpdateInventoryItem, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemResponse>;
|
52
|
+
/**
|
53
|
+
* This method retrieves a paginated list of inventory items. It sends a request to the
|
54
|
+
* [List Inventory Items](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitems)
|
55
|
+
* API route.
|
56
|
+
*
|
57
|
+
* @param query - Filters and pagination configurations.
|
58
|
+
* @param headers - Headers to pass in the request.
|
59
|
+
* @returns The paginated list of inventory items.
|
60
|
+
*
|
61
|
+
* @example
|
62
|
+
* To retrieve the list of inventory items:
|
63
|
+
*
|
64
|
+
* ```ts
|
65
|
+
* sdk.admin.inventoryItem.list()
|
66
|
+
* .then(({ inventory_items, count, limit, offset }) => {
|
67
|
+
* console.log(inventory_items)
|
68
|
+
* })
|
69
|
+
* ```
|
70
|
+
*
|
71
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
72
|
+
*
|
73
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
74
|
+
*
|
75
|
+
* ```ts
|
76
|
+
* sdk.admin.inventoryItem.list({
|
77
|
+
* limit: 10,
|
78
|
+
* offset: 10
|
79
|
+
* })
|
80
|
+
* .then(({ inventory_items, count, limit, offset }) => {
|
81
|
+
* console.log(inventory_items)
|
82
|
+
* })
|
83
|
+
* ```
|
84
|
+
*
|
85
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
86
|
+
* in each inventory item:
|
87
|
+
*
|
88
|
+
* ```ts
|
89
|
+
* sdk.admin.inventoryItem.list({
|
90
|
+
* fields: "id,*location_levels"
|
91
|
+
* })
|
92
|
+
* .then(({ inventory_items, count, limit, offset }) => {
|
93
|
+
* console.log(inventory_items)
|
94
|
+
* })
|
95
|
+
* ```
|
96
|
+
*
|
97
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
98
|
+
*/
|
15
99
|
list(query?: HttpTypes.AdminInventoryItemParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemListResponse>;
|
100
|
+
/**
|
101
|
+
* This method retrieves an inventory item by its ID. It sends a request to the
|
102
|
+
* [Get Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitemsid) API route.
|
103
|
+
*
|
104
|
+
* @param id - The inventory item's ID.
|
105
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
106
|
+
* @param headers - Headers to pass in the request
|
107
|
+
* @returns The inventory item's details.
|
108
|
+
*
|
109
|
+
* @example
|
110
|
+
* To retrieve an inventory item by its ID:
|
111
|
+
*
|
112
|
+
* ```ts
|
113
|
+
* sdk.admin.inventoryItem.retrieve("iitem_123")
|
114
|
+
* .then(({ inventory_item }) => {
|
115
|
+
* console.log(inventory_item)
|
116
|
+
* })
|
117
|
+
* ```
|
118
|
+
*
|
119
|
+
* To specify the fields and relations to retrieve:
|
120
|
+
*
|
121
|
+
* ```ts
|
122
|
+
* sdk.admin.inventoryItem.retrieve("iitem_123", {
|
123
|
+
* fields: "id,*location_levels"
|
124
|
+
* })
|
125
|
+
* .then(({ inventory_item }) => {
|
126
|
+
* console.log(inventory_item)
|
127
|
+
* })
|
128
|
+
* ```
|
129
|
+
*
|
130
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
131
|
+
*/
|
16
132
|
retrieve(id: string, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemResponse>;
|
133
|
+
/**
|
134
|
+
* This method deletes an inventory item. This sends a request to the
|
135
|
+
* [Delete Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_deleteinventoryitemsid)
|
136
|
+
* API route.
|
137
|
+
*
|
138
|
+
* @param id - The inventory item's ID.
|
139
|
+
* @param headers - Headers to pass in the request
|
140
|
+
* @returns The deletion's details.
|
141
|
+
*
|
142
|
+
* @example
|
143
|
+
* sdk.admin.inventoryItem.delete("iitem_123")
|
144
|
+
* .then(({ deleted }) => {
|
145
|
+
* console.log(deleted)
|
146
|
+
* })
|
147
|
+
*/
|
17
148
|
delete(id: string, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemDeleteResponse>;
|
149
|
+
/**
|
150
|
+
* This method retrieves a paginated list of inventory levels that belong to an inventory item.
|
151
|
+
* It sends a request to the [List Inventory Items](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitems)
|
152
|
+
* API route.
|
153
|
+
*
|
154
|
+
* @param id - The inventory item's ID.
|
155
|
+
* @param query - Filters and pagination configurations.
|
156
|
+
* @param headers - Headers to pass in the request.
|
157
|
+
* @returns The paginated list of inventory levels.
|
158
|
+
*
|
159
|
+
* @example
|
160
|
+
* To retrieve the list of inventory levels:
|
161
|
+
*
|
162
|
+
* ```ts
|
163
|
+
* sdk.admin.inventoryItem.listLevels("iitem_123")
|
164
|
+
* .then(({ inventory_levels, count, limit, offset }) => {
|
165
|
+
* console.log(inventory_levels)
|
166
|
+
* })
|
167
|
+
* ```
|
168
|
+
*
|
169
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
170
|
+
*
|
171
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
172
|
+
*
|
173
|
+
* ```ts
|
174
|
+
* sdk.admin.inventoryItem.listLevels("iitem_123", {
|
175
|
+
* limit: 10,
|
176
|
+
* offset: 10
|
177
|
+
* })
|
178
|
+
* .then(({ inventory_levels, count, limit, offset }) => {
|
179
|
+
* console.log(inventory_levels)
|
180
|
+
* })
|
181
|
+
* ```
|
182
|
+
*
|
183
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
184
|
+
* in each inventory level:
|
185
|
+
*
|
186
|
+
* ```ts
|
187
|
+
* sdk.admin.inventoryItem.listLevels("iitem_123", {
|
188
|
+
* fields: "id,*inventory_item"
|
189
|
+
* })
|
190
|
+
* .then(({ inventory_levels, count, limit, offset }) => {
|
191
|
+
* console.log(inventory_levels)
|
192
|
+
* })
|
193
|
+
* ```
|
194
|
+
*
|
195
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
196
|
+
*/
|
18
197
|
listLevels(id: string, query?: HttpTypes.AdminInventoryLevelFilters, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryLevelListResponse>;
|
198
|
+
/**
|
199
|
+
* This method updates the inventory level of the specified inventory item and
|
200
|
+
* stock location.
|
201
|
+
*
|
202
|
+
* This method sends a request to the
|
203
|
+
* [Update Inventory Level](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsidlocationlevelslocation_id)
|
204
|
+
* API route.
|
205
|
+
*
|
206
|
+
* @param id - The inventory item's ID.
|
207
|
+
* @param locationId - The stock location's ID.
|
208
|
+
* @param body - The details to update.
|
209
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
210
|
+
* @param headers - Headers to pass in the request
|
211
|
+
* @returns The inventory item's details.
|
212
|
+
*
|
213
|
+
* @example
|
214
|
+
* sdk.admin.inventoryItem.updateLevel(
|
215
|
+
* "iitem_123",
|
216
|
+
* "sloc_123",
|
217
|
+
* {
|
218
|
+
* stocked_quantity: 10
|
219
|
+
* }
|
220
|
+
* )
|
221
|
+
* .then(({ inventory_item }) => {
|
222
|
+
* console.log(inventory_item)
|
223
|
+
* })
|
224
|
+
*/
|
19
225
|
updateLevel(id: string, locationId: string, body: HttpTypes.AdminUpdateInventoryLevel, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemResponse>;
|
20
|
-
|
226
|
+
/**
|
227
|
+
* This method deletes an inventory level associated with an inventory item
|
228
|
+
* and a stock location.
|
229
|
+
*
|
230
|
+
* This method sends a request to the
|
231
|
+
* [Remove Inventory Level](https://docs.medusajs.com/v2/api/admin#inventory-items_deleteinventoryitemsidlocationlevelslocation_id)
|
232
|
+
* API route.
|
233
|
+
*
|
234
|
+
* @param id - The inventory item's ID.
|
235
|
+
* @param locationId - The stock location's ID.
|
236
|
+
* @param headers - Headers to pass in the request
|
237
|
+
* @returns The deletion's details.
|
238
|
+
*
|
239
|
+
* @example
|
240
|
+
* sdk.admin.inventoryItem.deleteLevel(
|
241
|
+
* "iitem_123",
|
242
|
+
* "sloc_123",
|
243
|
+
* )
|
244
|
+
* .then(({ deleted, parent: inventoryItem }) => {
|
245
|
+
* console.log(deleted, inventoryItem)
|
246
|
+
* })
|
247
|
+
*/
|
248
|
+
deleteLevel(id: string, locationId: string, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryLevelDeleteResponse>;
|
249
|
+
/**
|
250
|
+
* This method manages the inventory levels of an inventory item. It sends a request to the
|
251
|
+
* [Manage Inventory Levels](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsidlocationlevelsbatch)
|
252
|
+
* API route.
|
253
|
+
*
|
254
|
+
* @param id - The inventory item's ID.
|
255
|
+
* @param body - The inventory levels to create or delete.
|
256
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
257
|
+
* @param headers - Headers to pass in the request
|
258
|
+
* @returns The inventory item's details.
|
259
|
+
*
|
260
|
+
* @example
|
261
|
+
* sdk.admin.inventoryItem.batchUpdateLevels("iitem_123", {
|
262
|
+
* create: [{
|
263
|
+
* location_id: "sloc_123",
|
264
|
+
* stocked_quantity: 10
|
265
|
+
* }],
|
266
|
+
* delete: ["sloc_123"]
|
267
|
+
* })
|
268
|
+
* .then(({ inventory_item }) => {
|
269
|
+
* console.log(inventory_item)
|
270
|
+
* })
|
271
|
+
*/
|
21
272
|
batchUpdateLevels(id: string, body: HttpTypes.AdminBatchUpdateInventoryLevelLocation, query?: SelectParams, headers?: ClientHeaders): Promise<HttpTypes.AdminInventoryItemResponse>;
|
22
273
|
}
|
23
274
|
//# sourceMappingURL=inventory-item.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inventory-item.d.ts","sourceRoot":"","sources":["../../../src/admin/inventory-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,aAAa;IACxB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAQ;IACtB;;OAEG;gBACS,MAAM,EAAE,MAAM;
|
1
|
+
{"version":3,"file":"inventory-item.d.ts","sourceRoot":"","sources":["../../../src/admin/inventory-item.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,aAAa;IACxB;;OAEG;IACH,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UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa;IAUzE;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,iBAAiB,CACrB,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,SAAS,CAAC,sCAAsC,EACtD,KAAK,CAAC,EAAE,YAAY,EACpB,OAAO,CAAC,EAAE,aAAa;CAY1B"}
|
@@ -14,6 +14,24 @@ export class InventoryItem {
|
|
14
14
|
constructor(client) {
|
15
15
|
this.client = client;
|
16
16
|
}
|
17
|
+
/**
|
18
|
+
* This method creates an inventory item. It sends a request to the
|
19
|
+
* [Create Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitems)
|
20
|
+
* API route.
|
21
|
+
*
|
22
|
+
* @param body - The inventory item's details.
|
23
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
24
|
+
* @param headers - Headers to pass in the request.
|
25
|
+
* @returns The inventory item's details.
|
26
|
+
*
|
27
|
+
* @example
|
28
|
+
* sdk.admin.inventoryItem.create({
|
29
|
+
* sku: "SHIRT"
|
30
|
+
* })
|
31
|
+
* .then(({ inventory_item }) => {
|
32
|
+
* console.log(inventory_item)
|
33
|
+
* })
|
34
|
+
*/
|
17
35
|
create(body, query, headers) {
|
18
36
|
return __awaiter(this, void 0, void 0, function* () {
|
19
37
|
return yield this.client.fetch(`/admin/inventory-items`, {
|
@@ -24,6 +42,25 @@ export class InventoryItem {
|
|
24
42
|
});
|
25
43
|
});
|
26
44
|
}
|
45
|
+
/**
|
46
|
+
* This method updates an inventory level. It sends a request to the
|
47
|
+
* [Update Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsid)
|
48
|
+
* API route.
|
49
|
+
*
|
50
|
+
* @param id - The inventory item's ID.
|
51
|
+
* @param body - The data to update.
|
52
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
53
|
+
* @param headers - Headers to pass in the request.
|
54
|
+
* @returns The inventory item's details.
|
55
|
+
*
|
56
|
+
* @example
|
57
|
+
* sdk.admin.inventoryItem.update("iitem_123", {
|
58
|
+
* sku: "SHIRT"
|
59
|
+
* })
|
60
|
+
* .then(({ inventory_item }) => {
|
61
|
+
* console.log(inventory_item)
|
62
|
+
* })
|
63
|
+
*/
|
27
64
|
update(id, body, query, headers) {
|
28
65
|
return __awaiter(this, void 0, void 0, function* () {
|
29
66
|
return yield this.client.fetch(`/admin/inventory-items/${id}`, {
|
@@ -34,6 +71,53 @@ export class InventoryItem {
|
|
34
71
|
});
|
35
72
|
});
|
36
73
|
}
|
74
|
+
/**
|
75
|
+
* This method retrieves a paginated list of inventory items. It sends a request to the
|
76
|
+
* [List Inventory Items](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitems)
|
77
|
+
* API route.
|
78
|
+
*
|
79
|
+
* @param query - Filters and pagination configurations.
|
80
|
+
* @param headers - Headers to pass in the request.
|
81
|
+
* @returns The paginated list of inventory items.
|
82
|
+
*
|
83
|
+
* @example
|
84
|
+
* To retrieve the list of inventory items:
|
85
|
+
*
|
86
|
+
* ```ts
|
87
|
+
* sdk.admin.inventoryItem.list()
|
88
|
+
* .then(({ inventory_items, count, limit, offset }) => {
|
89
|
+
* console.log(inventory_items)
|
90
|
+
* })
|
91
|
+
* ```
|
92
|
+
*
|
93
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
94
|
+
*
|
95
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
96
|
+
*
|
97
|
+
* ```ts
|
98
|
+
* sdk.admin.inventoryItem.list({
|
99
|
+
* limit: 10,
|
100
|
+
* offset: 10
|
101
|
+
* })
|
102
|
+
* .then(({ inventory_items, count, limit, offset }) => {
|
103
|
+
* console.log(inventory_items)
|
104
|
+
* })
|
105
|
+
* ```
|
106
|
+
*
|
107
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
108
|
+
* in each inventory item:
|
109
|
+
*
|
110
|
+
* ```ts
|
111
|
+
* sdk.admin.inventoryItem.list({
|
112
|
+
* fields: "id,*location_levels"
|
113
|
+
* })
|
114
|
+
* .then(({ inventory_items, count, limit, offset }) => {
|
115
|
+
* console.log(inventory_items)
|
116
|
+
* })
|
117
|
+
* ```
|
118
|
+
*
|
119
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
120
|
+
*/
|
37
121
|
list(query, headers) {
|
38
122
|
return __awaiter(this, void 0, void 0, function* () {
|
39
123
|
return yield this.client.fetch(`/admin/inventory-items`, {
|
@@ -42,6 +126,38 @@ export class InventoryItem {
|
|
42
126
|
});
|
43
127
|
});
|
44
128
|
}
|
129
|
+
/**
|
130
|
+
* This method retrieves an inventory item by its ID. It sends a request to the
|
131
|
+
* [Get Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitemsid) API route.
|
132
|
+
*
|
133
|
+
* @param id - The inventory item's ID.
|
134
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
135
|
+
* @param headers - Headers to pass in the request
|
136
|
+
* @returns The inventory item's details.
|
137
|
+
*
|
138
|
+
* @example
|
139
|
+
* To retrieve an inventory item by its ID:
|
140
|
+
*
|
141
|
+
* ```ts
|
142
|
+
* sdk.admin.inventoryItem.retrieve("iitem_123")
|
143
|
+
* .then(({ inventory_item }) => {
|
144
|
+
* console.log(inventory_item)
|
145
|
+
* })
|
146
|
+
* ```
|
147
|
+
*
|
148
|
+
* To specify the fields and relations to retrieve:
|
149
|
+
*
|
150
|
+
* ```ts
|
151
|
+
* sdk.admin.inventoryItem.retrieve("iitem_123", {
|
152
|
+
* fields: "id,*location_levels"
|
153
|
+
* })
|
154
|
+
* .then(({ inventory_item }) => {
|
155
|
+
* console.log(inventory_item)
|
156
|
+
* })
|
157
|
+
* ```
|
158
|
+
*
|
159
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
160
|
+
*/
|
45
161
|
retrieve(id, query, headers) {
|
46
162
|
return __awaiter(this, void 0, void 0, function* () {
|
47
163
|
return yield this.client.fetch(`/admin/inventory-items/${id}`, {
|
@@ -50,6 +166,21 @@ export class InventoryItem {
|
|
50
166
|
});
|
51
167
|
});
|
52
168
|
}
|
169
|
+
/**
|
170
|
+
* This method deletes an inventory item. This sends a request to the
|
171
|
+
* [Delete Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_deleteinventoryitemsid)
|
172
|
+
* API route.
|
173
|
+
*
|
174
|
+
* @param id - The inventory item's ID.
|
175
|
+
* @param headers - Headers to pass in the request
|
176
|
+
* @returns The deletion's details.
|
177
|
+
*
|
178
|
+
* @example
|
179
|
+
* sdk.admin.inventoryItem.delete("iitem_123")
|
180
|
+
* .then(({ deleted }) => {
|
181
|
+
* console.log(deleted)
|
182
|
+
* })
|
183
|
+
*/
|
53
184
|
delete(id, headers) {
|
54
185
|
return __awaiter(this, void 0, void 0, function* () {
|
55
186
|
return yield this.client.fetch(`/admin/inventory-items/${id}`, {
|
@@ -58,6 +189,54 @@ export class InventoryItem {
|
|
58
189
|
});
|
59
190
|
});
|
60
191
|
}
|
192
|
+
/**
|
193
|
+
* This method retrieves a paginated list of inventory levels that belong to an inventory item.
|
194
|
+
* It sends a request to the [List Inventory Items](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitems)
|
195
|
+
* API route.
|
196
|
+
*
|
197
|
+
* @param id - The inventory item's ID.
|
198
|
+
* @param query - Filters and pagination configurations.
|
199
|
+
* @param headers - Headers to pass in the request.
|
200
|
+
* @returns The paginated list of inventory levels.
|
201
|
+
*
|
202
|
+
* @example
|
203
|
+
* To retrieve the list of inventory levels:
|
204
|
+
*
|
205
|
+
* ```ts
|
206
|
+
* sdk.admin.inventoryItem.listLevels("iitem_123")
|
207
|
+
* .then(({ inventory_levels, count, limit, offset }) => {
|
208
|
+
* console.log(inventory_levels)
|
209
|
+
* })
|
210
|
+
* ```
|
211
|
+
*
|
212
|
+
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
213
|
+
*
|
214
|
+
* For example, to retrieve only 10 items and skip 10 items:
|
215
|
+
*
|
216
|
+
* ```ts
|
217
|
+
* sdk.admin.inventoryItem.listLevels("iitem_123", {
|
218
|
+
* limit: 10,
|
219
|
+
* offset: 10
|
220
|
+
* })
|
221
|
+
* .then(({ inventory_levels, count, limit, offset }) => {
|
222
|
+
* console.log(inventory_levels)
|
223
|
+
* })
|
224
|
+
* ```
|
225
|
+
*
|
226
|
+
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
227
|
+
* in each inventory level:
|
228
|
+
*
|
229
|
+
* ```ts
|
230
|
+
* sdk.admin.inventoryItem.listLevels("iitem_123", {
|
231
|
+
* fields: "id,*inventory_item"
|
232
|
+
* })
|
233
|
+
* .then(({ inventory_levels, count, limit, offset }) => {
|
234
|
+
* console.log(inventory_levels)
|
235
|
+
* })
|
236
|
+
* ```
|
237
|
+
*
|
238
|
+
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
239
|
+
*/
|
61
240
|
listLevels(id, query, headers) {
|
62
241
|
return __awaiter(this, void 0, void 0, function* () {
|
63
242
|
return yield this.client.fetch(`/admin/inventory-items/${id}/location-levels`, {
|
@@ -66,6 +245,33 @@ export class InventoryItem {
|
|
66
245
|
});
|
67
246
|
});
|
68
247
|
}
|
248
|
+
/**
|
249
|
+
* This method updates the inventory level of the specified inventory item and
|
250
|
+
* stock location.
|
251
|
+
*
|
252
|
+
* This method sends a request to the
|
253
|
+
* [Update Inventory Level](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsidlocationlevelslocation_id)
|
254
|
+
* API route.
|
255
|
+
*
|
256
|
+
* @param id - The inventory item's ID.
|
257
|
+
* @param locationId - The stock location's ID.
|
258
|
+
* @param body - The details to update.
|
259
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
260
|
+
* @param headers - Headers to pass in the request
|
261
|
+
* @returns The inventory item's details.
|
262
|
+
*
|
263
|
+
* @example
|
264
|
+
* sdk.admin.inventoryItem.updateLevel(
|
265
|
+
* "iitem_123",
|
266
|
+
* "sloc_123",
|
267
|
+
* {
|
268
|
+
* stocked_quantity: 10
|
269
|
+
* }
|
270
|
+
* )
|
271
|
+
* .then(({ inventory_item }) => {
|
272
|
+
* console.log(inventory_item)
|
273
|
+
* })
|
274
|
+
*/
|
69
275
|
updateLevel(id, locationId, body, query, headers) {
|
70
276
|
return __awaiter(this, void 0, void 0, function* () {
|
71
277
|
return yield this.client.fetch(`/admin/inventory-items/${id}/location-levels/${locationId}`, {
|
@@ -76,6 +282,28 @@ export class InventoryItem {
|
|
76
282
|
});
|
77
283
|
});
|
78
284
|
}
|
285
|
+
/**
|
286
|
+
* This method deletes an inventory level associated with an inventory item
|
287
|
+
* and a stock location.
|
288
|
+
*
|
289
|
+
* This method sends a request to the
|
290
|
+
* [Remove Inventory Level](https://docs.medusajs.com/v2/api/admin#inventory-items_deleteinventoryitemsidlocationlevelslocation_id)
|
291
|
+
* API route.
|
292
|
+
*
|
293
|
+
* @param id - The inventory item's ID.
|
294
|
+
* @param locationId - The stock location's ID.
|
295
|
+
* @param headers - Headers to pass in the request
|
296
|
+
* @returns The deletion's details.
|
297
|
+
*
|
298
|
+
* @example
|
299
|
+
* sdk.admin.inventoryItem.deleteLevel(
|
300
|
+
* "iitem_123",
|
301
|
+
* "sloc_123",
|
302
|
+
* )
|
303
|
+
* .then(({ deleted, parent: inventoryItem }) => {
|
304
|
+
* console.log(deleted, inventoryItem)
|
305
|
+
* })
|
306
|
+
*/
|
79
307
|
deleteLevel(id, locationId, headers) {
|
80
308
|
return __awaiter(this, void 0, void 0, function* () {
|
81
309
|
return yield this.client.fetch(`/admin/inventory-items/${id}/location-levels/${locationId}`, {
|
@@ -84,6 +312,29 @@ export class InventoryItem {
|
|
84
312
|
});
|
85
313
|
});
|
86
314
|
}
|
315
|
+
/**
|
316
|
+
* This method manages the inventory levels of an inventory item. It sends a request to the
|
317
|
+
* [Manage Inventory Levels](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsidlocationlevelsbatch)
|
318
|
+
* API route.
|
319
|
+
*
|
320
|
+
* @param id - The inventory item's ID.
|
321
|
+
* @param body - The inventory levels to create or delete.
|
322
|
+
* @param query - Configure the fields to retrieve in the inventory item.
|
323
|
+
* @param headers - Headers to pass in the request
|
324
|
+
* @returns The inventory item's details.
|
325
|
+
*
|
326
|
+
* @example
|
327
|
+
* sdk.admin.inventoryItem.batchUpdateLevels("iitem_123", {
|
328
|
+
* create: [{
|
329
|
+
* location_id: "sloc_123",
|
330
|
+
* stocked_quantity: 10
|
331
|
+
* }],
|
332
|
+
* delete: ["sloc_123"]
|
333
|
+
* })
|
334
|
+
* .then(({ inventory_item }) => {
|
335
|
+
* console.log(inventory_item)
|
336
|
+
* })
|
337
|
+
*/
|
87
338
|
batchUpdateLevels(id, body, query, headers) {
|
88
339
|
return __awaiter(this, void 0, void 0, function* () {
|
89
340
|
return yield this.client.fetch(`/admin/inventory-items/${id}/location-levels/batch`, {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"inventory-item.js","sourceRoot":"","sources":["../../../src/admin/inventory-item.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,aAAa;IAKxB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;
|
1
|
+
{"version":3,"file":"inventory-item.js","sourceRoot":"","sources":["../../../src/admin/inventory-item.ts"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,OAAO,aAAa;IAKxB;;OAEG;IACH,YAAY,MAAc;QACxB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAA;IACtB,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CACV,IAAwC,EACxC,KAA8B,EAC9B,OAAuB;;YAEvB,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAC5B,wBAAwB,EACxB;gBACE,MAAM,EAAE,MAAM;gBACd,OAAO;gBACP,IAA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