@gpt-platform/client 0.10.4 → 0.11.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/dist/_internal/client/client.gen.d.ts +3 -0
- package/dist/_internal/client/client.gen.d.ts.map +1 -0
- package/dist/_internal/client/index.d.ts +9 -0
- package/dist/_internal/client/index.d.ts.map +1 -0
- package/dist/_internal/client/types.gen.d.ts +118 -0
- package/dist/_internal/client/types.gen.d.ts.map +1 -0
- package/dist/_internal/client/utils.gen.d.ts +34 -0
- package/dist/_internal/client/utils.gen.d.ts.map +1 -0
- package/dist/_internal/client.gen.d.ts +13 -0
- package/dist/_internal/client.gen.d.ts.map +1 -0
- package/dist/_internal/core/auth.gen.d.ts +19 -0
- package/dist/_internal/core/auth.gen.d.ts.map +1 -0
- package/dist/_internal/core/bodySerializer.gen.d.ts +26 -0
- package/dist/_internal/core/bodySerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/params.gen.d.ts +44 -0
- package/dist/_internal/core/params.gen.d.ts.map +1 -0
- package/dist/_internal/core/pathSerializer.gen.d.ts +34 -0
- package/dist/_internal/core/pathSerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/queryKeySerializer.gen.d.ts +19 -0
- package/dist/_internal/core/queryKeySerializer.gen.d.ts.map +1 -0
- package/dist/_internal/core/serverSentEvents.gen.d.ts +72 -0
- package/dist/_internal/core/serverSentEvents.gen.d.ts.map +1 -0
- package/dist/_internal/core/types.gen.d.ts +79 -0
- package/dist/_internal/core/types.gen.d.ts.map +1 -0
- package/dist/_internal/core/utils.gen.d.ts +20 -0
- package/dist/_internal/core/utils.gen.d.ts.map +1 -0
- package/dist/_internal/index.d.ts +3 -0
- package/dist/_internal/index.d.ts.map +1 -0
- package/dist/_internal/sdk.gen.d.ts +7053 -0
- package/dist/_internal/sdk.gen.d.ts.map +1 -0
- package/dist/_internal/types.gen.d.ts +146633 -0
- package/dist/_internal/types.gen.d.ts.map +1 -0
- package/dist/base-client.d.ts +199 -0
- package/dist/base-client.d.ts.map +1 -0
- package/dist/errors/index.d.ts +128 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/events.d.ts +69 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/execution-events.d.ts +95 -0
- package/dist/execution-events.d.ts.map +1 -0
- package/dist/gpt-client.d.ts +2175 -0
- package/dist/gpt-client.d.ts.map +1 -0
- package/dist/index.d.ts +51 -30308
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +775 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +775 -14
- package/dist/index.mjs.map +1 -1
- package/dist/json-api.d.ts +26 -0
- package/dist/json-api.d.ts.map +1 -0
- package/dist/logging.d.ts +22 -0
- package/dist/logging.d.ts.map +1 -0
- package/dist/namespace-types.d.ts +79 -0
- package/dist/namespace-types.d.ts.map +1 -0
- package/dist/namespaces/access-grants.d.ts +71 -0
- package/dist/namespaces/access-grants.d.ts.map +1 -0
- package/dist/namespaces/agents.d.ts +1406 -0
- package/dist/namespaces/agents.d.ts.map +1 -0
- package/dist/namespaces/ai.d.ts +407 -0
- package/dist/namespaces/ai.d.ts.map +1 -0
- package/dist/namespaces/audit.d.ts +83 -0
- package/dist/namespaces/audit.d.ts.map +1 -0
- package/dist/namespaces/billing.d.ts +854 -0
- package/dist/namespaces/billing.d.ts.map +1 -0
- package/dist/namespaces/campaigns.d.ts +973 -0
- package/dist/namespaces/campaigns.d.ts.map +1 -0
- package/dist/namespaces/catalog.d.ts +964 -0
- package/dist/namespaces/catalog.d.ts.map +1 -0
- package/dist/namespaces/channels.d.ts +162 -0
- package/dist/namespaces/channels.d.ts.map +1 -0
- package/dist/namespaces/clinical.d.ts +2443 -0
- package/dist/namespaces/clinical.d.ts.map +1 -0
- package/dist/namespaces/communication.d.ts +439 -0
- package/dist/namespaces/communication.d.ts.map +1 -0
- package/dist/namespaces/compliance.d.ts +2310 -0
- package/dist/namespaces/compliance.d.ts.map +1 -0
- package/dist/namespaces/connectors.d.ts +1368 -0
- package/dist/namespaces/connectors.d.ts.map +1 -0
- package/dist/namespaces/content.d.ts +188 -0
- package/dist/namespaces/content.d.ts.map +1 -0
- package/dist/namespaces/crawler.d.ts +408 -0
- package/dist/namespaces/crawler.d.ts.map +1 -0
- package/dist/namespaces/crm-clusters.d.ts +31 -0
- package/dist/namespaces/crm-clusters.d.ts.map +1 -0
- package/dist/namespaces/crm.d.ts +1539 -0
- package/dist/namespaces/crm.d.ts.map +1 -0
- package/dist/namespaces/documents.d.ts +136 -0
- package/dist/namespaces/documents.d.ts.map +1 -0
- package/dist/namespaces/email.d.ts +550 -0
- package/dist/namespaces/email.d.ts.map +1 -0
- package/dist/namespaces/extraction.d.ts +1249 -0
- package/dist/namespaces/extraction.d.ts.map +1 -0
- package/dist/namespaces/identity.d.ts +411 -0
- package/dist/namespaces/identity.d.ts.map +1 -0
- package/dist/namespaces/imports.d.ts +177 -0
- package/dist/namespaces/imports.d.ts.map +1 -0
- package/dist/namespaces/index.d.ts +119 -0
- package/dist/namespaces/index.d.ts.map +1 -0
- package/dist/namespaces/memory.d.ts +105 -0
- package/dist/namespaces/memory.d.ts.map +1 -0
- package/dist/namespaces/models.d.ts +75 -0
- package/dist/namespaces/models.d.ts.map +1 -0
- package/dist/namespaces/permissions.d.ts +75 -0
- package/dist/namespaces/permissions.d.ts.map +1 -0
- package/dist/namespaces/pipeline-executions.d.ts +130 -0
- package/dist/namespaces/pipeline-executions.d.ts.map +1 -0
- package/dist/namespaces/pipelines.d.ts +120 -0
- package/dist/namespaces/pipelines.d.ts.map +1 -0
- package/dist/namespaces/platform.d.ts +1430 -0
- package/dist/namespaces/platform.d.ts.map +1 -0
- package/dist/namespaces/portal.d.ts +198 -0
- package/dist/namespaces/portal.d.ts.map +1 -0
- package/dist/namespaces/projects.d.ts +553 -0
- package/dist/namespaces/projects.d.ts.map +1 -0
- package/dist/namespaces/roles.d.ts +65 -0
- package/dist/namespaces/roles.d.ts.map +1 -0
- package/dist/namespaces/scheduling.d.ts +944 -0
- package/dist/namespaces/scheduling.d.ts.map +1 -0
- package/dist/namespaces/search.d.ts +224 -0
- package/dist/namespaces/search.d.ts.map +1 -0
- package/dist/namespaces/session-notes.d.ts +67 -0
- package/dist/namespaces/session-notes.d.ts.map +1 -0
- package/dist/namespaces/social.d.ts +330 -0
- package/dist/namespaces/social.d.ts.map +1 -0
- package/dist/namespaces/storage.d.ts +378 -0
- package/dist/namespaces/storage.d.ts.map +1 -0
- package/dist/namespaces/support.d.ts +427 -0
- package/dist/namespaces/support.d.ts.map +1 -0
- package/dist/namespaces/threads.d.ts +596 -0
- package/dist/namespaces/threads.d.ts.map +1 -0
- package/dist/namespaces/training.d.ts +358 -0
- package/dist/namespaces/training.d.ts.map +1 -0
- package/dist/namespaces/voice.d.ts +752 -0
- package/dist/namespaces/voice.d.ts.map +1 -0
- package/dist/namespaces/watcher.d.ts +425 -0
- package/dist/namespaces/watcher.d.ts.map +1 -0
- package/dist/namespaces/webhooks-ns.d.ts +3 -0
- package/dist/namespaces/webhooks-ns.d.ts.map +1 -0
- package/dist/pagination.d.ts +57 -0
- package/dist/pagination.d.ts.map +1 -0
- package/dist/request-builder.d.ts +95 -0
- package/dist/request-builder.d.ts.map +1 -0
- package/dist/security.d.ts +32 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/streaming.d.ts +135 -0
- package/dist/streaming.d.ts.map +1 -0
- package/dist/utils/retry.d.ts +63 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/version.d.ts +5 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/webhook-signature.d.ts +109 -0
- package/dist/webhook-signature.d.ts.map +1 -0
- package/llms.txt +40 -1
- package/package.json +286 -36
- package/dist/index.d.mts +0 -30308
|
@@ -0,0 +1,1430 @@
|
|
|
1
|
+
import type { Application, BrandIdentity, Invitation, Permission, PermissionPreset, PlatformTone, Role, Tenant, Workspace } from "../_internal/types.gen";
|
|
2
|
+
/** Attributes accepted when updating a workspace (PATCH semantics). */
|
|
3
|
+
export type UpdateWorkspaceAttributes = {
|
|
4
|
+
name?: string;
|
|
5
|
+
slug?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
deduplicate_uploads?: boolean;
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
/** Attributes accepted when creating an application. */
|
|
11
|
+
export type CreateApplicationAttributes = {
|
|
12
|
+
name: string;
|
|
13
|
+
owner_id?: string;
|
|
14
|
+
slug?: string;
|
|
15
|
+
base_url?: string;
|
|
16
|
+
workspace_mode?: "single" | "multi";
|
|
17
|
+
enabled_capabilities?: string[];
|
|
18
|
+
allow_org_creation?: boolean;
|
|
19
|
+
invitation_mode?: "open" | "admin_only";
|
|
20
|
+
max_parallel_tools_global?: number;
|
|
21
|
+
[key: string]: unknown;
|
|
22
|
+
};
|
|
23
|
+
/** Attributes accepted when updating an application (PATCH semantics). */
|
|
24
|
+
export type UpdateApplicationAttributes = {
|
|
25
|
+
name?: string;
|
|
26
|
+
slug?: string;
|
|
27
|
+
base_url?: string;
|
|
28
|
+
workspace_mode?: "single" | "multi";
|
|
29
|
+
enabled_capabilities?: string[];
|
|
30
|
+
allow_org_creation?: boolean;
|
|
31
|
+
invitation_mode?: "open" | "admin_only";
|
|
32
|
+
max_parallel_tools_global?: number;
|
|
33
|
+
[key: string]: unknown;
|
|
34
|
+
};
|
|
35
|
+
/** Attributes accepted when creating a tenant. */
|
|
36
|
+
export type CreateTenantAttributes = {
|
|
37
|
+
name: string;
|
|
38
|
+
slug?: string;
|
|
39
|
+
owner_id?: string;
|
|
40
|
+
application_id?: string;
|
|
41
|
+
kind?: string;
|
|
42
|
+
logo_url?: string;
|
|
43
|
+
badge_url?: string;
|
|
44
|
+
plan_tier?: string;
|
|
45
|
+
is_personal?: boolean;
|
|
46
|
+
vanity_slug?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
contact_email?: string;
|
|
49
|
+
contact_phone?: string;
|
|
50
|
+
[key: string]: unknown;
|
|
51
|
+
};
|
|
52
|
+
/** Attributes accepted when updating a tenant (PATCH semantics). */
|
|
53
|
+
export type UpdateTenantAttributes = {
|
|
54
|
+
name?: string;
|
|
55
|
+
slug?: string;
|
|
56
|
+
logo_url?: string;
|
|
57
|
+
badge_url?: string;
|
|
58
|
+
vanity_slug?: string;
|
|
59
|
+
plan_tier?: string;
|
|
60
|
+
description?: string;
|
|
61
|
+
contact_email?: string;
|
|
62
|
+
contact_phone?: string;
|
|
63
|
+
[key: string]: unknown;
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* Attributes accepted when creating an invitation.
|
|
67
|
+
*
|
|
68
|
+
* Invitations target a scope: either a tenant or a workspace.
|
|
69
|
+
* Use `scope_type` + `scope_id` to specify the target, or use
|
|
70
|
+
* the convenience shorthand `workspace_id` or `tenant_id`.
|
|
71
|
+
*/
|
|
72
|
+
export type CreateInvitationAttributes = {
|
|
73
|
+
email: string;
|
|
74
|
+
role: "admin" | "member" | "editor" | "viewer";
|
|
75
|
+
custom_message?: string;
|
|
76
|
+
permissions?: string[];
|
|
77
|
+
application_id?: string;
|
|
78
|
+
/** Shorthand: invite to a workspace. Sets scope_type: "workspace", scope_id: workspace_id */
|
|
79
|
+
workspace_id?: string;
|
|
80
|
+
/** Shorthand: invite to a tenant. Sets scope_type: "tenant", scope_id: tenant_id */
|
|
81
|
+
tenant_id?: string;
|
|
82
|
+
/** Explicit scope type (alternative to workspace_id/tenant_id shorthand) */
|
|
83
|
+
scope_type?: "tenant" | "workspace";
|
|
84
|
+
/** Explicit scope ID (use with scope_type) */
|
|
85
|
+
scope_id?: string;
|
|
86
|
+
[key: string]: unknown;
|
|
87
|
+
};
|
|
88
|
+
/** Attributes accepted when creating a brand identity. */
|
|
89
|
+
export type CreateBrandIdentityAttributes = {
|
|
90
|
+
/** Required. Display name for this brand identity. */
|
|
91
|
+
name: string;
|
|
92
|
+
/** Tenant UUID — required for tenant-scoped identities. */
|
|
93
|
+
tenant_id: string;
|
|
94
|
+
/** Optional workspace UUID — set for workspace-level overrides, omit for tenant-level. */
|
|
95
|
+
workspace_id?: string;
|
|
96
|
+
/** Brand voice description (e.g. "Professional but approachable"). */
|
|
97
|
+
voice?: string;
|
|
98
|
+
/** Brand values as an array of strings (e.g. ["innovation", "integrity"]). */
|
|
99
|
+
values?: string[];
|
|
100
|
+
/** Target audience description. */
|
|
101
|
+
target_audience?: string;
|
|
102
|
+
/** Industry vertical. */
|
|
103
|
+
industry?: string;
|
|
104
|
+
/** Brand website URL. */
|
|
105
|
+
website_url?: string;
|
|
106
|
+
/** Logo image URL. */
|
|
107
|
+
logo_url?: string;
|
|
108
|
+
/** Color palette map (e.g. { primary: "#0066CC", secondary: "#FF0000" }). */
|
|
109
|
+
color_palette?: Record<string, string>;
|
|
110
|
+
/** General description of this brand identity. */
|
|
111
|
+
description?: string;
|
|
112
|
+
/** Whether this is the default identity at its scope level. */
|
|
113
|
+
is_default?: boolean;
|
|
114
|
+
};
|
|
115
|
+
/** Attributes accepted when updating a brand identity (PATCH semantics). */
|
|
116
|
+
export type UpdateBrandIdentityAttributes = Partial<Omit<CreateBrandIdentityAttributes, "workspace_id" | "tenant_id">>;
|
|
117
|
+
/** Attributes accepted when creating a platform tone. */
|
|
118
|
+
export type CreatePlatformToneAttributes = {
|
|
119
|
+
/** Required. Social platform this tone applies to. */
|
|
120
|
+
platform: "facebook" | "instagram" | "threads" | "twitter" | "linkedin" | "reddit" | "bluesky";
|
|
121
|
+
/** Required. Brand identity UUID this tone belongs to. */
|
|
122
|
+
brand_identity_id: string;
|
|
123
|
+
/** Tone preset. Default: "casual". */
|
|
124
|
+
tone?: "casual" | "professional" | "humorous" | "inspirational" | "educational" | "promotional";
|
|
125
|
+
/** Emoji usage policy. Default: "minimal". */
|
|
126
|
+
emoji_policy?: "none" | "minimal" | "moderate" | "heavy";
|
|
127
|
+
/** Number of hashtags to include. Default: 5. */
|
|
128
|
+
hashtag_count?: number;
|
|
129
|
+
/** Maximum character length for posts on this platform. */
|
|
130
|
+
max_length?: number;
|
|
131
|
+
/** Call-to-action text to include in generated copy. */
|
|
132
|
+
call_to_action?: string;
|
|
133
|
+
/** Free-form instructions for AI content generation on this platform. */
|
|
134
|
+
custom_instructions?: string;
|
|
135
|
+
};
|
|
136
|
+
/** Attributes accepted when updating a platform tone (PATCH semantics). */
|
|
137
|
+
export type UpdatePlatformToneAttributes = Partial<Omit<CreatePlatformToneAttributes, "brand_identity_id" | "platform">>;
|
|
138
|
+
import type { RequestOptions } from "../base-client";
|
|
139
|
+
import { RequestBuilder } from "../request-builder";
|
|
140
|
+
/**
|
|
141
|
+
* Creates the platform namespace providing access to workspace management,
|
|
142
|
+
* application configuration, tenant administration, workspace invitations,
|
|
143
|
+
* member management, and application-level config entries.
|
|
144
|
+
*
|
|
145
|
+
* Access via `client.platform`.
|
|
146
|
+
*
|
|
147
|
+
* @example
|
|
148
|
+
* ```typescript
|
|
149
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
150
|
+
* const workspaces = await client.platform.workspaces.list();
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export declare function createPlatformNamespace(rb: RequestBuilder): {
|
|
154
|
+
/**
|
|
155
|
+
* Workspaces — the primary data isolation boundary.
|
|
156
|
+
*
|
|
157
|
+
* All resources (documents, agents, results, etc.) belong to a workspace.
|
|
158
|
+
* The current user's accessible workspaces depend on their memberships
|
|
159
|
+
* and the application's `workspace_mode` (`"single"` or `"multi"`).
|
|
160
|
+
*/
|
|
161
|
+
workspaces: {
|
|
162
|
+
/**
|
|
163
|
+
* List all workspaces the current user has access to.
|
|
164
|
+
*
|
|
165
|
+
* Returns workspaces across all memberships (owned and shared).
|
|
166
|
+
* Equivalent to the union of `mine` and `shared`.
|
|
167
|
+
*
|
|
168
|
+
* @param options - Optional page number, page size, and request options.
|
|
169
|
+
* @returns A page of `Workspace` records accessible to the current user.
|
|
170
|
+
*
|
|
171
|
+
* @example
|
|
172
|
+
* ```typescript
|
|
173
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
174
|
+
* const workspaces = await client.platform.workspaces.list();
|
|
175
|
+
* workspaces.forEach(w => console.log(w.attributes?.name));
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
list: (options?: {
|
|
179
|
+
page?: number;
|
|
180
|
+
pageSize?: number;
|
|
181
|
+
} & RequestOptions) => Promise<Workspace[]>;
|
|
182
|
+
/**
|
|
183
|
+
* List workspaces owned by the currently authenticated user.
|
|
184
|
+
*
|
|
185
|
+
* Returns only workspaces for which the current user is the primary owner.
|
|
186
|
+
* Does not include workspaces where the user is a member but not the owner.
|
|
187
|
+
*
|
|
188
|
+
* @param options - Optional request options.
|
|
189
|
+
* @returns An array of `Workspace` records owned by the current user.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```typescript
|
|
193
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
194
|
+
* const mine = await client.platform.workspaces.mine();
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
mine: (options?: RequestOptions) => Promise<Workspace[]>;
|
|
198
|
+
/**
|
|
199
|
+
* List workspaces shared with the currently authenticated user.
|
|
200
|
+
*
|
|
201
|
+
* Returns workspaces where the current user has been granted membership
|
|
202
|
+
* by another owner. Does not include workspaces the user owns.
|
|
203
|
+
*
|
|
204
|
+
* @param options - Optional request options.
|
|
205
|
+
* @returns An array of `Workspace` records shared with the current user.
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```typescript
|
|
209
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
210
|
+
* const shared = await client.platform.workspaces.shared();
|
|
211
|
+
* shared.forEach(w => console.log(w.attributes?.name));
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
shared: (options?: RequestOptions) => Promise<Workspace[]>;
|
|
215
|
+
/**
|
|
216
|
+
* Retrieve a single workspace by its ID.
|
|
217
|
+
*
|
|
218
|
+
* @param id - The UUID of the workspace.
|
|
219
|
+
* @param options - Optional request options.
|
|
220
|
+
* @returns The matching `Workspace`.
|
|
221
|
+
*
|
|
222
|
+
* @example
|
|
223
|
+
* ```typescript
|
|
224
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
225
|
+
* const workspace = await client.platform.workspaces.get('ws_abc123');
|
|
226
|
+
* console.log(workspace.attributes?.name, workspace.attributes?.slug);
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
get: (id: string, options?: RequestOptions) => Promise<Workspace>;
|
|
230
|
+
/**
|
|
231
|
+
* Create a new workspace.
|
|
232
|
+
*
|
|
233
|
+
* Creates a workspace under the current tenant. The `name` is required;
|
|
234
|
+
* `slug` is optional and will be auto-generated from the name if omitted.
|
|
235
|
+
* In applications with `workspace_mode: "single"`, a default workspace
|
|
236
|
+
* is created automatically at tenant provisioning time — manual creation
|
|
237
|
+
* is only needed in `"multi"` mode.
|
|
238
|
+
*
|
|
239
|
+
* @param name - Human-readable workspace name.
|
|
240
|
+
* @param slug - Optional URL-friendly slug. Auto-generated if omitted.
|
|
241
|
+
* @param options - Optional request options.
|
|
242
|
+
* @returns The newly created `Workspace`.
|
|
243
|
+
*
|
|
244
|
+
* @example
|
|
245
|
+
* ```typescript
|
|
246
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
247
|
+
* const workspace = await client.platform.workspaces.create(
|
|
248
|
+
* 'Clinical Team — East Wing',
|
|
249
|
+
* 'clinical-east',
|
|
250
|
+
* );
|
|
251
|
+
* console.log(workspace.id);
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
create: (name: string, slug?: string, options?: RequestOptions) => Promise<Workspace>;
|
|
255
|
+
/**
|
|
256
|
+
* List extraction exports for a specific workspace (paginated).
|
|
257
|
+
*
|
|
258
|
+
* Returns one page of export records associated with the given workspace.
|
|
259
|
+
* Prefer `client.extraction.exports.list` for extraction-specific workflows;
|
|
260
|
+
* this method is provided here for workspace-centric views.
|
|
261
|
+
*
|
|
262
|
+
* @param workspaceId - The UUID of the workspace to list exports for.
|
|
263
|
+
* @param options - Optional page number, page size, and request options.
|
|
264
|
+
* @returns A page of export records.
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* ```typescript
|
|
268
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
269
|
+
* const exports = await client.platform.workspaces.listExtractionExportsByWorkspace('ws_abc123');
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
listExtractionExportsByWorkspace: (workspaceId: string, options?: {
|
|
273
|
+
page?: number;
|
|
274
|
+
pageSize?: number;
|
|
275
|
+
} & RequestOptions) => Promise<Workspace[]>;
|
|
276
|
+
/**
|
|
277
|
+
* List all extraction exports for a workspace, auto-paginating through every page.
|
|
278
|
+
*
|
|
279
|
+
* @param workspaceId - The UUID of the workspace to list exports for.
|
|
280
|
+
* @param options - Optional request options.
|
|
281
|
+
* @returns All export records for the workspace as a flat array.
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
286
|
+
* const allExports = await client.platform.workspaces.listAllExtractionExportsByWorkspace('ws_abc123');
|
|
287
|
+
* ```
|
|
288
|
+
*/
|
|
289
|
+
listAllExtractionExportsByWorkspace: (workspaceId: string, options?: RequestOptions) => Promise<Workspace[]>;
|
|
290
|
+
/**
|
|
291
|
+
* Delete a workspace.
|
|
292
|
+
*
|
|
293
|
+
* Permanently removes the workspace and all data it contains (documents,
|
|
294
|
+
* results, agents, etc.). This operation is irreversible. Deletion may
|
|
295
|
+
* be asynchronous — the workspace may be scheduled for purge rather than
|
|
296
|
+
* deleted immediately.
|
|
297
|
+
*
|
|
298
|
+
* @param id - The UUID of the workspace to delete.
|
|
299
|
+
* @param options - Optional request options.
|
|
300
|
+
* @returns `true` on successful deletion or scheduling.
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* ```typescript
|
|
304
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
305
|
+
* await client.platform.workspaces.delete('ws_abc123');
|
|
306
|
+
* ```
|
|
307
|
+
*/
|
|
308
|
+
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
309
|
+
/**
|
|
310
|
+
* Update workspace settings.
|
|
311
|
+
*
|
|
312
|
+
* Currently used to update storage settings (e.g., custom storage bucket,
|
|
313
|
+
* retention overrides) via the `storage_settings` attribute. Also accepts
|
|
314
|
+
* general workspace attributes like `name` and `slug`.
|
|
315
|
+
*
|
|
316
|
+
* @param id - The UUID of the workspace to update.
|
|
317
|
+
* @param attributes - Attribute map of fields to change.
|
|
318
|
+
* @param options - Optional request options.
|
|
319
|
+
* @returns The updated `Workspace`.
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* ```typescript
|
|
323
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
324
|
+
* const workspace = await client.platform.workspaces.update('ws_abc123', {
|
|
325
|
+
* name: 'Clinical Team — West Wing',
|
|
326
|
+
* });
|
|
327
|
+
* ```
|
|
328
|
+
*/
|
|
329
|
+
update: (id: string, attributes: UpdateWorkspaceAttributes, options?: RequestOptions) => Promise<Workspace>;
|
|
330
|
+
/**
|
|
331
|
+
* Update storage-specific settings for a workspace.
|
|
332
|
+
*
|
|
333
|
+
* Updates the embedded storage settings (e.g., deduplication,
|
|
334
|
+
* upload limits) without touching other workspace attributes.
|
|
335
|
+
*
|
|
336
|
+
* @param id - The UUID of the workspace.
|
|
337
|
+
* @param settings - Storage settings to update.
|
|
338
|
+
* @param options - Optional request options.
|
|
339
|
+
* @returns The updated `Workspace`.
|
|
340
|
+
*/
|
|
341
|
+
updateStorageSettings: (id: string, settings: Record<string, unknown>, options?: RequestOptions) => Promise<Workspace>;
|
|
342
|
+
/**
|
|
343
|
+
* Allocate credits to a workspace.
|
|
344
|
+
*
|
|
345
|
+
* Triggers a credit allocation operation for the specified workspace,
|
|
346
|
+
* drawing from the tenant's credit pool. The resulting workspace record
|
|
347
|
+
* reflects the updated credit balance.
|
|
348
|
+
*
|
|
349
|
+
* @param workspaceId - The UUID of the workspace to allocate credits for.
|
|
350
|
+
* @param amount - Number of credits to allocate (max 100,000 per call).
|
|
351
|
+
* @param options - Optional request options.
|
|
352
|
+
* @returns The updated `Workspace` after allocation.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* ```typescript
|
|
356
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
357
|
+
* const workspace = await client.platform.workspaces.allocateCredits('ws_abc123', 5000);
|
|
358
|
+
* ```
|
|
359
|
+
*/
|
|
360
|
+
allocateCredits: (workspaceId: string, amount: number, options?: RequestOptions) => Promise<Workspace>;
|
|
361
|
+
/**
|
|
362
|
+
* Populate content hashes for all documents in a workspace.
|
|
363
|
+
*
|
|
364
|
+
* Triggers a backfill operation that computes and stores content
|
|
365
|
+
* hashes for documents that were created before hash-on-upload
|
|
366
|
+
* was enabled. This is an idempotent operation — documents that
|
|
367
|
+
* already have hashes are skipped.
|
|
368
|
+
*
|
|
369
|
+
* @param workspaceId - The UUID of the workspace to populate hashes for.
|
|
370
|
+
* @param options - Optional request options.
|
|
371
|
+
* @returns The updated `Workspace`.
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```typescript
|
|
375
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
376
|
+
* const workspace = await client.platform.workspaces.populateHashes('ws_abc123');
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
populateHashes: (workspaceId: string, options?: RequestOptions) => Promise<Workspace>;
|
|
380
|
+
};
|
|
381
|
+
/**
|
|
382
|
+
* Applications — ISV application management.
|
|
383
|
+
*
|
|
384
|
+
* Applications are the top-level ISV product identity. Each application
|
|
385
|
+
* has its own branding, API keys, plan catalog, and configuration. A
|
|
386
|
+
* single ISV may operate multiple applications (e.g., one per product or
|
|
387
|
+
* market segment).
|
|
388
|
+
*/
|
|
389
|
+
applications: {
|
|
390
|
+
/**
|
|
391
|
+
* List all applications accessible to the current actor.
|
|
392
|
+
*
|
|
393
|
+
* @param options - Optional page number, page size, and request options.
|
|
394
|
+
* @returns A page of `Application` records.
|
|
395
|
+
*
|
|
396
|
+
* @example
|
|
397
|
+
* ```typescript
|
|
398
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
399
|
+
* const apps = await client.platform.applications.list();
|
|
400
|
+
* apps.forEach(a => console.log(a.attributes?.name));
|
|
401
|
+
* ```
|
|
402
|
+
*/
|
|
403
|
+
list: (options?: {
|
|
404
|
+
page?: number;
|
|
405
|
+
pageSize?: number;
|
|
406
|
+
} & RequestOptions) => Promise<Application[]>;
|
|
407
|
+
/**
|
|
408
|
+
* Delete an application.
|
|
409
|
+
*
|
|
410
|
+
* Permanently removes the application and all associated tenants,
|
|
411
|
+
* workspaces, and data. This is irreversible and should only be
|
|
412
|
+
* performed after confirming with all affected parties.
|
|
413
|
+
*
|
|
414
|
+
* @param id - The UUID of the application to delete.
|
|
415
|
+
* @param options - Optional request options.
|
|
416
|
+
* @returns `true` on successful deletion.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
421
|
+
* await client.platform.applications.delete('app_abc123');
|
|
422
|
+
* ```
|
|
423
|
+
*/
|
|
424
|
+
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
425
|
+
/**
|
|
426
|
+
* Create a new application.
|
|
427
|
+
*
|
|
428
|
+
* Typical attributes: `name`, `slug`, `workspace_mode` (`"single"` or
|
|
429
|
+
* `"multi"`), and branding config. The application is provisioned with
|
|
430
|
+
* a default plan and API key set.
|
|
431
|
+
*
|
|
432
|
+
* @param attributes - Application creation attributes. `name` is required.
|
|
433
|
+
* @param options - Optional request options.
|
|
434
|
+
* @returns The newly created `Application`.
|
|
435
|
+
*
|
|
436
|
+
* @example
|
|
437
|
+
* ```typescript
|
|
438
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
439
|
+
* const app = await client.platform.applications.create({
|
|
440
|
+
* name: 'HealthHub Patient Portal',
|
|
441
|
+
* slug: 'healthhub',
|
|
442
|
+
* workspace_mode: 'multi',
|
|
443
|
+
* });
|
|
444
|
+
* console.log(app.id);
|
|
445
|
+
* ```
|
|
446
|
+
*/
|
|
447
|
+
create: (attributes: CreateApplicationAttributes, options?: RequestOptions) => Promise<Application>;
|
|
448
|
+
/**
|
|
449
|
+
* Update an application's configuration.
|
|
450
|
+
*
|
|
451
|
+
* Use to change the application's name, branding, plan settings,
|
|
452
|
+
* or credit allocation configuration.
|
|
453
|
+
*
|
|
454
|
+
* @param id - The UUID of the application to update.
|
|
455
|
+
* @param attributes - Attribute map of fields to change.
|
|
456
|
+
* @param options - Optional request options.
|
|
457
|
+
* @returns The updated `Application`.
|
|
458
|
+
*
|
|
459
|
+
* @example
|
|
460
|
+
* ```typescript
|
|
461
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
462
|
+
* const app = await client.platform.applications.update('app_abc123', {
|
|
463
|
+
* name: 'HealthHub — Enterprise',
|
|
464
|
+
* });
|
|
465
|
+
* ```
|
|
466
|
+
*/
|
|
467
|
+
update: (id: string, attributes: UpdateApplicationAttributes, options?: RequestOptions) => Promise<Application>;
|
|
468
|
+
/**
|
|
469
|
+
* Retrieve a single application by its ID.
|
|
470
|
+
*
|
|
471
|
+
* @param id - The UUID of the application.
|
|
472
|
+
* @param options - Optional request options.
|
|
473
|
+
* @returns The matching `Application`.
|
|
474
|
+
*
|
|
475
|
+
* @example
|
|
476
|
+
* ```typescript
|
|
477
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
478
|
+
* const app = await client.platform.applications.get('app_abc123');
|
|
479
|
+
* console.log(app.attributes?.name, app.attributes?.workspace_mode);
|
|
480
|
+
* ```
|
|
481
|
+
*/
|
|
482
|
+
get: (id: string, options?: RequestOptions) => Promise<Application>;
|
|
483
|
+
/**
|
|
484
|
+
* Get the application scoped to the current `x-application-key` request header.
|
|
485
|
+
*
|
|
486
|
+
* Useful when you have an API key and want to retrieve the application
|
|
487
|
+
* context it belongs to, without knowing the application's UUID upfront.
|
|
488
|
+
* The response is derived from the key used to authenticate the request.
|
|
489
|
+
*
|
|
490
|
+
* @param options - Optional request options.
|
|
491
|
+
* @returns The `Application` associated with the current API key.
|
|
492
|
+
*
|
|
493
|
+
* @example
|
|
494
|
+
* ```typescript
|
|
495
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
496
|
+
* const currentApp = await client.platform.applications.readCurrent();
|
|
497
|
+
* console.log(currentApp.attributes?.name);
|
|
498
|
+
* ```
|
|
499
|
+
*/
|
|
500
|
+
readCurrent: (options?: RequestOptions) => Promise<Application>;
|
|
501
|
+
/**
|
|
502
|
+
* Fetch an application by its unique slug.
|
|
503
|
+
*
|
|
504
|
+
* Looks up an application using its URL-friendly slug identifier
|
|
505
|
+
* rather than its UUID. Useful for public-facing flows where the
|
|
506
|
+
* slug is known (e.g., from a vanity URL).
|
|
507
|
+
*
|
|
508
|
+
* @param slug - The application slug (e.g., `"my-saas-app"`).
|
|
509
|
+
* @param options - Optional request options.
|
|
510
|
+
* @returns The matching `Application`.
|
|
511
|
+
*
|
|
512
|
+
* @example
|
|
513
|
+
* ```typescript
|
|
514
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
515
|
+
* const app = await client.platform.applications.getBySlug('my-saas-app');
|
|
516
|
+
* console.log(app.attributes?.name);
|
|
517
|
+
* ```
|
|
518
|
+
*/
|
|
519
|
+
getBySlug: (slug: string, options?: RequestOptions) => Promise<Application>;
|
|
520
|
+
};
|
|
521
|
+
/**
|
|
522
|
+
* Tenants — customer organization management.
|
|
523
|
+
*
|
|
524
|
+
* Tenants represent customer organizations within an application. Each
|
|
525
|
+
* tenant owns its own billing account, membership roster, and workspace(s).
|
|
526
|
+
* ISVs provision tenants when onboarding new customers.
|
|
527
|
+
*/
|
|
528
|
+
tenants: {
|
|
529
|
+
/**
|
|
530
|
+
* List all tenants (paginated).
|
|
531
|
+
*
|
|
532
|
+
* Returns tenants accessible to the current actor (application-scoped).
|
|
533
|
+
*
|
|
534
|
+
* @param options - Optional page number, page size, and request options.
|
|
535
|
+
* @returns A page of `Tenant` records.
|
|
536
|
+
*/
|
|
537
|
+
list: (options?: {
|
|
538
|
+
page?: number;
|
|
539
|
+
pageSize?: number;
|
|
540
|
+
} & RequestOptions) => Promise<Tenant[]>;
|
|
541
|
+
/**
|
|
542
|
+
* List document statistics for tenants (paginated).
|
|
543
|
+
*
|
|
544
|
+
* Returns per-tenant document usage metrics, useful for billing
|
|
545
|
+
* dashboards and usage monitoring at the ISV level.
|
|
546
|
+
*
|
|
547
|
+
* @param options - Optional page number, page size, and request options.
|
|
548
|
+
* @returns A page of tenant document stat records (typed as `Tenant[]`).
|
|
549
|
+
*
|
|
550
|
+
* @example
|
|
551
|
+
* ```typescript
|
|
552
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
553
|
+
* const stats = await client.platform.tenants.listDocumentStats();
|
|
554
|
+
* stats.forEach(s => console.log(s.attributes?.document_count));
|
|
555
|
+
* ```
|
|
556
|
+
*/
|
|
557
|
+
listDocumentStats: (tenantId: string, options?: {
|
|
558
|
+
page?: number;
|
|
559
|
+
pageSize?: number;
|
|
560
|
+
} & RequestOptions) => Promise<Tenant[]>;
|
|
561
|
+
/**
|
|
562
|
+
* List all document statistics for tenants, auto-paginating.
|
|
563
|
+
*
|
|
564
|
+
* @param tenantId - The UUID of the tenant.
|
|
565
|
+
* @param options - Optional request options.
|
|
566
|
+
* @returns All tenant document stat records as a flat array.
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```typescript
|
|
570
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
571
|
+
* const allStats = await client.platform.tenants.listAllDocumentStats('tenant_abc123');
|
|
572
|
+
* ```
|
|
573
|
+
*/
|
|
574
|
+
listAllDocumentStats: (tenantId: string, options?: RequestOptions) => Promise<Tenant[]>;
|
|
575
|
+
/**
|
|
576
|
+
* Allocate credits to a tenant's liability account.
|
|
577
|
+
*
|
|
578
|
+
* Adds credits to the tenant's billing account, drawn from the
|
|
579
|
+
* application's credit pool. Used by ISVs to grant prepaid usage
|
|
580
|
+
* allowances to their customers.
|
|
581
|
+
*
|
|
582
|
+
* @param id - The UUID of the tenant to credit.
|
|
583
|
+
* @param options - Optional request options.
|
|
584
|
+
* @returns The updated `Tenant` with new credit balance.
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* ```typescript
|
|
588
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
589
|
+
* const tenant = await client.platform.tenants.credit('tenant_abc123');
|
|
590
|
+
* console.log(tenant.attributes?.credit_balance);
|
|
591
|
+
* ```
|
|
592
|
+
*/
|
|
593
|
+
credit: (id: string, amount: number, description?: string, options?: RequestOptions) => Promise<Tenant>;
|
|
594
|
+
/**
|
|
595
|
+
* Deactivate a tenant (hide from user's account).
|
|
596
|
+
*
|
|
597
|
+
* Sets `deactivated_at` on the tenant. The tenant and its workspaces
|
|
598
|
+
* disappear from `workspaces.mine()` and tenant listings. Billing and
|
|
599
|
+
* data are completely unaffected. Reversible via `reactivate()`.
|
|
600
|
+
*
|
|
601
|
+
* Only the tenant owner can deactivate.
|
|
602
|
+
*
|
|
603
|
+
* @param id - The UUID of the tenant to deactivate.
|
|
604
|
+
* @param options - Optional request options.
|
|
605
|
+
* @returns The updated tenant record.
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* ```typescript
|
|
609
|
+
* await client.platform.tenants.deactivate('tenant_abc123');
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
deactivate: (id: string, options?: RequestOptions) => Promise<Tenant>;
|
|
613
|
+
/**
|
|
614
|
+
* Reactivate a previously deactivated tenant.
|
|
615
|
+
*
|
|
616
|
+
* Clears `deactivated_at`, restoring the tenant and its workspaces
|
|
617
|
+
* to the user's account. Only works on deactivated tenants.
|
|
618
|
+
*
|
|
619
|
+
* Only the tenant owner can reactivate.
|
|
620
|
+
*
|
|
621
|
+
* @param id - The UUID of the tenant to reactivate.
|
|
622
|
+
* @param options - Optional request options.
|
|
623
|
+
* @returns The updated tenant record.
|
|
624
|
+
*
|
|
625
|
+
* @example
|
|
626
|
+
* ```typescript
|
|
627
|
+
* await client.platform.tenants.reactivate('tenant_abc123');
|
|
628
|
+
* ```
|
|
629
|
+
*/
|
|
630
|
+
reactivate: (id: string, options?: RequestOptions) => Promise<Tenant>;
|
|
631
|
+
/**
|
|
632
|
+
* Create a new tenant (ISV provisioning flow).
|
|
633
|
+
*
|
|
634
|
+
* Provisions a new customer tenant under the current application.
|
|
635
|
+
* Typical attributes: `name`, `email`, `plan_id`. The platform
|
|
636
|
+
* automatically creates the tenant's default workspace and billing
|
|
637
|
+
* account upon creation.
|
|
638
|
+
*
|
|
639
|
+
* @param attributes - Tenant creation attributes. `name` and `email` are required.
|
|
640
|
+
* @param options - Optional request options.
|
|
641
|
+
* @returns The newly created `Tenant`.
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```typescript
|
|
645
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
646
|
+
* const tenant = await client.platform.tenants.create({
|
|
647
|
+
* name: 'Acme Medical Group',
|
|
648
|
+
* email: 'billing@acme-medical.com',
|
|
649
|
+
* plan_id: 'plan_professional',
|
|
650
|
+
* });
|
|
651
|
+
* console.log('Tenant provisioned:', tenant.id);
|
|
652
|
+
* ```
|
|
653
|
+
*/
|
|
654
|
+
create: (attributes: CreateTenantAttributes, options?: RequestOptions) => Promise<Tenant>;
|
|
655
|
+
/**
|
|
656
|
+
* Update a tenant's details.
|
|
657
|
+
*
|
|
658
|
+
* Use to update the tenant's name, contact email, plan assignment,
|
|
659
|
+
* or other configurable attributes.
|
|
660
|
+
*
|
|
661
|
+
* @param id - The UUID of the tenant to update.
|
|
662
|
+
* @param attributes - Attribute map of fields to change.
|
|
663
|
+
* @param options - Optional request options.
|
|
664
|
+
* @returns The updated `Tenant`.
|
|
665
|
+
*
|
|
666
|
+
* @example
|
|
667
|
+
* ```typescript
|
|
668
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
669
|
+
* const tenant = await client.platform.tenants.update('tenant_abc123', {
|
|
670
|
+
* name: 'Acme Medical Group LLC',
|
|
671
|
+
* });
|
|
672
|
+
* ```
|
|
673
|
+
*/
|
|
674
|
+
update: (id: string, attributes: UpdateTenantAttributes, options?: RequestOptions) => Promise<Tenant>;
|
|
675
|
+
/**
|
|
676
|
+
* Schedule a tenant for data purge.
|
|
677
|
+
*
|
|
678
|
+
* Marks the tenant for deferred deletion. The platform will retain
|
|
679
|
+
* data for a configurable grace period (for export purposes) before
|
|
680
|
+
* permanently purging all records. Use this for compliant off-boarding
|
|
681
|
+
* rather than immediate `delete`.
|
|
682
|
+
*
|
|
683
|
+
* @param id - The UUID of the tenant to schedule for purge.
|
|
684
|
+
* @param options - Optional request options.
|
|
685
|
+
* @returns The updated `Tenant` with `purge_scheduled_at` populated.
|
|
686
|
+
*
|
|
687
|
+
* @example
|
|
688
|
+
* ```typescript
|
|
689
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
690
|
+
* const tenant = await client.platform.tenants.schedulePurge('tenant_abc123');
|
|
691
|
+
* console.log('Purge scheduled for:', tenant.attributes?.purge_scheduled_at);
|
|
692
|
+
* ```
|
|
693
|
+
*/
|
|
694
|
+
schedulePurge: (id: string, options?: RequestOptions) => Promise<Tenant>;
|
|
695
|
+
/**
|
|
696
|
+
* Retrieve a single tenant by its ID.
|
|
697
|
+
*
|
|
698
|
+
* @param id - The UUID of the tenant.
|
|
699
|
+
* @param options - Optional request options.
|
|
700
|
+
* @returns The matching `Tenant`.
|
|
701
|
+
*
|
|
702
|
+
* @example
|
|
703
|
+
* ```typescript
|
|
704
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
705
|
+
* const tenant = await client.platform.tenants.get('tenant_abc123');
|
|
706
|
+
* console.log(tenant.attributes?.name, tenant.attributes?.plan_id);
|
|
707
|
+
* ```
|
|
708
|
+
*/
|
|
709
|
+
get: (id: string, options?: RequestOptions) => Promise<Tenant>;
|
|
710
|
+
/**
|
|
711
|
+
* Transfer ownership of a tenant to another admin member.
|
|
712
|
+
*
|
|
713
|
+
* The new owner must already be a tenant admin. The previous owner
|
|
714
|
+
* retains their admin role. Cannot be used on personal tenants.
|
|
715
|
+
*
|
|
716
|
+
* @param tenantId - The UUID of the tenant to transfer.
|
|
717
|
+
* @param newOwnerId - The UUID of the user to become the new owner.
|
|
718
|
+
* @param options - Optional request options.
|
|
719
|
+
* @returns The updated `Tenant`.
|
|
720
|
+
*/
|
|
721
|
+
transferOwnership: (tenantId: string, newOwnerId: string, options?: RequestOptions) => Promise<Tenant>;
|
|
722
|
+
/**
|
|
723
|
+
* Convert a personal tenant to an organization.
|
|
724
|
+
*
|
|
725
|
+
* Flips `is_personal` to `false`, sets a new name and slug, and
|
|
726
|
+
* provisions a default workspace if `application_id` is provided.
|
|
727
|
+
* Only the tenant owner can perform this action.
|
|
728
|
+
*
|
|
729
|
+
* @param tenantId - The UUID of the personal tenant to convert.
|
|
730
|
+
* @param attributes - Conversion attributes. `name` is required; `slug` and `application_id` are optional.
|
|
731
|
+
* @param options - Optional request options.
|
|
732
|
+
* @returns The converted `Tenant`.
|
|
733
|
+
*
|
|
734
|
+
* @example
|
|
735
|
+
* ```typescript
|
|
736
|
+
* const org = await client.platform.tenants.convertToOrg(tenantId, {
|
|
737
|
+
* name: "My Company",
|
|
738
|
+
* });
|
|
739
|
+
* console.log(org.is_personal); // false
|
|
740
|
+
* ```
|
|
741
|
+
*/
|
|
742
|
+
convertToOrg: (tenantId: string, attributes: {
|
|
743
|
+
name: string;
|
|
744
|
+
slug?: string;
|
|
745
|
+
application_id?: string;
|
|
746
|
+
}, options?: RequestOptions) => Promise<Tenant>;
|
|
747
|
+
/**
|
|
748
|
+
* Create a new organization tenant.
|
|
749
|
+
*
|
|
750
|
+
* Requires the application to have `allow_org_creation` enabled.
|
|
751
|
+
* Provisions a workspace, billing accounts, and storage for the new org.
|
|
752
|
+
*
|
|
753
|
+
* @param attributes - Org creation attributes. `name` is required.
|
|
754
|
+
* @param options - Optional request options.
|
|
755
|
+
* @returns The newly created organization `Tenant`.
|
|
756
|
+
*/
|
|
757
|
+
createOrg: (attributes: {
|
|
758
|
+
name: string;
|
|
759
|
+
logo_url?: string;
|
|
760
|
+
[key: string]: unknown;
|
|
761
|
+
}, options?: RequestOptions) => Promise<Tenant>;
|
|
762
|
+
/**
|
|
763
|
+
* Create a personal tenant for the current user.
|
|
764
|
+
*
|
|
765
|
+
* Each user may have at most one personal tenant. Name and slug are
|
|
766
|
+
* auto-generated from the user's email.
|
|
767
|
+
*
|
|
768
|
+
* @param options - Optional request options.
|
|
769
|
+
* @returns The newly created personal `Tenant`.
|
|
770
|
+
*/
|
|
771
|
+
createPersonal: (options?: RequestOptions) => Promise<Tenant>;
|
|
772
|
+
};
|
|
773
|
+
/**
|
|
774
|
+
* Invitations — workspace and application invitations for the current user.
|
|
775
|
+
*/
|
|
776
|
+
invitations: {
|
|
777
|
+
/**
|
|
778
|
+
* Accept a pending invitation (authenticated user flow).
|
|
779
|
+
*
|
|
780
|
+
* Accepts an invitation the current user received, creating
|
|
781
|
+
* the appropriate membership records.
|
|
782
|
+
*
|
|
783
|
+
* @param id - The UUID of the invitation to accept.
|
|
784
|
+
* @param options - Optional request options.
|
|
785
|
+
* @returns The updated `Invitation`.
|
|
786
|
+
*/
|
|
787
|
+
accept: (id: string, token: string, options?: RequestOptions) => Promise<Invitation>;
|
|
788
|
+
/**
|
|
789
|
+
* Decline a pending invitation.
|
|
790
|
+
*
|
|
791
|
+
* The invitation status is set to `:declined` and no membership is created.
|
|
792
|
+
*
|
|
793
|
+
* @param id - The UUID of the invitation to decline.
|
|
794
|
+
* @param options - Optional request options.
|
|
795
|
+
* @returns The updated `Invitation`.
|
|
796
|
+
*/
|
|
797
|
+
decline: (id: string, options?: RequestOptions) => Promise<Invitation>;
|
|
798
|
+
/**
|
|
799
|
+
* Revoke a pending invitation (inviter flow).
|
|
800
|
+
*
|
|
801
|
+
* Cancels the invitation so it can no longer be accepted or declined.
|
|
802
|
+
* Callable by the original inviter or a tenant admin.
|
|
803
|
+
*
|
|
804
|
+
* @param id - The UUID of the invitation to revoke.
|
|
805
|
+
* @param options - Optional request options.
|
|
806
|
+
* @returns The updated `Invitation`.
|
|
807
|
+
*/
|
|
808
|
+
revoke: (id: string, options?: RequestOptions) => Promise<Invitation>;
|
|
809
|
+
/**
|
|
810
|
+
* List pending invitations for the currently authenticated user (paginated).
|
|
811
|
+
*
|
|
812
|
+
* Returns workspace and application invitations that have been sent to
|
|
813
|
+
* the current user and are awaiting a response.
|
|
814
|
+
*
|
|
815
|
+
* @param options - Optional page number, page size, and request options.
|
|
816
|
+
* @returns A page of `Invitation` records for the current user.
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* ```typescript
|
|
820
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
821
|
+
* const invites = await client.platform.invitations.listMe();
|
|
822
|
+
* invites.forEach(i => console.log(i.attributes?.workspace_name, i.attributes?.role));
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
listMe: (options?: {
|
|
826
|
+
page?: number;
|
|
827
|
+
pageSize?: number;
|
|
828
|
+
} & RequestOptions) => Promise<Invitation[]>;
|
|
829
|
+
/**
|
|
830
|
+
* List all pending invitations for the current user, auto-paginating.
|
|
831
|
+
*
|
|
832
|
+
* @param options - Optional request options.
|
|
833
|
+
* @returns All pending `Invitation` records as a flat array.
|
|
834
|
+
*
|
|
835
|
+
* @example
|
|
836
|
+
* ```typescript
|
|
837
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
838
|
+
* const allInvites = await client.platform.invitations.listAllMe();
|
|
839
|
+
* ```
|
|
840
|
+
*/
|
|
841
|
+
listAllMe: (options?: RequestOptions) => Promise<Invitation[]>;
|
|
842
|
+
/**
|
|
843
|
+
* Send a workspace invitation to a user.
|
|
844
|
+
*
|
|
845
|
+
* Creates and dispatches an invitation email. Typical attributes:
|
|
846
|
+
* `email` (recipient), `workspace_id`, and `role`
|
|
847
|
+
* (e.g., `"member"`, `"admin"`).
|
|
848
|
+
*
|
|
849
|
+
* @param attributes - Invitation attributes. `email` and `workspace_id`
|
|
850
|
+
* are required.
|
|
851
|
+
* @param options - Optional request options.
|
|
852
|
+
* @returns The newly created `Invitation` record.
|
|
853
|
+
*
|
|
854
|
+
* @example
|
|
855
|
+
* ```typescript
|
|
856
|
+
* // Using workspace_id shorthand (recommended):
|
|
857
|
+
* const invite = await client.platform.invitations.create({
|
|
858
|
+
* email: 'new.clinician@hospital.org',
|
|
859
|
+
* workspace_id: 'ws_abc123',
|
|
860
|
+
* role: 'member',
|
|
861
|
+
* });
|
|
862
|
+
*
|
|
863
|
+
* // Using explicit scope_type + scope_id:
|
|
864
|
+
* const invite2 = await client.platform.invitations.create({
|
|
865
|
+
* email: 'admin@hospital.org',
|
|
866
|
+
* scope_type: 'tenant',
|
|
867
|
+
* scope_id: tenantId,
|
|
868
|
+
* role: 'admin',
|
|
869
|
+
* });
|
|
870
|
+
* ```
|
|
871
|
+
*/
|
|
872
|
+
create: (attributes: CreateInvitationAttributes, options?: RequestOptions) => Promise<Invitation>;
|
|
873
|
+
/**
|
|
874
|
+
* Resend an invitation email with a refreshed token and new 7-day expiry.
|
|
875
|
+
*
|
|
876
|
+
* Only pending invitations can be resent. Generates a new token (invalidating
|
|
877
|
+
* the old one) and re-sends the invitation email. Callable by the original
|
|
878
|
+
* inviter or the tenant owner.
|
|
879
|
+
*
|
|
880
|
+
* @param id - The UUID of the invitation to resend.
|
|
881
|
+
* @param options - Optional request options.
|
|
882
|
+
* @returns The updated `Invitation`.
|
|
883
|
+
*
|
|
884
|
+
* @example
|
|
885
|
+
* ```typescript
|
|
886
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
887
|
+
* await client.platform.invitations.resend('inv_abc123');
|
|
888
|
+
* ```
|
|
889
|
+
*/
|
|
890
|
+
resend: (id: string, applicationId?: string, options?: RequestOptions) => Promise<Invitation>;
|
|
891
|
+
/**
|
|
892
|
+
* List invitations visible to the current actor.
|
|
893
|
+
*
|
|
894
|
+
* Returns invitations where the actor is the inviter, the tenant owner,
|
|
895
|
+
* or the recipient (matched by email). Use this to build admin views
|
|
896
|
+
* of pending/accepted invitations for a tenant or workspace.
|
|
897
|
+
*
|
|
898
|
+
* @param options - Optional page number, page size, and request options.
|
|
899
|
+
* @returns A page of `Invitation` records.
|
|
900
|
+
*
|
|
901
|
+
* @example
|
|
902
|
+
* ```typescript
|
|
903
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
904
|
+
* const invites = await client.platform.invitations.list();
|
|
905
|
+
* ```
|
|
906
|
+
*/
|
|
907
|
+
list: (options?: {
|
|
908
|
+
page?: number;
|
|
909
|
+
pageSize?: number;
|
|
910
|
+
} & RequestOptions) => Promise<Invitation[]>;
|
|
911
|
+
/**
|
|
912
|
+
* List all invitations visible to the current actor, auto-paginating.
|
|
913
|
+
*
|
|
914
|
+
* @param options - Optional request options.
|
|
915
|
+
* @returns All visible `Invitation` records as a flat array.
|
|
916
|
+
*
|
|
917
|
+
* @example
|
|
918
|
+
* ```typescript
|
|
919
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
920
|
+
* const all = await client.platform.invitations.listAll();
|
|
921
|
+
* ```
|
|
922
|
+
*/
|
|
923
|
+
listAll: (options?: RequestOptions) => Promise<Invitation[]>;
|
|
924
|
+
/**
|
|
925
|
+
* Look up a pending invitation by its raw token.
|
|
926
|
+
*
|
|
927
|
+
* Call this on the `/invite/:token` landing page to display invitation
|
|
928
|
+
* details before the user accepts. Returns the full invitation record
|
|
929
|
+
* including `email` (to pre-fill the register form), `role`, `scope_type`,
|
|
930
|
+
* `scope_id`, `tenant_id`, `expires_at`, and the `inviter` relationship
|
|
931
|
+
* (pass `include=inviter` via request options to embed inviter email).
|
|
932
|
+
*
|
|
933
|
+
* Returns `null` if the token is invalid, already used, or expired —
|
|
934
|
+
* there is no partial response for consumed tokens.
|
|
935
|
+
*
|
|
936
|
+
* **Note:** The response does not include the workspace or tenant name.
|
|
937
|
+
* Fetch it separately using `platform.workspaces.get(scope_id)` or
|
|
938
|
+
* `platform.tenants.get(scope_id)` based on `scope_type`.
|
|
939
|
+
*
|
|
940
|
+
* @param token - The raw invitation token from the email link (`/invite/:token`).
|
|
941
|
+
* @param options - Optional request options (e.g., `{ headers: { include: 'inviter' } }`).
|
|
942
|
+
* @returns The pending `Invitation` record, or `null` if not found.
|
|
943
|
+
*
|
|
944
|
+
* @example
|
|
945
|
+
* ```typescript
|
|
946
|
+
* // On your /invite/:token page
|
|
947
|
+
* const invite = await client.platform.invitations.consumeByToken(token);
|
|
948
|
+
* if (!invite) {
|
|
949
|
+
* // Token expired or already used
|
|
950
|
+
* return redirect('/invite/expired');
|
|
951
|
+
* }
|
|
952
|
+
* // Pre-fill form
|
|
953
|
+
* setEmail(invite.attributes?.email);
|
|
954
|
+
* setRole(invite.attributes?.role);
|
|
955
|
+
* ```
|
|
956
|
+
*/
|
|
957
|
+
consumeByToken: (token: string, options?: RequestOptions) => Promise<Invitation | null>;
|
|
958
|
+
/**
|
|
959
|
+
* Accept a pending invitation using only the raw token.
|
|
960
|
+
*
|
|
961
|
+
* Call this after the user is authenticated (either via `registerViaInvitation`
|
|
962
|
+
* or an existing account login). The platform validates the token, creates or
|
|
963
|
+
* upgrades the user's `TenantMembership` and `WorkspaceMembership`, and returns
|
|
964
|
+
* the accepted invitation.
|
|
965
|
+
*
|
|
966
|
+
* For new users: `registerViaInvitation` accepts the invitation atomically —
|
|
967
|
+
* do NOT call `acceptByToken` again after registration. Only call this for
|
|
968
|
+
* existing users accepting a new invite after sign-in.
|
|
969
|
+
*
|
|
970
|
+
* @param token - The raw invitation token from the email link.
|
|
971
|
+
* @param options - Optional request options.
|
|
972
|
+
* @returns The accepted `Invitation` with `scope_id` and `tenant_id` populated.
|
|
973
|
+
*
|
|
974
|
+
* @example
|
|
975
|
+
* ```typescript
|
|
976
|
+
* // Existing user accepting an invite after login
|
|
977
|
+
* const accepted = await client.platform.invitations.acceptByToken(token);
|
|
978
|
+
* const workspaceId = accepted.attributes?.scope_type === 'workspace'
|
|
979
|
+
* ? accepted.attributes?.scope_id
|
|
980
|
+
* : null;
|
|
981
|
+
* const tenantId = accepted.attributes?.tenant_id;
|
|
982
|
+
* ```
|
|
983
|
+
*/
|
|
984
|
+
acceptByToken: (token: string, options?: RequestOptions) => Promise<Invitation>;
|
|
985
|
+
};
|
|
986
|
+
/**
|
|
987
|
+
* Roles — named permission bundles for workspace access control.
|
|
988
|
+
*
|
|
989
|
+
* Access via `client.platform.roles`.
|
|
990
|
+
*/
|
|
991
|
+
roles: {
|
|
992
|
+
/**
|
|
993
|
+
* List all roles for the current application.
|
|
994
|
+
*
|
|
995
|
+
* @returns Paginated list of roles
|
|
996
|
+
* @example
|
|
997
|
+
* const roles = await client.platform.roles.list();
|
|
998
|
+
*/
|
|
999
|
+
list: () => Promise<{
|
|
1000
|
+
data?: Array<Role>;
|
|
1001
|
+
}>;
|
|
1002
|
+
/**
|
|
1003
|
+
* Create a new role with a set of permissions.
|
|
1004
|
+
*
|
|
1005
|
+
* @param name - Human-readable role name
|
|
1006
|
+
* @param permissions - List of permission strings (e.g. "extract:document:read:all")
|
|
1007
|
+
* @returns The created role
|
|
1008
|
+
* @example
|
|
1009
|
+
* const role = await client.platform.roles.create("Editor", ["extract:document:read:all"]);
|
|
1010
|
+
*/
|
|
1011
|
+
create: (name: string, permissions: string[]) => Promise<{
|
|
1012
|
+
data?: Role;
|
|
1013
|
+
}>;
|
|
1014
|
+
/**
|
|
1015
|
+
* Update an existing role.
|
|
1016
|
+
*
|
|
1017
|
+
* @param id - Role UUID
|
|
1018
|
+
* @param attributes - Attributes to update (name, permissions)
|
|
1019
|
+
* @returns The updated role
|
|
1020
|
+
* @example
|
|
1021
|
+
* const updated = await client.platform.roles.update("role-uuid", { name: "Senior Editor" });
|
|
1022
|
+
*/
|
|
1023
|
+
update: (id: string, attributes: Partial<{
|
|
1024
|
+
name: string;
|
|
1025
|
+
permissions: string[];
|
|
1026
|
+
}>) => Promise<{
|
|
1027
|
+
data?: Role;
|
|
1028
|
+
}>;
|
|
1029
|
+
/**
|
|
1030
|
+
* Delete a role.
|
|
1031
|
+
*
|
|
1032
|
+
* @param id - Role UUID
|
|
1033
|
+
* @example
|
|
1034
|
+
* await client.platform.roles.destroy("role-uuid");
|
|
1035
|
+
*/
|
|
1036
|
+
destroy: (id: string) => Promise<void>;
|
|
1037
|
+
};
|
|
1038
|
+
/**
|
|
1039
|
+
* Permissions — permission registry, presets, and metadata.
|
|
1040
|
+
*
|
|
1041
|
+
* Access via `client.platform.permissions`.
|
|
1042
|
+
*/
|
|
1043
|
+
permissions: {
|
|
1044
|
+
/**
|
|
1045
|
+
* List all available permissions for the current application context.
|
|
1046
|
+
*
|
|
1047
|
+
* @param params - Optional filter parameters (context, app, category)
|
|
1048
|
+
* @returns List of permissions
|
|
1049
|
+
* @example
|
|
1050
|
+
* const perms = await client.platform.permissions.list();
|
|
1051
|
+
*/
|
|
1052
|
+
list: (params?: Record<string, string>) => Promise<{
|
|
1053
|
+
data?: Array<Permission>;
|
|
1054
|
+
}>;
|
|
1055
|
+
/**
|
|
1056
|
+
* Get a single permission by ID.
|
|
1057
|
+
*
|
|
1058
|
+
* @param id - Permission ID string
|
|
1059
|
+
* @returns The permission record
|
|
1060
|
+
* @example
|
|
1061
|
+
* const perm = await client.platform.permissions.get("extract:document:read:all");
|
|
1062
|
+
*/
|
|
1063
|
+
get: (id: string) => Promise<{
|
|
1064
|
+
data?: Permission;
|
|
1065
|
+
}>;
|
|
1066
|
+
/**
|
|
1067
|
+
* Get permission metadata (available contexts, apps, and categories).
|
|
1068
|
+
*
|
|
1069
|
+
* @returns Permission metadata
|
|
1070
|
+
* @example
|
|
1071
|
+
* const meta = await client.platform.permissions.meta();
|
|
1072
|
+
*/
|
|
1073
|
+
meta: () => Promise<unknown>;
|
|
1074
|
+
/**
|
|
1075
|
+
* Permission presets — pre-built permission sets per role type.
|
|
1076
|
+
*/
|
|
1077
|
+
presets: {
|
|
1078
|
+
/**
|
|
1079
|
+
* List all permission presets, optionally filtered by context or app.
|
|
1080
|
+
*
|
|
1081
|
+
* @param params - Optional filter parameters (context, app)
|
|
1082
|
+
* @returns List of permission presets
|
|
1083
|
+
* @example
|
|
1084
|
+
* const presets = await client.platform.permissions.presets.list({ context: "workspace" });
|
|
1085
|
+
*/
|
|
1086
|
+
list: (params?: Record<string, string>) => Promise<{
|
|
1087
|
+
data?: Array<PermissionPreset>;
|
|
1088
|
+
}>;
|
|
1089
|
+
/**
|
|
1090
|
+
* Get a single permission preset by ID.
|
|
1091
|
+
*
|
|
1092
|
+
* @param id - Preset ID string
|
|
1093
|
+
* @returns The permission preset
|
|
1094
|
+
* @example
|
|
1095
|
+
* const preset = await client.platform.permissions.presets.get("workspace_editor");
|
|
1096
|
+
*/
|
|
1097
|
+
get: (id: string) => Promise<{
|
|
1098
|
+
data?: PermissionPreset;
|
|
1099
|
+
}>;
|
|
1100
|
+
};
|
|
1101
|
+
};
|
|
1102
|
+
/**
|
|
1103
|
+
* Brand Identities — visual branding configuration for tenants and workspaces.
|
|
1104
|
+
*
|
|
1105
|
+
* Brand identities define the visual appearance (colors, logos, fonts) applied
|
|
1106
|
+
* to tenant or workspace experiences. Each brand identity can be scoped to a
|
|
1107
|
+
* tenant or workspace, and one can be marked as the default at each scope level.
|
|
1108
|
+
*
|
|
1109
|
+
* Access via `client.platform.brandIdentities`.
|
|
1110
|
+
*/
|
|
1111
|
+
brandIdentities: {
|
|
1112
|
+
/**
|
|
1113
|
+
* List all brand identities accessible to the current actor.
|
|
1114
|
+
*
|
|
1115
|
+
* @param options - Optional page number, page size, and request options.
|
|
1116
|
+
* @returns A page of `BrandIdentity` records.
|
|
1117
|
+
*
|
|
1118
|
+
* @example
|
|
1119
|
+
* ```typescript
|
|
1120
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1121
|
+
* const brands = await client.platform.brandIdentities.list();
|
|
1122
|
+
* brands.forEach(b => console.log(b.attributes?.name));
|
|
1123
|
+
* ```
|
|
1124
|
+
*/
|
|
1125
|
+
list: (options?: {
|
|
1126
|
+
page?: number;
|
|
1127
|
+
pageSize?: number;
|
|
1128
|
+
} & RequestOptions) => Promise<BrandIdentity[]>;
|
|
1129
|
+
/**
|
|
1130
|
+
* Retrieve a single brand identity by its ID.
|
|
1131
|
+
*
|
|
1132
|
+
* @param id - The UUID of the brand identity.
|
|
1133
|
+
* @param options - Optional request options.
|
|
1134
|
+
* @returns The matching `BrandIdentity`.
|
|
1135
|
+
*
|
|
1136
|
+
* @example
|
|
1137
|
+
* ```typescript
|
|
1138
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1139
|
+
* const brand = await client.platform.brandIdentities.get('bi_abc123');
|
|
1140
|
+
* console.log(brand.attributes?.name, brand.attributes?.primary_color);
|
|
1141
|
+
* ```
|
|
1142
|
+
*/
|
|
1143
|
+
get: (id: string, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1144
|
+
/**
|
|
1145
|
+
* Create a new brand identity.
|
|
1146
|
+
*
|
|
1147
|
+
* Defines visual branding (colors, logos, fonts) scoped to a tenant or
|
|
1148
|
+
* workspace. Pass `tenant_id` or `workspace_id` to set the scope.
|
|
1149
|
+
*
|
|
1150
|
+
* @param attributes - Brand identity creation attributes. `name` is required.
|
|
1151
|
+
* @param options - Optional request options.
|
|
1152
|
+
* @returns The newly created `BrandIdentity`.
|
|
1153
|
+
*
|
|
1154
|
+
* @example
|
|
1155
|
+
* ```typescript
|
|
1156
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1157
|
+
* const brand = await client.platform.brandIdentities.create({
|
|
1158
|
+
* name: 'Acme Healthcare',
|
|
1159
|
+
* primary_color: '#2563eb',
|
|
1160
|
+
* font_family: 'Inter',
|
|
1161
|
+
* tenant_id: 'tenant_abc123',
|
|
1162
|
+
* });
|
|
1163
|
+
* console.log(brand.id);
|
|
1164
|
+
* ```
|
|
1165
|
+
*/
|
|
1166
|
+
create: (attributes: CreateBrandIdentityAttributes, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1167
|
+
/**
|
|
1168
|
+
* Update a brand identity's attributes.
|
|
1169
|
+
*
|
|
1170
|
+
* @param id - The UUID of the brand identity to update.
|
|
1171
|
+
* @param attributes - Attribute map of fields to change.
|
|
1172
|
+
* @param options - Optional request options.
|
|
1173
|
+
* @returns The updated `BrandIdentity`.
|
|
1174
|
+
*
|
|
1175
|
+
* @example
|
|
1176
|
+
* ```typescript
|
|
1177
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1178
|
+
* const brand = await client.platform.brandIdentities.update('bi_abc123', {
|
|
1179
|
+
* primary_color: '#dc2626',
|
|
1180
|
+
* tagline: 'Caring for you',
|
|
1181
|
+
* });
|
|
1182
|
+
* ```
|
|
1183
|
+
*/
|
|
1184
|
+
update: (id: string, attributes: UpdateBrandIdentityAttributes, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1185
|
+
/**
|
|
1186
|
+
* Delete a brand identity.
|
|
1187
|
+
*
|
|
1188
|
+
* Permanently removes the brand identity. Any platform tones associated
|
|
1189
|
+
* with this brand identity should be deleted or reassigned first.
|
|
1190
|
+
*
|
|
1191
|
+
* @param id - The UUID of the brand identity to delete.
|
|
1192
|
+
* @param options - Optional request options.
|
|
1193
|
+
* @returns `true` on successful deletion.
|
|
1194
|
+
*
|
|
1195
|
+
* @example
|
|
1196
|
+
* ```typescript
|
|
1197
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1198
|
+
* await client.platform.brandIdentities.delete('bi_abc123');
|
|
1199
|
+
* ```
|
|
1200
|
+
*/
|
|
1201
|
+
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
1202
|
+
/**
|
|
1203
|
+
* List brand identities scoped to a specific tenant.
|
|
1204
|
+
*
|
|
1205
|
+
* @param tenantId - The UUID of the tenant.
|
|
1206
|
+
* @param options - Optional page number, page size, and request options.
|
|
1207
|
+
* @returns A page of `BrandIdentity` records for the tenant.
|
|
1208
|
+
*
|
|
1209
|
+
* @example
|
|
1210
|
+
* ```typescript
|
|
1211
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1212
|
+
* const brands = await client.platform.brandIdentities.listByTenant('tenant_abc123');
|
|
1213
|
+
* ```
|
|
1214
|
+
*/
|
|
1215
|
+
listByTenant: (tenantId: string, options?: {
|
|
1216
|
+
page?: number;
|
|
1217
|
+
pageSize?: number;
|
|
1218
|
+
} & RequestOptions) => Promise<BrandIdentity[]>;
|
|
1219
|
+
/**
|
|
1220
|
+
* List brand identities scoped to a specific workspace.
|
|
1221
|
+
*
|
|
1222
|
+
* @param workspaceId - The UUID of the workspace.
|
|
1223
|
+
* @param options - Optional page number, page size, and request options.
|
|
1224
|
+
* @returns A page of `BrandIdentity` records for the workspace.
|
|
1225
|
+
*
|
|
1226
|
+
* @example
|
|
1227
|
+
* ```typescript
|
|
1228
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1229
|
+
* const brands = await client.platform.brandIdentities.listByWorkspace('ws_abc123');
|
|
1230
|
+
* ```
|
|
1231
|
+
*/
|
|
1232
|
+
listByWorkspace: (workspaceId: string, options?: {
|
|
1233
|
+
page?: number;
|
|
1234
|
+
pageSize?: number;
|
|
1235
|
+
} & RequestOptions) => Promise<BrandIdentity[]>;
|
|
1236
|
+
/**
|
|
1237
|
+
* Get the default brand identity for a tenant.
|
|
1238
|
+
*
|
|
1239
|
+
* Returns the brand identity marked as default for the given tenant,
|
|
1240
|
+
* or throws if none is set.
|
|
1241
|
+
*
|
|
1242
|
+
* @param tenantId - The UUID of the tenant.
|
|
1243
|
+
* @param options - Optional request options.
|
|
1244
|
+
* @returns The default `BrandIdentity` for the tenant.
|
|
1245
|
+
*
|
|
1246
|
+
* @example
|
|
1247
|
+
* ```typescript
|
|
1248
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1249
|
+
* const defaultBrand = await client.platform.brandIdentities.getDefaultForTenant('tenant_abc123');
|
|
1250
|
+
* console.log(defaultBrand.attributes?.name);
|
|
1251
|
+
* ```
|
|
1252
|
+
*/
|
|
1253
|
+
getDefaultForTenant: (tenantId: string, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1254
|
+
/**
|
|
1255
|
+
* Get the default brand identity for a workspace.
|
|
1256
|
+
*
|
|
1257
|
+
* Returns the brand identity marked as default for the given workspace,
|
|
1258
|
+
* or throws if none is set.
|
|
1259
|
+
*
|
|
1260
|
+
* @param workspaceId - The UUID of the workspace.
|
|
1261
|
+
* @param options - Optional request options.
|
|
1262
|
+
* @returns The default `BrandIdentity` for the workspace.
|
|
1263
|
+
*
|
|
1264
|
+
* @example
|
|
1265
|
+
* ```typescript
|
|
1266
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1267
|
+
* const defaultBrand = await client.platform.brandIdentities.getDefaultForWorkspace('ws_abc123');
|
|
1268
|
+
* console.log(defaultBrand.attributes?.name);
|
|
1269
|
+
* ```
|
|
1270
|
+
*/
|
|
1271
|
+
getDefaultForWorkspace: (workspaceId: string, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1272
|
+
/**
|
|
1273
|
+
* Mark a brand identity as the default for its scope (tenant or workspace).
|
|
1274
|
+
*
|
|
1275
|
+
* If another brand identity was previously the default at this scope,
|
|
1276
|
+
* it is automatically unset.
|
|
1277
|
+
*
|
|
1278
|
+
* @param id - The UUID of the brand identity to set as default.
|
|
1279
|
+
* @param options - Optional request options.
|
|
1280
|
+
* @returns The updated `BrandIdentity` with `is_default` set to `true`.
|
|
1281
|
+
*
|
|
1282
|
+
* @example
|
|
1283
|
+
* ```typescript
|
|
1284
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1285
|
+
* const brand = await client.platform.brandIdentities.setDefault('bi_abc123');
|
|
1286
|
+
* console.log(brand.attributes?.is_default); // true
|
|
1287
|
+
* ```
|
|
1288
|
+
*/
|
|
1289
|
+
setDefault: (id: string, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Remove the default status from a brand identity.
|
|
1292
|
+
*
|
|
1293
|
+
* After this call, the scope (tenant or workspace) will have no default
|
|
1294
|
+
* brand identity until another is explicitly set.
|
|
1295
|
+
*
|
|
1296
|
+
* @param id - The UUID of the brand identity to unset as default.
|
|
1297
|
+
* @param options - Optional request options.
|
|
1298
|
+
* @returns The updated `BrandIdentity` with `is_default` set to `false`.
|
|
1299
|
+
*
|
|
1300
|
+
* @example
|
|
1301
|
+
* ```typescript
|
|
1302
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1303
|
+
* const brand = await client.platform.brandIdentities.unsetDefault('bi_abc123');
|
|
1304
|
+
* console.log(brand.attributes?.is_default); // false
|
|
1305
|
+
* ```
|
|
1306
|
+
*/
|
|
1307
|
+
unsetDefault: (id: string, options?: RequestOptions) => Promise<BrandIdentity>;
|
|
1308
|
+
};
|
|
1309
|
+
/**
|
|
1310
|
+
* Platform Tones — communication tone and style configuration.
|
|
1311
|
+
*
|
|
1312
|
+
* Platform tones define the voice, formality, and vocabulary preferences
|
|
1313
|
+
* used by AI-generated content within a brand identity context. Each tone
|
|
1314
|
+
* is associated with a brand identity and can be used to customize how
|
|
1315
|
+
* the platform communicates on behalf of the brand.
|
|
1316
|
+
*
|
|
1317
|
+
* Access via `client.platform.platformTones`.
|
|
1318
|
+
*/
|
|
1319
|
+
platformTones: {
|
|
1320
|
+
/**
|
|
1321
|
+
* List all platform tones accessible to the current actor.
|
|
1322
|
+
*
|
|
1323
|
+
* @param options - Optional page number, page size, and request options.
|
|
1324
|
+
* @returns A page of `PlatformTone` records.
|
|
1325
|
+
*
|
|
1326
|
+
* @example
|
|
1327
|
+
* ```typescript
|
|
1328
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1329
|
+
* const tones = await client.platform.platformTones.list();
|
|
1330
|
+
* tones.forEach(t => console.log(t.attributes?.name));
|
|
1331
|
+
* ```
|
|
1332
|
+
*/
|
|
1333
|
+
list: (options?: {
|
|
1334
|
+
page?: number;
|
|
1335
|
+
pageSize?: number;
|
|
1336
|
+
} & RequestOptions) => Promise<PlatformTone[]>;
|
|
1337
|
+
/**
|
|
1338
|
+
* Retrieve a single platform tone by its ID.
|
|
1339
|
+
*
|
|
1340
|
+
* @param id - The UUID of the platform tone.
|
|
1341
|
+
* @param options - Optional request options.
|
|
1342
|
+
* @returns The matching `PlatformTone`.
|
|
1343
|
+
*
|
|
1344
|
+
* @example
|
|
1345
|
+
* ```typescript
|
|
1346
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1347
|
+
* const tone = await client.platform.platformTones.get('pt_abc123');
|
|
1348
|
+
* console.log(tone.attributes?.name, tone.attributes?.formality_level);
|
|
1349
|
+
* ```
|
|
1350
|
+
*/
|
|
1351
|
+
get: (id: string, options?: RequestOptions) => Promise<PlatformTone>;
|
|
1352
|
+
/**
|
|
1353
|
+
* Create a new platform tone.
|
|
1354
|
+
*
|
|
1355
|
+
* Defines tone and style preferences for AI-generated content within
|
|
1356
|
+
* the context of a brand identity. `brand_identity_id` is required to
|
|
1357
|
+
* associate the tone with the correct brand.
|
|
1358
|
+
*
|
|
1359
|
+
* @param attributes - Platform tone creation attributes. `name` and `brand_identity_id` are required.
|
|
1360
|
+
* @param options - Optional request options.
|
|
1361
|
+
* @returns The newly created `PlatformTone`.
|
|
1362
|
+
*
|
|
1363
|
+
* @example
|
|
1364
|
+
* ```typescript
|
|
1365
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1366
|
+
* const tone = await client.platform.platformTones.create({
|
|
1367
|
+
* name: 'Professional',
|
|
1368
|
+
* brand_identity_id: 'bi_abc123',
|
|
1369
|
+
* formality_level: 'formal',
|
|
1370
|
+
* tone_style: 'authoritative',
|
|
1371
|
+
* });
|
|
1372
|
+
* console.log(tone.id);
|
|
1373
|
+
* ```
|
|
1374
|
+
*/
|
|
1375
|
+
create: (attributes: CreatePlatformToneAttributes, options?: RequestOptions) => Promise<PlatformTone>;
|
|
1376
|
+
/**
|
|
1377
|
+
* Update a platform tone's attributes.
|
|
1378
|
+
*
|
|
1379
|
+
* @param id - The UUID of the platform tone to update.
|
|
1380
|
+
* @param attributes - Attribute map of fields to change.
|
|
1381
|
+
* @param options - Optional request options.
|
|
1382
|
+
* @returns The updated `PlatformTone`.
|
|
1383
|
+
*
|
|
1384
|
+
* @example
|
|
1385
|
+
* ```typescript
|
|
1386
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1387
|
+
* const tone = await client.platform.platformTones.update('pt_abc123', {
|
|
1388
|
+
* formality_level: 'casual',
|
|
1389
|
+
* tone_style: 'friendly',
|
|
1390
|
+
* });
|
|
1391
|
+
* ```
|
|
1392
|
+
*/
|
|
1393
|
+
update: (id: string, attributes: UpdatePlatformToneAttributes, options?: RequestOptions) => Promise<PlatformTone>;
|
|
1394
|
+
/**
|
|
1395
|
+
* Delete a platform tone.
|
|
1396
|
+
*
|
|
1397
|
+
* Permanently removes the platform tone.
|
|
1398
|
+
*
|
|
1399
|
+
* @param id - The UUID of the platform tone to delete.
|
|
1400
|
+
* @param options - Optional request options.
|
|
1401
|
+
* @returns `true` on successful deletion.
|
|
1402
|
+
*
|
|
1403
|
+
* @example
|
|
1404
|
+
* ```typescript
|
|
1405
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1406
|
+
* await client.platform.platformTones.delete('pt_abc123');
|
|
1407
|
+
* ```
|
|
1408
|
+
*/
|
|
1409
|
+
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
1410
|
+
/**
|
|
1411
|
+
* List platform tones associated with a specific brand identity.
|
|
1412
|
+
*
|
|
1413
|
+
* @param brandIdentityId - The UUID of the brand identity.
|
|
1414
|
+
* @param options - Optional page number, page size, and request options.
|
|
1415
|
+
* @returns A page of `PlatformTone` records for the brand.
|
|
1416
|
+
*
|
|
1417
|
+
* @example
|
|
1418
|
+
* ```typescript
|
|
1419
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
1420
|
+
* const tones = await client.platform.platformTones.listByBrand('bi_abc123');
|
|
1421
|
+
* tones.forEach(t => console.log(t.attributes?.name));
|
|
1422
|
+
* ```
|
|
1423
|
+
*/
|
|
1424
|
+
listByBrand: (brandIdentityId: string, options?: {
|
|
1425
|
+
page?: number;
|
|
1426
|
+
pageSize?: number;
|
|
1427
|
+
} & RequestOptions) => Promise<PlatformTone[]>;
|
|
1428
|
+
};
|
|
1429
|
+
};
|
|
1430
|
+
//# sourceMappingURL=platform.d.ts.map
|