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

LicenseKeyInstances

Caven edited this page Jan 31, 2024 · 2 revisions

getLicenseKeyInstance

Retrieves the license key instance with the given ID.

Usage

import { type LicenseKeyInstance, getLicenseKeyInstance } from '@heybrostudio/lemonsqueezy.js'

const licenseKeyInstanceId = 234567
const { statusCode, error, data } = await getLicenseKeyInstance(licenseKeyInstanceId)

With related resources:

import { type LicenseKeyInstance, type GetLicenseKeyInstanceParams, getLicenseKeyInstance } from '@heybrostudio/lemonsqueezy.js'

const licenseKeyInstanceId = 234567
const { statusCode, error, data } = await getLicenseKeyInstance(licenseKeyInstanceId, { include: ['license-key'] })

Type Declarations

/**
 * Retrieve a license key instance.
 *
 * @param licenseKeyInstanceId The given license key instance id.
 * @param [params] (Optional) Additional parameters.
 * @param [params.include] (Optional) Related resources.
 * @returns A license key instance object.
 */
declare function getLicenseKeyInstance(
  licenseKeyInstanceId: number | string,
  params?: GetLicenseKeyInstanceParams,
): Promise<FetchResponse<LicenseKeyInstance>>

Returns

Returns a license key instance object.

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

Source

Source ~ Type ~ Test

listLicenseKeyInstances

Returns a paginated list of license key instances.

Usage

import { type ListLicenseKeyInstances, listLicenseKeyInstances } from '@heybrostudio/lemonsqueezy.js'

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

With filter:

import { type ListLicenseKeyInstances, type ListLicenseKeyInstancesParams, listLicenseKeyInstances } from '@heybrostudio/lemonsqueezy.js'

const { statusCode, error, data } = await listLicenseKeyInstances({ filter: { licenseKeyId: 234567 } })

With pagination:

import { type ListLicenseKeyInstances, type ListLicenseKeyInstancesParams, listLicenseKeyInstances } from '@heybrostudio/lemonsqueezy.js'

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

With related resources:

import { type ListLicenseKeyInstances, type ListLicenseKeyInstancesParams, listLicenseKeyInstances } from '@heybrostudio/lemonsqueezy.js'

const { statusCode, error, data } = await listLicenseKeyInstances({ include: ['license-key'] })

Type Declarations

/**
 * List all license key instances.
 *
 * @param [params] (Optional) Additional parameters.
 * @param [params.filter] (Optional) Filter parameters.
 * @param [params.filter.licenseKeyId] (Optional) The license key 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 license key instance objects ordered by `id`.
 */
declare function listLicenseKeyInstances(
  params?: ListLicenseKeyInstancesParams,
): Promise<FetchResponse<ListLicenseKeyInstances>>

Returns

Returns a paginated list of license key instance objects ordered by id.

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

Source

Source ~ Type ~ Test

Clone this wiki locally