@gpt-platform/client 0.8.2 → 0.8.4
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/index.d.mts +266 -16
- package/dist/index.d.ts +266 -16
- package/dist/index.js +337 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +337 -18
- package/dist/index.mjs.map +1 -1
- package/llms.txt +8 -0
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1269,7 +1269,7 @@ function buildUserAgent(sdkVersion, appInfo) {
|
|
|
1269
1269
|
}
|
|
1270
1270
|
|
|
1271
1271
|
// src/version.ts
|
|
1272
|
-
var SDK_VERSION = "0.8.
|
|
1272
|
+
var SDK_VERSION = "0.8.4";
|
|
1273
1273
|
var DEFAULT_API_VERSION = "2026-03-11";
|
|
1274
1274
|
|
|
1275
1275
|
// src/base-client.ts
|
|
@@ -1540,6 +1540,36 @@ var BaseClient = class {
|
|
|
1540
1540
|
clearToken() {
|
|
1541
1541
|
this.config = { ...this.config, token: void 0 };
|
|
1542
1542
|
}
|
|
1543
|
+
/**
|
|
1544
|
+
* Switch the workspace context for all subsequent requests.
|
|
1545
|
+
*
|
|
1546
|
+
* Sets the `workspace_id` query parameter appended to every request.
|
|
1547
|
+
* Use this after creating a new workspace or switching workspace context
|
|
1548
|
+
* without constructing a new client instance.
|
|
1549
|
+
*
|
|
1550
|
+
* @param workspaceId - The workspace UUID to scope requests to, or
|
|
1551
|
+
* `undefined` to clear workspace scoping.
|
|
1552
|
+
*
|
|
1553
|
+
* @example
|
|
1554
|
+
* ```typescript
|
|
1555
|
+
* const org = await sdk.platform.tenants.createOrg({ name: 'Acme' });
|
|
1556
|
+
* const workspaces = await sdk.platform.workspaces.mine();
|
|
1557
|
+
* const ws = workspaces.find(w => w.tenant_id === org.id);
|
|
1558
|
+
*
|
|
1559
|
+
* sdk.setWorkspaceId(ws.id);
|
|
1560
|
+
* // All subsequent calls are scoped to the new workspace
|
|
1561
|
+
* await sdk.scheduling.events.create({ ... });
|
|
1562
|
+
* ```
|
|
1563
|
+
*/
|
|
1564
|
+
setWorkspaceId(workspaceId) {
|
|
1565
|
+
this.config = { ...this.config, workspaceId };
|
|
1566
|
+
}
|
|
1567
|
+
/**
|
|
1568
|
+
* Get the current workspace ID, if set.
|
|
1569
|
+
*/
|
|
1570
|
+
getWorkspaceId() {
|
|
1571
|
+
return this.config.workspaceId;
|
|
1572
|
+
}
|
|
1543
1573
|
};
|
|
1544
1574
|
|
|
1545
1575
|
// src/namespaces/audit.ts
|
|
@@ -3818,6 +3848,11 @@ var postVoiceSessions = (options) => (options.client ?? client).post({
|
|
|
3818
3848
|
...options.headers
|
|
3819
3849
|
}
|
|
3820
3850
|
});
|
|
3851
|
+
var getInvitations = (options) => (options.client ?? client).get({
|
|
3852
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3853
|
+
url: "/invitations",
|
|
3854
|
+
...options
|
|
3855
|
+
});
|
|
3821
3856
|
var postInvitations = (options) => (options.client ?? client).post({
|
|
3822
3857
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3823
3858
|
url: "/invitations",
|
|
@@ -4573,6 +4608,15 @@ var getEmailInclusionsEmailByOutboundEmailId = (options) => (options.client ?? c
|
|
|
4573
4608
|
url: "/email/inclusions/email/{outbound_email_id}",
|
|
4574
4609
|
...options
|
|
4575
4610
|
});
|
|
4611
|
+
var patchTenantsByIdReactivate = (options) => (options.client ?? client).patch({
|
|
4612
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4613
|
+
url: "/tenants/{id}/reactivate",
|
|
4614
|
+
...options,
|
|
4615
|
+
headers: {
|
|
4616
|
+
"Content-Type": "application/vnd.api+json",
|
|
4617
|
+
...options.headers
|
|
4618
|
+
}
|
|
4619
|
+
});
|
|
4576
4620
|
var getWorkspacesByWorkspaceIdExtractionExportsById = (options) => (options.client ?? client).get({
|
|
4577
4621
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4578
4622
|
url: "/workspaces/{workspace_id}/extraction/exports/{id}",
|
|
@@ -4675,6 +4719,15 @@ var postConnectorsFullscriptCheckPatient = (options) => (options.client ?? clien
|
|
|
4675
4719
|
...options.headers
|
|
4676
4720
|
}
|
|
4677
4721
|
});
|
|
4722
|
+
var patchTenantsByIdDeactivate = (options) => (options.client ?? client).patch({
|
|
4723
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4724
|
+
url: "/tenants/{id}/deactivate",
|
|
4725
|
+
...options,
|
|
4726
|
+
headers: {
|
|
4727
|
+
"Content-Type": "application/vnd.api+json",
|
|
4728
|
+
...options.headers
|
|
4729
|
+
}
|
|
4730
|
+
});
|
|
4678
4731
|
var getSchedulingEventTypes = (options) => (options.client ?? client).get({
|
|
4679
4732
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4680
4733
|
url: "/scheduling/event-types",
|
|
@@ -5993,11 +6046,6 @@ var patchBrandIdentitiesByIdUnsetDefault = (options) => (options.client ?? clien
|
|
|
5993
6046
|
...options.headers
|
|
5994
6047
|
}
|
|
5995
6048
|
});
|
|
5996
|
-
var deleteTenantsById = (options) => (options.client ?? client).delete({
|
|
5997
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
5998
|
-
url: "/tenants/{id}",
|
|
5999
|
-
...options
|
|
6000
|
-
});
|
|
6001
6049
|
var getTenantsById = (options) => (options.client ?? client).get({
|
|
6002
6050
|
security: [{ scheme: "bearer", type: "http" }],
|
|
6003
6051
|
url: "/tenants/{id}",
|
|
@@ -6344,6 +6392,11 @@ var postWatcherEvents = (options) => (options.client ?? client).post({
|
|
|
6344
6392
|
...options.headers
|
|
6345
6393
|
}
|
|
6346
6394
|
});
|
|
6395
|
+
var getAgentsBySlugBySlug = (options) => (options.client ?? client).get({
|
|
6396
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
6397
|
+
url: "/agents/by-slug/{slug}",
|
|
6398
|
+
...options
|
|
6399
|
+
});
|
|
6347
6400
|
var getFeatureDefinitionsByApplicationByApplicationId = (options) => (options.client ?? client).get({
|
|
6348
6401
|
security: [{ scheme: "bearer", type: "http" }],
|
|
6349
6402
|
url: "/feature-definitions/by-application/{application_id}",
|
|
@@ -6849,6 +6902,15 @@ var postAgentsByIdExport = (options) => (options.client ?? client).post({
|
|
|
6849
6902
|
url: "/agents/{id}/export",
|
|
6850
6903
|
...options
|
|
6851
6904
|
});
|
|
6905
|
+
var postUsersAuthRegisterViaInvitation = (options) => (options.client ?? client).post({
|
|
6906
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
6907
|
+
url: "/users/auth/register-via-invitation",
|
|
6908
|
+
...options,
|
|
6909
|
+
headers: {
|
|
6910
|
+
"Content-Type": "application/vnd.api+json",
|
|
6911
|
+
...options.headers
|
|
6912
|
+
}
|
|
6913
|
+
});
|
|
6852
6914
|
var postEmailInboundAddresses = (options) => (options.client ?? client).post({
|
|
6853
6915
|
security: [{ scheme: "bearer", type: "http" }],
|
|
6854
6916
|
url: "/email/inbound-addresses",
|
|
@@ -7139,6 +7201,26 @@ function createAgentsNamespace(rb) {
|
|
|
7139
7201
|
get: async (id, options) => {
|
|
7140
7202
|
return rb.execute(getAgentsById, { path: { id } }, options);
|
|
7141
7203
|
},
|
|
7204
|
+
/**
|
|
7205
|
+
* Look up an agent by its system_slug. Use this for ISV-provisioned agents
|
|
7206
|
+
* where the slug is a stable identifier that survives database resets.
|
|
7207
|
+
*
|
|
7208
|
+
* @param slug - The system_slug of the agent (e.g., "chartless-session-prep-briefing").
|
|
7209
|
+
* @param options - Optional request options.
|
|
7210
|
+
* @returns The Agent record.
|
|
7211
|
+
*
|
|
7212
|
+
* @example
|
|
7213
|
+
* ```ts
|
|
7214
|
+
* const agent = await client.agents.getBySlug("chartless-session-prep-briefing");
|
|
7215
|
+
* ```
|
|
7216
|
+
*/
|
|
7217
|
+
getBySlug: async (slug, options) => {
|
|
7218
|
+
return rb.execute(
|
|
7219
|
+
getAgentsBySlugBySlug,
|
|
7220
|
+
{ path: { slug } },
|
|
7221
|
+
options
|
|
7222
|
+
);
|
|
7223
|
+
},
|
|
7142
7224
|
/**
|
|
7143
7225
|
* Creates a new agent with a blank initial version (v1).
|
|
7144
7226
|
*
|
|
@@ -10139,6 +10221,31 @@ function createBillingNamespace(rb) {
|
|
|
10139
10221
|
);
|
|
10140
10222
|
return result.data ?? result;
|
|
10141
10223
|
}
|
|
10224
|
+
},
|
|
10225
|
+
/**
|
|
10226
|
+
* Get capacity estimates for a plan's monthly credits.
|
|
10227
|
+
*
|
|
10228
|
+
* Returns how many of each ISV-defined feature the plan supports per month.
|
|
10229
|
+
* No Bearer token required — uses application key only.
|
|
10230
|
+
*
|
|
10231
|
+
* @param planSlug - The plan slug to calculate capacity for.
|
|
10232
|
+
* @param options - Optional request-level overrides.
|
|
10233
|
+
* @returns Plan details and capacity breakdown per composite operation.
|
|
10234
|
+
*
|
|
10235
|
+
* @example
|
|
10236
|
+
* ```typescript
|
|
10237
|
+
* const result = await client.billing.capacityCalculator("pro-plan");
|
|
10238
|
+
* console.log(`Plan: ${result.plan.name}`);
|
|
10239
|
+
* for (const item of result.capacity) {
|
|
10240
|
+
* console.log(`${item.display_name}: ~${item.estimated_monthly_count}/month`);
|
|
10241
|
+
* }
|
|
10242
|
+
* ```
|
|
10243
|
+
*/
|
|
10244
|
+
capacityCalculator: async (planSlug, options) => {
|
|
10245
|
+
return rb.rawGet(
|
|
10246
|
+
`/billing/capacity-calculator?plan_slug=${encodeURIComponent(planSlug)}`,
|
|
10247
|
+
options
|
|
10248
|
+
);
|
|
10142
10249
|
}
|
|
10143
10250
|
};
|
|
10144
10251
|
}
|
|
@@ -11914,6 +12021,46 @@ function createClinicalNamespace(rb) {
|
|
|
11914
12021
|
getClinicalPracticeResourcesCatalog,
|
|
11915
12022
|
{ query: params ?? {} },
|
|
11916
12023
|
options
|
|
12024
|
+
),
|
|
12025
|
+
/**
|
|
12026
|
+
* List distinct practice resource categories in a workspace.
|
|
12027
|
+
*
|
|
12028
|
+
* Returns unique `resource_type` values with their active resource counts,
|
|
12029
|
+
* sorted by count descending.
|
|
12030
|
+
*
|
|
12031
|
+
* @param params - Must include `workspace_id`
|
|
12032
|
+
* @param options - Request options
|
|
12033
|
+
* @returns Array of {@link PracticeResourceCategory} records
|
|
12034
|
+
*
|
|
12035
|
+
* @example
|
|
12036
|
+
* ```typescript
|
|
12037
|
+
* const categories = await client.clinical.practiceResources.listCategories({
|
|
12038
|
+
* workspace_id: "..."
|
|
12039
|
+
* });
|
|
12040
|
+
* // [{ category: "article", resource_count: 5 }, { category: "video", resource_count: 3 }]
|
|
12041
|
+
* ```
|
|
12042
|
+
*/
|
|
12043
|
+
listCategories: async (params, options) => rb.rawGet(
|
|
12044
|
+
`/clinical/practice-resources/categories?workspace_id=${encodeURIComponent(params.workspace_id)}`,
|
|
12045
|
+
options
|
|
12046
|
+
),
|
|
12047
|
+
/**
|
|
12048
|
+
* List distinct catalog practice resource categories.
|
|
12049
|
+
*
|
|
12050
|
+
* Returns unique `resource_type` values from application-level catalog resources.
|
|
12051
|
+
* Application ID is resolved from the API key context.
|
|
12052
|
+
*
|
|
12053
|
+
* @param options - Request options
|
|
12054
|
+
* @returns Array of {@link PracticeResourceCategory} records
|
|
12055
|
+
*
|
|
12056
|
+
* @example
|
|
12057
|
+
* ```typescript
|
|
12058
|
+
* const cats = await client.clinical.practiceResources.listCatalogCategories();
|
|
12059
|
+
* ```
|
|
12060
|
+
*/
|
|
12061
|
+
listCatalogCategories: async (options) => rb.rawGet(
|
|
12062
|
+
`/clinical/practice-resources/categories/catalog`,
|
|
12063
|
+
options
|
|
11917
12064
|
)
|
|
11918
12065
|
},
|
|
11919
12066
|
/**
|
|
@@ -12017,6 +12164,24 @@ function createClinicalNamespace(rb) {
|
|
|
12017
12164
|
getClinicalPracticeToolsCatalog,
|
|
12018
12165
|
{ query: params ?? {} },
|
|
12019
12166
|
options
|
|
12167
|
+
),
|
|
12168
|
+
/**
|
|
12169
|
+
* List distinct catalog practice tool categories.
|
|
12170
|
+
*
|
|
12171
|
+
* Returns unique `tool_type` values from application-level catalog tools.
|
|
12172
|
+
* Application ID is resolved from the API key context.
|
|
12173
|
+
*
|
|
12174
|
+
* @param options - Request options
|
|
12175
|
+
* @returns Array of {@link PracticeToolCategory} records
|
|
12176
|
+
*
|
|
12177
|
+
* @example
|
|
12178
|
+
* ```typescript
|
|
12179
|
+
* const cats = await client.clinical.practiceTools.listCatalogCategories();
|
|
12180
|
+
* ```
|
|
12181
|
+
*/
|
|
12182
|
+
listCatalogCategories: async (options) => rb.rawGet(
|
|
12183
|
+
`/clinical/practice-tools/categories/catalog`,
|
|
12184
|
+
options
|
|
12020
12185
|
)
|
|
12021
12186
|
},
|
|
12022
12187
|
/**
|
|
@@ -12296,6 +12461,24 @@ function createClinicalNamespace(rb) {
|
|
|
12296
12461
|
getClinicalGoalTemplatesCatalog,
|
|
12297
12462
|
{ query: params ?? {} },
|
|
12298
12463
|
options
|
|
12464
|
+
),
|
|
12465
|
+
/**
|
|
12466
|
+
* List distinct catalog goal template categories.
|
|
12467
|
+
*
|
|
12468
|
+
* Returns unique `category` values from application-level catalog templates.
|
|
12469
|
+
* Application ID is resolved from the API key context.
|
|
12470
|
+
*
|
|
12471
|
+
* @param options - Request options
|
|
12472
|
+
* @returns Array of {@link ClinicalGoalTemplateCategory} records
|
|
12473
|
+
*
|
|
12474
|
+
* @example
|
|
12475
|
+
* ```typescript
|
|
12476
|
+
* const cats = await client.clinical.goalTemplates.listCatalogCategories();
|
|
12477
|
+
* ```
|
|
12478
|
+
*/
|
|
12479
|
+
listCatalogCategories: async (options) => rb.rawGet(
|
|
12480
|
+
`/clinical/goal-templates/categories/catalog`,
|
|
12481
|
+
options
|
|
12299
12482
|
)
|
|
12300
12483
|
},
|
|
12301
12484
|
/**
|
|
@@ -22219,6 +22402,15 @@ var ChangePasswordSchema = z2.object({
|
|
|
22219
22402
|
message: "Passwords do not match",
|
|
22220
22403
|
path: ["password_confirmation"]
|
|
22221
22404
|
});
|
|
22405
|
+
var RegisterViaInvitationSchema = z2.object({
|
|
22406
|
+
email: z2.string().email(),
|
|
22407
|
+
password: z2.string().min(8),
|
|
22408
|
+
password_confirmation: z2.string().min(8),
|
|
22409
|
+
invitation_token: z2.string().min(1)
|
|
22410
|
+
}).refine((data) => data.password === data.password_confirmation, {
|
|
22411
|
+
message: "Passwords do not match",
|
|
22412
|
+
path: ["password_confirmation"]
|
|
22413
|
+
});
|
|
22222
22414
|
function createIdentityNamespace(rb, baseUrl) {
|
|
22223
22415
|
return {
|
|
22224
22416
|
/**
|
|
@@ -22307,6 +22499,57 @@ function createIdentityNamespace(rb, baseUrl) {
|
|
|
22307
22499
|
options
|
|
22308
22500
|
);
|
|
22309
22501
|
},
|
|
22502
|
+
/**
|
|
22503
|
+
* Register a new user via invitation — skips personal tenant creation.
|
|
22504
|
+
*
|
|
22505
|
+
* Creates the user account, accepts the invitation (creating tenant/workspace
|
|
22506
|
+
* memberships), and returns the authenticated user with a session token.
|
|
22507
|
+
* The email must match the invitation's recipient email.
|
|
22508
|
+
*
|
|
22509
|
+
* @param email - Must match the invitation recipient email
|
|
22510
|
+
* @param password - Minimum 8 characters
|
|
22511
|
+
* @param passwordConfirmation - Must match password
|
|
22512
|
+
* @param invitationToken - Raw token from the invitation email link
|
|
22513
|
+
* @param attrs - Optional extra attributes (first_name, last_name)
|
|
22514
|
+
* @param options - Optional request options
|
|
22515
|
+
* @returns The newly created `User` with session token
|
|
22516
|
+
*
|
|
22517
|
+
* @example
|
|
22518
|
+
* ```typescript
|
|
22519
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
22520
|
+
* const user = await client.identity.registerViaInvitation(
|
|
22521
|
+
* 'invited@example.com', 'securepass', 'securepass', 'raw-token-from-email',
|
|
22522
|
+
* { first_name: 'Jane', last_name: 'Doe' },
|
|
22523
|
+
* );
|
|
22524
|
+
* console.log(user.token); // JWT session token
|
|
22525
|
+
* ```
|
|
22526
|
+
*/
|
|
22527
|
+
registerViaInvitation: async (email, password, passwordConfirmation, invitationToken, attrs, options) => {
|
|
22528
|
+
RegisterViaInvitationSchema.parse({
|
|
22529
|
+
email,
|
|
22530
|
+
password,
|
|
22531
|
+
password_confirmation: passwordConfirmation,
|
|
22532
|
+
invitation_token: invitationToken
|
|
22533
|
+
});
|
|
22534
|
+
return rb.execute(
|
|
22535
|
+
postUsersAuthRegisterViaInvitation,
|
|
22536
|
+
{
|
|
22537
|
+
body: {
|
|
22538
|
+
data: {
|
|
22539
|
+
type: "user",
|
|
22540
|
+
attributes: {
|
|
22541
|
+
email,
|
|
22542
|
+
password,
|
|
22543
|
+
password_confirmation: passwordConfirmation,
|
|
22544
|
+
invitation_token: invitationToken,
|
|
22545
|
+
...attrs
|
|
22546
|
+
}
|
|
22547
|
+
}
|
|
22548
|
+
}
|
|
22549
|
+
},
|
|
22550
|
+
options
|
|
22551
|
+
);
|
|
22552
|
+
},
|
|
22310
22553
|
/** Get the currently authenticated user */
|
|
22311
22554
|
me: async (options) => {
|
|
22312
22555
|
return rb.execute(getUsersMe, {}, options);
|
|
@@ -23457,26 +23700,56 @@ function createPlatformNamespace(rb) {
|
|
|
23457
23700
|
);
|
|
23458
23701
|
},
|
|
23459
23702
|
/**
|
|
23460
|
-
*
|
|
23703
|
+
* Deactivate a tenant (hide from user's account).
|
|
23461
23704
|
*
|
|
23462
|
-
*
|
|
23463
|
-
*
|
|
23464
|
-
*
|
|
23465
|
-
* deletion.
|
|
23705
|
+
* Sets `deactivated_at` on the tenant. The tenant and its workspaces
|
|
23706
|
+
* disappear from `workspaces.mine()` and tenant listings. Billing and
|
|
23707
|
+
* data are completely unaffected. Reversible via `reactivate()`.
|
|
23466
23708
|
*
|
|
23467
|
-
*
|
|
23709
|
+
* Only the tenant owner can deactivate.
|
|
23710
|
+
*
|
|
23711
|
+
* @param id - The UUID of the tenant to deactivate.
|
|
23468
23712
|
* @param options - Optional request options.
|
|
23469
|
-
* @returns
|
|
23713
|
+
* @returns The updated tenant record.
|
|
23470
23714
|
*
|
|
23471
23715
|
* @example
|
|
23472
23716
|
* ```typescript
|
|
23473
|
-
*
|
|
23474
|
-
* await client.platform.tenants.delete('tenant_abc123');
|
|
23717
|
+
* await client.platform.tenants.deactivate('tenant_abc123');
|
|
23475
23718
|
* ```
|
|
23476
23719
|
*/
|
|
23477
|
-
|
|
23478
|
-
|
|
23479
|
-
|
|
23720
|
+
deactivate: async (id, options) => rb.execute(
|
|
23721
|
+
patchTenantsByIdDeactivate,
|
|
23722
|
+
{
|
|
23723
|
+
path: { id },
|
|
23724
|
+
body: { data: { type: "tenant", id, attributes: {} } }
|
|
23725
|
+
},
|
|
23726
|
+
options
|
|
23727
|
+
),
|
|
23728
|
+
/**
|
|
23729
|
+
* Reactivate a previously deactivated tenant.
|
|
23730
|
+
*
|
|
23731
|
+
* Clears `deactivated_at`, restoring the tenant and its workspaces
|
|
23732
|
+
* to the user's account. Only works on deactivated tenants.
|
|
23733
|
+
*
|
|
23734
|
+
* Only the tenant owner can reactivate.
|
|
23735
|
+
*
|
|
23736
|
+
* @param id - The UUID of the tenant to reactivate.
|
|
23737
|
+
* @param options - Optional request options.
|
|
23738
|
+
* @returns The updated tenant record.
|
|
23739
|
+
*
|
|
23740
|
+
* @example
|
|
23741
|
+
* ```typescript
|
|
23742
|
+
* await client.platform.tenants.reactivate('tenant_abc123');
|
|
23743
|
+
* ```
|
|
23744
|
+
*/
|
|
23745
|
+
reactivate: async (id, options) => rb.execute(
|
|
23746
|
+
patchTenantsByIdReactivate,
|
|
23747
|
+
{
|
|
23748
|
+
path: { id },
|
|
23749
|
+
body: { data: { type: "tenant", id, attributes: {} } }
|
|
23750
|
+
},
|
|
23751
|
+
options
|
|
23752
|
+
),
|
|
23480
23753
|
/**
|
|
23481
23754
|
* Create a new tenant (ISV provisioning flow).
|
|
23482
23755
|
*
|
|
@@ -23847,6 +24120,52 @@ function createPlatformNamespace(rb) {
|
|
|
23847
24120
|
options
|
|
23848
24121
|
);
|
|
23849
24122
|
},
|
|
24123
|
+
/**
|
|
24124
|
+
* List invitations visible to the current actor.
|
|
24125
|
+
*
|
|
24126
|
+
* Returns invitations where the actor is the inviter, the tenant owner,
|
|
24127
|
+
* or the recipient (matched by email). Use this to build admin views
|
|
24128
|
+
* of pending/accepted invitations for a tenant or workspace.
|
|
24129
|
+
*
|
|
24130
|
+
* @param options - Optional page number, page size, and request options.
|
|
24131
|
+
* @returns A page of `Invitation` records.
|
|
24132
|
+
*
|
|
24133
|
+
* @example
|
|
24134
|
+
* ```typescript
|
|
24135
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
24136
|
+
* const invites = await client.platform.invitations.list();
|
|
24137
|
+
* ```
|
|
24138
|
+
*/
|
|
24139
|
+
list: async (options) => {
|
|
24140
|
+
return rb.execute(
|
|
24141
|
+
getInvitations,
|
|
24142
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
24143
|
+
options
|
|
24144
|
+
);
|
|
24145
|
+
},
|
|
24146
|
+
/**
|
|
24147
|
+
* List all invitations visible to the current actor, auto-paginating.
|
|
24148
|
+
*
|
|
24149
|
+
* @param options - Optional request options.
|
|
24150
|
+
* @returns All visible `Invitation` records as a flat array.
|
|
24151
|
+
*
|
|
24152
|
+
* @example
|
|
24153
|
+
* ```typescript
|
|
24154
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
24155
|
+
* const all = await client.platform.invitations.listAll();
|
|
24156
|
+
* ```
|
|
24157
|
+
*/
|
|
24158
|
+
listAll: async (options) => {
|
|
24159
|
+
return paginateToArray(
|
|
24160
|
+
rb.createPaginatedFetcher(
|
|
24161
|
+
getInvitations,
|
|
24162
|
+
(page, pageSize) => ({
|
|
24163
|
+
query: { page: { number: page, size: pageSize } }
|
|
24164
|
+
}),
|
|
24165
|
+
options
|
|
24166
|
+
)
|
|
24167
|
+
);
|
|
24168
|
+
},
|
|
23850
24169
|
/**
|
|
23851
24170
|
* Look up a pending invitation by its raw token.
|
|
23852
24171
|
*
|