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

DiscountRedemptions

Caven edited this page Jan 31, 2024 · 1 revision

getDiscountRedemption

Retrieves the discount redemption with the given ID.

Usage

import { type DiscountRedemption, getDiscountRedemption } from '@heybrostudio/lemonsqueezy.js'

const discountRedemptionId = 456789
const { statusCode, error, data } = await getDiscountRedemption(discountRedemptionId)

With related resources:

import { type DiscountRedemption, type GetDiscountRedemptionParams, getDiscountRedemption } from '@heybrostudio/lemonsqueezy.js'

const discountRedemptionId = 456789
const { statusCode, error, data } = await getDiscountRedemption(discountRedemptionId, { include: ['discount'] })

Type Declarations

/**
 * Retrieve a discount redemption.
 *
 * @param discountRedemptionId The given discount redemption id.
 * @param [params] (Optional) Additional parameters.
 * @param [params.include] (Optional) Related resources.
 * @returns A discount redemption object.
 */
declare function getDiscountRedemption(
  discountRedemptionId: number | string,
  params?: GetDiscountRedemptionParams,
): Promise<FetchResponse<DiscountRedemption>>

Returns

Returns a discount redemption object.

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

Source

Source ~ Type ~ Test

listDiscountRedemptions

Returns a paginated list of discount redemptions.

Usage

import { type ListDiscountRedemptions, listDiscountRedemptions } from '@heybrostudio/lemonsqueezy.js'

const { statusCode, error, data } = await listDiscountRedemptions()

With filter:

import { type ListDiscountRedemptions, type ListDiscountRedemptionsParams, listDiscountRedemptions } from '@heybrostudio/lemonsqueezy.js'

const { statusCode, error, data } = await listDiscountRedemptions({ filter: { discountId: 234567 } })

With pagination:

import { type ListDiscountRedemptions, type ListDiscountRedemptionsParams, listDiscountRedemptions } from '@heybrostudio/lemonsqueezy.js'

const { statusCode, error, data } = await listDiscountRedemptions({ page: { number: 1, size: 10 } })

With related resources:

import { type ListDiscountRedemptions, type ListDiscountRedemptionsParams, listDiscountRedemptions } from '@heybrostudio/lemonsqueezy.js'

const { statusCode, error, data } = await listDiscountRedemptions({ include: ['discount'] })

Type Declarations

/**
 * List all discount redemptions.
 *
 * @param [params] (Optional) Additional parameters.
 * @param [params.filter] (Optional) Filter parameters.
 * @param [params.filter.discountId] (Optional) Only return discount redemptions belonging to the discount with this ID.
 * @param [params.filter.orderId] (Optional) Only return discount redemptions belonging to the order 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 discount redemption objects ordered by `created_at` (descending).
 */
declare function listDiscountRedemptions(
  params?: ListDiscountRedemptionsParams,
): Promise<FetchResponse<ListDiscountRedemptions>>

Returns

Returns a paginated list of discount redemption objects ordered by created_at (descending).

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

Source

Source ~ Type ~ Test

Clone this wiki locally