docs: enhance how references are generated (#5805)
* adjusted configurations * enhancements to tool and configurations * change reference in docs * fixed issue in workflows reference * added project name * more optimizations * fix context error * added a types reference * resolved missing types * fix reference reflection types not having children * add an expand url parameter * added new option to the README * added details about new option
This commit is contained in:
+202
@@ -0,0 +1,202 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/adjustInventory
|
||||
sidebar_label: adjustInventory
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# adjustInventory - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `adjustInventory` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to adjust the inventory level's stocked quantity. The inventory level is identified by the IDs of its associated inventory item and location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function adjustInventory (
|
||||
inventoryItemId: string,
|
||||
locationId: string,
|
||||
adjustment: number
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryLevel = await inventoryModule.adjustInventory(
|
||||
inventoryItemId,
|
||||
locationId,
|
||||
adjustment
|
||||
)
|
||||
|
||||
// do something with the inventory level or return it.
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "adjustment",
|
||||
"type": "`number`",
|
||||
"description": "A positive or negative number used to adjust the inventory level's stocked quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The inventory level's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the incoming stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "the item location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the reserved stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the total stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+119
@@ -0,0 +1,119 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/confirmInventory
|
||||
sidebar_label: confirmInventory
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# confirmInventory - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `confirmInventory` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to confirm whether the specified quantity of an inventory item is available in the specified locations.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function confirmInventory (
|
||||
inventoryItemId: string,
|
||||
locationIds: string[],
|
||||
quantity: number
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
return await inventoryModule.confirmInventory(
|
||||
inventoryItemId,
|
||||
locationIds,
|
||||
quantity
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item to check its availability.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the locations to check the quantity availability in.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The quantity to check if available for the inventory item in the specified locations.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<boolean>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Whether the specified quantity is available for the inventory item in the specified locations.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "boolean",
|
||||
"type": "`boolean`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+380
@@ -0,0 +1,380 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/createInventoryItem
|
||||
sidebar_label: createInventoryItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createInventoryItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `createInventoryItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to create an inventory item.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function createInventoryItem (item: {
|
||||
sku: string,
|
||||
requires_shipping: boolean
|
||||
}) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryItem = await inventoryModule.createInventoryItem(
|
||||
item
|
||||
)
|
||||
|
||||
// do something with the inventory item or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[CreateInventoryItemInput](../../inventory/interfaces/inventory.CreateInventoryItemInput.mdx)",
|
||||
"description": "The details of the inventory item to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The description of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The height of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The HS code of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The length of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The material of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`null` \\| `Record<string, unknown>`",
|
||||
"description": "Holds custom data in key-value pairs.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The MID code of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The origin country of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the inventory item requires shipping.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The SKU of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The thumbnail of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The title of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The weight of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The width of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created inventory item's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Description of the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The height of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The inventory item's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The length of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the item requires shipping.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Stock Keeping Unit (SKU) code of the Inventory Item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Thumbnail for the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Title of the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The weight of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The width of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+237
@@ -0,0 +1,237 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/createInventoryItems
|
||||
sidebar_label: createInventoryItems
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createInventoryItems - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `createInventoryItems` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to create inventory items.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function createInventoryItems (items: {
|
||||
sku: string,
|
||||
requires_shipping: boolean
|
||||
}[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryItems = await inventoryModule.createInventoryItems(
|
||||
items
|
||||
)
|
||||
|
||||
// do something with the inventory items or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[CreateInventoryItemInput](../../inventory/interfaces/inventory.CreateInventoryItemInput.mdx)[]",
|
||||
"description": "The details of the inventory items to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The description of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The height of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The HS code of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The length of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The material of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`null` \\| `Record<string, unknown>`",
|
||||
"description": "Holds custom data in key-value pairs.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The MID code of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The origin country of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the inventory item requires shipping.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The SKU of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The thumbnail of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The title of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The weight of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The width of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created inventory items' details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryItemDTO[]",
|
||||
"type": "[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryItemDTO",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/createInventoryLevel
|
||||
sidebar_label: createInventoryLevel
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createInventoryLevel - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `createInventoryLevel` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to create inventory level.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function createInventoryLevel (item: {
|
||||
inventory_item_id: string
|
||||
location_id: string
|
||||
stocked_quantity: number
|
||||
}) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryLevel = await inventoryModule.createInventoryLevel(
|
||||
item
|
||||
)
|
||||
|
||||
// do something with the inventory level or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreateInventoryLevelInput](../../inventory/interfaces/inventory.CreateInventoryLevelInput.mdx)",
|
||||
"description": "The details of the inventory level to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The incoming quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The reserved quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The stocked quantity of the associated inventory item in the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created inventory level's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the incoming stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "the item location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the reserved stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the total stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+157
@@ -0,0 +1,157 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/createInventoryLevels
|
||||
sidebar_label: createInventoryLevels
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createInventoryLevels - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `createInventoryLevels` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to create inventory levels.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function createInventoryLevels (items: {
|
||||
inventory_item_id: string
|
||||
location_id: string
|
||||
stocked_quantity: number
|
||||
}[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryLevels = await inventoryModule.createInventoryLevels(
|
||||
items
|
||||
)
|
||||
|
||||
// do something with the inventory levels or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "data",
|
||||
"type": "[CreateInventoryLevelInput](../../inventory/interfaces/inventory.CreateInventoryLevelInput.mdx)[]",
|
||||
"description": "The details of the inventory levels to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The incoming quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The reserved quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The stocked quantity of the associated inventory item in the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created inventory levels' details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryLevelDTO[]",
|
||||
"type": "[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryLevelDTO",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+264
@@ -0,0 +1,264 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/createReservationItem
|
||||
sidebar_label: createReservationItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createReservationItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `createReservationItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to create a reservation item.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function createReservationItem (item: {
|
||||
inventory_item_id: string,
|
||||
location_id: string,
|
||||
quantity: number
|
||||
}) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const reservationItem = await inventoryModule.createReservationItems(
|
||||
item
|
||||
)
|
||||
|
||||
// do something with the reservation item or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[CreateReservationItemInput](../../inventory/interfaces/inventory.CreateReservationItemInput.mdx)",
|
||||
"description": "The details of the reservation item to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string`",
|
||||
"description": "The user or system that created the reservation. Can be any form of identification string.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "The description of the reservation.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "external_id",
|
||||
"type": "`string`",
|
||||
"description": "An ID associated with an external third-party system that the reservation item is connected to.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "line_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated line item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`null` \\| `Record<string, unknown>`",
|
||||
"description": "Holds custom data in key-value pairs.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The reserved quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created reservation item's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "UserId of user who created the reservation item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Description of the reservation item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the reservation item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the inventory item the reservation relates to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "line_item_id",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the location of the reservation",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The id of the reservation item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+184
@@ -0,0 +1,184 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/createReservationItems
|
||||
sidebar_label: createReservationItems
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# createReservationItems - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `createReservationItems` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to create reservation items.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function createReservationItems (items: {
|
||||
inventory_item_id: string,
|
||||
location_id: string,
|
||||
quantity: number
|
||||
}[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const reservationItems = await inventoryModule.createReservationItems(
|
||||
items
|
||||
)
|
||||
|
||||
// do something with the reservation items or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[CreateReservationItemInput](../../inventory/interfaces/inventory.CreateReservationItemInput.mdx)[]",
|
||||
"description": "The details of the reservation items to create.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string`",
|
||||
"description": "The user or system that created the reservation. Can be any form of identification string.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "The description of the reservation.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "external_id",
|
||||
"type": "`string`",
|
||||
"description": "An ID associated with an external third-party system that the reservation item is connected to.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "line_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated line item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`null` \\| `Record<string, unknown>`",
|
||||
"description": "Holds custom data in key-value pairs.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The reserved quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The created reservation items' details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ReservationItemDTO[]",
|
||||
"type": "[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ReservationItemDTO",
|
||||
"type": "`object`",
|
||||
"description": "Represents a reservation of an inventory item at a stock location",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+88
@@ -0,0 +1,88 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/deleteInventoryItem
|
||||
sidebar_label: deleteInventoryItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteInventoryItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteInventoryItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to delete an inventory item or multiple inventory items. The inventory items are only soft deleted and can be restored using the
|
||||
[restoreInventoryItem](inventory.IInventoryService.restoreInventoryItem.mdx) method.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function deleteInventoryItem (
|
||||
inventoryItems: string[]
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.deleteInventoryItem(
|
||||
inventoryItems
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The ID(s) of the inventory item(s) to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the inventory item(s) are successfully deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/deleteInventoryItemLevelByLocationId
|
||||
sidebar_label: deleteInventoryItemLevelByLocationId
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteInventoryItemLevelByLocationId - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteInventoryItemLevelByLocationId` method. This belongs to the Inventory Module.
|
||||
|
||||
This method deletes the inventory item level(s) for the ID(s) of associated location(s).
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function deleteInventoryItemLevelByLocationId (
|
||||
locationIds: string[]
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.deleteInventoryItemLevelByLocationId(
|
||||
locationIds
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "locationId",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The ID(s) of the associated location(s).",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the inventory item level(s) are successfully restored.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/deleteInventoryLevel
|
||||
sidebar_label: deleteInventoryLevel
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteInventoryLevel - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteInventoryLevel` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to delete an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function deleteInventoryLevel (
|
||||
inventoryItemId: string,
|
||||
locationId: string
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.deleteInventoryLevel(
|
||||
inventoryItemId,
|
||||
locationId
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the inventory level(s) are successfully restored.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/deleteReservationItem
|
||||
sidebar_label: deleteReservationItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteReservationItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteReservationItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to delete a reservation item or multiple reservation items by their IDs.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function deleteReservationItems (
|
||||
reservationItemIds: string[]
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.deleteReservationItem(
|
||||
reservationItemIds
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "reservationItemId",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The ID(s) of the reservation item(s) to delete.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the reservation item(s) are successfully deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/deleteReservationItemByLocationId
|
||||
sidebar_label: deleteReservationItemByLocationId
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteReservationItemByLocationId - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteReservationItemByLocationId` method. This belongs to the Inventory Module.
|
||||
|
||||
This method deletes reservation item(s) by the ID(s) of associated location(s).
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function deleteReservationItemByLocationId (
|
||||
locationIds: string[]
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.deleteReservationItemByLocationId(
|
||||
locationIds
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "locationId",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The ID(s) of the associated location(s).",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the reservation item(s) are successfully restored.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/deleteReservationItemsByLineItem
|
||||
sidebar_label: deleteReservationItemsByLineItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# deleteReservationItemsByLineItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `deleteReservationItemsByLineItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to delete the reservation items associated with a line item or multiple line items.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function deleteReservationItemsByLineItem (
|
||||
lineItemIds: string[]
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.deleteReservationItemsByLineItem(
|
||||
lineItemIds
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "lineItemId",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The ID(s) of the line item(s).",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share re9sources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the reservation items are successfully deleted.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+278
@@ -0,0 +1,278 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/listInventoryItems
|
||||
sidebar_label: listInventoryItems
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listInventoryItems - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `listInventoryItems` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve a paginated list of inventory items along with the total count of available inventory items satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of inventory items using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryItems (ids: string[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [inventoryItems, count] = await inventoryModule.listInventoryItems({
|
||||
id: ids
|
||||
})
|
||||
|
||||
// do something with the inventory items or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the inventory items:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryItems (ids: string[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [inventoryItems, count] = await inventoryModule.listInventoryItems({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["inventory_level"]
|
||||
})
|
||||
|
||||
// do something with the inventory items or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryItems (ids: string[], skip: number, take: number) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [inventoryItems, count] = await inventoryModule.listInventoryItems({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["inventory_level"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the inventory items or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[FilterableInventoryItemProps](../../inventory/interfaces/inventory.FilterableInventoryItemProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved inventory items.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../inventory/interfaces/inventory.StringComparisonOperator.mdx)",
|
||||
"description": "The HS Codes to filter inventory items by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The IDs to filter inventory items by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Filter inventory items by the ID of their associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The origin country to filter inventory items by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "q",
|
||||
"type": "`string`",
|
||||
"description": "Search term to search inventory items' attributes.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Filter inventory items by whether they require shipping.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`string` \\| `string`[] \\| [StringComparisonOperator](../../inventory/interfaces/inventory.StringComparisonOperator.mdx)",
|
||||
"description": "The SKUs to filter inventory items by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../inventory/interfaces/inventory.FindConfig.mdx)<[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)>",
|
||||
"description": "The configurations determining how the inventory items are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of inventory items along with the total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryItemDTO[]",
|
||||
"type": "[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+260
@@ -0,0 +1,260 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/listInventoryLevels
|
||||
sidebar_label: listInventoryLevels
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listInventoryLevels - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `listInventoryLevels` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve a paginated list of inventory levels along with the total count of available inventory levels satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of inventory levels using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryLevels (inventoryItemIds: string[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
|
||||
inventory_item_id: inventoryItemIds
|
||||
})
|
||||
|
||||
// do something with the inventory levels or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the inventory levels:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryLevels (inventoryItemIds: string[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
|
||||
inventory_item_id: inventoryItemIds
|
||||
}, {
|
||||
relations: ["inventory_item"]
|
||||
})
|
||||
|
||||
// do something with the inventory levels or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryLevels (inventoryItemIds: string[], skip: number, take: number) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [inventoryLevels, count] = await inventoryModule.listInventoryLevels({
|
||||
inventory_item_id: inventoryItemIds
|
||||
}, {
|
||||
relations: ["inventory_item"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the inventory levels or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[FilterableInventoryLevelProps](../../inventory/interfaces/inventory.FilterableInventoryLevelProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved inventory levels.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
|
||||
"description": "Filters to apply on inventory levels' `incoming_quantity` attribute.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Filter inventory levels by the ID of their associated inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Filter inventory levels by the ID of their associated inventory location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
|
||||
"description": "Filters to apply on inventory levels' `reserved_quantity` attribute.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
|
||||
"description": "Filters to apply on inventory levels' `stocked_quantity` attribute.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../inventory/interfaces/inventory.FindConfig.mdx)<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)>",
|
||||
"description": "The configurations determining how the inventory levels are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a inventory level.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of inventory levels along with the total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryLevelDTO[]",
|
||||
"type": "[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+278
@@ -0,0 +1,278 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/listReservationItems
|
||||
sidebar_label: listReservationItems
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# listReservationItems - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `listReservationItems` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve a paginated list of reservation items along with the total count of available reservation items satisfying the provided filters.
|
||||
|
||||
## Example
|
||||
|
||||
To retrieve a list of reservation items using their IDs:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveReservationItems (ids: string[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [reservationItems, count] = await inventoryModule.listReservationItems({
|
||||
id: ids
|
||||
})
|
||||
|
||||
// do something with the reservation items or return them
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved within the reservation items:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveReservationItems (ids: string[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [reservationItems, count] = await inventoryModule.listReservationItems({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["inventory_item"]
|
||||
})
|
||||
|
||||
// do something with the reservation items or return them
|
||||
}
|
||||
```
|
||||
|
||||
By default, only the first `10` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveReservationItems (ids: string[], skip: number, take: number) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const [reservationItems, count] = await inventoryModule.listReservationItems({
|
||||
id: ids
|
||||
}, {
|
||||
relations: ["inventory_item"],
|
||||
skip,
|
||||
take
|
||||
})
|
||||
|
||||
// do something with the reservation items or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "selector",
|
||||
"type": "[FilterableReservationItemProps](../../inventory/interfaces/inventory.FilterableReservationItemProps.mdx)",
|
||||
"description": "The filters to apply on the retrieved reservation items.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The \"created by\" values to filter reservation items by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| [StringComparisonOperator](../../inventory/interfaces/inventory.StringComparisonOperator.mdx)",
|
||||
"description": "Description filters to apply on the reservation items' `description` attribute.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The IDs to filter reservation items by.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Filter reservation items by the ID of their associated inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "line_item_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Filter reservation items by the ID of their associated line item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "Filter reservation items by the ID of their associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number` \\| [NumericalComparisonOperator](../../inventory/interfaces/inventory.NumericalComparisonOperator.mdx)",
|
||||
"description": "Filters to apply on the reservation items' `quantity` attribute.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../inventory/interfaces/inventory.FindConfig.mdx)<[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)>",
|
||||
"description": "The configurations determining how the reservation items are retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a reservation item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)[], number]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The list of reservation items along with the total count.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "ReservationItemDTO[]",
|
||||
"type": "[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+87
@@ -0,0 +1,87 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/restoreInventoryItem
|
||||
sidebar_label: restoreInventoryItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# restoreInventoryItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `restoreInventoryItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to restore an inventory item or multiple inventory items that were previously deleted using the [deleteInventoryItem](inventory.IInventoryService.deleteInventoryItem.mdx) method.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function restoreInventoryItem (
|
||||
inventoryItems: string[]
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
await inventoryModule.restoreInventoryItem(
|
||||
inventoryItems
|
||||
)
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string` \\| `string`[]",
|
||||
"description": "The ID(s) of the inventory item(s) to restore.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<void>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "Resolves when the inventory item(s) are successfully restored.",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]} />
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/retrieveAvailableQuantity
|
||||
sidebar_label: retrieveAvailableQuantity
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveAvailableQuantity - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveAvailableQuantity` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve the available quantity of an inventory item within the specified locations.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveAvailableQuantity (
|
||||
inventoryItemId: string,
|
||||
locationIds: string[],
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const quantity = await inventoryModule.retrieveAvailableQuantity(
|
||||
inventoryItemId,
|
||||
locationIds,
|
||||
)
|
||||
|
||||
// do something with the quantity or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item to retrieve its quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the locations to retrieve the available quantity from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<number>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The available quantity of the inventory item in the specified locations.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+332
@@ -0,0 +1,332 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/retrieveInventoryItem
|
||||
sidebar_label: retrieveInventoryItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveInventoryItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveInventoryItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve an inventory item by its ID
|
||||
|
||||
## Example
|
||||
|
||||
A simple example that retrieves a inventory item by its ID:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryItem (id: string) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryItem = await inventoryModule.retrieveInventoryItem(id)
|
||||
|
||||
// do something with the inventory item or return it
|
||||
}
|
||||
```
|
||||
|
||||
To specify relations that should be retrieved:
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryItem (id: string) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryItem = await inventoryModule.retrieveInventoryItem(id, {
|
||||
relations: ["inventory_level"]
|
||||
})
|
||||
|
||||
// do something with the inventory item or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item to retrieve.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "config",
|
||||
"type": "[FindConfig](../../inventory/interfaces/inventory.FindConfig.mdx)<[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)>",
|
||||
"description": "The configurations determining how the inventory item is retrieved. Its properties, such as `select` or `relations`, accept the\nattributes or relations associated with a inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "order",
|
||||
"type": "`object`",
|
||||
"description": "An object used to specify how to sort the returned records. Its keys are the names of attributes of the entity, and a key's value can either be `ASC`\nto sort retrieved records in an ascending order, or `DESC` to sort retrieved records in a descending order.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "relations",
|
||||
"type": "`string`[]",
|
||||
"description": "An array of strings, each being relation names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "select",
|
||||
"type": "(`string` \\| keyof `Entity`)[]",
|
||||
"description": "An array of strings, each being attribute names of the entity to retrieve in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "skip",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to skip before retrieving the results.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "take",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "A number indicating the number of records to return in the result.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "withDeleted",
|
||||
"type": "`boolean`",
|
||||
"description": "A boolean indicating whether deleted records should also be retrieved as part of the result. This only works if the entity extends the\n`SoftDeletableEntity` class.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved inventory item.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Description of the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The height of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The inventory item's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The length of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the item requires shipping.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Stock Keeping Unit (SKU) code of the Inventory Item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Thumbnail for the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Title of the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The weight of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The width of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+191
@@ -0,0 +1,191 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/retrieveInventoryLevel
|
||||
sidebar_label: retrieveInventoryLevel
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveInventoryLevel - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveInventoryLevel` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve an inventory level for an inventory item and a location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveInventoryLevel (
|
||||
inventoryItemId: string,
|
||||
locationId: string
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryLevel = await inventoryModule.retrieveInventoryLevel(
|
||||
inventoryItemId,
|
||||
locationId
|
||||
)
|
||||
|
||||
// do something with the inventory level or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved inventory level.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the incoming stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "the item location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the reserved stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the total stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+185
@@ -0,0 +1,185 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/retrieveReservationItem
|
||||
sidebar_label: retrieveReservationItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveReservationItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveReservationItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve a reservation item by its ID.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveReservationItem (id: string) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const reservationItem = await inventoryModule.retrieveReservationItem(id)
|
||||
|
||||
// do something with the reservation item or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "reservationId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the reservation item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The retrieved reservation item.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "UserId of user who created the reservation item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Description of the reservation item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the reservation item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the inventory item the reservation relates to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "line_item_id",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the location of the reservation",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The id of the reservation item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/retrieveReservedQuantity
|
||||
sidebar_label: retrieveReservedQuantity
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveReservedQuantity - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveReservedQuantity` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve the reserved quantity of an inventory item within the specified locations.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveReservedQuantity (
|
||||
inventoryItemId: string,
|
||||
locationIds: string[],
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const quantity = await inventoryModule.retrieveReservedQuantity(
|
||||
inventoryItemId,
|
||||
locationIds,
|
||||
)
|
||||
|
||||
// do something with the quantity or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item to retrieve its reserved quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the locations to retrieve the reserved quantity from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<number>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The reserved quantity of the inventory item in the specified locations.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+110
@@ -0,0 +1,110 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/retrieveStockedQuantity
|
||||
sidebar_label: retrieveStockedQuantity
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# retrieveStockedQuantity - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `retrieveStockedQuantity` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to retrieve the stocked quantity of an inventory item within the specified locations.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function retrieveStockedQuantity (
|
||||
inventoryItemId: string,
|
||||
locationIds: string[],
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const quantity = await inventoryModule.retrieveStockedQuantity(
|
||||
inventoryItemId,
|
||||
locationIds,
|
||||
)
|
||||
|
||||
// do something with the quantity or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item to retrieve its stocked quantity.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationIds",
|
||||
"type": "`string`[]",
|
||||
"description": "The IDs of the locations to retrieve the stocked quantity from.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<number>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The stocked quantity of the inventory item in the specified locations.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "number",
|
||||
"type": "`number`",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+392
@@ -0,0 +1,392 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/updateInventoryItem
|
||||
sidebar_label: updateInventoryItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateInventoryItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateInventoryItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to update an inventory item.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function updateInventoryItem (
|
||||
inventoryItemId: string,
|
||||
sku: string
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryItem = await inventoryModule.updateInventoryItem(
|
||||
inventoryItemId,
|
||||
{
|
||||
sku
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the inventory item or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "Partial<[CreateInventoryItemInput](../../inventory/interfaces/inventory.CreateInventoryItemInput.mdx)>",
|
||||
"description": "The attributes to update in the inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The description of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The height of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The HS code of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The length of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The material of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`null` \\| `Record<string, unknown>`",
|
||||
"description": "Holds custom data in key-value pairs.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The MID code of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The origin country of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the inventory item requires shipping.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The SKU of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The thumbnail of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`null` \\| `string`",
|
||||
"description": "The title of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The weight of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`null` \\| `number`",
|
||||
"description": "The width of the inventory item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryItemDTO](../../inventory/types/inventory.InventoryItemDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated inventory item's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Description of the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "height",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The height of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "hs_code",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Harmonized System code of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The inventory item's ID.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "length",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The length of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "material",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The material and composition that the Inventory Item is made of, May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "mid_code",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Manufacturers Identification code that identifies the manufacturer of the Inventory Item. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "origin_country",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The country in which the Inventory Item was produced. May be used by Fulfillment Providers to pass customs information to shipping carriers.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "requires_shipping",
|
||||
"type": "`boolean`",
|
||||
"description": "Whether the item requires shipping.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "sku",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "The Stock Keeping Unit (SKU) code of the Inventory Item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "thumbnail",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Thumbnail for the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "title",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Title of the inventory item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The weight of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "width",
|
||||
"type": "`number` \\| `null`",
|
||||
"description": "The width of the Inventory Item. May be used in shipping rate calculations.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+223
@@ -0,0 +1,223 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/updateInventoryLevel
|
||||
sidebar_label: updateInventoryLevel
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateInventoryLevel - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateInventoryLevel` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to update an inventory level. The inventory level is identified by the IDs of its associated inventory item and location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function updateInventoryLevel (
|
||||
inventoryItemId: string,
|
||||
locationId: string,
|
||||
stockedQuantity: number
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryLevel = await inventoryModule.updateInventoryLevels(
|
||||
inventoryItemId,
|
||||
locationId,
|
||||
{
|
||||
stocked_quantity: stockedQuantity
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the inventory level or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "inventoryItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the inventory item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "locationId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "update",
|
||||
"type": "[UpdateInventoryLevelInput](../../inventory/interfaces/inventory.UpdateInventoryLevelInput.mdx)",
|
||||
"description": "The attributes to update in the location level.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The incoming quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The stocked quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated inventory level's details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the incoming stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "the item location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "reserved_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the reserved stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "the total stock quantity of an inventory item at the given location ID",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/updateInventoryLevels
|
||||
sidebar_label: updateInventoryLevels
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateInventoryLevels - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateInventoryLevels` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to update inventory levels. Each inventory level is identified by the IDs of its associated inventory item and location.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function updateInventoryLevels (items: {
|
||||
inventory_item_id: string,
|
||||
location_id: string,
|
||||
stocked_quantity: number
|
||||
}[]) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const inventoryLevels = await inventoryModule.updateInventoryLevels(
|
||||
items
|
||||
)
|
||||
|
||||
// do something with the inventory levels or return them
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "updates",
|
||||
"type": "[BulkUpdateInventoryLevelInput](../../inventory/interfaces/inventory.BulkUpdateInventoryLevelInput.mdx)[]",
|
||||
"description": "The attributes to update in each inventory level.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "incoming_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The incoming quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated inventory level.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "stocked_quantity",
|
||||
"type": "`number`",
|
||||
"description": "The stocked quantity of the associated inventory item in the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated inventory levels' details.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryLevelDTO[]",
|
||||
"type": "[InventoryLevelDTO](../../inventory/types/inventory.InventoryLevelDTO.mdx)[]",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "InventoryLevelDTO",
|
||||
"type": "`object`",
|
||||
"description": "",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
+239
@@ -0,0 +1,239 @@
|
||||
---
|
||||
displayed_sidebar: inventoryReference
|
||||
slug: /references/inventory/updateReservationItem
|
||||
sidebar_label: updateReservationItem
|
||||
---
|
||||
|
||||
import ParameterTypes from "@site/src/components/ParameterTypes"
|
||||
|
||||
# updateReservationItem - Inventory Module Reference
|
||||
|
||||
This documentation provides a reference to the `updateReservationItem` method. This belongs to the Inventory Module.
|
||||
|
||||
This method is used to update a reservation item.
|
||||
|
||||
## Example
|
||||
|
||||
```ts
|
||||
import {
|
||||
initialize as initializeInventoryModule,
|
||||
} from "@medusajs/inventory"
|
||||
|
||||
async function updateReservationItem (
|
||||
reservationItemId: string,
|
||||
quantity: number
|
||||
) {
|
||||
const inventoryModule = await initializeInventoryModule({})
|
||||
|
||||
const reservationItem = await inventoryModule.updateReservationItem(
|
||||
reservationItemId,
|
||||
{
|
||||
quantity
|
||||
}
|
||||
)
|
||||
|
||||
// do something with the reservation item or return it
|
||||
}
|
||||
```
|
||||
|
||||
## Parameters
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "reservationItemId",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the reservation item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "input",
|
||||
"type": "[UpdateReservationItemInput](../../inventory/interfaces/inventory.UpdateReservationItemInput.mdx)",
|
||||
"description": "The attributes to update in the reservation item.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string`",
|
||||
"description": "The description of the reservation item.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The ID of the associated location.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`null` \\| `Record<string, unknown>`",
|
||||
"description": "Holds custom data in key-value pairs.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The reserved quantity.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "context",
|
||||
"type": "[SharedContext](../../inventory/interfaces/inventory.SharedContext.mdx)",
|
||||
"description": "A context used to share resources, such as transaction manager, between the application and the module.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "manager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of an entity manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "transactionManager",
|
||||
"type": "`EntityManager`",
|
||||
"description": "An instance of a transaction manager.",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
|
||||
## Returns
|
||||
|
||||
<ParameterTypes parameters={[
|
||||
{
|
||||
"name": "Promise",
|
||||
"type": "Promise<[ReservationItemDTO](../../inventory/types/inventory.ReservationItemDTO.mdx)>",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"description": "The updated reservation item.",
|
||||
"expandable": false,
|
||||
"children": [
|
||||
{
|
||||
"name": "created_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was created.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "created_by",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "UserId of user who created the reservation item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "deleted_at",
|
||||
"type": "`string` \\| `Date` \\| `null`",
|
||||
"description": "The date with timezone at which the resource was deleted.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "description",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "Description of the reservation item",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the reservation item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "inventory_item_id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the inventory item the reservation relates to",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "line_item_id",
|
||||
"type": "`string` \\| `null`",
|
||||
"description": "",
|
||||
"optional": true,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "location_id",
|
||||
"type": "`string`",
|
||||
"description": "The id of the location of the reservation",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "metadata",
|
||||
"type": "`Record<string, unknown>` \\| `null`",
|
||||
"description": "An optional key-value map with additional details",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "quantity",
|
||||
"type": "`number`",
|
||||
"description": "The id of the reservation item",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
},
|
||||
{
|
||||
"name": "updated_at",
|
||||
"type": "`string` \\| `Date`",
|
||||
"description": "The date with timezone at which the resource was updated.",
|
||||
"optional": false,
|
||||
"defaultValue": "",
|
||||
"expandable": false,
|
||||
"children": []
|
||||
}
|
||||
]
|
||||
}
|
||||
]} />
|
||||
Reference in New Issue
Block a user