@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.js
CHANGED
|
@@ -1333,7 +1333,7 @@ function buildUserAgent(sdkVersion, appInfo) {
|
|
|
1333
1333
|
}
|
|
1334
1334
|
|
|
1335
1335
|
// src/version.ts
|
|
1336
|
-
var SDK_VERSION = "0.8.
|
|
1336
|
+
var SDK_VERSION = "0.8.4";
|
|
1337
1337
|
var DEFAULT_API_VERSION = "2026-03-11";
|
|
1338
1338
|
|
|
1339
1339
|
// src/base-client.ts
|
|
@@ -1604,6 +1604,36 @@ var BaseClient = class {
|
|
|
1604
1604
|
clearToken() {
|
|
1605
1605
|
this.config = { ...this.config, token: void 0 };
|
|
1606
1606
|
}
|
|
1607
|
+
/**
|
|
1608
|
+
* Switch the workspace context for all subsequent requests.
|
|
1609
|
+
*
|
|
1610
|
+
* Sets the `workspace_id` query parameter appended to every request.
|
|
1611
|
+
* Use this after creating a new workspace or switching workspace context
|
|
1612
|
+
* without constructing a new client instance.
|
|
1613
|
+
*
|
|
1614
|
+
* @param workspaceId - The workspace UUID to scope requests to, or
|
|
1615
|
+
* `undefined` to clear workspace scoping.
|
|
1616
|
+
*
|
|
1617
|
+
* @example
|
|
1618
|
+
* ```typescript
|
|
1619
|
+
* const org = await sdk.platform.tenants.createOrg({ name: 'Acme' });
|
|
1620
|
+
* const workspaces = await sdk.platform.workspaces.mine();
|
|
1621
|
+
* const ws = workspaces.find(w => w.tenant_id === org.id);
|
|
1622
|
+
*
|
|
1623
|
+
* sdk.setWorkspaceId(ws.id);
|
|
1624
|
+
* // All subsequent calls are scoped to the new workspace
|
|
1625
|
+
* await sdk.scheduling.events.create({ ... });
|
|
1626
|
+
* ```
|
|
1627
|
+
*/
|
|
1628
|
+
setWorkspaceId(workspaceId) {
|
|
1629
|
+
this.config = { ...this.config, workspaceId };
|
|
1630
|
+
}
|
|
1631
|
+
/**
|
|
1632
|
+
* Get the current workspace ID, if set.
|
|
1633
|
+
*/
|
|
1634
|
+
getWorkspaceId() {
|
|
1635
|
+
return this.config.workspaceId;
|
|
1636
|
+
}
|
|
1607
1637
|
};
|
|
1608
1638
|
|
|
1609
1639
|
// src/namespaces/audit.ts
|
|
@@ -3882,6 +3912,11 @@ var postVoiceSessions = (options) => (options.client ?? client).post({
|
|
|
3882
3912
|
...options.headers
|
|
3883
3913
|
}
|
|
3884
3914
|
});
|
|
3915
|
+
var getInvitations = (options) => (options.client ?? client).get({
|
|
3916
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
3917
|
+
url: "/invitations",
|
|
3918
|
+
...options
|
|
3919
|
+
});
|
|
3885
3920
|
var postInvitations = (options) => (options.client ?? client).post({
|
|
3886
3921
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3887
3922
|
url: "/invitations",
|
|
@@ -4637,6 +4672,15 @@ var getEmailInclusionsEmailByOutboundEmailId = (options) => (options.client ?? c
|
|
|
4637
4672
|
url: "/email/inclusions/email/{outbound_email_id}",
|
|
4638
4673
|
...options
|
|
4639
4674
|
});
|
|
4675
|
+
var patchTenantsByIdReactivate = (options) => (options.client ?? client).patch({
|
|
4676
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4677
|
+
url: "/tenants/{id}/reactivate",
|
|
4678
|
+
...options,
|
|
4679
|
+
headers: {
|
|
4680
|
+
"Content-Type": "application/vnd.api+json",
|
|
4681
|
+
...options.headers
|
|
4682
|
+
}
|
|
4683
|
+
});
|
|
4640
4684
|
var getWorkspacesByWorkspaceIdExtractionExportsById = (options) => (options.client ?? client).get({
|
|
4641
4685
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4642
4686
|
url: "/workspaces/{workspace_id}/extraction/exports/{id}",
|
|
@@ -4739,6 +4783,15 @@ var postConnectorsFullscriptCheckPatient = (options) => (options.client ?? clien
|
|
|
4739
4783
|
...options.headers
|
|
4740
4784
|
}
|
|
4741
4785
|
});
|
|
4786
|
+
var patchTenantsByIdDeactivate = (options) => (options.client ?? client).patch({
|
|
4787
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
4788
|
+
url: "/tenants/{id}/deactivate",
|
|
4789
|
+
...options,
|
|
4790
|
+
headers: {
|
|
4791
|
+
"Content-Type": "application/vnd.api+json",
|
|
4792
|
+
...options.headers
|
|
4793
|
+
}
|
|
4794
|
+
});
|
|
4742
4795
|
var getSchedulingEventTypes = (options) => (options.client ?? client).get({
|
|
4743
4796
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4744
4797
|
url: "/scheduling/event-types",
|
|
@@ -6057,11 +6110,6 @@ var patchBrandIdentitiesByIdUnsetDefault = (options) => (options.client ?? clien
|
|
|
6057
6110
|
...options.headers
|
|
6058
6111
|
}
|
|
6059
6112
|
});
|
|
6060
|
-
var deleteTenantsById = (options) => (options.client ?? client).delete({
|
|
6061
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
6062
|
-
url: "/tenants/{id}",
|
|
6063
|
-
...options
|
|
6064
|
-
});
|
|
6065
6113
|
var getTenantsById = (options) => (options.client ?? client).get({
|
|
6066
6114
|
security: [{ scheme: "bearer", type: "http" }],
|
|
6067
6115
|
url: "/tenants/{id}",
|
|
@@ -6408,6 +6456,11 @@ var postWatcherEvents = (options) => (options.client ?? client).post({
|
|
|
6408
6456
|
...options.headers
|
|
6409
6457
|
}
|
|
6410
6458
|
});
|
|
6459
|
+
var getAgentsBySlugBySlug = (options) => (options.client ?? client).get({
|
|
6460
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
6461
|
+
url: "/agents/by-slug/{slug}",
|
|
6462
|
+
...options
|
|
6463
|
+
});
|
|
6411
6464
|
var getFeatureDefinitionsByApplicationByApplicationId = (options) => (options.client ?? client).get({
|
|
6412
6465
|
security: [{ scheme: "bearer", type: "http" }],
|
|
6413
6466
|
url: "/feature-definitions/by-application/{application_id}",
|
|
@@ -6913,6 +6966,15 @@ var postAgentsByIdExport = (options) => (options.client ?? client).post({
|
|
|
6913
6966
|
url: "/agents/{id}/export",
|
|
6914
6967
|
...options
|
|
6915
6968
|
});
|
|
6969
|
+
var postUsersAuthRegisterViaInvitation = (options) => (options.client ?? client).post({
|
|
6970
|
+
security: [{ scheme: "bearer", type: "http" }],
|
|
6971
|
+
url: "/users/auth/register-via-invitation",
|
|
6972
|
+
...options,
|
|
6973
|
+
headers: {
|
|
6974
|
+
"Content-Type": "application/vnd.api+json",
|
|
6975
|
+
...options.headers
|
|
6976
|
+
}
|
|
6977
|
+
});
|
|
6916
6978
|
var postEmailInboundAddresses = (options) => (options.client ?? client).post({
|
|
6917
6979
|
security: [{ scheme: "bearer", type: "http" }],
|
|
6918
6980
|
url: "/email/inbound-addresses",
|
|
@@ -7203,6 +7265,26 @@ function createAgentsNamespace(rb) {
|
|
|
7203
7265
|
get: async (id, options) => {
|
|
7204
7266
|
return rb.execute(getAgentsById, { path: { id } }, options);
|
|
7205
7267
|
},
|
|
7268
|
+
/**
|
|
7269
|
+
* Look up an agent by its system_slug. Use this for ISV-provisioned agents
|
|
7270
|
+
* where the slug is a stable identifier that survives database resets.
|
|
7271
|
+
*
|
|
7272
|
+
* @param slug - The system_slug of the agent (e.g., "chartless-session-prep-briefing").
|
|
7273
|
+
* @param options - Optional request options.
|
|
7274
|
+
* @returns The Agent record.
|
|
7275
|
+
*
|
|
7276
|
+
* @example
|
|
7277
|
+
* ```ts
|
|
7278
|
+
* const agent = await client.agents.getBySlug("chartless-session-prep-briefing");
|
|
7279
|
+
* ```
|
|
7280
|
+
*/
|
|
7281
|
+
getBySlug: async (slug, options) => {
|
|
7282
|
+
return rb.execute(
|
|
7283
|
+
getAgentsBySlugBySlug,
|
|
7284
|
+
{ path: { slug } },
|
|
7285
|
+
options
|
|
7286
|
+
);
|
|
7287
|
+
},
|
|
7206
7288
|
/**
|
|
7207
7289
|
* Creates a new agent with a blank initial version (v1).
|
|
7208
7290
|
*
|
|
@@ -10203,6 +10285,31 @@ function createBillingNamespace(rb) {
|
|
|
10203
10285
|
);
|
|
10204
10286
|
return result.data ?? result;
|
|
10205
10287
|
}
|
|
10288
|
+
},
|
|
10289
|
+
/**
|
|
10290
|
+
* Get capacity estimates for a plan's monthly credits.
|
|
10291
|
+
*
|
|
10292
|
+
* Returns how many of each ISV-defined feature the plan supports per month.
|
|
10293
|
+
* No Bearer token required — uses application key only.
|
|
10294
|
+
*
|
|
10295
|
+
* @param planSlug - The plan slug to calculate capacity for.
|
|
10296
|
+
* @param options - Optional request-level overrides.
|
|
10297
|
+
* @returns Plan details and capacity breakdown per composite operation.
|
|
10298
|
+
*
|
|
10299
|
+
* @example
|
|
10300
|
+
* ```typescript
|
|
10301
|
+
* const result = await client.billing.capacityCalculator("pro-plan");
|
|
10302
|
+
* console.log(`Plan: ${result.plan.name}`);
|
|
10303
|
+
* for (const item of result.capacity) {
|
|
10304
|
+
* console.log(`${item.display_name}: ~${item.estimated_monthly_count}/month`);
|
|
10305
|
+
* }
|
|
10306
|
+
* ```
|
|
10307
|
+
*/
|
|
10308
|
+
capacityCalculator: async (planSlug, options) => {
|
|
10309
|
+
return rb.rawGet(
|
|
10310
|
+
`/billing/capacity-calculator?plan_slug=${encodeURIComponent(planSlug)}`,
|
|
10311
|
+
options
|
|
10312
|
+
);
|
|
10206
10313
|
}
|
|
10207
10314
|
};
|
|
10208
10315
|
}
|
|
@@ -11978,6 +12085,46 @@ function createClinicalNamespace(rb) {
|
|
|
11978
12085
|
getClinicalPracticeResourcesCatalog,
|
|
11979
12086
|
{ query: params ?? {} },
|
|
11980
12087
|
options
|
|
12088
|
+
),
|
|
12089
|
+
/**
|
|
12090
|
+
* List distinct practice resource categories in a workspace.
|
|
12091
|
+
*
|
|
12092
|
+
* Returns unique `resource_type` values with their active resource counts,
|
|
12093
|
+
* sorted by count descending.
|
|
12094
|
+
*
|
|
12095
|
+
* @param params - Must include `workspace_id`
|
|
12096
|
+
* @param options - Request options
|
|
12097
|
+
* @returns Array of {@link PracticeResourceCategory} records
|
|
12098
|
+
*
|
|
12099
|
+
* @example
|
|
12100
|
+
* ```typescript
|
|
12101
|
+
* const categories = await client.clinical.practiceResources.listCategories({
|
|
12102
|
+
* workspace_id: "..."
|
|
12103
|
+
* });
|
|
12104
|
+
* // [{ category: "article", resource_count: 5 }, { category: "video", resource_count: 3 }]
|
|
12105
|
+
* ```
|
|
12106
|
+
*/
|
|
12107
|
+
listCategories: async (params, options) => rb.rawGet(
|
|
12108
|
+
`/clinical/practice-resources/categories?workspace_id=${encodeURIComponent(params.workspace_id)}`,
|
|
12109
|
+
options
|
|
12110
|
+
),
|
|
12111
|
+
/**
|
|
12112
|
+
* List distinct catalog practice resource categories.
|
|
12113
|
+
*
|
|
12114
|
+
* Returns unique `resource_type` values from application-level catalog resources.
|
|
12115
|
+
* Application ID is resolved from the API key context.
|
|
12116
|
+
*
|
|
12117
|
+
* @param options - Request options
|
|
12118
|
+
* @returns Array of {@link PracticeResourceCategory} records
|
|
12119
|
+
*
|
|
12120
|
+
* @example
|
|
12121
|
+
* ```typescript
|
|
12122
|
+
* const cats = await client.clinical.practiceResources.listCatalogCategories();
|
|
12123
|
+
* ```
|
|
12124
|
+
*/
|
|
12125
|
+
listCatalogCategories: async (options) => rb.rawGet(
|
|
12126
|
+
`/clinical/practice-resources/categories/catalog`,
|
|
12127
|
+
options
|
|
11981
12128
|
)
|
|
11982
12129
|
},
|
|
11983
12130
|
/**
|
|
@@ -12081,6 +12228,24 @@ function createClinicalNamespace(rb) {
|
|
|
12081
12228
|
getClinicalPracticeToolsCatalog,
|
|
12082
12229
|
{ query: params ?? {} },
|
|
12083
12230
|
options
|
|
12231
|
+
),
|
|
12232
|
+
/**
|
|
12233
|
+
* List distinct catalog practice tool categories.
|
|
12234
|
+
*
|
|
12235
|
+
* Returns unique `tool_type` values from application-level catalog tools.
|
|
12236
|
+
* Application ID is resolved from the API key context.
|
|
12237
|
+
*
|
|
12238
|
+
* @param options - Request options
|
|
12239
|
+
* @returns Array of {@link PracticeToolCategory} records
|
|
12240
|
+
*
|
|
12241
|
+
* @example
|
|
12242
|
+
* ```typescript
|
|
12243
|
+
* const cats = await client.clinical.practiceTools.listCatalogCategories();
|
|
12244
|
+
* ```
|
|
12245
|
+
*/
|
|
12246
|
+
listCatalogCategories: async (options) => rb.rawGet(
|
|
12247
|
+
`/clinical/practice-tools/categories/catalog`,
|
|
12248
|
+
options
|
|
12084
12249
|
)
|
|
12085
12250
|
},
|
|
12086
12251
|
/**
|
|
@@ -12360,6 +12525,24 @@ function createClinicalNamespace(rb) {
|
|
|
12360
12525
|
getClinicalGoalTemplatesCatalog,
|
|
12361
12526
|
{ query: params ?? {} },
|
|
12362
12527
|
options
|
|
12528
|
+
),
|
|
12529
|
+
/**
|
|
12530
|
+
* List distinct catalog goal template categories.
|
|
12531
|
+
*
|
|
12532
|
+
* Returns unique `category` values from application-level catalog templates.
|
|
12533
|
+
* Application ID is resolved from the API key context.
|
|
12534
|
+
*
|
|
12535
|
+
* @param options - Request options
|
|
12536
|
+
* @returns Array of {@link ClinicalGoalTemplateCategory} records
|
|
12537
|
+
*
|
|
12538
|
+
* @example
|
|
12539
|
+
* ```typescript
|
|
12540
|
+
* const cats = await client.clinical.goalTemplates.listCatalogCategories();
|
|
12541
|
+
* ```
|
|
12542
|
+
*/
|
|
12543
|
+
listCatalogCategories: async (options) => rb.rawGet(
|
|
12544
|
+
`/clinical/goal-templates/categories/catalog`,
|
|
12545
|
+
options
|
|
12363
12546
|
)
|
|
12364
12547
|
},
|
|
12365
12548
|
/**
|
|
@@ -22283,6 +22466,15 @@ var ChangePasswordSchema = import_zod2.z.object({
|
|
|
22283
22466
|
message: "Passwords do not match",
|
|
22284
22467
|
path: ["password_confirmation"]
|
|
22285
22468
|
});
|
|
22469
|
+
var RegisterViaInvitationSchema = import_zod2.z.object({
|
|
22470
|
+
email: import_zod2.z.string().email(),
|
|
22471
|
+
password: import_zod2.z.string().min(8),
|
|
22472
|
+
password_confirmation: import_zod2.z.string().min(8),
|
|
22473
|
+
invitation_token: import_zod2.z.string().min(1)
|
|
22474
|
+
}).refine((data) => data.password === data.password_confirmation, {
|
|
22475
|
+
message: "Passwords do not match",
|
|
22476
|
+
path: ["password_confirmation"]
|
|
22477
|
+
});
|
|
22286
22478
|
function createIdentityNamespace(rb, baseUrl) {
|
|
22287
22479
|
return {
|
|
22288
22480
|
/**
|
|
@@ -22371,6 +22563,57 @@ function createIdentityNamespace(rb, baseUrl) {
|
|
|
22371
22563
|
options
|
|
22372
22564
|
);
|
|
22373
22565
|
},
|
|
22566
|
+
/**
|
|
22567
|
+
* Register a new user via invitation — skips personal tenant creation.
|
|
22568
|
+
*
|
|
22569
|
+
* Creates the user account, accepts the invitation (creating tenant/workspace
|
|
22570
|
+
* memberships), and returns the authenticated user with a session token.
|
|
22571
|
+
* The email must match the invitation's recipient email.
|
|
22572
|
+
*
|
|
22573
|
+
* @param email - Must match the invitation recipient email
|
|
22574
|
+
* @param password - Minimum 8 characters
|
|
22575
|
+
* @param passwordConfirmation - Must match password
|
|
22576
|
+
* @param invitationToken - Raw token from the invitation email link
|
|
22577
|
+
* @param attrs - Optional extra attributes (first_name, last_name)
|
|
22578
|
+
* @param options - Optional request options
|
|
22579
|
+
* @returns The newly created `User` with session token
|
|
22580
|
+
*
|
|
22581
|
+
* @example
|
|
22582
|
+
* ```typescript
|
|
22583
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
22584
|
+
* const user = await client.identity.registerViaInvitation(
|
|
22585
|
+
* 'invited@example.com', 'securepass', 'securepass', 'raw-token-from-email',
|
|
22586
|
+
* { first_name: 'Jane', last_name: 'Doe' },
|
|
22587
|
+
* );
|
|
22588
|
+
* console.log(user.token); // JWT session token
|
|
22589
|
+
* ```
|
|
22590
|
+
*/
|
|
22591
|
+
registerViaInvitation: async (email, password, passwordConfirmation, invitationToken, attrs, options) => {
|
|
22592
|
+
RegisterViaInvitationSchema.parse({
|
|
22593
|
+
email,
|
|
22594
|
+
password,
|
|
22595
|
+
password_confirmation: passwordConfirmation,
|
|
22596
|
+
invitation_token: invitationToken
|
|
22597
|
+
});
|
|
22598
|
+
return rb.execute(
|
|
22599
|
+
postUsersAuthRegisterViaInvitation,
|
|
22600
|
+
{
|
|
22601
|
+
body: {
|
|
22602
|
+
data: {
|
|
22603
|
+
type: "user",
|
|
22604
|
+
attributes: {
|
|
22605
|
+
email,
|
|
22606
|
+
password,
|
|
22607
|
+
password_confirmation: passwordConfirmation,
|
|
22608
|
+
invitation_token: invitationToken,
|
|
22609
|
+
...attrs
|
|
22610
|
+
}
|
|
22611
|
+
}
|
|
22612
|
+
}
|
|
22613
|
+
},
|
|
22614
|
+
options
|
|
22615
|
+
);
|
|
22616
|
+
},
|
|
22374
22617
|
/** Get the currently authenticated user */
|
|
22375
22618
|
me: async (options) => {
|
|
22376
22619
|
return rb.execute(getUsersMe, {}, options);
|
|
@@ -23521,26 +23764,56 @@ function createPlatformNamespace(rb) {
|
|
|
23521
23764
|
);
|
|
23522
23765
|
},
|
|
23523
23766
|
/**
|
|
23524
|
-
*
|
|
23767
|
+
* Deactivate a tenant (hide from user's account).
|
|
23525
23768
|
*
|
|
23526
|
-
*
|
|
23527
|
-
*
|
|
23528
|
-
*
|
|
23529
|
-
* deletion.
|
|
23769
|
+
* Sets `deactivated_at` on the tenant. The tenant and its workspaces
|
|
23770
|
+
* disappear from `workspaces.mine()` and tenant listings. Billing and
|
|
23771
|
+
* data are completely unaffected. Reversible via `reactivate()`.
|
|
23530
23772
|
*
|
|
23531
|
-
*
|
|
23773
|
+
* Only the tenant owner can deactivate.
|
|
23774
|
+
*
|
|
23775
|
+
* @param id - The UUID of the tenant to deactivate.
|
|
23532
23776
|
* @param options - Optional request options.
|
|
23533
|
-
* @returns
|
|
23777
|
+
* @returns The updated tenant record.
|
|
23534
23778
|
*
|
|
23535
23779
|
* @example
|
|
23536
23780
|
* ```typescript
|
|
23537
|
-
*
|
|
23538
|
-
* await client.platform.tenants.delete('tenant_abc123');
|
|
23781
|
+
* await client.platform.tenants.deactivate('tenant_abc123');
|
|
23539
23782
|
* ```
|
|
23540
23783
|
*/
|
|
23541
|
-
|
|
23542
|
-
|
|
23543
|
-
|
|
23784
|
+
deactivate: async (id, options) => rb.execute(
|
|
23785
|
+
patchTenantsByIdDeactivate,
|
|
23786
|
+
{
|
|
23787
|
+
path: { id },
|
|
23788
|
+
body: { data: { type: "tenant", id, attributes: {} } }
|
|
23789
|
+
},
|
|
23790
|
+
options
|
|
23791
|
+
),
|
|
23792
|
+
/**
|
|
23793
|
+
* Reactivate a previously deactivated tenant.
|
|
23794
|
+
*
|
|
23795
|
+
* Clears `deactivated_at`, restoring the tenant and its workspaces
|
|
23796
|
+
* to the user's account. Only works on deactivated tenants.
|
|
23797
|
+
*
|
|
23798
|
+
* Only the tenant owner can reactivate.
|
|
23799
|
+
*
|
|
23800
|
+
* @param id - The UUID of the tenant to reactivate.
|
|
23801
|
+
* @param options - Optional request options.
|
|
23802
|
+
* @returns The updated tenant record.
|
|
23803
|
+
*
|
|
23804
|
+
* @example
|
|
23805
|
+
* ```typescript
|
|
23806
|
+
* await client.platform.tenants.reactivate('tenant_abc123');
|
|
23807
|
+
* ```
|
|
23808
|
+
*/
|
|
23809
|
+
reactivate: async (id, options) => rb.execute(
|
|
23810
|
+
patchTenantsByIdReactivate,
|
|
23811
|
+
{
|
|
23812
|
+
path: { id },
|
|
23813
|
+
body: { data: { type: "tenant", id, attributes: {} } }
|
|
23814
|
+
},
|
|
23815
|
+
options
|
|
23816
|
+
),
|
|
23544
23817
|
/**
|
|
23545
23818
|
* Create a new tenant (ISV provisioning flow).
|
|
23546
23819
|
*
|
|
@@ -23911,6 +24184,52 @@ function createPlatformNamespace(rb) {
|
|
|
23911
24184
|
options
|
|
23912
24185
|
);
|
|
23913
24186
|
},
|
|
24187
|
+
/**
|
|
24188
|
+
* List invitations visible to the current actor.
|
|
24189
|
+
*
|
|
24190
|
+
* Returns invitations where the actor is the inviter, the tenant owner,
|
|
24191
|
+
* or the recipient (matched by email). Use this to build admin views
|
|
24192
|
+
* of pending/accepted invitations for a tenant or workspace.
|
|
24193
|
+
*
|
|
24194
|
+
* @param options - Optional page number, page size, and request options.
|
|
24195
|
+
* @returns A page of `Invitation` records.
|
|
24196
|
+
*
|
|
24197
|
+
* @example
|
|
24198
|
+
* ```typescript
|
|
24199
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
24200
|
+
* const invites = await client.platform.invitations.list();
|
|
24201
|
+
* ```
|
|
24202
|
+
*/
|
|
24203
|
+
list: async (options) => {
|
|
24204
|
+
return rb.execute(
|
|
24205
|
+
getInvitations,
|
|
24206
|
+
buildPageQuery(options?.page, options?.pageSize),
|
|
24207
|
+
options
|
|
24208
|
+
);
|
|
24209
|
+
},
|
|
24210
|
+
/**
|
|
24211
|
+
* List all invitations visible to the current actor, auto-paginating.
|
|
24212
|
+
*
|
|
24213
|
+
* @param options - Optional request options.
|
|
24214
|
+
* @returns All visible `Invitation` records as a flat array.
|
|
24215
|
+
*
|
|
24216
|
+
* @example
|
|
24217
|
+
* ```typescript
|
|
24218
|
+
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
24219
|
+
* const all = await client.platform.invitations.listAll();
|
|
24220
|
+
* ```
|
|
24221
|
+
*/
|
|
24222
|
+
listAll: async (options) => {
|
|
24223
|
+
return paginateToArray(
|
|
24224
|
+
rb.createPaginatedFetcher(
|
|
24225
|
+
getInvitations,
|
|
24226
|
+
(page, pageSize) => ({
|
|
24227
|
+
query: { page: { number: page, size: pageSize } }
|
|
24228
|
+
}),
|
|
24229
|
+
options
|
|
24230
|
+
)
|
|
24231
|
+
);
|
|
24232
|
+
},
|
|
23914
24233
|
/**
|
|
23915
24234
|
* Look up a pending invitation by its raw token.
|
|
23916
24235
|
*
|