Skip to content
Branko Conjic edited this page Feb 8, 2024 · 2 revisions

getStore

Retrieves the store with the given ID.

Usage

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

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

With related resources:

import { type Store, type GetStoreParams, getStore } from '@lemonsqueezy/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 '@lemonsqueezy/lemonsqueezy.js';

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

With pagination:

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

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

With related resources:

import { type ListStores, listStores } from '@lemonsqueezy/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