Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.

OrderItems

Caven edited this page Jan 31, 2024 · 1 revision

getOrderItem

Retrieves the order item with the given ID.

Usage

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'] })

Type Declarations

/**
 * 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

Returns an order item object.

{
  statusCode: number | null
  error: Error | null
  data: OrderItem | null
}

Source

Source ~ Type ~ Test

listOrderItems

Returns a paginated list of order items.

Usage

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'] })

Type Declarations

/**
 * 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

Returns a paginated list of order item objects ordered by id.

{
  statusCode: number | null
  error: Error | null
  data: ListOrderItems | null
}

Source

Source ~ Type ~ Test

Clone this wiki locally