chore(js-sdk,types): add tsdocs for admin JS SDK methods [3/n] (#9712)
This commit is contained in:
@@ -14,6 +14,21 @@ export class FulfillmentSet {
|
|||||||
this.client = client
|
this.client = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method deletes a fulfillment set. It sends a request to the
|
||||||
|
* [Delete Fulfillment Set](https://docs.medusajs.com/v2/api/admin#fulfillment-sets_deletefulfillmentsetsid)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The fulfillment set's ID.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The deletion's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillmentSet.delete("fset_123")
|
||||||
|
* .then(({ deleted }) => {
|
||||||
|
* console.log(deleted)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async delete(id: string, headers?: ClientHeaders) {
|
async delete(id: string, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<HttpTypes.AdminFulfillmentSetDeleteResponse>(
|
return await this.client.fetch<HttpTypes.AdminFulfillmentSetDeleteResponse>(
|
||||||
`/admin/fulfillment-sets/${id}`,
|
`/admin/fulfillment-sets/${id}`,
|
||||||
@@ -24,6 +39,29 @@ export class FulfillmentSet {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method adds a service zone to a fulfillment set. It uses the
|
||||||
|
* [Add Service Zone](https://docs.medusajs.com/v2/api/admin#fulfillment-sets_postfulfillmentsetsidservicezones)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The fulfillment set's ID.
|
||||||
|
* @param body - The service zone's details.
|
||||||
|
* @param query - Configure the fields to retrieve in the fulfillment set.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The fulfillment set's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillmentSet.createServiceZone("fset_123", {
|
||||||
|
* name: "Europe Service Zone",
|
||||||
|
* geo_zones: [{
|
||||||
|
* type: "country",
|
||||||
|
* country_code: "us"
|
||||||
|
* }]
|
||||||
|
* })
|
||||||
|
* .then(({ fulfillment_set }) => {
|
||||||
|
* console.log(fulfillment_set)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async createServiceZone(
|
async createServiceZone(
|
||||||
id: string,
|
id: string,
|
||||||
body: HttpTypes.AdminCreateFulfillmentSetServiceZone,
|
body: HttpTypes.AdminCreateFulfillmentSetServiceZone,
|
||||||
@@ -41,6 +79,47 @@ export class FulfillmentSet {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method retrieves a fulfillment set's service zone's details. It sends a request to the
|
||||||
|
* [Get Service Zone](https://docs.medusajs.com/v2/api/admin#fulfillment-sets_getfulfillmentsetsidservicezoneszone_id)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param fulfillmentSetId - The fulfillment set's ID.
|
||||||
|
* @param serviceZoneId - The service zone's ID.
|
||||||
|
* @param query - Configure the fields to retrieve in the service zone.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The service zone's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* To retrieve a fulfillment set's service zone by its ID:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.fulfillmentSet.retrieveServiceZone(
|
||||||
|
* "fset_123",
|
||||||
|
* "serzo_123"
|
||||||
|
* )
|
||||||
|
* .then(({ service_zone }) => {
|
||||||
|
* console.log(service_zone)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To specify the fields and relations to retrieve:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.fulfillmentSet.retrieveServiceZone(
|
||||||
|
* "fset_123",
|
||||||
|
* "serzo_123",
|
||||||
|
* {
|
||||||
|
* fields: "id,*geo_zones"
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
* .then(({ service_zone }) => {
|
||||||
|
* console.log(service_zone)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
||||||
|
*/
|
||||||
async retrieveServiceZone(
|
async retrieveServiceZone(
|
||||||
fulfillmentSetId: string,
|
fulfillmentSetId: string,
|
||||||
serviceZoneId: string,
|
serviceZoneId: string,
|
||||||
@@ -57,6 +136,30 @@ export class FulfillmentSet {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method updates a service zone in a fulfillment set. It sends a request to the
|
||||||
|
* [Update Service Zone](https://docs.medusajs.com/v2/api/admin#fulfillment-sets_postfulfillmentsetsidservicezoneszone_id)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param fulfillmentSetId - The fulfillment set's ID.
|
||||||
|
* @param serviceZoneId - The service zone's ID.
|
||||||
|
* @param body - The data to update in the service zone.
|
||||||
|
* @param query - Configure the fields to retrieve in the fulfillment set.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The fulfillment set's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillmentSet.updateServiceZone(
|
||||||
|
* "fset_123",
|
||||||
|
* "serzo_123",
|
||||||
|
* {
|
||||||
|
* name: "Europe Service Zone",
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
* .then(({ fulfillment_set }) => {
|
||||||
|
* console.log(fulfillment_set)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async updateServiceZone(
|
async updateServiceZone(
|
||||||
fulfillmentSetId: string,
|
fulfillmentSetId: string,
|
||||||
serviceZoneId: string,
|
serviceZoneId: string,
|
||||||
@@ -75,6 +178,25 @@ export class FulfillmentSet {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method deletes a service zone in a fulfillment set. It sends a request to the
|
||||||
|
* [Remove Service Zone](https://docs.medusajs.com/v2/api/admin#fulfillment-sets_deletefulfillmentsetsidservicezoneszone_id)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param fulfillmentSetId - The fulfullment set's ID.
|
||||||
|
* @param serviceZoneId - The service zone's ID.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The deletion's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillmentSet.deleteServiceZone(
|
||||||
|
* "fset_123",
|
||||||
|
* "serzo_123",
|
||||||
|
* )
|
||||||
|
* .then(({ deleted, parent: fulfillmentSet }) => {
|
||||||
|
* console.log(deleted, fulfillmentSet)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async deleteServiceZone(
|
async deleteServiceZone(
|
||||||
fulfillmentSetId: string,
|
fulfillmentSetId: string,
|
||||||
serviceZoneId: string,
|
serviceZoneId: string,
|
||||||
|
|||||||
@@ -14,6 +14,39 @@ export class Fulfillment {
|
|||||||
this.client = client
|
this.client = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates a fulfillment. It sends a request to the
|
||||||
|
* [Create Fulfillment](https://docs.medusajs.com/v2/api/admin#fulfillments_postfulfillments)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param body - The fulfillment's details.
|
||||||
|
* @param query - Configure the fields to retrieve in the fulfillment.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The fulfillment's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillment.create({
|
||||||
|
* location_id: "sloc_123",
|
||||||
|
* provider_id: "my_fulfillment",
|
||||||
|
* delivery_address: {
|
||||||
|
* country_code: "us"
|
||||||
|
* },
|
||||||
|
* items: [
|
||||||
|
* {
|
||||||
|
* title: "Shirt",
|
||||||
|
* sku: "SHIRT",
|
||||||
|
* quantity: 1,
|
||||||
|
* barcode: "123"
|
||||||
|
* }
|
||||||
|
* ],
|
||||||
|
* labels: [],
|
||||||
|
* order: {},
|
||||||
|
* order_id: "order_123"
|
||||||
|
* })
|
||||||
|
* .then(({ fulfillment }) => {
|
||||||
|
* console.log(fulfillment)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async create(
|
async create(
|
||||||
body: HttpTypes.AdminCreateFulfillment,
|
body: HttpTypes.AdminCreateFulfillment,
|
||||||
query?: HttpTypes.SelectParams,
|
query?: HttpTypes.SelectParams,
|
||||||
@@ -30,6 +63,22 @@ export class Fulfillment {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method cancels a fulfillment. It sends a request to the
|
||||||
|
* [Cancel Fulfillment](https://docs.medusajs.com/v2/api/admin#fulfillments_postfulfillmentsidcancel)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The fulfillment's ID.
|
||||||
|
* @param query - Configure the fields to retrieve in the fulfillment.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The fulfillment's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillment.cancel("ful_123")
|
||||||
|
* .then(({ fulfillment }) => {
|
||||||
|
* console.log(fulfillment)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async cancel(
|
async cancel(
|
||||||
id: string,
|
id: string,
|
||||||
query?: HttpTypes.SelectParams,
|
query?: HttpTypes.SelectParams,
|
||||||
@@ -41,10 +90,36 @@ export class Fulfillment {
|
|||||||
method: "POST",
|
method: "POST",
|
||||||
body: {},
|
body: {},
|
||||||
headers,
|
headers,
|
||||||
|
query
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates a shipment for a fulfillment. It sends a request to the
|
||||||
|
* [Create Shipment](https://docs.medusajs.com/v2/api/admin#fulfillments_postfulfillmentsidshipment)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The fulfillment's ID.
|
||||||
|
* @param body - The shipment's details.
|
||||||
|
* @param query - Configure the fields to retrieve in the fulfillment.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The fulfillment's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.fulfillment.createShipment("ful_123", {
|
||||||
|
* labels: [
|
||||||
|
* {
|
||||||
|
* tracking_number: "123",
|
||||||
|
* tracking_url: "example.com",
|
||||||
|
* label_url: "example.com"
|
||||||
|
* }
|
||||||
|
* ]
|
||||||
|
* })
|
||||||
|
* .then(({ fulfillment }) => {
|
||||||
|
* console.log(fulfillment)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async createShipment(
|
async createShipment(
|
||||||
id: string,
|
id: string,
|
||||||
body: HttpTypes.AdminCreateFulfillmentShipment,
|
body: HttpTypes.AdminCreateFulfillmentShipment,
|
||||||
|
|||||||
@@ -14,6 +14,24 @@ export class InventoryItem {
|
|||||||
this.client = client
|
this.client = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates an inventory item. It sends a request to the
|
||||||
|
* [Create Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitems)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param body - The inventory item's details.
|
||||||
|
* @param query - Configure the fields to retrieve in the inventory item.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The inventory item's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.inventoryItem.create({
|
||||||
|
* sku: "SHIRT"
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_item }) => {
|
||||||
|
* console.log(inventory_item)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async create(
|
async create(
|
||||||
body: HttpTypes.AdminCreateInventoryItem,
|
body: HttpTypes.AdminCreateInventoryItem,
|
||||||
query?: HttpTypes.SelectParams,
|
query?: HttpTypes.SelectParams,
|
||||||
@@ -30,6 +48,25 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method updates an inventory level. It sends a request to the
|
||||||
|
* [Update Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsid)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param body - The data to update.
|
||||||
|
* @param query - Configure the fields to retrieve in the inventory item.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The inventory item's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.inventoryItem.update("iitem_123", {
|
||||||
|
* sku: "SHIRT"
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_item }) => {
|
||||||
|
* console.log(inventory_item)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async update(
|
async update(
|
||||||
id: string,
|
id: string,
|
||||||
body: HttpTypes.AdminUpdateInventoryItem,
|
body: HttpTypes.AdminUpdateInventoryItem,
|
||||||
@@ -47,6 +84,53 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method retrieves a paginated list of inventory items. It sends a request to the
|
||||||
|
* [List Inventory Items](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitems)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param query - Filters and pagination configurations.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The paginated list of inventory items.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* To retrieve the list of inventory items:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.list()
|
||||||
|
* .then(({ inventory_items, count, limit, offset }) => {
|
||||||
|
* console.log(inventory_items)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
||||||
|
*
|
||||||
|
* For example, to retrieve only 10 items and skip 10 items:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.list({
|
||||||
|
* limit: 10,
|
||||||
|
* offset: 10
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_items, count, limit, offset }) => {
|
||||||
|
* console.log(inventory_items)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
||||||
|
* in each inventory item:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.list({
|
||||||
|
* fields: "id,*location_levels"
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_items, count, limit, offset }) => {
|
||||||
|
* console.log(inventory_items)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
||||||
|
*/
|
||||||
async list(
|
async list(
|
||||||
query?: HttpTypes.AdminInventoryItemParams,
|
query?: HttpTypes.AdminInventoryItemParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
@@ -60,6 +144,38 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method retrieves an inventory item by its ID. It sends a request to the
|
||||||
|
* [Get Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitemsid) API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param query - Configure the fields to retrieve in the inventory item.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The inventory item's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* To retrieve an inventory item by its ID:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.retrieve("iitem_123")
|
||||||
|
* .then(({ inventory_item }) => {
|
||||||
|
* console.log(inventory_item)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To specify the fields and relations to retrieve:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.retrieve("iitem_123", {
|
||||||
|
* fields: "id,*location_levels"
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_item }) => {
|
||||||
|
* console.log(inventory_item)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
||||||
|
*/
|
||||||
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
|
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<HttpTypes.AdminInventoryItemResponse>(
|
return await this.client.fetch<HttpTypes.AdminInventoryItemResponse>(
|
||||||
`/admin/inventory-items/${id}`,
|
`/admin/inventory-items/${id}`,
|
||||||
@@ -70,6 +186,21 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method deletes an inventory item. This sends a request to the
|
||||||
|
* [Delete Inventory Item](https://docs.medusajs.com/v2/api/admin#inventory-items_deleteinventoryitemsid)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The deletion's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.inventoryItem.delete("iitem_123")
|
||||||
|
* .then(({ deleted }) => {
|
||||||
|
* console.log(deleted)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async delete(id: string, headers?: ClientHeaders) {
|
async delete(id: string, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<HttpTypes.AdminInventoryItemDeleteResponse>(
|
return await this.client.fetch<HttpTypes.AdminInventoryItemDeleteResponse>(
|
||||||
`/admin/inventory-items/${id}`,
|
`/admin/inventory-items/${id}`,
|
||||||
@@ -80,6 +211,54 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method retrieves a paginated list of inventory levels that belong to an inventory item.
|
||||||
|
* It sends a request to the [List Inventory Items](https://docs.medusajs.com/v2/api/admin#inventory-items_getinventoryitems)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param query - Filters and pagination configurations.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The paginated list of inventory levels.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* To retrieve the list of inventory levels:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.listLevels("iitem_123")
|
||||||
|
* .then(({ inventory_levels, count, limit, offset }) => {
|
||||||
|
* console.log(inventory_levels)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
||||||
|
*
|
||||||
|
* For example, to retrieve only 10 items and skip 10 items:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.listLevels("iitem_123", {
|
||||||
|
* limit: 10,
|
||||||
|
* offset: 10
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_levels, count, limit, offset }) => {
|
||||||
|
* console.log(inventory_levels)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
||||||
|
* in each inventory level:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.inventoryItem.listLevels("iitem_123", {
|
||||||
|
* fields: "id,*inventory_item"
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_levels, count, limit, offset }) => {
|
||||||
|
* console.log(inventory_levels)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
||||||
|
*/
|
||||||
async listLevels(
|
async listLevels(
|
||||||
id: string,
|
id: string,
|
||||||
query?: HttpTypes.AdminInventoryLevelFilters,
|
query?: HttpTypes.AdminInventoryLevelFilters,
|
||||||
@@ -94,6 +273,33 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method updates the inventory level of the specified inventory item and
|
||||||
|
* stock location.
|
||||||
|
*
|
||||||
|
* This method sends a request to the
|
||||||
|
* [Update Inventory Level](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsidlocationlevelslocation_id)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param locationId - The stock location's ID.
|
||||||
|
* @param body - The details to update.
|
||||||
|
* @param query - Configure the fields to retrieve in the inventory item.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The inventory item's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.inventoryItem.updateLevel(
|
||||||
|
* "iitem_123",
|
||||||
|
* "sloc_123",
|
||||||
|
* {
|
||||||
|
* stocked_quantity: 10
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
* .then(({ inventory_item }) => {
|
||||||
|
* console.log(inventory_item)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async updateLevel(
|
async updateLevel(
|
||||||
id: string,
|
id: string,
|
||||||
locationId: string,
|
locationId: string,
|
||||||
@@ -112,8 +318,30 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method deletes an inventory level associated with an inventory item
|
||||||
|
* and a stock location.
|
||||||
|
*
|
||||||
|
* This method sends a request to the
|
||||||
|
* [Remove Inventory Level](https://docs.medusajs.com/v2/api/admin#inventory-items_deleteinventoryitemsidlocationlevelslocation_id)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param locationId - The stock location's ID.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The deletion's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.inventoryItem.deleteLevel(
|
||||||
|
* "iitem_123",
|
||||||
|
* "sloc_123",
|
||||||
|
* )
|
||||||
|
* .then(({ deleted, parent: inventoryItem }) => {
|
||||||
|
* console.log(deleted, inventoryItem)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async deleteLevel(id: string, locationId: string, headers?: ClientHeaders) {
|
async deleteLevel(id: string, locationId: string, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<HttpTypes.AdminInventoryItemDeleteResponse>(
|
return await this.client.fetch<HttpTypes.AdminInventoryLevelDeleteResponse>(
|
||||||
`/admin/inventory-items/${id}/location-levels/${locationId}`,
|
`/admin/inventory-items/${id}/location-levels/${locationId}`,
|
||||||
{
|
{
|
||||||
method: "DELETE",
|
method: "DELETE",
|
||||||
@@ -122,6 +350,29 @@ export class InventoryItem {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method manages the inventory levels of an inventory item. It sends a request to the
|
||||||
|
* [Manage Inventory Levels](https://docs.medusajs.com/v2/api/admin#inventory-items_postinventoryitemsidlocationlevelsbatch)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The inventory item's ID.
|
||||||
|
* @param body - The inventory levels to create or delete.
|
||||||
|
* @param query - Configure the fields to retrieve in the inventory item.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The inventory item's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.inventoryItem.batchUpdateLevels("iitem_123", {
|
||||||
|
* create: [{
|
||||||
|
* location_id: "sloc_123",
|
||||||
|
* stocked_quantity: 10
|
||||||
|
* }],
|
||||||
|
* delete: ["sloc_123"]
|
||||||
|
* })
|
||||||
|
* .then(({ inventory_item }) => {
|
||||||
|
* console.log(inventory_item)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async batchUpdateLevels(
|
async batchUpdateLevels(
|
||||||
id: string,
|
id: string,
|
||||||
body: HttpTypes.AdminBatchUpdateInventoryLevelLocation,
|
body: HttpTypes.AdminBatchUpdateInventoryLevelLocation,
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import {
|
import {
|
||||||
FindParams,
|
FindParams,
|
||||||
HttpTypes,
|
HttpTypes,
|
||||||
PaginatedResponse,
|
|
||||||
SelectParams,
|
SelectParams,
|
||||||
} from "@medusajs/types"
|
} from "@medusajs/types"
|
||||||
import { Client } from "../client"
|
import { Client } from "../client"
|
||||||
@@ -19,13 +18,52 @@ export class Invite {
|
|||||||
this.client = client
|
this.client = client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method accepts an invite. It requires sending a previous request to
|
||||||
|
* the {@link Auth.register}.
|
||||||
|
*
|
||||||
|
* This method sends a request to the [Accept Invite]
|
||||||
|
* (https://docs.medusajs.com/v2/api/admin#invites_postinvitesaccept)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param input - The details of the user to create.
|
||||||
|
* @param query - Configure the fields to retrieve in the user.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The user's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* const token = await sdk.auth.register("user", "emailpass", {
|
||||||
|
* email: "user@gmail.com",
|
||||||
|
* password: "supersecret"
|
||||||
|
* })
|
||||||
|
*
|
||||||
|
* sdk.admin.invite.accept(
|
||||||
|
* {
|
||||||
|
* email: "user@gmail.com",
|
||||||
|
* first_name: "John",
|
||||||
|
* last_name: "Smith",
|
||||||
|
* invite_token: "12345..."
|
||||||
|
* },
|
||||||
|
* {
|
||||||
|
* Authorization: `Bearer ${token}`
|
||||||
|
* }
|
||||||
|
* )
|
||||||
|
* .then(({ user }) => {
|
||||||
|
* console.log(user)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async accept(
|
async accept(
|
||||||
input: HttpTypes.AdminAcceptInvite & { invite_token: string },
|
input: HttpTypes.AdminAcceptInvite & {
|
||||||
|
/**
|
||||||
|
* The invite's token.
|
||||||
|
*/
|
||||||
|
invite_token: string
|
||||||
|
},
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) {
|
) {
|
||||||
const { invite_token, ...rest } = input
|
const { invite_token, ...rest } = input
|
||||||
return await this.client.fetch<{ user: HttpTypes.AdminUserResponse }>(
|
return await this.client.fetch<HttpTypes.AdminAcceptInviteResponse>(
|
||||||
`/admin/invites/accept?token=${input.invite_token}`,
|
`/admin/invites/accept?token=${input.invite_token}`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -36,12 +74,30 @@ export class Invite {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method creates an invite. It sends a request to the
|
||||||
|
* [Create Invite](https://docs.medusajs.com/v2/api/admin#invites_postinvites)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param body - The invite's details.
|
||||||
|
* @param query - Configure the fields to retrieve in the invite.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The invite's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.invite.create({
|
||||||
|
* email: "user@gmail.com",
|
||||||
|
* })
|
||||||
|
* .then(({ invite }) => {
|
||||||
|
* console.log(invite)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async create(
|
async create(
|
||||||
body: HttpTypes.AdminCreateInvite,
|
body: HttpTypes.AdminCreateInvite,
|
||||||
query?: SelectParams,
|
query?: SelectParams,
|
||||||
headers?: ClientHeaders
|
headers?: ClientHeaders
|
||||||
) {
|
) {
|
||||||
return await this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
return await this.client.fetch<HttpTypes.AdminInviteResponse>(
|
||||||
`/admin/invites`,
|
`/admin/invites`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -52,8 +108,41 @@ export class Invite {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method retrieves an invite by its ID. It sends a request to the
|
||||||
|
* [Get Invite](https://docs.medusajs.com/v2/api/admin#invites_getinvitesid)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The invite's ID.
|
||||||
|
* @param query - Configure the fields to retrieve in the invite.
|
||||||
|
* @param headers - Headers to pass in the request
|
||||||
|
* @returns The invite's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* To retrieve an invite its ID:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.invite.retrieve("invite_123")
|
||||||
|
* .then(({ invite }) => {
|
||||||
|
* console.log(invite)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To specify the fields and relations to retrieve:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.invite.retrieve("invite_123", {
|
||||||
|
* fields: "id,email"
|
||||||
|
* })
|
||||||
|
* .then(({ invite }) => {
|
||||||
|
* console.log(invite)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
||||||
|
*/
|
||||||
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
|
async retrieve(id: string, query?: SelectParams, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
return await this.client.fetch<HttpTypes.AdminInviteResponse>(
|
||||||
`/admin/invites/${id}`,
|
`/admin/invites/${id}`,
|
||||||
{
|
{
|
||||||
headers,
|
headers,
|
||||||
@@ -62,17 +151,79 @@ export class Invite {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method retrieves a paginated list of invites. It sends a request to the
|
||||||
|
* [List Invites](https://docs.medusajs.com/v2/api/admin#invites_getinvites)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param queryParams - Filters and pagination configurations.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The paginated list of invites.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* To retrieve the list of invites:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.invite.list()
|
||||||
|
* .then(({ invites, count, limit, offset }) => {
|
||||||
|
* console.log(invites)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* To configure the pagination, pass the `limit` and `offset` query parameters.
|
||||||
|
*
|
||||||
|
* For example, to retrieve only 10 items and skip 10 items:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.invite.list({
|
||||||
|
* limit: 10,
|
||||||
|
* offset: 10
|
||||||
|
* })
|
||||||
|
* .then(({ invites, count, limit, offset }) => {
|
||||||
|
* console.log(invites)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Using the `fields` query parameter, you can specify the fields and relations to retrieve
|
||||||
|
* in each invite:
|
||||||
|
*
|
||||||
|
* ```ts
|
||||||
|
* sdk.admin.invite.list({
|
||||||
|
* fields: "id,email"
|
||||||
|
* })
|
||||||
|
* .then(({ invites, count, limit, offset }) => {
|
||||||
|
* console.log(invites)
|
||||||
|
* })
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* Learn more about the `fields` property in the [API reference](https://docs.medusajs.com/v2/api/store#select-fields-and-relations).
|
||||||
|
*/
|
||||||
async list(queryParams?: FindParams, headers?: ClientHeaders) {
|
async list(queryParams?: FindParams, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<
|
return await this.client.fetch<
|
||||||
PaginatedResponse<{ invites: HttpTypes.AdminInviteResponse[] }>
|
HttpTypes.AdminInviteListResponse
|
||||||
>(`/admin/invites`, {
|
>(`/admin/invites`, {
|
||||||
headers,
|
headers,
|
||||||
query: queryParams,
|
query: queryParams,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method refreshes the token of an invite. It sends a request to the
|
||||||
|
* [Refresh Invite Token](https://docs.medusajs.com/v2/api/admin#invites_postinvitesidresend)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The invite's ID.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The invite's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.invite.resend("invite_123")
|
||||||
|
* .then(({ invite }) => {
|
||||||
|
* console.log(invite)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async resend(id: string, headers?: ClientHeaders) {
|
async resend(id: string, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<{ invite: HttpTypes.AdminInviteResponse }>(
|
return await this.client.fetch<HttpTypes.AdminInviteResponse>(
|
||||||
`/admin/invites/${id}/resend`,
|
`/admin/invites/${id}/resend`,
|
||||||
{
|
{
|
||||||
method: "POST",
|
method: "POST",
|
||||||
@@ -81,6 +232,21 @@ export class Invite {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method deletes an invite. It sends a request to the
|
||||||
|
* [Delete Invite](https://docs.medusajs.com/v2/api/admin#invites_deleteinvitesid)
|
||||||
|
* API route.
|
||||||
|
*
|
||||||
|
* @param id - The invite's ID.
|
||||||
|
* @param headers - Headers to pass in the request.
|
||||||
|
* @returns The deletion's details.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* sdk.admin.invite.delete("invite_123")
|
||||||
|
* .then(({ deleted }) => {
|
||||||
|
* console.log(deleted)
|
||||||
|
* })
|
||||||
|
*/
|
||||||
async delete(id: string, headers?: ClientHeaders) {
|
async delete(id: string, headers?: ClientHeaders) {
|
||||||
return await this.client.fetch<HttpTypes.AdminInviteDeleteResponse>(
|
return await this.client.fetch<HttpTypes.AdminInviteDeleteResponse>(
|
||||||
`/admin/invites/${id}`,
|
`/admin/invites/${id}`,
|
||||||
|
|||||||
@@ -1071,7 +1071,7 @@ export class Store {
|
|||||||
* },
|
* },
|
||||||
* {},
|
* {},
|
||||||
* {
|
* {
|
||||||
* authorization: `Bearer ${token}`
|
* Authorization: `Bearer ${token}`
|
||||||
* }
|
* }
|
||||||
* )
|
* )
|
||||||
* .then(({ customer }) => {
|
* .then(({ customer }) => {
|
||||||
|
|||||||
@@ -3,36 +3,120 @@ import { AdminShippingOption } from "../../shipping-option"
|
|||||||
import { AdminStockLocation } from "../../stock-locations"
|
import { AdminStockLocation } from "../../stock-locations"
|
||||||
|
|
||||||
export interface AdminGeoZone {
|
export interface AdminGeoZone {
|
||||||
|
/**
|
||||||
|
* The geo zone's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The geo zone's type.
|
||||||
|
*/
|
||||||
type: GeoZoneType
|
type: GeoZoneType
|
||||||
|
/**
|
||||||
|
* The geo zone's country code.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* us
|
||||||
|
*/
|
||||||
country_code: string
|
country_code: string
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string | null
|
province_code: string | null
|
||||||
|
/**
|
||||||
|
* The geo zone's city.
|
||||||
|
*/
|
||||||
city: string | null
|
city: string | null
|
||||||
|
/**
|
||||||
|
* The geo zone's postal expression.
|
||||||
|
*/
|
||||||
postal_expression: Record<string, unknown> | null
|
postal_expression: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* The date the geo zone was created.
|
||||||
|
*/
|
||||||
created_at: string
|
created_at: string
|
||||||
|
/**
|
||||||
|
* The date the geo zone was updated.
|
||||||
|
*/
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
/**
|
||||||
|
* The date the geo zone was deleted.
|
||||||
|
*/
|
||||||
deleted_at: string | null
|
deleted_at: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminServiceZone {
|
export interface AdminServiceZone {
|
||||||
|
/**
|
||||||
|
* The service zone's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The service zone's name.
|
||||||
|
*/
|
||||||
name: string
|
name: string
|
||||||
|
/**
|
||||||
|
* The ID of the fulfillment set this service zone belongs to.
|
||||||
|
*/
|
||||||
fulfillment_set_id: string
|
fulfillment_set_id: string
|
||||||
|
/**
|
||||||
|
* The fulfillment set this service zone belongs to.
|
||||||
|
*/
|
||||||
fulfillment_set: AdminFulfillmentSet
|
fulfillment_set: AdminFulfillmentSet
|
||||||
|
/**
|
||||||
|
* The service zone's geo zones.
|
||||||
|
*/
|
||||||
geo_zones: AdminGeoZone[]
|
geo_zones: AdminGeoZone[]
|
||||||
|
/**
|
||||||
|
* The shipping options that can be used in this service zone.
|
||||||
|
*/
|
||||||
shipping_options: AdminShippingOption[]
|
shipping_options: AdminShippingOption[]
|
||||||
|
/**
|
||||||
|
* The date the service zone is created.
|
||||||
|
*/
|
||||||
created_at: string
|
created_at: string
|
||||||
|
/**
|
||||||
|
* The date the service zone is updated.
|
||||||
|
*/
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
/**
|
||||||
|
* The date the service zone is deleted.
|
||||||
|
*/
|
||||||
deleted_at: string | null
|
deleted_at: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminFulfillmentSet {
|
export interface AdminFulfillmentSet {
|
||||||
|
/**
|
||||||
|
* The fulfillment set's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The fulfillment set's name.
|
||||||
|
*/
|
||||||
name: string
|
name: string
|
||||||
|
/**
|
||||||
|
* The fulfillment set's type.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* delivery
|
||||||
|
*/
|
||||||
type: string
|
type: string
|
||||||
|
/**
|
||||||
|
* The stock location associated with this fulfillment set.
|
||||||
|
*/
|
||||||
location: AdminStockLocation
|
location: AdminStockLocation
|
||||||
|
/**
|
||||||
|
* The fulfillment set's service zones.
|
||||||
|
*/
|
||||||
service_zones: AdminServiceZone[]
|
service_zones: AdminServiceZone[]
|
||||||
|
/**
|
||||||
|
* The date the fulfillment set is created.
|
||||||
|
*/
|
||||||
created_at: string
|
created_at: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment set is updated.
|
||||||
|
*/
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment set is deleted.
|
||||||
|
*/
|
||||||
deleted_at: string | null
|
deleted_at: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,18 @@
|
|||||||
interface AdminUpsertGeoZone {
|
interface AdminUpsertGeoZone {
|
||||||
|
/**
|
||||||
|
* The geo zone's type.
|
||||||
|
*/
|
||||||
type: string
|
type: string
|
||||||
|
/**
|
||||||
|
* The geo zone's country code.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* us
|
||||||
|
*/
|
||||||
country_code: string
|
country_code: string
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -12,19 +24,37 @@ interface AdminUpsertFulfillmentSetServiceZoneCountry
|
|||||||
interface AdminUpsertFulfillmentSetServiceZoneProvince
|
interface AdminUpsertFulfillmentSetServiceZoneProvince
|
||||||
extends AdminUpsertGeoZone {
|
extends AdminUpsertGeoZone {
|
||||||
type: "province"
|
type: "province"
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string
|
province_code: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminUpsertFulfillmentSetServiceZoneCity extends AdminUpsertGeoZone {
|
interface AdminUpsertFulfillmentSetServiceZoneCity extends AdminUpsertGeoZone {
|
||||||
type: "city"
|
type: "city"
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string
|
province_code: string
|
||||||
|
/**
|
||||||
|
* The geo zone's city.
|
||||||
|
*/
|
||||||
city: string
|
city: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminUpsertFulfillmentSetServiceZoneZip extends AdminUpsertGeoZone {
|
interface AdminUpsertFulfillmentSetServiceZoneZip extends AdminUpsertGeoZone {
|
||||||
type: "zip"
|
type: "zip"
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string
|
province_code: string
|
||||||
|
/**
|
||||||
|
* The geo zone's city.
|
||||||
|
*/
|
||||||
city: string
|
city: string
|
||||||
|
/**
|
||||||
|
* The geo zone's postal expression or ZIP code.
|
||||||
|
*/
|
||||||
postal_expression: Record<string, unknown>
|
postal_expression: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,11 +65,21 @@ type AdminUpsertFulfillmentSetServiceZoneGeoZone =
|
|||||||
| AdminUpsertFulfillmentSetServiceZoneZip
|
| AdminUpsertFulfillmentSetServiceZoneZip
|
||||||
|
|
||||||
export interface AdminCreateFulfillmentSetServiceZone {
|
export interface AdminCreateFulfillmentSetServiceZone {
|
||||||
|
/**
|
||||||
|
* The service zone's name.
|
||||||
|
*/
|
||||||
name: string
|
name: string
|
||||||
|
/**
|
||||||
|
* The service zone's geo zones to restrict it to
|
||||||
|
* specific geographical locations.
|
||||||
|
*/
|
||||||
geo_zones: AdminUpsertFulfillmentSetServiceZoneGeoZone[]
|
geo_zones: AdminUpsertFulfillmentSetServiceZoneGeoZone[]
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminUpdateGeoZone extends AdminUpsertGeoZone {
|
interface AdminUpdateGeoZone extends AdminUpsertGeoZone {
|
||||||
|
/**
|
||||||
|
* The ID of the geo zone to update.
|
||||||
|
*/
|
||||||
id?: string
|
id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -51,19 +91,37 @@ interface AdminUpdateFulfillmentSetServiceZoneCountry
|
|||||||
interface AdminUpdateFulfillmentSetServiceZoneProvince
|
interface AdminUpdateFulfillmentSetServiceZoneProvince
|
||||||
extends AdminUpdateGeoZone {
|
extends AdminUpdateGeoZone {
|
||||||
type: "province"
|
type: "province"
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string
|
province_code: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminUpdateFulfillmentSetServiceZoneCity extends AdminUpdateGeoZone {
|
interface AdminUpdateFulfillmentSetServiceZoneCity extends AdminUpdateGeoZone {
|
||||||
type: "city"
|
type: "city"
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string
|
province_code: string
|
||||||
|
/**
|
||||||
|
* The geo zone's city.
|
||||||
|
*/
|
||||||
city: string
|
city: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminUpdateFulfillmentSetServiceZoneZip extends AdminUpdateGeoZone {
|
interface AdminUpdateFulfillmentSetServiceZoneZip extends AdminUpdateGeoZone {
|
||||||
type: "zip"
|
type: "zip"
|
||||||
|
/**
|
||||||
|
* The geo zone's province code.
|
||||||
|
*/
|
||||||
province_code: string
|
province_code: string
|
||||||
|
/**
|
||||||
|
* The geo zone's city.
|
||||||
|
*/
|
||||||
city: string
|
city: string
|
||||||
|
/**
|
||||||
|
* The geo zone's postal expression or ZIP code.
|
||||||
|
*/
|
||||||
postal_expression: Record<string, unknown>
|
postal_expression: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,6 +132,14 @@ type AdminUpdateFulfillmentSetServiceZoneGeoZone =
|
|||||||
| AdminUpdateFulfillmentSetServiceZoneZip
|
| AdminUpdateFulfillmentSetServiceZoneZip
|
||||||
|
|
||||||
export interface AdminUpdateFulfillmentSetServiceZone {
|
export interface AdminUpdateFulfillmentSetServiceZone {
|
||||||
|
/**
|
||||||
|
* The service zone's name.
|
||||||
|
*/
|
||||||
name?: string
|
name?: string
|
||||||
|
/**
|
||||||
|
* The service zone's geo zones to restrict it to
|
||||||
|
* specific geographical locations. You can update
|
||||||
|
* existing ones by their IDs or add new ones.
|
||||||
|
*/
|
||||||
geo_zones?: AdminUpdateFulfillmentSetServiceZoneGeoZone[]
|
geo_zones?: AdminUpdateFulfillmentSetServiceZoneGeoZone[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ import { DeleteResponse, DeleteResponseWithParent } from "../../common"
|
|||||||
import { AdminFulfillmentSet, AdminServiceZone } from "./entities"
|
import { AdminFulfillmentSet, AdminServiceZone } from "./entities"
|
||||||
|
|
||||||
export interface AdminServiceZoneResponse {
|
export interface AdminServiceZoneResponse {
|
||||||
|
/**
|
||||||
|
* The service zone's details.
|
||||||
|
*/
|
||||||
service_zone: AdminServiceZone
|
service_zone: AdminServiceZone
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -9,6 +12,9 @@ export interface AdminServiceZoneDeleteResponse
|
|||||||
extends DeleteResponseWithParent<"service_zone", AdminFulfillmentSet> {}
|
extends DeleteResponseWithParent<"service_zone", AdminFulfillmentSet> {}
|
||||||
|
|
||||||
export interface AdminFulfillmentSetResponse {
|
export interface AdminFulfillmentSetResponse {
|
||||||
|
/**
|
||||||
|
* The fulfillment set's details.
|
||||||
|
*/
|
||||||
fulfillment_set: AdminFulfillmentSet
|
fulfillment_set: AdminFulfillmentSet
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,16 +1,49 @@
|
|||||||
import { AdminFulfillmentProvider } from "../../fulfillment-provider"
|
import { AdminFulfillmentProvider } from "../../fulfillment-provider"
|
||||||
|
|
||||||
export interface AdminFulfillmentItem {
|
export interface AdminFulfillmentItem {
|
||||||
|
/**
|
||||||
|
* The fulfillment item's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The fulfillment item's title.
|
||||||
|
*/
|
||||||
title: string
|
title: string
|
||||||
|
/**
|
||||||
|
* The fulfillment item's quantity.
|
||||||
|
*/
|
||||||
quantity: number
|
quantity: number
|
||||||
|
/**
|
||||||
|
* The fulfillment item's SKU.
|
||||||
|
*/
|
||||||
sku: string
|
sku: string
|
||||||
|
/**
|
||||||
|
* The fulfillment item's barcode.
|
||||||
|
*/
|
||||||
barcode: string
|
barcode: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated line item in an order.
|
||||||
|
*/
|
||||||
line_item_id: string | null
|
line_item_id: string | null
|
||||||
|
/**
|
||||||
|
* The ID of the associated inventory item.
|
||||||
|
*/
|
||||||
inventory_item_id: string | null
|
inventory_item_id: string | null
|
||||||
|
/**
|
||||||
|
* The ID of the fulfillment that the item belongs to.
|
||||||
|
*/
|
||||||
fulfillment_id: string
|
fulfillment_id: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment item was created.
|
||||||
|
*/
|
||||||
created_at: string
|
created_at: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment item was updated.
|
||||||
|
*/
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment item was deleted.
|
||||||
|
*/
|
||||||
deleted_at: string | null
|
deleted_at: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -26,40 +59,146 @@ export interface AdminFulfillmentLabel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminFulfillmentAddress {
|
export interface AdminFulfillmentAddress {
|
||||||
|
/**
|
||||||
|
* The address's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The ID of the fulfillment this address belongs to.
|
||||||
|
*/
|
||||||
fulfillment_id: string | null
|
fulfillment_id: string | null
|
||||||
|
/**
|
||||||
|
* The address's company.
|
||||||
|
*/
|
||||||
company: string | null
|
company: string | null
|
||||||
|
/**
|
||||||
|
* The address's first name.
|
||||||
|
*/
|
||||||
first_name: string | null
|
first_name: string | null
|
||||||
|
/**
|
||||||
|
* The address's last name.
|
||||||
|
*/
|
||||||
last_name: string | null
|
last_name: string | null
|
||||||
|
/**
|
||||||
|
* The address's first line.
|
||||||
|
*/
|
||||||
address_1: string | null
|
address_1: string | null
|
||||||
|
/**
|
||||||
|
* The address's last line.
|
||||||
|
*/
|
||||||
address_2: string | null
|
address_2: string | null
|
||||||
|
/**
|
||||||
|
* The address's city.
|
||||||
|
*/
|
||||||
city: string | null
|
city: string | null
|
||||||
|
/**
|
||||||
|
* The address's country code.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* us
|
||||||
|
*/
|
||||||
country_code: string | null
|
country_code: string | null
|
||||||
|
/**
|
||||||
|
* The address's province.
|
||||||
|
*/
|
||||||
province: string | null
|
province: string | null
|
||||||
|
/**
|
||||||
|
* The address's postal code.
|
||||||
|
*/
|
||||||
postal_code: string | null
|
postal_code: string | null
|
||||||
|
/**
|
||||||
|
* The address's phone number.
|
||||||
|
*/
|
||||||
phone: string | null
|
phone: string | null
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* The date the address was created.
|
||||||
|
*/
|
||||||
created_at: string
|
created_at: string
|
||||||
|
/**
|
||||||
|
* The date the address was updated.
|
||||||
|
*/
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
/**
|
||||||
|
* The date the address was deleted.
|
||||||
|
*/
|
||||||
deleted_at: string | null
|
deleted_at: string | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminFulfillment {
|
export interface AdminFulfillment {
|
||||||
|
/**
|
||||||
|
* The fulfillment's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The ID of the stock location the items
|
||||||
|
* are delivered from.
|
||||||
|
*/
|
||||||
location_id: string
|
location_id: string
|
||||||
|
/**
|
||||||
|
* The ID of the fulfillment provider
|
||||||
|
* handling the fulfillment.
|
||||||
|
*/
|
||||||
provider_id: string
|
provider_id: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated shipping option.
|
||||||
|
*/
|
||||||
shipping_option_id: string | null
|
shipping_option_id: string | null
|
||||||
|
/**
|
||||||
|
* The associated fulfillment provider's details.
|
||||||
|
*/
|
||||||
provider: AdminFulfillmentProvider
|
provider: AdminFulfillmentProvider
|
||||||
|
/**
|
||||||
|
* The address to deliver the items to.
|
||||||
|
*/
|
||||||
delivery_address: AdminFulfillmentAddress
|
delivery_address: AdminFulfillmentAddress
|
||||||
|
/**
|
||||||
|
* The items to fulfill.
|
||||||
|
*/
|
||||||
items: AdminFulfillmentItem[]
|
items: AdminFulfillmentItem[]
|
||||||
|
/**
|
||||||
|
* The fulfillment's labels.
|
||||||
|
*/
|
||||||
labels: AdminFulfillmentLabel[]
|
labels: AdminFulfillmentLabel[]
|
||||||
|
/**
|
||||||
|
* The date the fulfillment items were packed.
|
||||||
|
*/
|
||||||
packed_at: string | null
|
packed_at: string | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment items were shipped.
|
||||||
|
*/
|
||||||
shipped_at: string | null
|
shipped_at: string | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment items were delivered.
|
||||||
|
*/
|
||||||
delivered_at: string | null
|
delivered_at: string | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment was canceled.
|
||||||
|
*/
|
||||||
canceled_at: string | null
|
canceled_at: string | null
|
||||||
|
/**
|
||||||
|
* Data useful for the fulfillment provider handling the fulfillment.
|
||||||
|
*
|
||||||
|
* Learn more in [this documentation](https://docs.medusajs.com/v2/resources/commerce-modules/fulfillment#data-property).
|
||||||
|
*/
|
||||||
data: Record<string, unknown> | null
|
data: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment was created.
|
||||||
|
*/
|
||||||
created_at: string
|
created_at: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment was updated.
|
||||||
|
*/
|
||||||
updated_at: string
|
updated_at: string
|
||||||
|
/**
|
||||||
|
* The date the fulfillment was deleted.
|
||||||
|
*/
|
||||||
deleted_at: string | null
|
deleted_at: string | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,46 +1,155 @@
|
|||||||
interface AdminCreateFulfillmentItem {
|
interface AdminCreateFulfillmentItem {
|
||||||
|
/**
|
||||||
|
* The item's name.
|
||||||
|
*/
|
||||||
title: string
|
title: string
|
||||||
|
/**
|
||||||
|
* The item's SKU.
|
||||||
|
*/
|
||||||
sku: string
|
sku: string
|
||||||
|
/**
|
||||||
|
* The item's quantity.
|
||||||
|
*/
|
||||||
quantity: number
|
quantity: number
|
||||||
|
/**
|
||||||
|
* The item's barcode.
|
||||||
|
*/
|
||||||
barcode: string
|
barcode: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated line item in an order.
|
||||||
|
*/
|
||||||
line_item_id?: string
|
line_item_id?: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated inventory item.
|
||||||
|
*/
|
||||||
inventory_item_id?: string
|
inventory_item_id?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminCreateFulfillmentLabel {
|
interface AdminCreateFulfillmentLabel {
|
||||||
|
/**
|
||||||
|
* The tracking number of the fulfillment's shipment.
|
||||||
|
*/
|
||||||
tracking_number: string
|
tracking_number: string
|
||||||
|
/**
|
||||||
|
* The tracking URL of the fulfillment's shipment.
|
||||||
|
*/
|
||||||
tracking_url: string
|
tracking_url: string
|
||||||
|
/**
|
||||||
|
* The label URL of the fulfillment's shipment.
|
||||||
|
*/
|
||||||
label_url: string
|
label_url: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AdminFulfillmentDeliveryAddress {
|
interface AdminFulfillmentDeliveryAddress {
|
||||||
|
/**
|
||||||
|
* The address's first name.
|
||||||
|
*/
|
||||||
first_name?: string
|
first_name?: string
|
||||||
|
/**
|
||||||
|
* The address's last name.
|
||||||
|
*/
|
||||||
last_name?: string
|
last_name?: string
|
||||||
|
/**
|
||||||
|
* The address's phone number.
|
||||||
|
*/
|
||||||
phone?: string
|
phone?: string
|
||||||
|
/**
|
||||||
|
* The address's company.
|
||||||
|
*/
|
||||||
company?: string
|
company?: string
|
||||||
|
/**
|
||||||
|
* The address's first line.
|
||||||
|
*/
|
||||||
address_1?: string
|
address_1?: string
|
||||||
|
/**
|
||||||
|
* The address's second line.
|
||||||
|
*/
|
||||||
address_2?: string
|
address_2?: string
|
||||||
|
/**
|
||||||
|
* The address's city.
|
||||||
|
*/
|
||||||
city?: string
|
city?: string
|
||||||
|
/**
|
||||||
|
* The address's country code.
|
||||||
|
*
|
||||||
|
* @example
|
||||||
|
* us
|
||||||
|
*/
|
||||||
country_code?: string
|
country_code?: string
|
||||||
|
/**
|
||||||
|
* The address's province.
|
||||||
|
*/
|
||||||
province?: string
|
province?: string
|
||||||
|
/**
|
||||||
|
* The address's postal code.
|
||||||
|
*/
|
||||||
postal_code?: string
|
postal_code?: string
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, string> | null
|
metadata?: Record<string, string> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminCreateFulfillment {
|
export interface AdminCreateFulfillment {
|
||||||
|
/**
|
||||||
|
* The ID of the location the items are fulfilled from.
|
||||||
|
*/
|
||||||
location_id: string
|
location_id: string
|
||||||
|
/**
|
||||||
|
* The ID of the fulfillment provider used to handle the fulfillment.
|
||||||
|
*/
|
||||||
provider_id: string
|
provider_id: string
|
||||||
|
/**
|
||||||
|
* The address to deliver items to.
|
||||||
|
*/
|
||||||
delivery_address: AdminFulfillmentDeliveryAddress
|
delivery_address: AdminFulfillmentDeliveryAddress
|
||||||
|
/**
|
||||||
|
* The items to fulfill.
|
||||||
|
*/
|
||||||
items: AdminCreateFulfillmentItem[]
|
items: AdminCreateFulfillmentItem[]
|
||||||
|
/**
|
||||||
|
* The fulfillment's shipment labels.
|
||||||
|
*/
|
||||||
labels: AdminCreateFulfillmentLabel[]
|
labels: AdminCreateFulfillmentLabel[]
|
||||||
// TODO: Validator requires an empty object for the order field.
|
/**
|
||||||
// This is a temporary solution until the order field is
|
* The ID of the order the fulfillment is created for.
|
||||||
// removed or typed correctly.
|
*/
|
||||||
order: Record<string, unknown>
|
|
||||||
order_id: string
|
order_id: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated shipping option.
|
||||||
|
*/
|
||||||
|
shipping_option_id?: string | null
|
||||||
|
/**
|
||||||
|
* Data useful for the fulfillment provider handling the fulfillment.
|
||||||
|
*
|
||||||
|
* Learn more in [this documentation](https://docs.medusajs.com/v2/resources/commerce-modules/fulfillment#data-property).
|
||||||
|
*/
|
||||||
|
data?: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment items were packed.
|
||||||
|
*/
|
||||||
|
packed_at?: Date | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment items were shipped.
|
||||||
|
*/
|
||||||
|
shipped_at?: Date | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment items were delivered.
|
||||||
|
*/
|
||||||
|
delivered_at?: Date | null
|
||||||
|
/**
|
||||||
|
* The date the fulfillment was canceled.
|
||||||
|
*/
|
||||||
|
canceled_at?: Date | null
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminCreateFulfillmentShipment {
|
export interface AdminCreateFulfillmentShipment {
|
||||||
|
/**
|
||||||
|
* The shipment's labels.
|
||||||
|
*/
|
||||||
labels: AdminCreateFulfillmentLabel[]
|
labels: AdminCreateFulfillmentLabel[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
import { AdminFulfillment } from "./entitites"
|
import { AdminFulfillment } from "./entitites"
|
||||||
|
|
||||||
export interface AdminFulfillmentResponse {
|
export interface AdminFulfillmentResponse {
|
||||||
|
/**
|
||||||
|
* The fulfillment's details.
|
||||||
|
*/
|
||||||
fulfillment: AdminFulfillment
|
fulfillment: AdminFulfillment
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,38 @@
|
|||||||
export interface InventoryLevel {
|
export interface InventoryLevel {
|
||||||
|
/**
|
||||||
|
* The inventory level's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated inventory item.
|
||||||
|
*/
|
||||||
inventory_item_id: string
|
inventory_item_id: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated stock location
|
||||||
|
*/
|
||||||
location_id: string
|
location_id: string
|
||||||
|
/**
|
||||||
|
* The associated inventory item's stocked quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
stocked_quantity: number
|
stocked_quantity: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's reserved quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
reserved_quantity: number
|
reserved_quantity: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's available quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
available_quantity: number
|
available_quantity: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's incoming quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
incoming_quantity: number
|
incoming_quantity: number
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,46 @@
|
|||||||
export interface AdminUpdateInventoryLevel {
|
export interface AdminUpdateInventoryLevel {
|
||||||
|
/**
|
||||||
|
* The associated inventory item's stocked quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
stocked_quantity?: number
|
stocked_quantity?: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's incoming quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
incoming_quantity?: number
|
incoming_quantity?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminCreateInventoryLevel {
|
export interface AdminCreateInventoryLevel {
|
||||||
|
/**
|
||||||
|
* The ID of the associated stock location.
|
||||||
|
*/
|
||||||
location_id: string
|
location_id: string
|
||||||
|
/**
|
||||||
|
* The associated inventory item's stocked quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
stocked_quantity?: number
|
stocked_quantity?: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's incoming quantity in the
|
||||||
|
* associated stock location.
|
||||||
|
*/
|
||||||
incoming_quantity?: number
|
incoming_quantity?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminBatchUpdateInventoryLevelLocation {
|
export interface AdminBatchUpdateInventoryLevelLocation {
|
||||||
delete?: string[] // a list of location_ids
|
/**
|
||||||
|
* A list of location IDs to
|
||||||
|
* delete their associated inventory
|
||||||
|
* levels of the inventory item.
|
||||||
|
*/
|
||||||
|
delete?: string[]
|
||||||
|
/**
|
||||||
|
* @ignore
|
||||||
|
*/
|
||||||
update?: never // TODO - not implemented // AdminUpdateInventoryLevel[]
|
update?: never // TODO - not implemented // AdminUpdateInventoryLevel[]
|
||||||
|
/**
|
||||||
|
* A list of inventory levels to create.
|
||||||
|
*/
|
||||||
create?: AdminCreateInventoryLevel[]
|
create?: AdminCreateInventoryLevel[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,9 @@
|
|||||||
import { FindParams } from "../../common"
|
import { FindParams } from "../../common"
|
||||||
|
|
||||||
export interface AdminInventoryLevelFilters extends FindParams {
|
export interface AdminInventoryLevelFilters extends FindParams {
|
||||||
|
/**
|
||||||
|
* Filter by stock location IDs to retrieve their
|
||||||
|
* associated inventory levels.
|
||||||
|
*/
|
||||||
location_id?: string | string[]
|
location_id?: string | string[]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,15 @@ import { PaginatedResponse } from "../../common"
|
|||||||
import { InventoryLevel } from "./entities"
|
import { InventoryLevel } from "./entities"
|
||||||
|
|
||||||
export interface AdminInventoryLevelResponse {
|
export interface AdminInventoryLevelResponse {
|
||||||
|
/**
|
||||||
|
* The inventory level's details.
|
||||||
|
*/
|
||||||
inventory_level: InventoryLevel
|
inventory_level: InventoryLevel
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdminInventoryLevelListResponse = PaginatedResponse<{
|
export type AdminInventoryLevelListResponse = PaginatedResponse<{
|
||||||
|
/**
|
||||||
|
* The list of inventory levels.
|
||||||
|
*/
|
||||||
inventory_levels: InventoryLevel[]
|
inventory_levels: InventoryLevel[]
|
||||||
}>
|
}>
|
||||||
|
|||||||
@@ -1,34 +1,117 @@
|
|||||||
export interface AdminInventoryItem {
|
export interface AdminInventoryItem {
|
||||||
|
/**
|
||||||
|
* The inventory item's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The inventory item's SKU.
|
||||||
|
*/
|
||||||
sku?: string | null
|
sku?: string | null
|
||||||
|
/**
|
||||||
|
* The inventory item's origin country.
|
||||||
|
*/
|
||||||
origin_country?: string | null
|
origin_country?: string | null
|
||||||
|
/**
|
||||||
|
* The inventory item's HS code.
|
||||||
|
*/
|
||||||
hs_code?: string | null
|
hs_code?: string | null
|
||||||
|
/**
|
||||||
|
* Whether the item requires shipping.
|
||||||
|
*/
|
||||||
requires_shipping: boolean
|
requires_shipping: boolean
|
||||||
|
/**
|
||||||
|
* The inventory item's MID code.
|
||||||
|
*/
|
||||||
mid_code?: string | null
|
mid_code?: string | null
|
||||||
|
/**
|
||||||
|
* The inventory item's material.
|
||||||
|
*/
|
||||||
material?: string | null
|
material?: string | null
|
||||||
|
/**
|
||||||
|
* The inventory item's weight.
|
||||||
|
*/
|
||||||
weight?: number | null
|
weight?: number | null
|
||||||
|
/**
|
||||||
|
* The inventory item's length.
|
||||||
|
*/
|
||||||
length?: number | null
|
length?: number | null
|
||||||
|
/**
|
||||||
|
* The inventory item's height.
|
||||||
|
*/
|
||||||
height?: number | null
|
height?: number | null
|
||||||
|
/**
|
||||||
|
* The inventory item's width.
|
||||||
|
*/
|
||||||
width?: number | null
|
width?: number | null
|
||||||
|
/**
|
||||||
|
* The inventory item's title.
|
||||||
|
*/
|
||||||
title?: string | null
|
title?: string | null
|
||||||
|
/**
|
||||||
|
* The inventory item's description.
|
||||||
|
*/
|
||||||
description?: string | null
|
description?: string | null
|
||||||
|
/**
|
||||||
|
* The inventory item's thumbnail URL.
|
||||||
|
*/
|
||||||
thumbnail?: string | null
|
thumbnail?: string | null
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown> | null
|
metadata?: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* The item's associated inventory levels.
|
||||||
|
*/
|
||||||
location_levels?: AdminInventoryLevel[]
|
location_levels?: AdminInventoryLevel[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface AdminInventoryLevel {
|
export interface AdminInventoryLevel {
|
||||||
|
/**
|
||||||
|
* The inventory level's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The date the inventory level was created.
|
||||||
|
*/
|
||||||
created_at: Date
|
created_at: Date
|
||||||
|
/**
|
||||||
|
* The date the inventory level was updated.
|
||||||
|
*/
|
||||||
updated_at: Date
|
updated_at: Date
|
||||||
|
/**
|
||||||
|
* The date the inventory level was deleted.
|
||||||
|
*/
|
||||||
deleted_at: Date | null
|
deleted_at: Date | null
|
||||||
|
/**
|
||||||
|
* The ID of the associated inventory item.
|
||||||
|
*/
|
||||||
inventory_item_id: string
|
inventory_item_id: string
|
||||||
|
/**
|
||||||
|
* The ID of the associated stock location.
|
||||||
|
*/
|
||||||
location_id: string
|
location_id: string
|
||||||
|
/**
|
||||||
|
* The associated inventory item's stocked quantity in the associated location.
|
||||||
|
*/
|
||||||
stocked_quantity: number
|
stocked_quantity: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's reserved quantity in the associated location.
|
||||||
|
*/
|
||||||
reserved_quantity: number
|
reserved_quantity: number
|
||||||
|
/**
|
||||||
|
* The associated inventory item's incoming quantity in the associated location.
|
||||||
|
*/
|
||||||
incoming_quantity: number
|
incoming_quantity: number
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata: Record<string, unknown> | null
|
metadata: Record<string, unknown> | null
|
||||||
|
/**
|
||||||
|
* The associated inventory item.
|
||||||
|
*/
|
||||||
inventory_item?: AdminInventoryItem
|
inventory_item?: AdminInventoryItem
|
||||||
|
/**
|
||||||
|
* The associated inventory item's available quantity in the associated location.
|
||||||
|
*/
|
||||||
available_quantity: number | null
|
available_quantity: number | null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,59 @@
|
|||||||
export interface AdminCreateInventoryItem {
|
export interface AdminCreateInventoryItem {
|
||||||
|
/**
|
||||||
|
* The inventory item's SKU.
|
||||||
|
*/
|
||||||
sku?: string
|
sku?: string
|
||||||
|
/**
|
||||||
|
* The inventory item's HS code.
|
||||||
|
*/
|
||||||
hs_code?: string
|
hs_code?: string
|
||||||
|
/**
|
||||||
|
* The inventory item's weight.
|
||||||
|
*/
|
||||||
weight?: number
|
weight?: number
|
||||||
|
/**
|
||||||
|
* The inventory item's length.
|
||||||
|
*/
|
||||||
length?: number
|
length?: number
|
||||||
|
/**
|
||||||
|
* The inventory item's height.
|
||||||
|
*/
|
||||||
height?: number
|
height?: number
|
||||||
|
/**
|
||||||
|
* The inventory item's width.
|
||||||
|
*/
|
||||||
width?: number
|
width?: number
|
||||||
|
/**
|
||||||
|
* The inventory item's origin country.
|
||||||
|
*/
|
||||||
origin_country?: string
|
origin_country?: string
|
||||||
|
/**
|
||||||
|
* The inventory item's MID code.
|
||||||
|
*/
|
||||||
mid_code?: string
|
mid_code?: string
|
||||||
|
/**
|
||||||
|
* The inventory item's material.
|
||||||
|
*/
|
||||||
material?: string
|
material?: string
|
||||||
|
/**
|
||||||
|
* The inventory item's title.
|
||||||
|
*/
|
||||||
title?: string
|
title?: string
|
||||||
|
/**
|
||||||
|
* The inventory item's description.
|
||||||
|
*/
|
||||||
description?: string
|
description?: string
|
||||||
|
/**
|
||||||
|
* Whether the inventory item requires shipping.
|
||||||
|
*/
|
||||||
requires_shipping?: boolean
|
requires_shipping?: boolean
|
||||||
|
/**
|
||||||
|
* The inventory item's thumbnail URL.
|
||||||
|
*/
|
||||||
thumbnail?: string
|
thumbnail?: string
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown>
|
metadata?: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,17 +4,57 @@ import { BaseFilterable, OperatorMap } from "../../../dal"
|
|||||||
export interface AdminInventoryItemParams
|
export interface AdminInventoryItemParams
|
||||||
extends FindParams,
|
extends FindParams,
|
||||||
BaseFilterable<AdminInventoryItemParams> {
|
BaseFilterable<AdminInventoryItemParams> {
|
||||||
|
/**
|
||||||
|
* Filter by inventory item ID(s).
|
||||||
|
*/
|
||||||
id?: string | string[]
|
id?: string | string[]
|
||||||
|
/**
|
||||||
|
* Query or keywords to search the inventory item's searchable fields.
|
||||||
|
*/
|
||||||
q?: string
|
q?: string
|
||||||
|
/**
|
||||||
|
* Filter by SKU(s).
|
||||||
|
*/
|
||||||
sku?: string | string[]
|
sku?: string | string[]
|
||||||
|
/**
|
||||||
|
* Filter by origin countries.
|
||||||
|
*/
|
||||||
origin_country?: string | string[]
|
origin_country?: string | string[]
|
||||||
|
/**
|
||||||
|
* Filter by MID code(s).
|
||||||
|
*/
|
||||||
mid_code?: string | string[]
|
mid_code?: string | string[]
|
||||||
|
/**
|
||||||
|
* Filter by HS code(s).
|
||||||
|
*/
|
||||||
hs_code?: string | string[]
|
hs_code?: string | string[]
|
||||||
|
/**
|
||||||
|
* Filter by material(s).
|
||||||
|
*/
|
||||||
material?: string | string[]
|
material?: string | string[]
|
||||||
|
/**
|
||||||
|
* Filter by whether the item requires shipping.
|
||||||
|
*/
|
||||||
requires_shipping?: boolean
|
requires_shipping?: boolean
|
||||||
|
/**
|
||||||
|
* Filter by weight(s).
|
||||||
|
*/
|
||||||
weight?: number | OperatorMap<number>
|
weight?: number | OperatorMap<number>
|
||||||
|
/**
|
||||||
|
* Filter by length(s).
|
||||||
|
*/
|
||||||
length?: number | OperatorMap<number>
|
length?: number | OperatorMap<number>
|
||||||
|
/**
|
||||||
|
* Filter by height(s).
|
||||||
|
*/
|
||||||
height?: number | OperatorMap<number>
|
height?: number | OperatorMap<number>
|
||||||
|
/**
|
||||||
|
* Filter by width(s).
|
||||||
|
*/
|
||||||
width?: number | OperatorMap<number>
|
width?: number | OperatorMap<number>
|
||||||
|
/**
|
||||||
|
* Filter by stock location IDs to retrieve inventory items
|
||||||
|
* that have inventory levels associated with the locations.
|
||||||
|
*/
|
||||||
location_levels?: Record<"location_id", string | string[]>
|
location_levels?: Record<"location_id", string | string[]>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,16 @@ import {
|
|||||||
import { AdminInventoryItem } from "./entities"
|
import { AdminInventoryItem } from "./entities"
|
||||||
|
|
||||||
export interface AdminInventoryItemResponse {
|
export interface AdminInventoryItemResponse {
|
||||||
|
/**
|
||||||
|
* The inventory item's details.
|
||||||
|
*/
|
||||||
inventory_item: AdminInventoryItem
|
inventory_item: AdminInventoryItem
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdminInventoryItemListResponse = PaginatedResponse<{
|
export type AdminInventoryItemListResponse = PaginatedResponse<{
|
||||||
|
/**
|
||||||
|
* The list of inventory items.
|
||||||
|
*/
|
||||||
inventory_items: AdminInventoryItem[]
|
inventory_items: AdminInventoryItem[]
|
||||||
}>
|
}>
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,34 @@
|
|||||||
export interface AdminInvite {
|
export interface AdminInvite {
|
||||||
|
/**
|
||||||
|
* The invite's ID.
|
||||||
|
*/
|
||||||
id: string
|
id: string
|
||||||
|
/**
|
||||||
|
* The email of the invited user.
|
||||||
|
*/
|
||||||
email: string
|
email: string
|
||||||
|
/**
|
||||||
|
* Whether the invite was accepted.
|
||||||
|
*/
|
||||||
accepted: boolean
|
accepted: boolean
|
||||||
|
/**
|
||||||
|
* The invite token.
|
||||||
|
*/
|
||||||
token: string
|
token: string
|
||||||
|
/**
|
||||||
|
* The date the invite expires.
|
||||||
|
*/
|
||||||
expires_at?: Date
|
expires_at?: Date
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown>
|
metadata?: Record<string, unknown>
|
||||||
|
/**
|
||||||
|
* The date that the invite was created.
|
||||||
|
*/
|
||||||
created_at?: Date
|
created_at?: Date
|
||||||
|
/**
|
||||||
|
* The date that the invite was updated.
|
||||||
|
*/
|
||||||
updated_at?: Date
|
updated_at?: Date
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
export type AdminAcceptInvite = {
|
export type AdminAcceptInvite = {
|
||||||
|
/**
|
||||||
|
* The user's email.
|
||||||
|
*/
|
||||||
|
email: string
|
||||||
|
/**
|
||||||
|
* The user's first name.
|
||||||
|
*/
|
||||||
first_name: string
|
first_name: string
|
||||||
|
/**
|
||||||
|
* The user's last name.
|
||||||
|
*/
|
||||||
last_name: string
|
last_name: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdminCreateInvite = {
|
export type AdminCreateInvite = {
|
||||||
|
/**
|
||||||
|
* The email of the user to invite.
|
||||||
|
*/
|
||||||
email: string
|
email: string
|
||||||
|
/**
|
||||||
|
* Key-value pairs of custom data.
|
||||||
|
*/
|
||||||
metadata?: Record<string, unknown>
|
metadata?: Record<string, unknown>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,18 +3,30 @@ import { AdminUser } from "../../user"
|
|||||||
import { AdminInvite } from "./entities"
|
import { AdminInvite } from "./entities"
|
||||||
|
|
||||||
export interface AdminInviteResponse {
|
export interface AdminInviteResponse {
|
||||||
|
/**
|
||||||
|
* The invite's details.
|
||||||
|
*/
|
||||||
invite: AdminInvite
|
invite: AdminInvite
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AdminInviteListResponse = PaginatedResponse<{
|
export type AdminInviteListResponse = PaginatedResponse<{
|
||||||
|
/**
|
||||||
|
* The list of invites.
|
||||||
|
*/
|
||||||
invites: AdminInvite[]
|
invites: AdminInvite[]
|
||||||
}>
|
}>
|
||||||
|
|
||||||
export type AdminAcceptInviteResponse =
|
export type AdminAcceptInviteResponse =
|
||||||
| {
|
| {
|
||||||
|
/**
|
||||||
|
* The user's details.
|
||||||
|
*/
|
||||||
user: AdminUser
|
user: AdminUser
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
|
/**
|
||||||
|
* A message if an error occurs.
|
||||||
|
*/
|
||||||
message: string
|
message: string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user