-
Notifications
You must be signed in to change notification settings - Fork 26
LicenseKeys
Branko Conjic edited this page Feb 8, 2024
·
2 revisions
Update a license key with the given ID.
import { type UpdateLicenseKey, type LicenseKey, updateLicenseKey } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKeyId = 234567;
const { statusCode, error, data } = await updateLicenseKey(licenseKeyId, { activationLimit: 5, disabled: false });
/**
* Update a license key.
*
* @param licenseKeyId The license key id.
* @param licenseKey (Optional) Values to be updated.
* @param [licenseKey.activationLimit] (Optional) The activation limit of this license key. Assign `null` to set the activation limit to "unlimited".
* @param [licenseKey.disabled] (Optional) If `true`, the license key will have "disabled" status.
* @returns A license key object.
*/
declare function updateLicenseKey(licenseKeyId: string | number, licenseKey: UpdateLicenseKey): Promise<FetchResponse<LicenseKey>>;
Returns a license key object.
{
statusCode: number | null;
error: Error | null;
data: LicenseKey | null;
}
Retrieves the license key with the given ID.
import { type LicenseKey, getLicenseKey } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKeyId = 234567;
const { statusCode, error, data } = await getLicenseKey(licenseKeyId);
With related resources:
import { type LicenseKey, type GetLicenseKeyParams, getLicenseKey } from '@lemonsqueezy/lemonsqueezy.js';
const licenseKeyId = 234567;
const { statusCode, error, data } = await getLicenseKey(licenseKeyId, { include: ['order'] });
/**
* Retrieve a license key.
*
* @param licenseKeyId The license key id.
* @param [params] (Optional) Additional parameters.
* @param [params.include] (Optional) Related resources.
* @returns A license key object.
*/
declare function getLicenseKey(licenseKeyId: number | string, params?: GetLicenseKeyParams): Promise<FetchResponse<LicenseKey>>;
Returns a license key object.
{
statusCode: number | null;
error: Error | null;
data: LicenseKey | null;
}
Returns a paginated list of license keys.
import { type ListLicenseKeys, listLicenseKeys } from '@lemonsqueezy/lemonsqueezy.js';
const { statusCode, error, data } = await listLicenseKeys();
With filter:
import { type ListLicenseKeys, type ListLicenseKeysParams, listLicenseKeys } from '@lemonsqueezy/lemonsqueezy.js';
const { statusCode, error, data } = await listLicenseKeys({ filter: { storeId: 123456 } });
With pagination:
import { type ListLicenseKeys, type ListLicenseKeysParams, listLicenseKeys } from '@lemonsqueezy/lemonsqueezy.js';
const { statusCode, error, data } = await listLicenseKeys({ page: { number: 1, size: 10 } });
With related resources:
import { type ListLicenseKeys, type ListLicenseKeysParams, listLicenseKeys } from '@lemonsqueezy/lemonsqueezy.js';
const { statusCode, error, data } = await listLicenseKeys({ include: ['order'] });
/**
* List all license keys.
*
* @param [params] (Optional) Additional parameters.
* @param [params.filter] (Optional) Filter parameters.
* @param [params.filter.storeId] (Optional) Only return license keys belonging to the store with this ID.
* @param [params.filter.orderId] (Optional) (Optional) Only return license keys belonging to the order with this ID.
* @param [params.filter.orderItemId] (Optional) Only return license keys belonging to the order item with this ID.
* @param [params.filter.productId] (Optional) Only return license keys belonging to the product 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 license key objects ordered by `id`.
*/
declare function listLicenseKeys(params?: ListLicenseKeysParams): Promise<FetchResponse<ListLicenseKeys>>;
Returns a paginated list of license key objects ordered by id
.
{
statusCode: number | null;
error: Error | null;
data: ListLicenseKeys | null;
}