@medusajs/types
Version:
Medusa Types definition
1,145 lines • 196 kB
TypeScript
import { FindConfig } from "../common";
import { RestoreReturn, SoftDeleteReturn } from "../dal";
import { IModuleService } from "../modules-sdk";
import { Context } from "../shared-context";
import { FilterableOrderAddressProps, FilterableOrderChangeActionProps, FilterableOrderChangeProps, FilterableOrderClaimProps, FilterableOrderExchangeProps, FilterableOrderLineItemAdjustmentProps, FilterableOrderLineItemProps, FilterableOrderLineItemTaxLineProps, FilterableOrderProps, FilterableOrderReturnReasonProps, FilterableOrderShippingMethodAdjustmentProps, FilterableOrderShippingMethodProps, FilterableOrderShippingMethodTaxLineProps, FilterableOrderTransactionProps, FilterableReturnProps, OrderAddressDTO, OrderChangeActionDTO, OrderChangeDTO, OrderChangeReturn, OrderClaimDTO, OrderClaimItemDTO, OrderCreditLineDTO, OrderDTO, OrderExchangeDTO, OrderExchangeItemDTO, OrderItemDTO, OrderLineItemAdjustmentDTO, OrderLineItemDTO, OrderLineItemTaxLineDTO, OrderPreviewDTO, OrderReturnItemDTO, OrderReturnReasonDTO, OrderShippingMethodAdjustmentDTO, OrderShippingMethodDTO, OrderShippingMethodTaxLineDTO, OrderTransactionDTO, ReturnDTO } from "./common";
import { CancelOrderChangeDTO, CancelOrderClaimDTO, CancelOrderExchangeDTO, CancelOrderFulfillmentDTO, CancelOrderReturnDTO, ConfirmOrderChangeDTO, CreateOrderAddressDTO, CreateOrderChangeActionDTO, CreateOrderChangeDTO, CreateOrderClaimDTO, CreateOrderClaimItemDTO, CreateOrderCreditLineDTO, CreateOrderDTO, CreateOrderExchangeDTO, CreateOrderExchangeItemDTO, CreateOrderLineItemAdjustmentDTO, CreateOrderLineItemDTO, CreateOrderLineItemTaxLineDTO, CreateOrderReturnDTO, CreateOrderReturnItemDTO, CreateOrderReturnReasonDTO, CreateOrderShippingMethodAdjustmentDTO, CreateOrderShippingMethodDTO, CreateOrderShippingMethodTaxLineDTO, CreateOrderTransactionDTO, DeclineOrderChangeDTO, ReceiveOrderReturnDTO, RegisterOrderChangeDTO, RegisterOrderDeliveryDTO, RegisterOrderFulfillmentDTO, RegisterOrderShipmentDTO, UpdateOrderAddressDTO, UpdateOrderChangeActionDTO, UpdateOrderChangeDTO, UpdateOrderClaimDTO, UpdateOrderClaimWithSelectorDTO, UpdateOrderDTO, UpdateOrderExchangeDTO, UpdateOrderExchangeWithSelectorDTO, UpdateOrderItemDTO, UpdateOrderItemWithSelectorDTO, UpdateOrderLineItemDTO, UpdateOrderLineItemTaxLineDTO, UpdateOrderLineItemWithSelectorDTO, UpdateOrderReturnReasonDTO, UpdateOrderReturnWithSelectorDTO, UpdateOrderShippingMethodAdjustmentDTO, UpdateOrderShippingMethodDTO, UpdateOrderShippingMethodTaxLineDTO, UpdateReturnDTO, UpsertOrderLineItemAdjustmentDTO } from "./mutations";
/**
* The main service interface for the Order Module.
*/
export interface IOrderModuleService extends IModuleService {
/**
* This method retrieves an order by its ID.
*
* @param {string} orderId - The order's ID.
* @param {FindConfig<OrderDTO>} config - The configurations determining how the order is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderDTO>} The retrieved order.
*
* @example
* A simple example that retrieves an order change by its ID:
*
* ```ts
* const order = await orderModuleService.retrieveOrder(
* "123"
* )
* ```
*
* To specify relations that should be retrieved:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const order = await orderModuleService.retrieveOrder(
* "123",
* {
* relations: ["items"]
* }
* )
* ```
*
*/
retrieveOrder(orderId: string, config?: FindConfig<OrderDTO>, sharedContext?: Context): Promise<OrderDTO>;
/**
* This method retrieves a paginated list of orders based on optional filters and configuration.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved order.
* @param {FindConfig<OrderDTO>} config - The configurations determining how the order is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderDTO[]>} The list of orders.
*
* @example
* To retrieve a list of orders using their IDs:
*
* ```ts
* const orders = await orderModuleService.listOrders({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the order:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const orders = await orderModuleService.listOrders({
* id: ["123", "321"]
* }, {
* relations: ["items"]
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const orders = await orderModuleService.listOrders({
* id: ["123", "321"]
* }, {
* relations: ["items"],
* take: 20,
* skip: 2
* })
* ```
*
*/
listOrders(filters?: FilterableOrderProps, config?: FindConfig<OrderDTO>, sharedContext?: Context): Promise<OrderDTO[]>;
/**
* This method retrieves a paginated list of orders along with the total count of available orders satisfying the provided filters.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved order.
* @param {FindConfig<OrderDTO>} config - The configurations determining how the order is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[OrderDTO[], number]>} The list of orders along with their total count.
*
* @example
* To retrieve a list of orders using their IDs:
*
* ```ts
* const [orders, count] = await orderModuleService.listAndCountOrders({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the order:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const [orders, count] = await orderModuleService.listAndCountOrders({
* id: ["123", "321"]
* }, {
* relations: ["items"],
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const [orders, count] = await orderModuleService.listAndCountOrders({
* id: ["123", "321"]
* }, {
* relations: ["items"],
* take: 20,
* skip: 2
* })
* ```
*
*/
listAndCountOrders(filters?: FilterableOrderProps, config?: FindConfig<OrderDTO>, sharedContext?: Context): Promise<[OrderDTO[], number]>;
/**
* This method retrieves a return by its ID.
*
* @param {string} returnId - The return's ID.
* @param {FindConfig<ReturnDTO>} config - The configurations determining how the return is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a return.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<ReturnDTO>} The retrieved return.
*
* @example
* A simple example that retrieves an order change by its ID:
*
* ```ts
* const orderReturn = await orderModuleService.retrieveReturn(
* "123"
* )
* ```
*
* To specify relations that should be retrieved:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const orderReturn = await orderModuleService.retrieveReturn(
* "123",
* {
* relations: ["order"]
* }
* )
* ```
*/
retrieveReturn(returnId: string, config?: FindConfig<ReturnDTO>, sharedContext?: Context): Promise<ReturnDTO>;
/**
* This method retrieves a paginated list of returns based on optional filters and configuration.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved returns.
* @param {FindConfig<ReturnDTO>} config - The configurations determining how the return is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a return.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<ReturnDTO[]>} The list of returns.
*
* @example
* To retrieve a list of returns using their IDs:
*
* ```ts
* const returns = await orderModuleService.listReturns({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the return:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const returns = await orderModuleService.listReturns({
* id: ["123", "321"]
* }, {
* relations: ["order"]
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const returns = await orderModuleService.listReturns({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*/
listReturns(filters?: FilterableOrderProps, config?: FindConfig<ReturnDTO>, sharedContext?: Context): Promise<ReturnDTO[]>;
/**
* This method retrieves a paginated list of returns along with the total count of available returns satisfying the provided filters.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved returns.
* @param {FindConfig<ReturnDTO>} config - The configurations determining how the return is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a return.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[ReturnDTO[], number]>} The list of returns along with their total count.
*
* @example
* To retrieve a list of returns using their IDs:
*
* ```ts
* const [returns, count] = await orderModuleService.listAndCountReturns({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the return:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const [returns, count] = await orderModuleService.listAndCountReturns({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const [returns, count] = await orderModuleService.listAndCountReturns({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*/
listAndCountReturns(filters?: FilterableOrderProps, config?: FindConfig<ReturnDTO>, sharedContext?: Context): Promise<[ReturnDTO[], number]>;
/**
* This method retrieves an order claim by its ID.
*
* @param {string} claimId - The claim's ID.
* @param {FindConfig<OrderClaimDTO>} config - The configurations determining how the order claim is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order claim.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderClaimDTO>} The retrieved order claim.
*
* @example
* A simple example that retrieves an order change by its ID:
*
* ```ts
* const claim = await orderModuleService.retrieveOrderClaim(
* "123"
* )
* ```
*
* To specify relations that should be retrieved:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const claim = await orderModuleService.retrieveOrderClaim(
* "123",
* {
* relations: ["order"]
* }
* )
* ```
*/
retrieveOrderClaim(claimId: string, config?: FindConfig<OrderClaimDTO>, sharedContext?: Context): Promise<OrderClaimDTO>;
/**
* This method retrieves a paginated list of order claims based on optional filters and configuration.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved order claims.
* @param {FindConfig<OrderClaimDTO>} config - The configurations determining how the order claim is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order claim.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderClaimDTO[]>} The list of order claims.
*
* @example
* To retrieve a list of order claims using their IDs:
*
* ```ts
* const claims = await orderModuleService.listOrderClaims({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the claim:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const claims = await orderModuleService.listOrderClaims({
* id: ["123", "321"]
* }, {
* relations: ["order"]
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const claims = await orderModuleService.listOrderClaims({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*/
listOrderClaims(filters?: FilterableOrderProps, config?: FindConfig<OrderClaimDTO>, sharedContext?: Context): Promise<OrderClaimDTO[]>;
/**
* This method retrieves a paginated list of order claims along with the total count of available claims satisfying the provided filters.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved order claims.
* @param {FindConfig<OrderClaimDTO>} config - The configurations determining how the order claim is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order claim.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[OrderClaimDTO[], number]>} The list of order claims along with their total count.
*
* @example
* To retrieve a list of order claims using their IDs:
*
* ```ts
* const [claims, count] = await orderModuleService.listAndCountOrderClaims({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the claim:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const [claims, count] = await orderModuleService.listAndCountOrderClaims({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const [claims, count] = await orderModuleService.listAndCountOrderClaims({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*/
listAndCountOrderClaims(filters?: FilterableOrderProps, config?: FindConfig<OrderClaimDTO>, sharedContext?: Context): Promise<[OrderClaimDTO[], number]>;
/**
* This method retrieves an order exchange by its ID.
*
* @param {string} exchangeId - The exchange's ID.
* @param {FindConfig<OrderExchangeDTO>} config - The configurations determining how the order exchange is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order exchange.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderExchangeDTO>} The retrieved order exchange.
*
* @example
* A simple example that retrieves an order change by its ID:
*
* ```ts
* const exchange = await orderModuleService.retrieveOrderExchange(
* "123"
* )
* ```
*
* To specify relations that should be retrieved:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const exchange = await orderModuleService.retrieveOrderExchange(
* "123",
* {
* relations: ["order"]
* }
* )
* ```
*/
retrieveOrderExchange(exchangeId: string, config?: FindConfig<OrderExchangeDTO>, sharedContext?: Context): Promise<OrderExchangeDTO>;
/**
* This method retrieves a paginated list of order exchanges based on optional filters and configuration.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved exchanges.
* @param {FindConfig<OrderExchangeDTO>} config - The configurations determining how the order exchange is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order exchange.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderExchangeDTO[]>} The list of exchanges.
*
* @example
* To retrieve a list of exchanges using their IDs:
*
* ```ts
* const exchanges = await orderModuleService.listOrderExchanges({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the exchange:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const exchanges = await orderModuleService.listOrderExchanges({
* id: ["123", "321"]
* }, {
* relations: ["order"]
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const exchanges = await orderModuleService.listOrderExchanges({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*/
listOrderExchanges(filters?: FilterableOrderProps, config?: FindConfig<OrderExchangeDTO>, sharedContext?: Context): Promise<OrderExchangeDTO[]>;
/**
* This method retrieves a paginated list of exchanges along with the total count of available exchanges satisfying the provided filters.
*
* @param {FilterableOrderProps} filters - The filters to apply on the retrieved exchanges.
* @param {FindConfig<OrderExchangeDTO>} config - The configurations determining how the order exchange is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order exchange.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<[OrderExchangeDTO[], number]>} The list of exchanges along with their total count.
*
* @example
* To retrieve a list of exchanges using their IDs:
*
* ```ts
* const [exchanges, count] = await orderModuleService.listOrderExchanges({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the exchange:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const [exchanges, count] = await orderModuleService.listOrderExchanges({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const [exchanges, count] = await orderModuleService.listOrderExchanges({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*/
listAndCountOrderExchanges(filters?: FilterableOrderProps, config?: FindConfig<OrderExchangeDTO>, sharedContext?: Context): Promise<[OrderExchangeDTO[], number]>;
/**
* This method creates orders
*
* @param {CreateOrderDTO[]} data - The order to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderDTO[]>} The created orders.
*
* @example
* ```ts
* const orders = await orderModuleService.createOrders([{
* currency_code: "usd",
* items: [
* {
* title: "Product Name",
* quantity: 1,
* unit_price: 20
* }
* ]
* }])
* ```
*
*/
createOrders(data: CreateOrderDTO[], sharedContext?: Context): Promise<OrderDTO[]>;
/**
* This method creates orders
*
* @param {CreateOrderDTO} data - The order to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderDTO>} The created orders.
*
* @example
* ```ts
* const order = await orderModuleService.createOrders({
* currency_code: "usd",
* items: [
* {
* title: "Product Name",
* quantity: 1,
* unit_price: 20
* }
* ]
* })
* ```
*
*/
createOrders(data: CreateOrderDTO, sharedContext?: Context): Promise<OrderDTO>;
/**
* This method updates existing orders. The order IDs are specified in each order object.
*
* @param {UpdateOrderDTO[]} data - The attributes to update in the order.
* @returns {Promise<OrderDTO[]>} The updated orders.
*
* @example
* ```typescript
* const orders = await orderModuleService.updateOrders([{
* id: "123",
* email: "example@gmail.com"
* }])
* ```
*
*/
updateOrders(data: UpdateOrderDTO[], sharedContext?: Context): Promise<OrderDTO[]>;
/**
* This method updates existing orders.
*
* @param {string} orderId - The ID of the order to update.
* @param {UpdateOrderDTO} data - The attributes to update in the order.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderDTO>} The updated orders.
*
* @example
* ```typescript
* const order = await orderModuleService.updateOrders(
* "123",
* {
* email: "example@gmail.com"
* }
* )
* ```
*
*/
updateOrders(orderId: string, data: UpdateOrderDTO, sharedContext?: Context): Promise<OrderDTO>;
/**
* This method updates existing orders matching the specified filters.
*
* @param {Partial<OrderDTO>} selector - The filters specifying which orders to update.
* @param {UpdateOrderDTO} data - The attributes to update in the orders.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderDTO[]>} The updated orders.
*
* @example
* ```typescript
* const orders = await orderModuleService.updateOrders({
* id: ["123", "321"]
* }, {
* email: "example@gmail.com"
* })
* ```
*
*/
updateOrders(selector: Partial<FilterableOrderProps>, data: UpdateOrderDTO, sharedContext?: Context): Promise<OrderDTO[]>;
/**
* This method deletes orders by its ID.
*
* @param {string[]} orderIds - The IDs of orders to delete.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the orders are deleted successfully.
*
* @example
* ```typescript
* await orderModuleService.deleteOrders(["123", "321"])
* ```
*
*/
deleteOrders(orderIds: string[], sharedContext?: Context): Promise<void>;
/**
* This method deletes an order by its ID.
*
* @param {string} orderId - The order's ID.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the order is deleted successfully.
*
* @example
* ```typescript
* await orderModuleService.deleteOrders("123");
* ```
*
*/
deleteOrders(orderId: string, sharedContext?: Context): Promise<void>;
/**
* This method soft deletes orders by their IDs.
*
* @param {string[]} orderIds - The list of order IDs.
* @param {SoftDeleteReturn<TReturnableLinkableKeys>} config - An object that is used to specify an entity's related entities that should be soft-deleted when the main entity is soft-deleted.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were also soft deleted, such as the ID of the associated items.
* The object's keys are the ID attribute names of the order entity's relations, such as `item_id`, and its value is an array of strings, each being the ID of a record associated
* with the order through this relation, such as the IDs of associated item.
*
* If there are no related records, the promise resolves to `void`.
*
* @example
* await orderModuleService.softDeleteOrders(["123", "321"])
*/
softDeleteOrders<TReturnableLinkableKeys extends string = string>(orderIds: string[], config?: SoftDeleteReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
/**
* This method restores soft deleted orders by their IDs.
*
* @param {string[]} orderIds - The list of order IDs.
* @param {RestoreReturn<TReturnableLinkableKeys>} config - Configurations determining which relations to restore along with each of the orders. You can pass to its `returnLinkableKeys`
* property any of the order's relation attribute names, such as `items`.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void | Record<string, string[]>>} An object that includes the IDs of related records that were restored, such as the IDs of associated items.
* The object's keys are the ID attribute names of the order entity's relations, such as `item_id`,
* and its value is an array of strings, each being the ID of the record associated with the order through this relation,
* such as the IDs of associated items.
*
* If there are no related records restored, the promise resolves to `void`.
*
* @example
* await orderModuleService.restoreOrders(["123", "321"])
*/
restoreOrders<TReturnableLinkableKeys extends string = string>(orderIds: string[], config?: RestoreReturn<TReturnableLinkableKeys>, sharedContext?: Context): Promise<Record<string, string[]> | void>;
/**
* This method retrieves a paginated list of addresses based on optional filters and configuration.
*
* @param {FilterableOrderAddressProps} filters - The filters to apply on the retrieved order addresss.
* @param {FindConfig<OrderAddressDTO>} config - The configurations determining how the order address is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a order address.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderAddressDTO[]>} The list of addresses.
*
* @example
* To retrieve a list of addresses using their IDs:
*
* ```ts
* const addresses = await orderModuleService.listOrderAddresses({
* id: ["123", "321"]
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const addresses = await orderModuleService.listOrderAddresses({
* id: ["123", "321"]
* }, {
* take: 20,
* skip: 2
* })
* ```
*/
listOrderAddresses(filters?: FilterableOrderAddressProps, config?: FindConfig<OrderAddressDTO>, sharedContext?: Context): Promise<OrderAddressDTO[]>;
/**
* This method creates addresses.
*
* @param {CreateOrderAddressDTO[]} data - The addresses to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderAddressDTO[]>} The created addresses.
*
* @example
* ```typescript
* const addresses = await orderModuleService.createOrderAddresses([
* {
* first_name: "John",
* last_name: "Doe",
* address_1: "123 Main St",
* city: "Anytown",
* country_code: "us",
* province: "us-ca",
* postal_code: "12345"
* }
* ])
* ```
*
*/
createOrderAddresses(data: CreateOrderAddressDTO[], sharedContext?: Context): Promise<OrderAddressDTO[]>;
/**
* This method creates a return.
*
* @param {CreateOrderAddressDTO} data - The address to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderAddressDTO>} The created return.
*
* @example
* ```typescript
* const address = await orderModuleService.createOrderAddresses({
* first_name: "John",
* last_name: "Doe",
* address_1: "123 Main St",
* city: "Anytown",
* country_code: "us",
* province: "us-ca",
* postal_code: "12345"
* })
* ```
*
*/
createOrderAddresses(data: CreateOrderAddressDTO, sharedContext?: Context): Promise<OrderAddressDTO>;
/**
* This method updates existing addresses. The address ID is specified in each address object.
*
* @param {UpdateOrderAddressDTO[]} data - The attributes to update in the address.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderAddressDTO[]>} The updated addresses.
*
* @example
* ```typescript
* const addresses = await orderModuleService.updateOrderAddresses([{
* id: "123",
* first_name: "John",
* }])
* ```
*
*/
updateOrderAddresses(data: UpdateOrderAddressDTO[], sharedContext?: Context): Promise<OrderAddressDTO[]>;
/**
* This method updates an existing address.
*
* @param {UpdateOrderAddressDTO} data - The attributes to update in the address.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderAddressDTO>} The updated address.
*
* @example
* ```typescript
* const address = await orderModuleService.updateOrderAddresses({
* id: "123",
* first_name: "John",
* })
* ```
*
*/
updateOrderAddresses(data: UpdateOrderAddressDTO, sharedContext?: Context): Promise<OrderAddressDTO>;
/**
* This method deletes addresses by their IDs.
*
* @param {string[]} ids - The list of address IDs.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the addresses are deleted.
*
* @example
* ```typescript
* await orderModuleService.deleteOrderAddresses(["123", "321"])
* ```
*
*/
deleteOrderAddresses(ids: string[], sharedContext?: Context): Promise<void>;
/**
* This method deletes an address by its ID.
*
* @param {string} ids - The ID of the address.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the address is deleted.
*
* @example
* ```typescript
* await orderModuleService.deleteOrderAddresses("123")
* ```
*
*/
deleteOrderAddresses(ids: string, sharedContext?: Context): Promise<void>;
/**
* This method retrieves a line item by its ID.
*
* @param {string} itemId - The item's ID.
* @param {FindConfig<OrderLineItemDTO>} config - The configurations determining how the line item is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a line item.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO>} The retrieved line item.
*
* @example
* A simple example that retrieves an order change by its ID:
*
* ```ts
* const lineItem = await orderModuleService.retrieveOrderLineItem("123")
* ```
*
* To specify relations that should be retrieved:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const lineItem = await orderModuleService.retrieveOrderLineItem(
* "123",
* {
* relations: ["order"]
* }
* )
* ```
*
*/
retrieveOrderLineItem(itemId: string, config?: FindConfig<OrderLineItemDTO>, sharedContext?: Context): Promise<OrderLineItemDTO>;
/**
* This method retrieves a paginated list of line items based on optional filters and configuration.
*
* @param {FilterableOrderLineItemProps} filters - The filters to apply on the retrieved line item.
* @param {FindConfig<OrderLineItemDTO>} config - The configurations determining how the line item is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a line item.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO[]>} The list of line items.
*
* @example
* To retrieve a list of line items using their IDs:
*
* ```ts
* const lineItems = await orderModuleService.listOrderLineItems({
* id: ["123", "321"]
* })
* ```
*
* To specify relations that should be retrieved within the line item:
*
* :::note
*
* You can only retrieve data models defined in the same module. To retrieve linked data models
* from other modules, use [Query](https://docs.medusajs.com/learn/fundamentals/module-links/query) instead.
*
* :::
*
* ```ts
* const lineItems = await orderModuleService.listOrderLineItems({
* id: ["123", "321"]
* }, {
* relations: ["order"]
* })
* ```
*
* By default, only the first `15` records are retrieved. You can control pagination by specifying the `skip` and `take` properties of the `config` parameter:
*
* ```ts
* const lineItems = await orderModuleService.listOrderLineItems({
* id: ["123", "321"]
* }, {
* relations: ["order"],
* take: 20,
* skip: 2
* })
* ```
*
*/
listOrderLineItems(filters: FilterableOrderLineItemProps, config?: FindConfig<OrderLineItemDTO>, sharedContext?: Context): Promise<OrderLineItemDTO[]>;
/**
* This method creates a line item.
*
* @param {CreateOrderLineItemDTO} data - The line item to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO[]>} The created line items.
*
* @example
* const lineItems = await orderModuleService.createOrderLineItems({
* title: "Shirt",
* quantity: 1,
* unit_price: 20
* })
*/
createOrderLineItems(data: CreateOrderLineItemDTO, sharedContext?: Context): Promise<OrderLineItemDTO[]>;
/**
* This method creates line items.
*
* @param {CreateOrderLineItemDTO[]} data - The line items to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO[]>} The created line items.
*
* @example
* const lineItems = await orderModuleService.createOrderLineItems([{
* title: "Shirt",
* quantity: 1,
* unit_price: 20
* }])
*/
createOrderLineItems(data: CreateOrderLineItemDTO[], sharedContext?: Context): Promise<OrderLineItemDTO[]>;
/**
* This method creates orders.
*
* @param {string} orderId - The order's ID.
* @param {CreateOrderLineItemDTO[]} items - The order line items to be created.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO[]>} The created orders.
*
* @example
* const lineItems = await orderModuleService.createOrderLineItems(
* "123",
* [{
* title: "Shirt",
* quantity: 1,
* unit_price: 20
* }]
* )
*/
createOrderLineItems(orderId: string, items: CreateOrderLineItemDTO[], sharedContext?: Context): Promise<OrderLineItemDTO[]>;
/**
* This method updates existing line items. The line item to update is specified by the `selector` property of the first parameter.
*
* @param {UpdateOrderLineItemWithSelectorDTO[]} data - The attributes to update in the order line item with selector.
* @returns {Promise<OrderLineItemDTO[]>} The updated line items.
*
* @example
* ```typescript
* const lineItems = await orderModuleService.updateOrderLineItems([
* {
* selector: {
* id: "123"
* },
* data: {
* quantity: 2
* }
* }
* ])
* ```
*
*/
updateOrderLineItems(data: UpdateOrderLineItemWithSelectorDTO[], sharedContext?: Context): Promise<OrderLineItemDTO[]>;
/**
* This method updates existing line items matching the specified filters.
*
* @param {Partial<OrderLineItemDTO>} selector - The filters specifying which line items to update.
* @param {Partial<UpdateOrderLineItemDTO>} data - The data to update in the line items.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO[]>} The updated line items.
*
* @example
* const lineItems = await orderModuleService.updateOrderLineItems({
* id: "123"
* }, {
* quantity: 2
* })
*
*/
updateOrderLineItems(selector: Partial<FilterableOrderLineItemProps>, data: Partial<UpdateOrderLineItemDTO>, sharedContext?: Context): Promise<OrderLineItemDTO[]>;
/**
* This method updates an existing line item.
*
* @param {string} lineId - The line items's ID.
* @param {Partial<UpdateOrderLineItemDTO>} data - The data to update in the line item.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderLineItemDTO>} The updated line item.
*
* @example
* const lineItem = await orderModuleService.updateOrderLineItems(
* "123",
* {
* quantity: 2
* }
* )
*
*/
updateOrderLineItems(lineId: string, data: Partial<UpdateOrderLineItemDTO>, sharedContext?: Context): Promise<OrderLineItemDTO>;
/**
* This method deletes line items by their IDs.
*
* @param {string[]} itemIds - The IDs of the line items to delete.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the line items are deleted successfully.
*
* @example
* await orderModuleService.deleteOrderLineItems([
* "123", "321"
* ])
*/
deleteOrderLineItems(itemIds: string[], sharedContext?: Context): Promise<void>;
/**
* This method deletes a line item by its ID.
*
* @param {string} itemId - The line item's ID.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the line item is deleted successfully.
*
* @example
* await orderModuleService.deleteOrderLineItems("123")
*/
deleteOrderLineItems(itemId: string, sharedContext?: Context): Promise<void>;
/**
* This method deletes line items that match the specified filters.
*
* @param {Partial<FilterableOrderLineItemProps>} selector - The filters specifying which line items to delete.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<void>} Resolves when the line items are deleted successfully.
*
* @example
* await orderModuleService.deleteOrderLineItems({
* id: ["123", "321"]
* })
*/
deleteOrderLineItems(selector: Partial<FilterableOrderLineItemProps>, sharedContext?: Context): Promise<void>;
/**
* This method updates existing order items matching the specified filters.
*
* @param {Partial<OrderItemDTO>} selector - The filters specifying which order items to update.
* @param {UpdateOrderItemDTO} data - The attributes to update in the order item.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderItemDTO[]>} The updated order items.
*
* @example
* const orderItems = await orderModuleService.updateOrderItem({
* id: "123"
* }, {
* quantity: 2
* })
*
*/
updateOrderItem(selector: Partial<FilterableOrderShippingMethodProps>, data: UpdateOrderItemDTO, sharedContext?: Context): Promise<OrderItemDTO[]>;
/**
* This method updates an existing order item.
*
* @param {string} orderItemId - The order item's ID.
* @param {Partial<UpdateOrderItemDTO>} data - The data to update in the order item.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderItemDTO>} The updated order item.
*
* @example
* const orderItem = await orderModuleService.updateOrderItem(
* "123",
* {
* quantity: 2
* }
* )
*
*/
updateOrderItem(orderItemId: string, data: Partial<UpdateOrderItemDTO>, sharedContext?: Context): Promise<OrderItemDTO>;
/**
* This method updates existing order items. The items are identified either by their ID or the specified filters.
*
* @param {string | Partial<OrderItemDTO> | UpdateOrderItemWithSelectorDTO[]} orderItemIdOrDataOrSelector - Either the ID of an order item, or the
* filters specifying which order items to update.
* @param {UpdateOrderItemDTO | Partial<UpdateOrderItemDTO>} data - The data to update.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderItemDTO | OrderItemDTO[]>} The updated order items.
*
* @example
* const orderItem = await orderModuleService.updateOrderItem(
* "123",
* {
* quantity: 2
* }
* )
*
*/
updateOrderItem(orderItemIdOrDataOrSelector: string | UpdateOrderItemWithSelectorDTO[] | Partial<OrderItemDTO>, data?: UpdateOrderItemDTO | Partial<UpdateOrderItemDTO>, sharedContext?: Context): Promise<OrderItemDTO[] | OrderItemDTO>;
/**
* This method retrieves a paginated list of shipping methods based on optional filters and configuration.
*
* @param {FilterableOrderShippingMethodProps} filters - The filters to apply on the retrieved shipping method.
* @param {FindConfig<OrderShippingMethodDTO>} config - The configurations determining how the shipping method is retrieved. Its properties, such as `select` or `relations`, accept the
* attributes or relations associated with a shipping method.
* @param {Context} sharedContext - A context used to share resources, such as transaction manager, between the application and the module.
* @returns {Promise<OrderShippingMethodDTO[]>} The list of shipping methods.
*
* @example
* To retrieve a list of shipping methods using their IDs:
*
* ```ts
* const shippingMethods = await orderModuleService.listOrderShippingMethods({
* id: ["123", "321"]
* }, {})
* ``