This repository has been archived by the owner on Feb 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
OrderItems
Caven edited this page Jan 31, 2024
·
1 revision
Retrieves the order item with the given ID.
import { type OrderItem, getOrderItem } from '@heybrostudio/lemonsqueezy.js'
const orderItemId = 234567
const { statusCode, error, data } = await getOrderItem(orderItemId)
With related resources:
import { type GetOrderItemParams, type OrderItem, getOrderItem } from '@heybrostudio/lemonsqueezy.js'
const orderItemId = 234567
const { statusCode, error, data } = await getOrderItem(orderItemId, { include: ['order'] })
/**
* Retrieve an order item.
*
* @param orderItemId The given order item id.
* @param [params] (Optional) Additional parameters.
* @param [params.include] (Optional) Related resources.
* @returns An order item object.
*/
declare function getOrderItem(
orderItemId: number | string,
params?: GetOrderItemParams,
): Promise<FetchResponse<OrderItem>>
Returns an order item object.
{
statusCode: number | null
error: Error | null
data: OrderItem | null
}
Returns a paginated list of order items.
import { type ListOrderItems, listOrderItems } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listOrderItems()
With filter:
import { type ListOrderItems, type ListOrderItemsParams, listOrderItems } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listOrderItems({ filter: { orderId: 234567 } })
With pagination:
import { type ListOrderItems, type ListOrderItemsParams, listOrderItems } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listOrderItems({ page: { number: 1, size: 10 } })
With related resources:
import { type ListOrderItems, type ListOrderItemsParams, listOrderItems } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listOrderItems({ include: ['order'] })
/**
* List all order items.
*
* @param [params] (Optional) Additional parameters.
* @param [params.filter] (Optional) Filter parameters.
* @param [params.filter.orderId] (Optional) Only return order items belonging to the order with this ID.
* @param [params.filter.productId] (Optional) Only return order items belonging to the product with this ID.
* @param [params.filter.variantId] (Optional) Only return order items belonging to the variant with this ID.
* @param [params.page] (Optional) Custom paginated queries.
* @param [params.page.number] (Optional) The parameter determine which page to retrieve.
* @param [params.page.size] (Optional) The parameter to determine how many results to return per page.
* @param [params.include] (Optional) Related resources.
* @returns A paginated list of order item objects ordered by `id`.
*/
declare function listOrderItems(params?: ListOrderItemsParams): Promise<FetchResponse<ListOrderItems>>
Returns a paginated list of order item objects ordered by id
.
{
statusCode: number | null
error: Error | null
data: ListOrderItems | null
}