Skip to content
This repository has been archived by the owner on Feb 4, 2024. It is now read-only.
Caven edited this page Jan 31, 2024 · 2 revisions

getStore

Retrieves the store with the given ID.

Usage

import { type Store, getStore } from '@heybrostudio/lemonsqueezy.js'

const storeId = 123456
const { error, data, statusCode } = await getStore(123456)

With related resources:

import { type Store, type GetStoreParams, getStore } from '@heybrostudio/lemonsqueezy.js'

const storeId = 123456
const { error, data, statusCode } = await getStore(123456, { include: ['store'] })

Type Declarations

/**
 * Retrieve a store.
 *
 * @param storeId (Required) The given store id.
 * @param [params] (Optional) Additional parameters.
 * @param [params.include] (Optional) Related resources.
 * @returns A store object.
 */
declare function getStore(storeId: number | string, params?: GetStoreParams): Promise<FetchResponse<Store>>

Returns

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

Source

Source ~ Type ~ Test

listStores

Returns a paginated list of stores.

Usage

import { type ListStores, listStores } from '@heybrostudio/lemonsqueezy.js'

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

With pagination:

import { type ListStores, type ListStoresParams, listStores } from '@heybrostudio/lemonsqueezy.js'

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

With related resources:

import { type ListStores, listStores } from '@heybrostudio/lemonsqueezy.js'

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

Type Declarations

/**
 * List all stores.
 *
 * @param [params] (Optional) Additional parameters.
 * @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 `store` objects ordered by name.
 */
declare function listStores(params?: ListStoresParams): Promise<FetchResponse<ListStores>>

Returns

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

Source

Source ~ Type ~ Test

Clone this wiki locally