This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
generated from NuroDev/npm-template
-
Notifications
You must be signed in to change notification settings - Fork 17
/
licenseKeyInstance.action.ts
56 lines (51 loc) · 1.68 KB
/
licenseKeyInstance.action.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import { requestLemonSqueeze } from "~/shared";
import type {
ListAllLicenseKeyInstancesOptions,
ListAllLicenseKeyInstancesResult,
RetrieveLicenseKeyInstanceOptions,
RetrieveLicenseKeyInstanceResult,
} from "./licenseKeyInstance.types";
import type { SharedModuleOptions } from "~/shared";
/**
* List all license key instances
*
* @description Returns a paginated list of license key instances
*
* @docs https://docs.lemonsqueezy.com/api/license-key-instances#list-all-license-key-instances
*
* @param {Object} [options]
*
* @returns Returns a paginated list of license key instance objects ordered by `id`
*/
export async function listAllLicenseKeyInstances(
options: ListAllLicenseKeyInstancesOptions & SharedModuleOptions
): Promise<ListAllLicenseKeyInstancesResult> {
const { licenseKeyId, ...rest } = options;
return requestLemonSqueeze<ListAllLicenseKeyInstancesResult>({
params: {
...(licenseKeyId ? { license_key_id: licenseKeyId } : {}),
},
path: "/license-key-instances",
...rest,
});
}
/**
* Retrieve license key instance
*
* @description Retrieves the license key instance with the given ID
*
* @docs https://docs.lemonsqueezy.com/api/license-key-instances#retrieve-a-license-key-instance
*
* @param {String} options.id - The ID of the license key instance to retrieve
*
* @returns A license key instance object
*/
export async function retrieveLicenseKeyInstance(
options: RetrieveLicenseKeyInstanceOptions & SharedModuleOptions
): Promise<RetrieveLicenseKeyInstanceResult> {
const { id, ...rest } = options;
return requestLemonSqueeze<RetrieveLicenseKeyInstanceResult>({
path: `/license-key-instances/${id}`,
...rest,
});
}