@zavudev/sdk 0.31.0 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +116 -0
- package/client.d.mts +28 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +28 -4
- package/client.d.ts.map +1 -1
- package/client.js +25 -1
- package/client.js.map +1 -1
- package/client.mjs +25 -1
- package/client.mjs.map +1 -1
- package/internal/utils/env.js +2 -2
- package/internal/utils/env.js.map +1 -1
- package/internal/utils/env.mjs +2 -2
- package/internal/utils/env.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/balance.d.mts +33 -0
- package/resources/balance.d.mts.map +1 -0
- package/resources/balance.d.ts +33 -0
- package/resources/balance.d.ts.map +1 -0
- package/resources/balance.js +16 -0
- package/resources/balance.js.map +1 -0
- package/resources/balance.mjs +12 -0
- package/resources/balance.mjs.map +1 -0
- package/resources/broadcasts/broadcasts.d.mts +31 -1
- package/resources/broadcasts/broadcasts.d.mts.map +1 -1
- package/resources/broadcasts/broadcasts.d.ts +31 -1
- package/resources/broadcasts/broadcasts.d.ts.map +1 -1
- package/resources/broadcasts/broadcasts.js +28 -0
- package/resources/broadcasts/broadcasts.js.map +1 -1
- package/resources/broadcasts/broadcasts.mjs +28 -0
- package/resources/broadcasts/broadcasts.mjs.map +1 -1
- package/resources/broadcasts/index.d.mts +1 -1
- package/resources/broadcasts/index.d.mts.map +1 -1
- package/resources/broadcasts/index.d.ts +1 -1
- package/resources/broadcasts/index.d.ts.map +1 -1
- package/resources/broadcasts/index.js.map +1 -1
- package/resources/broadcasts/index.mjs.map +1 -1
- package/resources/contacts/channels.d.mts +127 -0
- package/resources/contacts/channels.d.mts.map +1 -0
- package/resources/contacts/channels.d.ts +127 -0
- package/resources/contacts/channels.d.ts.map +1 -0
- package/resources/contacts/channels.js +76 -0
- package/resources/contacts/channels.js.map +1 -0
- package/resources/contacts/channels.mjs +72 -0
- package/resources/contacts/channels.mjs.map +1 -0
- package/resources/contacts/contacts.d.mts +262 -0
- package/resources/contacts/contacts.d.mts.map +1 -0
- package/resources/contacts/contacts.d.ts +262 -0
- package/resources/contacts/contacts.d.ts.map +1 -0
- package/resources/contacts/contacts.js +118 -0
- package/resources/contacts/contacts.js.map +1 -0
- package/resources/contacts/contacts.mjs +113 -0
- package/resources/contacts/contacts.mjs.map +1 -0
- package/resources/contacts/index.d.mts +3 -0
- package/resources/contacts/index.d.mts.map +1 -0
- package/resources/contacts/index.d.ts +3 -0
- package/resources/contacts/index.d.ts.map +1 -0
- package/resources/contacts/index.js +9 -0
- package/resources/contacts/index.js.map +1 -0
- package/resources/contacts/index.mjs +4 -0
- package/resources/contacts/index.mjs.map +1 -0
- package/resources/contacts.d.mts +1 -144
- package/resources/contacts.d.mts.map +1 -1
- package/resources/contacts.d.ts +1 -144
- package/resources/contacts.d.ts.map +1 -1
- package/resources/contacts.js +2 -31
- package/resources/contacts.js.map +1 -1
- package/resources/contacts.mjs +1 -29
- package/resources/contacts.mjs.map +1 -1
- package/resources/exports.d.mts +101 -0
- package/resources/exports.d.mts.map +1 -0
- package/resources/exports.d.ts +101 -0
- package/resources/exports.d.ts.map +1 -0
- package/resources/exports.js +53 -0
- package/resources/exports.js.map +1 -0
- package/resources/exports.mjs +49 -0
- package/resources/exports.mjs.map +1 -0
- package/resources/index.d.mts +10 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +10 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +18 -2
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +9 -1
- package/resources/index.mjs.map +1 -1
- package/resources/invitations.d.mts +133 -0
- package/resources/invitations.d.mts.map +1 -0
- package/resources/invitations.d.ts +133 -0
- package/resources/invitations.d.ts.map +1 -0
- package/resources/invitations.js +67 -0
- package/resources/invitations.js.map +1 -0
- package/resources/invitations.mjs +63 -0
- package/resources/invitations.mjs.map +1 -0
- package/resources/messages.d.mts +37 -4
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +37 -4
- package/resources/messages.d.ts.map +1 -1
- package/resources/number-10dlc/brands.d.mts +258 -0
- package/resources/number-10dlc/brands.d.mts.map +1 -0
- package/resources/number-10dlc/brands.d.ts +258 -0
- package/resources/number-10dlc/brands.d.ts.map +1 -0
- package/resources/number-10dlc/brands.js +132 -0
- package/resources/number-10dlc/brands.js.map +1 -0
- package/resources/number-10dlc/brands.mjs +128 -0
- package/resources/number-10dlc/brands.mjs.map +1 -0
- package/resources/number-10dlc/campaigns/campaigns.d.mts +223 -0
- package/resources/number-10dlc/campaigns/campaigns.d.mts.map +1 -0
- package/resources/number-10dlc/campaigns/campaigns.d.ts +223 -0
- package/resources/number-10dlc/campaigns/campaigns.d.ts.map +1 -0
- package/resources/number-10dlc/campaigns/campaigns.js +133 -0
- package/resources/number-10dlc/campaigns/campaigns.js.map +1 -0
- package/resources/number-10dlc/campaigns/campaigns.mjs +128 -0
- package/resources/number-10dlc/campaigns/campaigns.mjs.map +1 -0
- package/resources/number-10dlc/campaigns/index.d.mts +3 -0
- package/resources/number-10dlc/campaigns/index.d.mts.map +1 -0
- package/resources/number-10dlc/campaigns/index.d.ts +3 -0
- package/resources/number-10dlc/campaigns/index.d.ts.map +1 -0
- package/resources/number-10dlc/campaigns/index.js +9 -0
- package/resources/number-10dlc/campaigns/index.js.map +1 -0
- package/resources/number-10dlc/campaigns/index.mjs +4 -0
- package/resources/number-10dlc/campaigns/index.mjs.map +1 -0
- package/resources/number-10dlc/campaigns/phone-numbers.d.mts +79 -0
- package/resources/number-10dlc/campaigns/phone-numbers.d.mts.map +1 -0
- package/resources/number-10dlc/campaigns/phone-numbers.d.ts +79 -0
- package/resources/number-10dlc/campaigns/phone-numbers.d.ts.map +1 -0
- package/resources/number-10dlc/campaigns/phone-numbers.js +59 -0
- package/resources/number-10dlc/campaigns/phone-numbers.js.map +1 -0
- package/resources/number-10dlc/campaigns/phone-numbers.mjs +55 -0
- package/resources/number-10dlc/campaigns/phone-numbers.mjs.map +1 -0
- package/resources/number-10dlc/campaigns.d.mts +2 -0
- package/resources/number-10dlc/campaigns.d.mts.map +1 -0
- package/resources/number-10dlc/campaigns.d.ts +2 -0
- package/resources/number-10dlc/campaigns.d.ts.map +1 -0
- package/resources/number-10dlc/campaigns.js +6 -0
- package/resources/number-10dlc/campaigns.js.map +1 -0
- package/resources/number-10dlc/campaigns.mjs +3 -0
- package/resources/number-10dlc/campaigns.mjs.map +1 -0
- package/resources/number-10dlc/index.d.mts +4 -0
- package/resources/number-10dlc/index.d.mts.map +1 -0
- package/resources/number-10dlc/index.d.ts +4 -0
- package/resources/number-10dlc/index.d.ts.map +1 -0
- package/resources/number-10dlc/index.js +11 -0
- package/resources/number-10dlc/index.js.map +1 -0
- package/resources/number-10dlc/index.mjs +5 -0
- package/resources/number-10dlc/index.mjs.map +1 -0
- package/resources/number-10dlc/number-10dlc.d.mts +14 -0
- package/resources/number-10dlc/number-10dlc.d.mts.map +1 -0
- package/resources/number-10dlc/number-10dlc.d.ts +14 -0
- package/resources/number-10dlc/number-10dlc.d.ts.map +1 -0
- package/resources/number-10dlc/number-10dlc.js +21 -0
- package/resources/number-10dlc/number-10dlc.js.map +1 -0
- package/resources/number-10dlc/number-10dlc.mjs +16 -0
- package/resources/number-10dlc/number-10dlc.mjs.map +1 -0
- package/resources/number-10dlc.d.mts +2 -0
- package/resources/number-10dlc.d.mts.map +1 -0
- package/resources/number-10dlc.d.ts +2 -0
- package/resources/number-10dlc.d.ts.map +1 -0
- package/resources/number-10dlc.js +6 -0
- package/resources/number-10dlc.js.map +1 -0
- package/resources/number-10dlc.mjs +3 -0
- package/resources/number-10dlc.mjs.map +1 -0
- package/resources/plan.d.mts +43 -0
- package/resources/plan.d.mts.map +1 -0
- package/resources/plan.d.ts +43 -0
- package/resources/plan.d.ts.map +1 -0
- package/resources/plan.js +16 -0
- package/resources/plan.js.map +1 -0
- package/resources/plan.mjs +12 -0
- package/resources/plan.mjs.map +1 -0
- package/resources/senders/agent/agent.d.mts +4 -4
- package/resources/senders/agent/agent.d.mts.map +1 -1
- package/resources/senders/agent/agent.d.ts +4 -4
- package/resources/senders/agent/agent.d.ts.map +1 -1
- package/resources/senders/agent/agent.js.map +1 -1
- package/resources/senders/agent/agent.mjs.map +1 -1
- package/resources/senders/agent/flows.d.mts +40 -114
- package/resources/senders/agent/flows.d.mts.map +1 -1
- package/resources/senders/agent/flows.d.ts +40 -114
- package/resources/senders/agent/flows.d.ts.map +1 -1
- package/resources/senders/agent/index.d.mts +2 -2
- package/resources/senders/agent/index.d.mts.map +1 -1
- package/resources/senders/agent/index.d.ts +2 -2
- package/resources/senders/agent/index.d.ts.map +1 -1
- package/resources/senders/agent/index.js.map +1 -1
- package/resources/senders/agent/index.mjs.map +1 -1
- package/resources/senders/agent/tools.d.mts +15 -47
- package/resources/senders/agent/tools.d.mts.map +1 -1
- package/resources/senders/agent/tools.d.ts +15 -47
- package/resources/senders/agent/tools.d.ts.map +1 -1
- package/resources/senders/index.d.mts +1 -0
- package/resources/senders/index.d.mts.map +1 -1
- package/resources/senders/index.d.ts +1 -0
- package/resources/senders/index.d.ts.map +1 -1
- package/resources/senders/index.js +3 -1
- package/resources/senders/index.js.map +1 -1
- package/resources/senders/index.mjs +1 -0
- package/resources/senders/index.mjs.map +1 -1
- package/resources/senders/senders.d.mts +17 -1
- package/resources/senders/senders.d.mts.map +1 -1
- package/resources/senders/senders.d.ts +17 -1
- package/resources/senders/senders.d.ts.map +1 -1
- package/resources/senders/senders.js +4 -0
- package/resources/senders/senders.js.map +1 -1
- package/resources/senders/senders.mjs +4 -0
- package/resources/senders/senders.mjs.map +1 -1
- package/resources/senders/whatsapp-sync.d.mts +134 -0
- package/resources/senders/whatsapp-sync.d.mts.map +1 -0
- package/resources/senders/whatsapp-sync.d.ts +134 -0
- package/resources/senders/whatsapp-sync.d.ts.map +1 -0
- package/resources/senders/whatsapp-sync.js +56 -0
- package/resources/senders/whatsapp-sync.js.map +1 -0
- package/resources/senders/whatsapp-sync.mjs +52 -0
- package/resources/senders/whatsapp-sync.mjs.map +1 -0
- package/resources/sub-accounts/api-keys.d.mts +85 -0
- package/resources/sub-accounts/api-keys.d.mts.map +1 -0
- package/resources/sub-accounts/api-keys.d.ts +85 -0
- package/resources/sub-accounts/api-keys.d.ts.map +1 -0
- package/resources/sub-accounts/api-keys.js +53 -0
- package/resources/sub-accounts/api-keys.js.map +1 -0
- package/resources/sub-accounts/api-keys.mjs +49 -0
- package/resources/sub-accounts/api-keys.mjs.map +1 -0
- package/resources/sub-accounts/index.d.mts +3 -0
- package/resources/sub-accounts/index.d.mts.map +1 -0
- package/resources/sub-accounts/index.d.ts +3 -0
- package/resources/sub-accounts/index.d.ts.map +1 -0
- package/resources/sub-accounts/index.js +9 -0
- package/resources/sub-accounts/index.js.map +1 -0
- package/resources/sub-accounts/index.mjs +4 -0
- package/resources/sub-accounts/index.mjs.map +1 -0
- package/resources/sub-accounts/sub-accounts.d.mts +168 -0
- package/resources/sub-accounts/sub-accounts.d.mts.map +1 -0
- package/resources/sub-accounts/sub-accounts.d.ts +168 -0
- package/resources/sub-accounts/sub-accounts.d.ts.map +1 -0
- package/resources/sub-accounts/sub-accounts.js +94 -0
- package/resources/sub-accounts/sub-accounts.js.map +1 -0
- package/resources/sub-accounts/sub-accounts.mjs +89 -0
- package/resources/sub-accounts/sub-accounts.mjs.map +1 -0
- package/resources/sub-accounts.d.mts +2 -0
- package/resources/sub-accounts.d.mts.map +1 -0
- package/resources/sub-accounts.d.ts +2 -0
- package/resources/sub-accounts.d.ts.map +1 -0
- package/resources/sub-accounts.js +6 -0
- package/resources/sub-accounts.js.map +1 -0
- package/resources/sub-accounts.mjs +3 -0
- package/resources/sub-accounts.mjs.map +1 -0
- package/resources/templates.d.mts +42 -2
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +42 -2
- package/resources/templates.d.ts.map +1 -1
- package/resources/urls.d.mts +88 -0
- package/resources/urls.d.mts.map +1 -0
- package/resources/urls.d.ts +88 -0
- package/resources/urls.d.ts.map +1 -0
- package/resources/urls.js +55 -0
- package/resources/urls.js.map +1 -0
- package/resources/urls.mjs +51 -0
- package/resources/urls.mjs.map +1 -0
- package/resources/usage.d.mts +36 -0
- package/resources/usage.d.mts.map +1 -0
- package/resources/usage.d.ts +36 -0
- package/resources/usage.d.ts.map +1 -0
- package/resources/usage.js +16 -0
- package/resources/usage.js.map +1 -0
- package/resources/usage.mjs +12 -0
- package/resources/usage.mjs.map +1 -0
- package/src/client.ts +130 -6
- package/src/internal/utils/env.ts +2 -2
- package/src/resources/balance.ts +43 -0
- package/src/resources/broadcasts/broadcasts.ts +40 -0
- package/src/resources/broadcasts/index.ts +2 -0
- package/src/resources/contacts/channels.ts +177 -0
- package/src/resources/contacts/contacts.ts +360 -0
- package/src/resources/contacts/index.ts +22 -0
- package/src/resources/contacts.ts +1 -196
- package/src/resources/exports.ts +141 -0
- package/src/resources/index.ts +51 -1
- package/src/resources/invitations.ts +188 -0
- package/src/resources/messages.ts +43 -3
- package/src/resources/number-10dlc/brands.ts +377 -0
- package/src/resources/number-10dlc/campaigns/campaigns.ts +349 -0
- package/src/resources/number-10dlc/campaigns/index.ts +23 -0
- package/src/resources/number-10dlc/campaigns/phone-numbers.ts +123 -0
- package/src/resources/number-10dlc/campaigns.ts +3 -0
- package/src/resources/number-10dlc/index.ts +30 -0
- package/src/resources/number-10dlc/number-10dlc.ts +71 -0
- package/src/resources/number-10dlc.ts +3 -0
- package/src/resources/plan.ts +62 -0
- package/src/resources/senders/agent/agent.ts +6 -0
- package/src/resources/senders/agent/flows.ts +44 -126
- package/src/resources/senders/agent/index.ts +3 -0
- package/src/resources/senders/agent/tools.ts +13 -50
- package/src/resources/senders/index.ts +9 -0
- package/src/resources/senders/senders.ts +38 -1
- package/src/resources/senders/whatsapp-sync.ts +175 -0
- package/src/resources/sub-accounts/api-keys.ts +126 -0
- package/src/resources/sub-accounts/index.ts +22 -0
- package/src/resources/sub-accounts/sub-accounts.ts +246 -0
- package/src/resources/sub-accounts.ts +3 -0
- package/src/resources/templates.ts +51 -2
- package/src/resources/urls.ts +125 -0
- package/src/resources/usage.ts +48 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
4
|
+
export declare class APIKeys extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Create sub-account API key
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const apiKey = await client.subAccounts.apiKeys.create(
|
|
11
|
+
* 'id',
|
|
12
|
+
* { name: 'Production Key', environment: 'live' },
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
create(id: string, body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKeyCreateResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* List sub-account API keys
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const apiKeys = await client.subAccounts.apiKeys.list('id');
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
list(id: string, options?: RequestOptions): APIPromise<APIKeyListResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Revoke sub-account API key
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* await client.subAccounts.apiKeys.revoke('keyId', {
|
|
32
|
+
* id: 'id',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
revoke(keyID: string, params: APIKeyRevokeParams, options?: RequestOptions): APIPromise<void>;
|
|
37
|
+
}
|
|
38
|
+
export interface APIKeyCreateResponse {
|
|
39
|
+
apiKey: APIKeyCreateResponse.APIKey;
|
|
40
|
+
}
|
|
41
|
+
export declare namespace APIKeyCreateResponse {
|
|
42
|
+
interface APIKey {
|
|
43
|
+
id: string;
|
|
44
|
+
environment: 'live' | 'test';
|
|
45
|
+
key: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export interface APIKeyListResponse {
|
|
50
|
+
items: Array<APIKeyListResponse.Item>;
|
|
51
|
+
}
|
|
52
|
+
export declare namespace APIKeyListResponse {
|
|
53
|
+
interface Item {
|
|
54
|
+
id: string;
|
|
55
|
+
createdAt: number;
|
|
56
|
+
environment: 'live' | 'test';
|
|
57
|
+
/**
|
|
58
|
+
* First characters of the key for identification.
|
|
59
|
+
*/
|
|
60
|
+
keyPrefix: string;
|
|
61
|
+
name: string;
|
|
62
|
+
/**
|
|
63
|
+
* Full API key. Only returned on creation.
|
|
64
|
+
*/
|
|
65
|
+
key?: string;
|
|
66
|
+
lastUsedAt?: number | null;
|
|
67
|
+
permissions?: Array<string>;
|
|
68
|
+
revokedAt?: number | null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export interface APIKeyCreateParams {
|
|
72
|
+
name: string;
|
|
73
|
+
environment?: 'live' | 'test';
|
|
74
|
+
permissions?: Array<string>;
|
|
75
|
+
}
|
|
76
|
+
export interface APIKeyRevokeParams {
|
|
77
|
+
/**
|
|
78
|
+
* Sub-account ID.
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
}
|
|
82
|
+
export declare namespace APIKeys {
|
|
83
|
+
export { type APIKeyCreateResponse as APIKeyCreateResponse, type APIKeyListResponse as APIKeyListResponse, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyRevokeParams as APIKeyRevokeParams, };
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=api-keys.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.d.mts","sourceRoot":"","sources":["../../src/resources/sub-accounts/api-keys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,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAE5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.js";
|
|
2
|
+
import { APIPromise } from "../../core/api-promise.js";
|
|
3
|
+
import { RequestOptions } from "../../internal/request-options.js";
|
|
4
|
+
export declare class APIKeys extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Create sub-account API key
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const apiKey = await client.subAccounts.apiKeys.create(
|
|
11
|
+
* 'id',
|
|
12
|
+
* { name: 'Production Key', environment: 'live' },
|
|
13
|
+
* );
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
create(id: string, body: APIKeyCreateParams, options?: RequestOptions): APIPromise<APIKeyCreateResponse>;
|
|
17
|
+
/**
|
|
18
|
+
* List sub-account API keys
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```ts
|
|
22
|
+
* const apiKeys = await client.subAccounts.apiKeys.list('id');
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
list(id: string, options?: RequestOptions): APIPromise<APIKeyListResponse>;
|
|
26
|
+
/**
|
|
27
|
+
* Revoke sub-account API key
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* await client.subAccounts.apiKeys.revoke('keyId', {
|
|
32
|
+
* id: 'id',
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
revoke(keyID: string, params: APIKeyRevokeParams, options?: RequestOptions): APIPromise<void>;
|
|
37
|
+
}
|
|
38
|
+
export interface APIKeyCreateResponse {
|
|
39
|
+
apiKey: APIKeyCreateResponse.APIKey;
|
|
40
|
+
}
|
|
41
|
+
export declare namespace APIKeyCreateResponse {
|
|
42
|
+
interface APIKey {
|
|
43
|
+
id: string;
|
|
44
|
+
environment: 'live' | 'test';
|
|
45
|
+
key: string;
|
|
46
|
+
name: string;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export interface APIKeyListResponse {
|
|
50
|
+
items: Array<APIKeyListResponse.Item>;
|
|
51
|
+
}
|
|
52
|
+
export declare namespace APIKeyListResponse {
|
|
53
|
+
interface Item {
|
|
54
|
+
id: string;
|
|
55
|
+
createdAt: number;
|
|
56
|
+
environment: 'live' | 'test';
|
|
57
|
+
/**
|
|
58
|
+
* First characters of the key for identification.
|
|
59
|
+
*/
|
|
60
|
+
keyPrefix: string;
|
|
61
|
+
name: string;
|
|
62
|
+
/**
|
|
63
|
+
* Full API key. Only returned on creation.
|
|
64
|
+
*/
|
|
65
|
+
key?: string;
|
|
66
|
+
lastUsedAt?: number | null;
|
|
67
|
+
permissions?: Array<string>;
|
|
68
|
+
revokedAt?: number | null;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
export interface APIKeyCreateParams {
|
|
72
|
+
name: string;
|
|
73
|
+
environment?: 'live' | 'test';
|
|
74
|
+
permissions?: Array<string>;
|
|
75
|
+
}
|
|
76
|
+
export interface APIKeyRevokeParams {
|
|
77
|
+
/**
|
|
78
|
+
* Sub-account ID.
|
|
79
|
+
*/
|
|
80
|
+
id: string;
|
|
81
|
+
}
|
|
82
|
+
export declare namespace APIKeys {
|
|
83
|
+
export { type APIKeyCreateResponse as APIKeyCreateResponse, type APIKeyListResponse as APIKeyListResponse, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyRevokeParams as APIKeyRevokeParams, };
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=api-keys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/sub-accounts/api-keys.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OAEd,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,oBAAoB,CAAC;IAIxG;;;;;;;OAOG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,kBAAkB,CAAC;IAI1E;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC;CAO9F;AAED,MAAM,WAAW,oBAAoB;IACnC,MAAM,EAAE,oBAAoB,CAAC,MAAM,CAAC;CACrC;AAED,yBAAiB,oBAAoB,CAAC;IACpC,UAAiB,MAAM;QACrB,EAAE,EAAE,MAAM,CAAC;QAEX,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;QAE7B,GAAG,EAAE,MAAM,CAAC;QAEZ,IAAI,EAAE,MAAM,CAAC;KACd;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC;CACvC;AAED,yBAAiB,kBAAkB,CAAC;IAClC,UAAiB,IAAI;QACnB,EAAE,EAAE,MAAM,CAAC;QAEX,SAAS,EAAE,MAAM,CAAC;QAElB,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;QAE7B;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAElB,IAAI,EAAE,MAAM,CAAC;QAEb;;WAEG;QACH,GAAG,CAAC,EAAE,MAAM,CAAC;QAEb,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAE5B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;KAC3B;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,MAAM,CAAC;IAEb,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAE9B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,GAC9C,CAAC;CACH"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.APIKeys = void 0;
|
|
5
|
+
const resource_1 = require("../../core/resource.js");
|
|
6
|
+
const headers_1 = require("../../internal/headers.js");
|
|
7
|
+
const path_1 = require("../../internal/utils/path.js");
|
|
8
|
+
class APIKeys extends resource_1.APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Create sub-account API key
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const apiKey = await client.subAccounts.apiKeys.create(
|
|
15
|
+
* 'id',
|
|
16
|
+
* { name: 'Production Key', environment: 'live' },
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
create(id, body, options) {
|
|
21
|
+
return this._client.post((0, path_1.path) `/v1/sub-accounts/${id}/api-keys`, { body, ...options });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* List sub-account API keys
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* const apiKeys = await client.subAccounts.apiKeys.list('id');
|
|
29
|
+
* ```
|
|
30
|
+
*/
|
|
31
|
+
list(id, options) {
|
|
32
|
+
return this._client.get((0, path_1.path) `/v1/sub-accounts/${id}/api-keys`, options);
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Revoke sub-account API key
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* await client.subAccounts.apiKeys.revoke('keyId', {
|
|
40
|
+
* id: 'id',
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
revoke(keyID, params, options) {
|
|
45
|
+
const { id } = params;
|
|
46
|
+
return this._client.delete((0, path_1.path) `/v1/sub-accounts/${id}/api-keys/${keyID}`, {
|
|
47
|
+
...options,
|
|
48
|
+
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.APIKeys = APIKeys;
|
|
53
|
+
//# sourceMappingURL=api-keys.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.js","sourceRoot":"","sources":["../../src/resources/sub-accounts/api-keys.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,qDAAkD;AAElD,uDAAsD;AAEtD,uDAAiD;AAEjD,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,oBAAoB,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,EAAU,EAAE,OAAwB;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,oBAAoB,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAa,EAAE,MAA0B,EAAE,OAAwB;QACxE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,oBAAoB,EAAE,aAAa,KAAK,EAAE,EAAE;YACzE,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF;AA7CD,0BA6CC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
3
|
+
import { buildHeaders } from "../../internal/headers.mjs";
|
|
4
|
+
import { path } from "../../internal/utils/path.mjs";
|
|
5
|
+
export class APIKeys extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Create sub-account API key
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const apiKey = await client.subAccounts.apiKeys.create(
|
|
12
|
+
* 'id',
|
|
13
|
+
* { name: 'Production Key', environment: 'live' },
|
|
14
|
+
* );
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
create(id, body, options) {
|
|
18
|
+
return this._client.post(path `/v1/sub-accounts/${id}/api-keys`, { body, ...options });
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* List sub-account API keys
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const apiKeys = await client.subAccounts.apiKeys.list('id');
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
list(id, options) {
|
|
29
|
+
return this._client.get(path `/v1/sub-accounts/${id}/api-keys`, options);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Revoke sub-account API key
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* await client.subAccounts.apiKeys.revoke('keyId', {
|
|
37
|
+
* id: 'id',
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
revoke(keyID, params, options) {
|
|
42
|
+
const { id } = params;
|
|
43
|
+
return this._client.delete(path `/v1/sub-accounts/${id}/api-keys/${keyID}`, {
|
|
44
|
+
...options,
|
|
45
|
+
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=api-keys.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-keys.mjs","sourceRoot":"","sources":["../../src/resources/sub-accounts/api-keys.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,YAAY,EAAE;OAEhB,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,EAAU,EAAE,IAAwB,EAAE,OAAwB;QACnE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,oBAAoB,EAAE,WAAW,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxF,CAAC;IAED;;;;;;;OAOG;IACH,IAAI,CAAC,EAAU,EAAE,OAAwB;QACvC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,oBAAoB,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAa,EAAE,MAA0B,EAAE,OAAwB;QACxE,MAAM,EAAE,EAAE,EAAE,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAA,oBAAoB,EAAE,aAAa,KAAK,EAAE,EAAE;YACzE,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { APIKeys, type APIKeyCreateResponse, type APIKeyListResponse, type APIKeyCreateParams, type APIKeyRevokeParams, } from "./api-keys.mjs";
|
|
2
|
+
export { SubAccounts, type SubAccount, type SubAccountCreateResponse, type SubAccountRetrieveResponse, type SubAccountUpdateResponse, type SubAccountDeactivateResponse, type SubAccountGetBalanceResponse, type SubAccountCreateParams, type SubAccountUpdateParams, type SubAccountListParams, type SubAccountsCursor, } from "./sub-accounts.mjs";
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/sub-accounts/index.ts"],"names":[],"mappings":"OAEO,EACL,OAAO,EACP,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB;OACM,EACL,WAAW,EACX,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { APIKeys, type APIKeyCreateResponse, type APIKeyListResponse, type APIKeyCreateParams, type APIKeyRevokeParams, } from "./api-keys.js";
|
|
2
|
+
export { SubAccounts, type SubAccount, type SubAccountCreateResponse, type SubAccountRetrieveResponse, type SubAccountUpdateResponse, type SubAccountDeactivateResponse, type SubAccountGetBalanceResponse, type SubAccountCreateParams, type SubAccountUpdateParams, type SubAccountListParams, type SubAccountsCursor, } from "./sub-accounts.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/sub-accounts/index.ts"],"names":[],"mappings":"OAEO,EACL,OAAO,EACP,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,GACxB;OACM,EACL,WAAW,EACX,KAAK,UAAU,EACf,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,wBAAwB,EAC7B,KAAK,4BAA4B,EACjC,KAAK,4BAA4B,EACjC,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,GACvB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.SubAccounts = exports.APIKeys = void 0;
|
|
5
|
+
var api_keys_1 = require("./api-keys.js");
|
|
6
|
+
Object.defineProperty(exports, "APIKeys", { enumerable: true, get: function () { return api_keys_1.APIKeys; } });
|
|
7
|
+
var sub_accounts_1 = require("./sub-accounts.js");
|
|
8
|
+
Object.defineProperty(exports, "SubAccounts", { enumerable: true, get: function () { return sub_accounts_1.SubAccounts; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/sub-accounts/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,0CAMoB;AALlB,mGAAA,OAAO,OAAA;AAMT,kDAYwB;AAXtB,2GAAA,WAAW,OAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/sub-accounts/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,OAAO,GAKR;OACM,EACL,WAAW,GAWZ"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { APIResource } from "../../core/resource.mjs";
|
|
2
|
+
import * as APIKeysAPI from "./api-keys.mjs";
|
|
3
|
+
import { APIKeyCreateParams, APIKeyCreateResponse, APIKeyListResponse, APIKeyRevokeParams, APIKeys } from "./api-keys.mjs";
|
|
4
|
+
import { APIPromise } from "../../core/api-promise.mjs";
|
|
5
|
+
import { Cursor, type CursorParams, PagePromise } from "../../core/pagination.mjs";
|
|
6
|
+
import { RequestOptions } from "../../internal/request-options.mjs";
|
|
7
|
+
export declare class SubAccounts extends APIResource {
|
|
8
|
+
apiKeys: APIKeysAPI.APIKeys;
|
|
9
|
+
/**
|
|
10
|
+
* Create a new sub-account (project) with its own API key. All charges are billed
|
|
11
|
+
* to the parent team's balance. Use creditLimit to set a spending cap. The
|
|
12
|
+
* sub-account's API key is returned only in the creation response.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const subAccount = await client.subAccounts.create({
|
|
17
|
+
* name: 'Client ABC',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
create(body: SubAccountCreateParams, options?: RequestOptions): APIPromise<SubAccountCreateResponse>;
|
|
22
|
+
/**
|
|
23
|
+
* Get sub-account
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const subAccount = await client.subAccounts.retrieve('id');
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
retrieve(id: string, options?: RequestOptions): APIPromise<SubAccountRetrieveResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Update sub-account
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const subAccount = await client.subAccounts.update('id');
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
update(id: string, body: SubAccountUpdateParams, options?: RequestOptions): APIPromise<SubAccountUpdateResponse>;
|
|
40
|
+
/**
|
|
41
|
+
* List sub-accounts for this team.
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```ts
|
|
45
|
+
* // Automatically fetches more pages as needed.
|
|
46
|
+
* for await (const subAccount of client.subAccounts.list()) {
|
|
47
|
+
* // ...
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
list(query?: SubAccountListParams | null | undefined, options?: RequestOptions): PagePromise<SubAccountsCursor, SubAccount>;
|
|
52
|
+
/**
|
|
53
|
+
* Deactivate a sub-account. Remaining balance is returned to the parent team and
|
|
54
|
+
* all API keys are revoked.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const response = await client.subAccounts.deactivate('id');
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
deactivate(id: string, options?: RequestOptions): APIPromise<SubAccountDeactivateResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Get spending information for a sub-account. Returns the parent team's balance,
|
|
64
|
+
* the sub-account's total spending, and its credit limit (spending cap).
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```ts
|
|
68
|
+
* const response = await client.subAccounts.getBalance('id');
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
getBalance(id: string, options?: RequestOptions): APIPromise<SubAccountGetBalanceResponse>;
|
|
72
|
+
}
|
|
73
|
+
export type SubAccountsCursor = Cursor<SubAccount>;
|
|
74
|
+
export interface SubAccount {
|
|
75
|
+
id: string;
|
|
76
|
+
createdAt: string;
|
|
77
|
+
name: string;
|
|
78
|
+
status: 'active' | 'inactive';
|
|
79
|
+
/**
|
|
80
|
+
* Total amount spent by this sub-account in cents.
|
|
81
|
+
*/
|
|
82
|
+
totalSpent: number;
|
|
83
|
+
/**
|
|
84
|
+
* API key for the sub-account. Only returned on creation.
|
|
85
|
+
*/
|
|
86
|
+
apiKey?: string;
|
|
87
|
+
/**
|
|
88
|
+
* Spending cap in cents. When reached, messages from this sub-account will be
|
|
89
|
+
* blocked.
|
|
90
|
+
*/
|
|
91
|
+
creditLimit?: number | null;
|
|
92
|
+
/**
|
|
93
|
+
* External reference ID set by the parent account.
|
|
94
|
+
*/
|
|
95
|
+
externalId?: string | null;
|
|
96
|
+
metadata?: {
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
} | null;
|
|
99
|
+
}
|
|
100
|
+
export interface SubAccountCreateResponse {
|
|
101
|
+
subAccount: SubAccount;
|
|
102
|
+
}
|
|
103
|
+
export interface SubAccountRetrieveResponse {
|
|
104
|
+
subAccount: SubAccount;
|
|
105
|
+
}
|
|
106
|
+
export interface SubAccountUpdateResponse {
|
|
107
|
+
subAccount: SubAccount;
|
|
108
|
+
}
|
|
109
|
+
export interface SubAccountDeactivateResponse {
|
|
110
|
+
/**
|
|
111
|
+
* Number of API keys revoked.
|
|
112
|
+
*/
|
|
113
|
+
keysRevoked: number;
|
|
114
|
+
message: string;
|
|
115
|
+
}
|
|
116
|
+
export interface SubAccountGetBalanceResponse {
|
|
117
|
+
/**
|
|
118
|
+
* Team balance in cents. All charges are billed to the parent team.
|
|
119
|
+
*/
|
|
120
|
+
balance: number;
|
|
121
|
+
currency: string;
|
|
122
|
+
/**
|
|
123
|
+
* Spending cap in cents (only for sub-accounts).
|
|
124
|
+
*/
|
|
125
|
+
creditLimit?: number | null;
|
|
126
|
+
/**
|
|
127
|
+
* Whether this API key belongs to a sub-account.
|
|
128
|
+
*/
|
|
129
|
+
isSubAccount?: boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Total amount spent by this sub-account in cents (only for sub-accounts).
|
|
132
|
+
*/
|
|
133
|
+
totalSpent?: number | null;
|
|
134
|
+
}
|
|
135
|
+
export interface SubAccountCreateParams {
|
|
136
|
+
/**
|
|
137
|
+
* Name of the sub-account.
|
|
138
|
+
*/
|
|
139
|
+
name: string;
|
|
140
|
+
/**
|
|
141
|
+
* Spending cap in cents. When reached, messages from this sub-account will be
|
|
142
|
+
* blocked. Omit or set to 0 for no limit.
|
|
143
|
+
*/
|
|
144
|
+
creditLimit?: number;
|
|
145
|
+
/**
|
|
146
|
+
* External reference ID for your own tracking.
|
|
147
|
+
*/
|
|
148
|
+
externalId?: string;
|
|
149
|
+
metadata?: {
|
|
150
|
+
[key: string]: unknown;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export interface SubAccountUpdateParams {
|
|
154
|
+
creditLimit?: number | null;
|
|
155
|
+
externalId?: string;
|
|
156
|
+
metadata?: {
|
|
157
|
+
[key: string]: unknown;
|
|
158
|
+
};
|
|
159
|
+
name?: string;
|
|
160
|
+
status?: 'active' | 'inactive';
|
|
161
|
+
}
|
|
162
|
+
export interface SubAccountListParams extends CursorParams {
|
|
163
|
+
}
|
|
164
|
+
export declare namespace SubAccounts {
|
|
165
|
+
export { type SubAccount as SubAccount, type SubAccountCreateResponse as SubAccountCreateResponse, type SubAccountRetrieveResponse as SubAccountRetrieveResponse, type SubAccountUpdateResponse as SubAccountUpdateResponse, type SubAccountDeactivateResponse as SubAccountDeactivateResponse, type SubAccountGetBalanceResponse as SubAccountGetBalanceResponse, type SubAccountsCursor as SubAccountsCursor, type SubAccountCreateParams as SubAccountCreateParams, type SubAccountUpdateParams as SubAccountUpdateParams, type SubAccountListParams as SubAccountListParams, };
|
|
166
|
+
export { APIKeys as APIKeys, type APIKeyCreateResponse as APIKeyCreateResponse, type APIKeyListResponse as APIKeyListResponse, type APIKeyCreateParams as APIKeyCreateParams, type APIKeyRevokeParams as APIKeyRevokeParams, };
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=sub-accounts.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sub-accounts.d.mts","sourceRoot":"","sources":["../../src/resources/sub-accounts/sub-accounts.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,kBAAkB,EAClB,OAAO,EACR;OACM,EAAE,UAAU,EAAE;OACd,EAAE,MAAM,EAAE,KAAK,YAAY,EAAE,WAAW,EAAE;OAC1C,EAAE,cAAc,EAAE;AAGzB,qBAAa,WAAY,SAAQ,WAAW;IAC1C,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IAEnE;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,IAAI,EAAE,sBAAsB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;IAIpG;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,0BAA0B,CAAC;IAItF;;;;;;;OAOG;IACH,MAAM,CACJ,EAAE,EAAE,MAAM,EACV,IAAI,EAAE,sBAAsB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB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