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
Prices
Caven edited this page Jan 31, 2024
·
2 revisions
Retrieves the price with the given ID.
import { type Price, getPrice } from '@heybrostudio/lemonsqueezy.js'
const priceId = 234567
const { statusCode, error, data } = await getPrice(priceId)
With related resources:
import { type GetPriceParams, type Price, getPrice } from '@heybrostudio/lemonsqueezy.js'
const priceId = 234567
const { statusCode, error, data } = await getPrice(priceId, { include: ['variant'] })
/**
* Retrieve a price.
*
* @param priceId The given price id.
* @param [params] (Optional) Additional parameters.
* @param [params.include] (Optional) Related resources.
* @returns A price object.
*/
declare function getPrice(priceId: number | string, params?: GetPriceParams): Promise<FetchResponse<Price>>
Returns a price object.
{
statusCode: number | null
error: Error | null
data: Price | null
}
Returns a paginated list of prices.
import { type ListPrices, listPrices } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listPrices()
With filter:
import { type ListPrices, type ListPricesParams, listPrices } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listPrices({ filter: { variantId: 234567 } })
With pagination:
import { type ListPrices, type ListPricesParams, listPrices } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listPrices({ page: { number: 1, size: 10 } })
With related resources:
import { type ListPrices, type ListPricesParams, listPrices } from '@heybrostudio/lemonsqueezy.js'
const { statusCode, error, data } = await listPrices({ include: ['variant'] })
/**
* List all prices.
*
* @param [params] (Optional) Additional parameters.
* @param [params.filter] (Optional) Filter parameters.
* @param [params.filter.variantId] Only return prices 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 price objects ordered by `created_at` (descending).
*/
declare function listPrices(params?: ListPricesParams): Promise<FetchResponse<ListPrices>>
Returns a paginated list of price objects ordered by created_at
(descending).
{
statusCode: number | null
error: Error | null
data: ListPrices | null
}