@gpt-platform/client 0.1.4 → 0.2.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/index.js CHANGED
@@ -1284,9 +1284,11 @@ function buildUserAgent(sdkVersion, appInfo) {
1284
1284
  return ua;
1285
1285
  }
1286
1286
 
1287
+ // src/version.ts
1288
+ var SDK_VERSION = "0.2.0";
1289
+ var DEFAULT_API_VERSION = "2026-02-25";
1290
+
1287
1291
  // src/base-client.ts
1288
- var DEFAULT_API_VERSION = "2025-12-03";
1289
- var SDK_VERSION = "0.1.4";
1290
1292
  function generateUUID() {
1291
1293
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
1292
1294
  return crypto.randomUUID();
@@ -1392,7 +1394,9 @@ var BaseClient = class {
1392
1394
  "Accept",
1393
1395
  `application/vnd.api+json; version=${this.apiVersion}`
1394
1396
  );
1395
- req.headers.set("Content-Type", "application/vnd.api+json");
1397
+ if (!req.headers.get("Content-Type")?.startsWith("multipart/")) {
1398
+ req.headers.set("Content-Type", "application/vnd.api+json");
1399
+ }
1396
1400
  if (typeof process !== "undefined") {
1397
1401
  req.headers.set("User-Agent", userAgent);
1398
1402
  }
@@ -1598,6 +1602,11 @@ var postThreads = (options) => (options.client ?? client).post({
1598
1602
  ...options.headers
1599
1603
  }
1600
1604
  });
1605
+ var getVoiceSessionsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
1606
+ security: [{ scheme: "bearer", type: "http" }],
1607
+ url: "/voice/sessions/workspace/{workspace_id}",
1608
+ ...options
1609
+ });
1601
1610
  var patchExtractionDocumentsByIdCancel = (options) => (options.client ?? client).patch({
1602
1611
  security: [{ scheme: "bearer", type: "http" }],
1603
1612
  url: "/extraction/documents/{id}/cancel",
@@ -1617,6 +1626,11 @@ var getAgentVersionsById = (options) => (options.client ?? client).get({
1617
1626
  url: "/agent-versions/{id}",
1618
1627
  ...options
1619
1628
  });
1629
+ var getWatcherEventsById = (options) => (options.client ?? client).get({
1630
+ security: [{ scheme: "bearer", type: "http" }],
1631
+ url: "/watcher/events/{id}",
1632
+ ...options
1633
+ });
1620
1634
  var patchApiKeysByIdRevoke = (options) => (options.client ?? client).patch({
1621
1635
  security: [{ scheme: "bearer", type: "http" }],
1622
1636
  url: "/api-keys/{id}/revoke",
@@ -1682,11 +1696,30 @@ var patchExtractionDocumentsByIdDismiss = (options) => (options.client ?? client
1682
1696
  ...options.headers
1683
1697
  }
1684
1698
  });
1699
+ var postUsersAuthResetPasswordRequest = (options) => (options.client ?? client).post({
1700
+ security: [{ scheme: "bearer", type: "http" }],
1701
+ url: "/users/auth/reset-password/request",
1702
+ ...options,
1703
+ headers: {
1704
+ "Content-Type": "application/vnd.api+json",
1705
+ ...options.headers
1706
+ }
1707
+ });
1685
1708
  var getSearchIndexes = (options) => (options.client ?? client).get({
1686
1709
  security: [{ scheme: "bearer", type: "http" }],
1687
1710
  url: "/search/indexes",
1688
1711
  ...options
1689
1712
  });
1713
+ var deleteTrainingSessionsById = (options) => (options.client ?? client).delete({
1714
+ security: [{ scheme: "bearer", type: "http" }],
1715
+ url: "/training-sessions/{id}",
1716
+ ...options
1717
+ });
1718
+ var getTrainingSessionsById = (options) => (options.client ?? client).get({
1719
+ security: [{ scheme: "bearer", type: "http" }],
1720
+ url: "/training-sessions/{id}",
1721
+ ...options
1722
+ });
1690
1723
  var postAgentsByIdAnalyzeTraining = (options) => (options.client ?? client).post({
1691
1724
  security: [{ scheme: "bearer", type: "http" }],
1692
1725
  url: "/agents/{id}/analyze-training",
@@ -1701,9 +1734,9 @@ var postWebhookConfigsByIdTest = (options) => (options.client ?? client).post({
1701
1734
  ...options.headers
1702
1735
  }
1703
1736
  });
1704
- var postStorageSignDownload = (options) => (options.client ?? client).post({
1737
+ var patchUsersAuthPasswordChange = (options) => (options.client ?? client).patch({
1705
1738
  security: [{ scheme: "bearer", type: "http" }],
1706
- url: "/storage/sign-download",
1739
+ url: "/users/auth/password/change",
1707
1740
  ...options,
1708
1741
  headers: {
1709
1742
  "Content-Type": "application/vnd.api+json",
@@ -1793,6 +1826,20 @@ var postAgentsByIdPublishVersion = (options) => (options.client ?? client).post(
1793
1826
  ...options.headers
1794
1827
  }
1795
1828
  });
1829
+ var getVoiceSessionsMine = (options) => (options.client ?? client).get({
1830
+ security: [{ scheme: "bearer", type: "http" }],
1831
+ url: "/voice/sessions/mine",
1832
+ ...options
1833
+ });
1834
+ var postUsersAuthMagicLinkLogin = (options) => (options.client ?? client).post({
1835
+ security: [{ scheme: "bearer", type: "http" }],
1836
+ url: "/users/auth/magic-link/login",
1837
+ ...options,
1838
+ headers: {
1839
+ "Content-Type": "application/vnd.api+json",
1840
+ ...options.headers
1841
+ }
1842
+ });
1796
1843
  var deleteApiKeysById = (options) => (options.client ?? client).delete({
1797
1844
  security: [{ scheme: "bearer", type: "http" }],
1798
1845
  url: "/api-keys/{id}",
@@ -1812,6 +1859,15 @@ var patchApiKeysById = (options) => (options.client ?? client).patch({
1812
1859
  ...options.headers
1813
1860
  }
1814
1861
  });
1862
+ var patchUsersAuthResetPassword = (options) => (options.client ?? client).patch({
1863
+ security: [{ scheme: "bearer", type: "http" }],
1864
+ url: "/users/auth/reset-password",
1865
+ ...options,
1866
+ headers: {
1867
+ "Content-Type": "application/vnd.api+json",
1868
+ ...options.headers
1869
+ }
1870
+ });
1815
1871
  var getSchedulingCalendarSyncsById = (options) => (options.client ?? client).get({
1816
1872
  security: [{ scheme: "bearer", type: "http" }],
1817
1873
  url: "/scheduling/calendar-syncs/{id}",
@@ -2043,6 +2099,15 @@ var getWebhookDeliveriesById = (options) => (options.client ?? client).get({
2043
2099
  url: "/webhook-deliveries/{id}",
2044
2100
  ...options
2045
2101
  });
2102
+ var patchVoiceSessionsByIdStop = (options) => (options.client ?? client).patch({
2103
+ security: [{ scheme: "bearer", type: "http" }],
2104
+ url: "/voice/sessions/{id}/stop",
2105
+ ...options,
2106
+ headers: {
2107
+ "Content-Type": "application/vnd.api+json",
2108
+ ...options.headers
2109
+ }
2110
+ });
2046
2111
  var getSchedulingParticipants = (options) => (options.client ?? client).get({
2047
2112
  security: [{ scheme: "bearer", type: "http" }],
2048
2113
  url: "/scheduling/participants",
@@ -2071,11 +2136,35 @@ var patchExtractionDocumentsByIdFinishUpload = (options) => (options.client ?? c
2071
2136
  ...options.headers
2072
2137
  }
2073
2138
  });
2139
+ var getTrainingSessionsAgentsByAgentIdSessions = (options) => (options.client ?? client).get({
2140
+ security: [{ scheme: "bearer", type: "http" }],
2141
+ url: "/training-sessions/agents/{agent_id}/sessions",
2142
+ ...options
2143
+ });
2074
2144
  var getSearch = (options) => (options.client ?? client).get({
2075
2145
  security: [{ scheme: "bearer", type: "http" }],
2076
2146
  url: "/search",
2077
2147
  ...options
2078
2148
  });
2149
+ var getVoiceSessionsById = (options) => (options.client ?? client).get({
2150
+ security: [{ scheme: "bearer", type: "http" }],
2151
+ url: "/voice/sessions/{id}",
2152
+ ...options
2153
+ });
2154
+ var getVoiceSessions = (options) => (options.client ?? client).get({
2155
+ security: [{ scheme: "bearer", type: "http" }],
2156
+ url: "/voice/sessions",
2157
+ ...options
2158
+ });
2159
+ var postVoiceSessions = (options) => (options.client ?? client).post({
2160
+ security: [{ scheme: "bearer", type: "http" }],
2161
+ url: "/voice/sessions",
2162
+ ...options,
2163
+ headers: {
2164
+ "Content-Type": "application/vnd.api+json",
2165
+ ...options.headers
2166
+ }
2167
+ });
2079
2168
  var postInvitations = (options) => (options.client ?? client).post({
2080
2169
  security: [{ scheme: "bearer", type: "http" }],
2081
2170
  url: "/invitations",
@@ -2183,6 +2272,20 @@ var patchNotificationPreferencesById = (options) => (options.client ?? client).p
2183
2272
  ...options.headers
2184
2273
  }
2185
2274
  });
2275
+ var getWatcherClaims = (options) => (options.client ?? client).get({
2276
+ security: [{ scheme: "bearer", type: "http" }],
2277
+ url: "/watcher/claims",
2278
+ ...options
2279
+ });
2280
+ var postWatcherClaims = (options) => (options.client ?? client).post({
2281
+ security: [{ scheme: "bearer", type: "http" }],
2282
+ url: "/watcher/claims",
2283
+ ...options,
2284
+ headers: {
2285
+ "Content-Type": "application/vnd.api+json",
2286
+ ...options.headers
2287
+ }
2288
+ });
2186
2289
  var patchSchedulingBookingsSchedulingBookingsByIdReschedule = (options) => (options.client ?? client).patch({
2187
2290
  security: [{ scheme: "bearer", type: "http" }],
2188
2291
  url: "/scheduling/bookings/scheduling/bookings/{id}/reschedule",
@@ -2192,6 +2295,15 @@ var patchSchedulingBookingsSchedulingBookingsByIdReschedule = (options) => (opti
2192
2295
  ...options.headers
2193
2296
  }
2194
2297
  });
2298
+ var patchVoiceSessionsByIdFinalize = (options) => (options.client ?? client).patch({
2299
+ security: [{ scheme: "bearer", type: "http" }],
2300
+ url: "/voice/sessions/{id}/finalize",
2301
+ ...options,
2302
+ headers: {
2303
+ "Content-Type": "application/vnd.api+json",
2304
+ ...options.headers
2305
+ }
2306
+ });
2195
2307
  var postThreadsByIdExport = (options) => (options.client ?? client).post({
2196
2308
  security: [{ scheme: "bearer", type: "http" }],
2197
2309
  url: "/threads/{id}/export",
@@ -2479,15 +2591,6 @@ var patchThreadsByIdUnarchive = (options) => (options.client ?? client).patch({
2479
2591
  ...options.headers
2480
2592
  }
2481
2593
  });
2482
- var postStorageSignUpload = (options) => (options.client ?? client).post({
2483
- security: [{ scheme: "bearer", type: "http" }],
2484
- url: "/storage/sign-upload",
2485
- ...options,
2486
- headers: {
2487
- "Content-Type": "application/vnd.api+json",
2488
- ...options.headers
2489
- }
2490
- });
2491
2594
  var getAiConversations = (options) => (options.client ?? client).get({
2492
2595
  security: [{ scheme: "bearer", type: "http" }],
2493
2596
  url: "/ai/conversations",
@@ -2594,6 +2697,20 @@ var postWebhookDeliveriesBulkRetry = (options) => (options.client ?? client).pos
2594
2697
  ...options.headers
2595
2698
  }
2596
2699
  });
2700
+ var getWatcherClaimsById = (options) => (options.client ?? client).get({
2701
+ security: [{ scheme: "bearer", type: "http" }],
2702
+ url: "/watcher/claims/{id}",
2703
+ ...options
2704
+ });
2705
+ var patchWatcherClaimsById = (options) => (options.client ?? client).patch({
2706
+ security: [{ scheme: "bearer", type: "http" }],
2707
+ url: "/watcher/claims/{id}",
2708
+ ...options,
2709
+ headers: {
2710
+ "Content-Type": "application/vnd.api+json",
2711
+ ...options.headers
2712
+ }
2713
+ });
2597
2714
  var postUsersAuthLogin = (options) => (options.client ?? client).post({
2598
2715
  security: [{ scheme: "bearer", type: "http" }],
2599
2716
  url: "/users/auth/login",
@@ -2663,6 +2780,15 @@ var patchExtractionResultsByIdRegenerate = (options) => (options.client ?? clien
2663
2780
  ...options.headers
2664
2781
  }
2665
2782
  });
2783
+ var postUsersAuthConfirm = (options) => (options.client ?? client).post({
2784
+ security: [{ scheme: "bearer", type: "http" }],
2785
+ url: "/users/auth/confirm",
2786
+ ...options,
2787
+ headers: {
2788
+ "Content-Type": "application/vnd.api+json",
2789
+ ...options.headers
2790
+ }
2791
+ });
2666
2792
  var getSchedulingEventsById = (options) => (options.client ?? client).get({
2667
2793
  security: [{ scheme: "bearer", type: "http" }],
2668
2794
  url: "/scheduling/events/{id}",
@@ -2677,6 +2803,20 @@ var patchSchedulingEventsById = (options) => (options.client ?? client).patch({
2677
2803
  ...options.headers
2678
2804
  }
2679
2805
  });
2806
+ var getWorkspaceMemberships = (options) => (options.client ?? client).get({
2807
+ security: [{ scheme: "bearer", type: "http" }],
2808
+ url: "/workspace-memberships",
2809
+ ...options
2810
+ });
2811
+ var postWorkspaceMemberships = (options) => (options.client ?? client).post({
2812
+ security: [{ scheme: "bearer", type: "http" }],
2813
+ url: "/workspace-memberships",
2814
+ ...options,
2815
+ headers: {
2816
+ "Content-Type": "application/vnd.api+json",
2817
+ ...options.headers
2818
+ }
2819
+ });
2680
2820
  var getTenantsByTenantIdDocumentStats = (options) => (options.client ?? client).get({
2681
2821
  security: [{ scheme: "bearer", type: "http" }],
2682
2822
  url: "/tenants/{tenant_id}/document_stats",
@@ -2767,6 +2907,15 @@ var patchApplicationsByIdAllocateCredits = (options) => (options.client ?? clien
2767
2907
  ...options.headers
2768
2908
  }
2769
2909
  });
2910
+ var postUsersAuthMagicLinkRequest = (options) => (options.client ?? client).post({
2911
+ security: [{ scheme: "bearer", type: "http" }],
2912
+ url: "/users/auth/magic-link/request",
2913
+ ...options,
2914
+ headers: {
2915
+ "Content-Type": "application/vnd.api+json",
2916
+ ...options.headers
2917
+ }
2918
+ });
2770
2919
  var getExtractionResultsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
2771
2920
  security: [{ scheme: "bearer", type: "http" }],
2772
2921
  url: "/extraction/results/workspace/{workspace_id}",
@@ -2870,6 +3019,20 @@ var postAiMessages = (options) => (options.client ?? client).post({
2870
3019
  ...options.headers
2871
3020
  }
2872
3021
  });
3022
+ var getWatcherEvents = (options) => (options.client ?? client).get({
3023
+ security: [{ scheme: "bearer", type: "http" }],
3024
+ url: "/watcher/events",
3025
+ ...options
3026
+ });
3027
+ var postWatcherEvents = (options) => (options.client ?? client).post({
3028
+ security: [{ scheme: "bearer", type: "http" }],
3029
+ url: "/watcher/events",
3030
+ ...options,
3031
+ headers: {
3032
+ "Content-Type": "application/vnd.api+json",
3033
+ ...options.headers
3034
+ }
3035
+ });
2873
3036
  var postAgentVersionsByIdSetSystemFields = (options) => (options.client ?? client).post({
2874
3037
  security: [{ scheme: "bearer", type: "http" }],
2875
3038
  url: "/agent-versions/{id}/set-system-fields",
@@ -2997,6 +3160,29 @@ var postWorkspacesByWorkspaceIdExtractionExports = (options) => (options.client
2997
3160
  ...options.headers
2998
3161
  }
2999
3162
  });
3163
+ var deleteWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).delete({
3164
+ security: [{ scheme: "bearer", type: "http" }],
3165
+ url: "/workspace-memberships/{workspace_id}/{user_id}",
3166
+ ...options
3167
+ });
3168
+ var patchWorkspaceMembershipsByWorkspaceIdByUserId = (options) => (options.client ?? client).patch({
3169
+ security: [{ scheme: "bearer", type: "http" }],
3170
+ url: "/workspace-memberships/{workspace_id}/{user_id}",
3171
+ ...options,
3172
+ headers: {
3173
+ "Content-Type": "application/vnd.api+json",
3174
+ ...options.headers
3175
+ }
3176
+ });
3177
+ var postTrainingExamplesBulkDelete = (options) => (options.client ?? client).post({
3178
+ security: [{ scheme: "bearer", type: "http" }],
3179
+ url: "/training-examples/bulk-delete",
3180
+ ...options,
3181
+ headers: {
3182
+ "Content-Type": "application/vnd.api+json",
3183
+ ...options.headers
3184
+ }
3185
+ });
3000
3186
  var getCreditPackages = (options) => (options.client ?? client).get({
3001
3187
  security: [{ scheme: "bearer", type: "http" }],
3002
3188
  url: "/credit-packages",
@@ -3007,11 +3193,6 @@ var getUsers = (options) => (options.client ?? client).get({
3007
3193
  url: "/users",
3008
3194
  ...options
3009
3195
  });
3010
- var getObjects = (options) => (options.client ?? client).get({
3011
- security: [{ scheme: "bearer", type: "http" }],
3012
- url: "/objects",
3013
- ...options
3014
- });
3015
3196
 
3016
3197
  // src/pagination.ts
3017
3198
  var DEFAULT_MAX_PAGES = 500;
@@ -3957,6 +4138,35 @@ function createExtractionNamespace(rb) {
3957
4138
  },
3958
4139
  options
3959
4140
  );
4141
+ },
4142
+ /**
4143
+ * Query rows in an ExtractionResult server-side.
4144
+ *
4145
+ * Applies AttributeFilter predicates against the `rows` JSONB array
4146
+ * using a PostgreSQL lateral join. Suitable for datasets with 10K+ rows.
4147
+ * Empty `filters` array returns all rows (paginated by `limit`/`offset`).
4148
+ *
4149
+ * @example
4150
+ * const result = await client.extraction.results.query(resultId, {
4151
+ * filters: [
4152
+ * { field: 'wellness_score', op: 'gt', value: 75 },
4153
+ * { field: 'enrolled', op: 'eq', value: 'true' },
4154
+ * ],
4155
+ * limit: 100,
4156
+ * offset: 0,
4157
+ * });
4158
+ * console.log(`${result.filtered} of ${result.total} rows match`);
4159
+ */
4160
+ query: async (resultId, params, options) => {
4161
+ return rb.rawPost(
4162
+ `/extraction/results/${resultId}/query`,
4163
+ {
4164
+ filters: params.filters,
4165
+ limit: params.limit,
4166
+ offset: params.offset
4167
+ },
4168
+ options
4169
+ );
3960
4170
  }
3961
4171
  },
3962
4172
  batches: {
@@ -4108,6 +4318,35 @@ var ApiKeyAllocateSchema = import_zod2.z.object({
4108
4318
  amount: import_zod2.z.number().positive(),
4109
4319
  description: import_zod2.z.string().min(1)
4110
4320
  });
4321
+ var MagicLinkRequestSchema = import_zod2.z.object({
4322
+ email: import_zod2.z.string().email()
4323
+ });
4324
+ var RequestPasswordResetSchema = import_zod2.z.object({
4325
+ email: import_zod2.z.string().email()
4326
+ });
4327
+ var MagicLinkLoginSchema = import_zod2.z.object({
4328
+ token: import_zod2.z.string().min(1)
4329
+ });
4330
+ var ConfirmEmailSchema = import_zod2.z.object({
4331
+ email: import_zod2.z.string().email(),
4332
+ confirmation_token: import_zod2.z.string().min(1)
4333
+ });
4334
+ var ResetPasswordWithTokenSchema = import_zod2.z.object({
4335
+ token: import_zod2.z.string().min(1),
4336
+ password: import_zod2.z.string().min(8),
4337
+ password_confirmation: import_zod2.z.string().min(8)
4338
+ }).refine((data) => data.password === data.password_confirmation, {
4339
+ message: "Passwords do not match",
4340
+ path: ["password_confirmation"]
4341
+ });
4342
+ var ChangePasswordSchema = import_zod2.z.object({
4343
+ current_password: import_zod2.z.string().min(1),
4344
+ password: import_zod2.z.string().min(8),
4345
+ password_confirmation: import_zod2.z.string().min(8)
4346
+ }).refine((data) => data.password === data.password_confirmation, {
4347
+ message: "Passwords do not match",
4348
+ path: ["password_confirmation"]
4349
+ });
4111
4350
  function createIdentityNamespace(rb) {
4112
4351
  return {
4113
4352
  /** Login with email and password — returns a token object */
@@ -4187,6 +4426,117 @@ function createIdentityNamespace(rb) {
4187
4426
  resendConfirmation: async (options) => {
4188
4427
  return rb.execute(postUsersAuthResendConfirmation, {}, options);
4189
4428
  },
4429
+ /** Confirm an email address using the token from the confirmation email */
4430
+ confirmEmail: async (email, confirmationToken, options) => {
4431
+ ConfirmEmailSchema.parse({
4432
+ email,
4433
+ confirmation_token: confirmationToken
4434
+ });
4435
+ return rb.execute(
4436
+ postUsersAuthConfirm,
4437
+ {
4438
+ body: {
4439
+ data: {
4440
+ type: "user",
4441
+ attributes: { email, confirmation_token: confirmationToken }
4442
+ }
4443
+ }
4444
+ },
4445
+ options
4446
+ );
4447
+ },
4448
+ /** Request a magic link sign-in email */
4449
+ requestMagicLink: async (email, options) => {
4450
+ MagicLinkRequestSchema.parse({ email });
4451
+ return rb.execute(
4452
+ postUsersAuthMagicLinkRequest,
4453
+ {
4454
+ body: {
4455
+ data: { type: "user", attributes: { email } }
4456
+ }
4457
+ },
4458
+ options
4459
+ );
4460
+ },
4461
+ /**
4462
+ * Request a password reset email — always returns success to prevent email enumeration.
4463
+ * The user will receive an email with a reset token if the account exists.
4464
+ */
4465
+ requestPasswordReset: async (email, options) => {
4466
+ RequestPasswordResetSchema.parse({ email });
4467
+ return rb.execute(
4468
+ postUsersAuthResetPasswordRequest,
4469
+ {
4470
+ body: {
4471
+ data: { type: "user", attributes: { email } }
4472
+ }
4473
+ },
4474
+ options
4475
+ );
4476
+ },
4477
+ /** Sign in using a token from a magic link email */
4478
+ signInWithMagicLink: async (token, options) => {
4479
+ MagicLinkLoginSchema.parse({ token });
4480
+ return rb.execute(
4481
+ postUsersAuthMagicLinkLogin,
4482
+ {
4483
+ body: {
4484
+ data: { type: "user", attributes: { token } }
4485
+ }
4486
+ },
4487
+ options
4488
+ );
4489
+ },
4490
+ /** Reset a password using the token from a password reset email */
4491
+ resetPasswordWithToken: async (token, password, passwordConfirmation, options) => {
4492
+ ResetPasswordWithTokenSchema.parse({
4493
+ token,
4494
+ password,
4495
+ password_confirmation: passwordConfirmation
4496
+ });
4497
+ return rb.execute(
4498
+ patchUsersAuthResetPassword,
4499
+ {
4500
+ body: {
4501
+ data: {
4502
+ id: "",
4503
+ type: "user",
4504
+ attributes: {
4505
+ token,
4506
+ password,
4507
+ password_confirmation: passwordConfirmation
4508
+ }
4509
+ }
4510
+ }
4511
+ },
4512
+ options
4513
+ );
4514
+ },
4515
+ /** Change password for the currently authenticated user */
4516
+ changePassword: async (currentPassword, password, passwordConfirmation, options) => {
4517
+ ChangePasswordSchema.parse({
4518
+ current_password: currentPassword,
4519
+ password,
4520
+ password_confirmation: passwordConfirmation
4521
+ });
4522
+ return rb.execute(
4523
+ patchUsersAuthPasswordChange,
4524
+ {
4525
+ body: {
4526
+ data: {
4527
+ id: "",
4528
+ type: "user",
4529
+ attributes: {
4530
+ current_password: currentPassword,
4531
+ password,
4532
+ password_confirmation: passwordConfirmation
4533
+ }
4534
+ }
4535
+ }
4536
+ },
4537
+ options
4538
+ );
4539
+ },
4190
4540
  delete: async (id, options) => {
4191
4541
  return rb.executeDelete(deleteUsersById, { path: { id } }, options);
4192
4542
  },
@@ -4579,12 +4929,440 @@ function createPlatformNamespace(rb) {
4579
4929
  options
4580
4930
  );
4581
4931
  }
4582
- }
4583
- };
4584
- }
4585
-
4586
- // src/namespaces/search.ts
4587
- function createSearchNamespace(rb) {
4932
+ },
4933
+ workspaceMembers: {
4934
+ /** List members of a workspace */
4935
+ list: async (workspaceId, options) => {
4936
+ return rb.execute(
4937
+ getWorkspaceMemberships,
4938
+ {
4939
+ query: {
4940
+ filter: { workspace_id: workspaceId },
4941
+ ...buildPageQuery(options?.page, options?.pageSize)?.query
4942
+ }
4943
+ },
4944
+ options
4945
+ );
4946
+ },
4947
+ /** Get a specific workspace member by workspace and user ID */
4948
+ get: async (workspaceId, memberId, options) => {
4949
+ return rb.rawGet(
4950
+ `/workspace-memberships/${workspaceId}/${memberId}`,
4951
+ options
4952
+ );
4953
+ },
4954
+ /** Add a user to a workspace */
4955
+ create: async (workspaceId, attrs, options) => {
4956
+ return rb.execute(
4957
+ postWorkspaceMemberships,
4958
+ {
4959
+ body: {
4960
+ data: {
4961
+ type: "workspace-membership",
4962
+ attributes: { workspace_id: workspaceId, ...attrs }
4963
+ }
4964
+ }
4965
+ },
4966
+ options
4967
+ );
4968
+ },
4969
+ /** Update workspace member permissions or role */
4970
+ update: async (workspaceId, memberId, attrs, options) => {
4971
+ return rb.execute(
4972
+ patchWorkspaceMembershipsByWorkspaceIdByUserId,
4973
+ {
4974
+ path: { workspace_id: workspaceId, user_id: memberId },
4975
+ body: {
4976
+ data: {
4977
+ id: memberId,
4978
+ type: "workspace-membership",
4979
+ attributes: attrs
4980
+ }
4981
+ }
4982
+ },
4983
+ options
4984
+ );
4985
+ },
4986
+ /** Update workspace member profile attributes (G9) */
4987
+ updateProfile: async (workspaceId, memberId, profileAttrs, options) => {
4988
+ return rb.rawPost(
4989
+ `/workspace-memberships/${workspaceId}/${memberId}/profile`,
4990
+ { data: { attributes: { profile_attributes: profileAttrs } } },
4991
+ options
4992
+ );
4993
+ },
4994
+ /** Remove a user from a workspace */
4995
+ remove: async (workspaceId, memberId, options) => {
4996
+ return rb.executeDelete(
4997
+ deleteWorkspaceMembershipsByWorkspaceIdByUserId,
4998
+ { path: { workspace_id: workspaceId, user_id: memberId } },
4999
+ options
5000
+ );
5001
+ }
5002
+ }
5003
+ };
5004
+ }
5005
+
5006
+ // src/namespaces/scheduling.ts
5007
+ function createSchedulingNamespace(rb) {
5008
+ return {
5009
+ /**
5010
+ * Event Types — templates for bookable events
5011
+ */
5012
+ eventTypes: {
5013
+ /** List event types with optional pagination */
5014
+ list: async (options) => {
5015
+ return rb.execute(
5016
+ getSchedulingEventTypes,
5017
+ buildPageQuery(options?.page, options?.pageSize),
5018
+ options
5019
+ );
5020
+ },
5021
+ /** List all event types with automatic pagination */
5022
+ listAll: async (options) => {
5023
+ return paginateToArray(
5024
+ rb.createPaginatedFetcher(
5025
+ getSchedulingEventTypes,
5026
+ (page, pageSize) => ({
5027
+ query: { page: { number: page, size: pageSize } }
5028
+ }),
5029
+ options
5030
+ )
5031
+ );
5032
+ },
5033
+ /** Get an event type by ID */
5034
+ get: async (id, options) => {
5035
+ return rb.execute(
5036
+ getSchedulingEventTypesById,
5037
+ { path: { id } },
5038
+ options
5039
+ );
5040
+ },
5041
+ /**
5042
+ * Create a new event type.
5043
+ * @example
5044
+ * ```typescript
5045
+ * const client = new GptClient({ apiKey: 'sk_tenant_...' });
5046
+ * const eventType = await client.scheduling.eventTypes.create({
5047
+ * name: '30-Minute Consultation',
5048
+ * slug: '30min-consult',
5049
+ * duration_minutes: 30,
5050
+ * location_type: 'video',
5051
+ * });
5052
+ * ```
5053
+ */
5054
+ create: async (attributes, options) => {
5055
+ return rb.execute(
5056
+ postSchedulingEventTypes,
5057
+ {
5058
+ body: { data: { type: "scheduling_event_type", attributes } }
5059
+ },
5060
+ options
5061
+ );
5062
+ },
5063
+ /** Update an event type */
5064
+ update: async (id, attributes, options) => {
5065
+ return rb.execute(
5066
+ patchSchedulingEventTypesById,
5067
+ {
5068
+ path: { id },
5069
+ body: { data: { id, type: "scheduling_event_type", attributes } }
5070
+ },
5071
+ options
5072
+ );
5073
+ }
5074
+ },
5075
+ /**
5076
+ * Events — scheduled occurrences
5077
+ */
5078
+ events: {
5079
+ /** List events with optional pagination */
5080
+ list: async (options) => {
5081
+ return rb.execute(
5082
+ getSchedulingEvents,
5083
+ buildPageQuery(options?.page, options?.pageSize),
5084
+ options
5085
+ );
5086
+ },
5087
+ /** List all events with automatic pagination */
5088
+ listAll: async (options) => {
5089
+ return paginateToArray(
5090
+ rb.createPaginatedFetcher(
5091
+ getSchedulingEvents,
5092
+ (page, pageSize) => ({
5093
+ query: { page: { number: page, size: pageSize } }
5094
+ }),
5095
+ options
5096
+ )
5097
+ );
5098
+ },
5099
+ /** Get an event by ID */
5100
+ get: async (id, options) => {
5101
+ return rb.execute(
5102
+ getSchedulingEventsById,
5103
+ { path: { id } },
5104
+ options
5105
+ );
5106
+ },
5107
+ /**
5108
+ * Create an internal event directly.
5109
+ * Use for meetings between known users in the workspace.
5110
+ */
5111
+ create: async (attributes, options) => {
5112
+ return rb.execute(
5113
+ postSchedulingEvents,
5114
+ {
5115
+ body: { data: { type: "scheduling_event", attributes } }
5116
+ },
5117
+ options
5118
+ );
5119
+ },
5120
+ /** Update an event */
5121
+ update: async (id, attributes, options) => {
5122
+ return rb.execute(
5123
+ patchSchedulingEventsById,
5124
+ {
5125
+ path: { id },
5126
+ body: { data: { id, type: "scheduling_event", attributes } }
5127
+ },
5128
+ options
5129
+ );
5130
+ }
5131
+ },
5132
+ /**
5133
+ * Participants — people attending events
5134
+ */
5135
+ participants: {
5136
+ /** List participants with optional pagination */
5137
+ list: async (options) => {
5138
+ return rb.execute(
5139
+ getSchedulingParticipants,
5140
+ buildPageQuery(options?.page, options?.pageSize),
5141
+ options
5142
+ );
5143
+ },
5144
+ /** List all participants with automatic pagination */
5145
+ listAll: async (options) => {
5146
+ return paginateToArray(
5147
+ rb.createPaginatedFetcher(
5148
+ getSchedulingParticipants,
5149
+ (page, pageSize) => ({
5150
+ query: { page: { number: page, size: pageSize } }
5151
+ }),
5152
+ options
5153
+ )
5154
+ );
5155
+ },
5156
+ /** Get a participant by ID */
5157
+ get: async (id, options) => {
5158
+ return rb.execute(
5159
+ getSchedulingParticipantsById,
5160
+ { path: { id } },
5161
+ options
5162
+ );
5163
+ },
5164
+ /** Add a participant to an event */
5165
+ create: async (attributes, options) => {
5166
+ return rb.execute(
5167
+ postSchedulingParticipants,
5168
+ {
5169
+ body: { data: { type: "scheduling_participant", attributes } }
5170
+ },
5171
+ options
5172
+ );
5173
+ },
5174
+ /** Update a participant (e.g., confirm attendance, respond to invite) */
5175
+ update: async (id, attributes, options) => {
5176
+ return rb.execute(
5177
+ patchSchedulingParticipantsById,
5178
+ {
5179
+ path: { id },
5180
+ body: { data: { id, type: "scheduling_participant", attributes } }
5181
+ },
5182
+ options
5183
+ );
5184
+ }
5185
+ },
5186
+ /**
5187
+ * Bookings — external party requests for appointments
5188
+ */
5189
+ bookings: {
5190
+ /** List bookings with optional pagination */
5191
+ list: async (options) => {
5192
+ return rb.execute(
5193
+ getSchedulingBookings,
5194
+ buildPageQuery(options?.page, options?.pageSize),
5195
+ options
5196
+ );
5197
+ },
5198
+ /** List all bookings with automatic pagination */
5199
+ listAll: async (options) => {
5200
+ return paginateToArray(
5201
+ rb.createPaginatedFetcher(
5202
+ getSchedulingBookings,
5203
+ (page, pageSize) => ({
5204
+ query: { page: { number: page, size: pageSize } }
5205
+ }),
5206
+ options
5207
+ )
5208
+ );
5209
+ },
5210
+ /** Get a booking by ID */
5211
+ get: async (id, options) => {
5212
+ return rb.execute(
5213
+ getSchedulingBookingsById,
5214
+ { path: { id } },
5215
+ options
5216
+ );
5217
+ },
5218
+ /**
5219
+ * Create a booking request.
5220
+ * Use when someone outside the platform requests an appointment.
5221
+ * @example
5222
+ * ```typescript
5223
+ * const booking = await client.scheduling.bookings.create({
5224
+ * event_type_id: 'event_123',
5225
+ * start_time: '2025-03-01T10:00:00Z',
5226
+ * booker_name: 'John Doe',
5227
+ * booker_email: 'john@example.com',
5228
+ * });
5229
+ * ```
5230
+ */
5231
+ create: async (attributes, options) => {
5232
+ return rb.execute(
5233
+ postSchedulingBookings,
5234
+ {
5235
+ body: { data: { type: "scheduling_booking", attributes } }
5236
+ },
5237
+ options
5238
+ );
5239
+ },
5240
+ /**
5241
+ * Confirm a pending booking.
5242
+ * For EventTypes with requires_approval=true.
5243
+ */
5244
+ confirm: async (id, options) => {
5245
+ return rb.execute(
5246
+ patchSchedulingBookingsSchedulingBookingsByIdConfirm,
5247
+ { path: { id }, body: {} },
5248
+ options
5249
+ );
5250
+ },
5251
+ /**
5252
+ * Cancel or reject a booking.
5253
+ */
5254
+ cancel: async (id, attributes, options) => {
5255
+ return rb.execute(
5256
+ patchSchedulingBookingsSchedulingBookingsByIdCancel,
5257
+ {
5258
+ path: { id },
5259
+ body: attributes ? { data: { type: "scheduling_booking", attributes } } : {}
5260
+ },
5261
+ options
5262
+ );
5263
+ },
5264
+ /**
5265
+ * Reschedule a booking to a new time.
5266
+ */
5267
+ reschedule: async (id, attributes, options) => {
5268
+ return rb.execute(
5269
+ patchSchedulingBookingsSchedulingBookingsByIdReschedule,
5270
+ {
5271
+ path: { id },
5272
+ body: { data: { type: "scheduling_booking", attributes } }
5273
+ },
5274
+ options
5275
+ );
5276
+ }
5277
+ },
5278
+ /**
5279
+ * Calendar Syncs — external calendar integrations
5280
+ */
5281
+ calendarSyncs: {
5282
+ /** List calendar syncs with optional pagination */
5283
+ list: async (options) => {
5284
+ return rb.execute(
5285
+ getSchedulingCalendarSyncs,
5286
+ buildPageQuery(options?.page, options?.pageSize),
5287
+ options
5288
+ );
5289
+ },
5290
+ /** List all calendar syncs with automatic pagination */
5291
+ listAll: async (options) => {
5292
+ return paginateToArray(
5293
+ rb.createPaginatedFetcher(
5294
+ getSchedulingCalendarSyncs,
5295
+ (page, pageSize) => ({
5296
+ query: { page: { number: page, size: pageSize } }
5297
+ }),
5298
+ options
5299
+ )
5300
+ );
5301
+ },
5302
+ /** Get a calendar sync by ID */
5303
+ get: async (id, options) => {
5304
+ return rb.execute(
5305
+ getSchedulingCalendarSyncsById,
5306
+ { path: { id } },
5307
+ options
5308
+ );
5309
+ },
5310
+ /**
5311
+ * Create a calendar sync.
5312
+ * For bi-directional sync with external calendars (Google, Outlook).
5313
+ */
5314
+ create: async (attributes, options) => {
5315
+ return rb.execute(
5316
+ postSchedulingCalendarSyncs,
5317
+ {
5318
+ body: { data: { type: "scheduling_calendar_sync", attributes } }
5319
+ },
5320
+ options
5321
+ );
5322
+ },
5323
+ /** Update a calendar sync */
5324
+ update: async (id, attributes, options) => {
5325
+ return rb.execute(
5326
+ patchSchedulingCalendarSyncsSchedulingCalendarSyncsById,
5327
+ {
5328
+ path: { id },
5329
+ body: {
5330
+ data: { id, type: "scheduling_calendar_sync", attributes }
5331
+ }
5332
+ },
5333
+ options
5334
+ );
5335
+ },
5336
+ /** Delete a calendar sync */
5337
+ delete: async (id, options) => {
5338
+ return rb.executeDelete(
5339
+ deleteSchedulingCalendarSyncsSchedulingCalendarSyncsById,
5340
+ { path: { id } },
5341
+ options
5342
+ );
5343
+ },
5344
+ /** Pause a calendar sync (stops pushing/pulling) */
5345
+ pause: async (id, options) => {
5346
+ return rb.execute(
5347
+ patchSchedulingCalendarSyncsSchedulingCalendarSyncsByIdPause,
5348
+ { path: { id }, body: {} },
5349
+ options
5350
+ );
5351
+ },
5352
+ /** Resume a paused calendar sync */
5353
+ resume: async (id, options) => {
5354
+ return rb.execute(
5355
+ patchSchedulingCalendarSyncsSchedulingCalendarSyncsByIdResume,
5356
+ { path: { id }, body: {} },
5357
+ options
5358
+ );
5359
+ }
5360
+ }
5361
+ };
5362
+ }
5363
+
5364
+ // src/namespaces/search.ts
5365
+ function createSearchNamespace(rb) {
4588
5366
  return {
4589
5367
  /** Full-text search query */
4590
5368
  query: async (query, options) => {
@@ -4649,29 +5427,15 @@ function createStorageNamespace(rb) {
4649
5427
  /** Generate a presigned upload URL for direct-to-storage uploads */
4650
5428
  signUpload: async (attributes, options) => {
4651
5429
  return rb.execute(
4652
- postStorageSignUpload,
4653
- {
4654
- body: { data: { type: "signed_url", attributes: attributes ?? {} } }
4655
- },
4656
- options
4657
- );
4658
- },
4659
- /** Generate a presigned download URL for accessing stored objects */
4660
- signDownload: async (attributes, options) => {
4661
- return rb.execute(
4662
- postStorageSignDownload,
5430
+ postDocumentsPresignedUpload,
4663
5431
  {
4664
- body: { data: { type: "signed_url", attributes: attributes ?? {} } }
5432
+ body: {
5433
+ data: { type: "presigned_upload", attributes: attributes ?? {} }
5434
+ }
4665
5435
  },
4666
5436
  options
4667
5437
  );
4668
5438
  },
4669
- objects: {
4670
- /** List storage objects */
4671
- list: async (options) => {
4672
- return rb.execute(getObjects, {}, options);
4673
- }
4674
- },
4675
5439
  buckets: {
4676
5440
  list: async (options) => {
4677
5441
  return rb.execute(
@@ -4833,20 +5597,20 @@ function createThreadsNamespace(rb) {
4833
5597
  };
4834
5598
  }
4835
5599
 
4836
- // src/namespaces/webhooks-ns.ts
4837
- function createWebhooksNamespace(rb) {
5600
+ // src/namespaces/training.ts
5601
+ function createTrainingNamespace(rb) {
4838
5602
  return {
4839
- configs: {
5603
+ examples: {
4840
5604
  delete: async (id, options) => {
4841
5605
  return rb.executeDelete(
4842
- deleteWebhookConfigsById,
5606
+ deleteTrainingExamplesById,
4843
5607
  { path: { id } },
4844
5608
  options
4845
5609
  );
4846
5610
  },
4847
5611
  list: async (options) => {
4848
5612
  return rb.execute(
4849
- getWebhookConfigs,
5613
+ getTrainingExamples,
4850
5614
  buildPageQuery(options?.page, options?.pageSize),
4851
5615
  options
4852
5616
  );
@@ -4854,7 +5618,7 @@ function createWebhooksNamespace(rb) {
4854
5618
  listAll: async (options) => {
4855
5619
  return paginateToArray(
4856
5620
  rb.createPaginatedFetcher(
4857
- getWebhookConfigs,
5621
+ getTrainingExamples,
4858
5622
  (page, pageSize) => ({
4859
5623
  query: { page: { number: page, size: pageSize } }
4860
5624
  }),
@@ -4862,112 +5626,257 @@ function createWebhooksNamespace(rb) {
4862
5626
  )
4863
5627
  );
4864
5628
  },
5629
+ get: async (id, options) => {
5630
+ return rb.execute(
5631
+ getTrainingExamplesById,
5632
+ { path: { id } },
5633
+ options
5634
+ );
5635
+ },
4865
5636
  create: async (attributes, options) => {
4866
5637
  return rb.execute(
4867
- postWebhookConfigs,
4868
- { body: { data: { type: "webhook_config", attributes } } },
5638
+ postTrainingExamplesBulkDelete,
5639
+ { body: { data: { type: "training_example", attributes } } },
4869
5640
  options
4870
5641
  );
4871
5642
  },
4872
5643
  update: async (id, attributes, options) => {
4873
5644
  return rb.execute(
4874
- patchWebhookConfigsById,
5645
+ patchTrainingExamplesById,
4875
5646
  {
4876
5647
  path: { id },
4877
- body: { data: { id, type: "webhook_config", attributes } }
5648
+ body: { data: { id, type: "training_example", attributes } }
4878
5649
  },
4879
5650
  options
4880
5651
  );
4881
5652
  },
4882
- test: async (id, options) => {
5653
+ bulkCreate: async (options) => {
4883
5654
  return rb.execute(
4884
- postWebhookConfigsByIdTest,
4885
- { path: { id }, body: {} },
5655
+ postTrainingExamplesBulkDelete,
5656
+ {},
4886
5657
  options
4887
5658
  );
4888
5659
  },
4889
- bulkEnable: async (options) => {
5660
+ bulkDestroy: async (options) => {
4890
5661
  return rb.execute(
4891
- postWebhookConfigsBulkEnable,
5662
+ postTrainingExamplesBulkDelete,
4892
5663
  {},
4893
5664
  options
4894
5665
  );
4895
5666
  },
4896
- bulkDisable: async (options) => {
5667
+ searchByVector: async (options) => {
4897
5668
  return rb.execute(
4898
- postWebhookConfigsBulkDisable,
5669
+ postTrainingExamplesBulkDelete,
4899
5670
  {},
4900
5671
  options
4901
5672
  );
4902
- },
4903
- /** Replay historical events to this webhook */
4904
- replay: async (id, options) => {
5673
+ }
5674
+ },
5675
+ sessions: {
5676
+ listAgentsSessions: async (options) => {
4905
5677
  return rb.execute(
4906
- postWebhookConfigsByIdReplay,
4907
- { path: { id }, body: {} },
5678
+ getTrainingSessionsAgentsByAgentIdSessions,
5679
+ buildPageQuery(options?.page, options?.pageSize),
4908
5680
  options
4909
5681
  );
4910
5682
  },
5683
+ listAllAgentsSessions: async (options) => {
5684
+ return paginateToArray(
5685
+ rb.createPaginatedFetcher(
5686
+ getTrainingSessionsAgentsByAgentIdSessions,
5687
+ (page, pageSize) => ({
5688
+ query: { page: { number: page, size: pageSize } }
5689
+ }),
5690
+ options
5691
+ )
5692
+ );
5693
+ },
4911
5694
  get: async (id, options) => {
4912
5695
  return rb.execute(
4913
- getWebhookConfigsById,
5696
+ getTrainingSessionsById,
4914
5697
  { path: { id } },
4915
5698
  options
4916
5699
  );
4917
5700
  },
4918
- /** Rotate the signing secret for a webhook config */
4919
- rotateSecret: async (id, options) => {
5701
+ create: async (attributes, options) => {
4920
5702
  return rb.execute(
4921
- patchWebhookConfigsByIdRotateSecret,
4922
- { path: { id }, body: {} },
5703
+ getTrainingSessionsAgentsByAgentIdSessions,
5704
+ { body: { data: { type: "training_session", attributes } } },
5705
+ options
5706
+ );
5707
+ },
5708
+ delete: async (id, options) => {
5709
+ return rb.executeDelete(
5710
+ deleteTrainingSessionsById,
5711
+ { path: { id } },
5712
+ options
5713
+ );
5714
+ },
5715
+ update: async (agentId, attributes, options) => {
5716
+ return rb.execute(
5717
+ getTrainingSessionsAgentsByAgentIdSessions,
5718
+ {
5719
+ path: { agent_id: agentId },
5720
+ body: { data: { type: "training_session", attributes } }
5721
+ },
4923
5722
  options
4924
5723
  );
4925
5724
  }
5725
+ }
5726
+ };
5727
+ }
5728
+
5729
+ // src/namespaces/voice.ts
5730
+ function createVoiceNamespace(rb) {
5731
+ return {
5732
+ /**
5733
+ * Transcribe an audio file via the voice transcription endpoint.
5734
+ * Accepts File or Blob. Supported formats: mp3, ogg, wav, m4a, webm, flac, aac.
5735
+ *
5736
+ * @param audio - Audio file to transcribe (max 200 MB)
5737
+ * @param params - Optional transcription parameters
5738
+ * @param options - Request options (signal, headers, etc.)
5739
+ */
5740
+ transcribe: async (audio, params, options) => {
5741
+ const form = new FormData();
5742
+ form.append("audio", audio);
5743
+ if (params?.language) form.append("language", params.language);
5744
+ if (params?.modelSize) form.append("model_size", params.modelSize);
5745
+ if (params?.phiMode) form.append("phi_mode", params.phiMode);
5746
+ if (params?.phiKey) form.append("phi_key", params.phiKey);
5747
+ return rb.rawPostMultipart(
5748
+ "/voice/transcribe",
5749
+ form,
5750
+ options
5751
+ );
4926
5752
  },
4927
- deliveries: {
5753
+ /**
5754
+ * Sessions — voice session management
5755
+ */
5756
+ sessions: {
5757
+ /** List voice sessions with pagination */
4928
5758
  list: async (options) => {
4929
5759
  return rb.execute(
4930
- getWebhookDeliveries,
5760
+ getVoiceSessions,
4931
5761
  buildPageQuery(options?.page, options?.pageSize),
4932
5762
  options
4933
5763
  );
4934
5764
  },
4935
- listAll: async (options) => {
4936
- return paginateToArray(
4937
- rb.createPaginatedFetcher(
4938
- getWebhookDeliveries,
4939
- (page, pageSize) => ({
4940
- query: { page: { number: page, size: pageSize } }
4941
- }),
4942
- options
4943
- )
5765
+ /** Get a session by ID */
5766
+ get: async (id, options) => {
5767
+ return rb.execute(
5768
+ getVoiceSessionsById,
5769
+ { path: { id } },
5770
+ options
4944
5771
  );
4945
5772
  },
4946
- create: async (attributes, options) => {
5773
+ /** List my voice sessions */
5774
+ listMine: async (options) => {
4947
5775
  return rb.execute(
4948
- postWebhookDeliveriesBulkRetry,
4949
- { body: { data: { type: "webhook_delivery", attributes } } },
5776
+ getVoiceSessionsMine,
5777
+ buildPageQuery(options?.page, options?.pageSize),
4950
5778
  options
4951
5779
  );
4952
5780
  },
4953
- retry: async (options) => {
5781
+ /** List sessions by workspace */
5782
+ listByWorkspace: async (workspaceId, options) => {
4954
5783
  return rb.execute(
4955
- postWebhookDeliveriesBulkRetry,
4956
- {},
5784
+ getVoiceSessionsWorkspaceByWorkspaceId,
5785
+ {
5786
+ path: { workspace_id: workspaceId },
5787
+ ...buildPageQuery(options?.page, options?.pageSize)
5788
+ },
4957
5789
  options
4958
5790
  );
4959
5791
  },
4960
- bulkRetry: async (options) => {
5792
+ /**
5793
+ * Start a new voice session with LiveKit room provisioning.
5794
+ *
5795
+ * @param params - Session parameters
5796
+ * @param params.phiKey - AES-256 encryption key for PHI (Protected Health
5797
+ * Information), encoded as Base64 (32 raw bytes). Required when
5798
+ * `phiMode` is `"tokenize_encrypt"`.
5799
+ * @param options - Request options
5800
+ *
5801
+ * @remarks
5802
+ * **Security — `phiKey`:** This value is a sensitive encryption key.
5803
+ * - Transmitted over HTTPS only — never send over plain HTTP.
5804
+ * - Do not log, store in `localStorage`, or include in error reports.
5805
+ * - Treat it with the same care as a password or private key.
5806
+ * - The server never persists this key; it is used only within the
5807
+ * lifetime of the request.
5808
+ */
5809
+ start: async (params, options) => {
4961
5810
  return rb.execute(
4962
- postWebhookDeliveriesBulkRetry,
4963
- {},
5811
+ postVoiceSessions,
5812
+ {
5813
+ body: {
5814
+ data: {
5815
+ type: "voice_session",
5816
+ attributes: {
5817
+ thread_id: params?.threadId,
5818
+ blueprint_id: params?.blueprintId,
5819
+ blueprint_mode: params?.blueprintMode,
5820
+ phi_mode: params?.phiMode,
5821
+ phi_key: params?.phiKey,
5822
+ patient_id: params?.patientId
5823
+ }
5824
+ }
5825
+ }
5826
+ },
4964
5827
  options
4965
5828
  );
4966
5829
  },
4967
- get: async (id, options) => {
5830
+ /** End a voice session and release the LiveKit room */
5831
+ stop: async (id, options) => {
4968
5832
  return rb.execute(
4969
- getWebhookDeliveriesById,
4970
- { path: { id } },
5833
+ patchVoiceSessionsByIdStop,
5834
+ { path: { id }, body: { data: { id, type: "voice_session" } } },
5835
+ options
5836
+ );
5837
+ },
5838
+ /**
5839
+ * Dispatch the accumulated session transcript to the blueprint or chat
5840
+ * pipeline. The transcript may contain PHI (Protected Health Information)
5841
+ * depending on the session's `phiMode`.
5842
+ *
5843
+ * @param id - Voice session ID
5844
+ * @param params - Finalization parameters
5845
+ * @param params.phiKey - AES-256 encryption key for PHI, encoded as
5846
+ * Base64 (32 raw bytes). Overrides the key supplied at session start.
5847
+ * Required when `phiMode` is `"tokenize_encrypt"`.
5848
+ * @param options - Request options
5849
+ *
5850
+ * @remarks
5851
+ * **Security — transcript PHI:** The finalized transcript submitted to
5852
+ * this endpoint may contain Protected Health Information. Ensure the
5853
+ * request is made over HTTPS only.
5854
+ *
5855
+ * **Security — `phiKey`:** This value is a sensitive encryption key.
5856
+ * - Transmitted over HTTPS only — never send over plain HTTP.
5857
+ * - Do not log, store in `localStorage`, or include in error reports.
5858
+ * - Treat it with the same care as a password or private key.
5859
+ * - The server never persists this key; it is used only within the
5860
+ * lifetime of the request.
5861
+ */
5862
+ finalize: async (id, params, options) => {
5863
+ return rb.execute(
5864
+ patchVoiceSessionsByIdFinalize,
5865
+ {
5866
+ path: { id },
5867
+ body: {
5868
+ data: {
5869
+ id,
5870
+ type: "voice_session",
5871
+ attributes: {
5872
+ blueprint_id: params?.blueprintId,
5873
+ phi_mode: params?.phiMode,
5874
+ phi_key: params?.phiKey,
5875
+ patient_id: params?.patientId
5876
+ }
5877
+ }
5878
+ }
5879
+ },
4971
5880
  options
4972
5881
  );
4973
5882
  }
@@ -4975,26 +5884,21 @@ function createWebhooksNamespace(rb) {
4975
5884
  };
4976
5885
  }
4977
5886
 
4978
- // src/namespaces/scheduling.ts
4979
- function createSchedulingNamespace(rb) {
5887
+ // src/namespaces/watcher.ts
5888
+ function createWatcherNamespace(rb) {
4980
5889
  return {
4981
- /**
4982
- * Event Types — templates for bookable events
4983
- */
4984
- eventTypes: {
4985
- /** List event types with optional pagination */
5890
+ claims: {
4986
5891
  list: async (options) => {
4987
5892
  return rb.execute(
4988
- getSchedulingEventTypes,
5893
+ getWatcherClaims,
4989
5894
  buildPageQuery(options?.page, options?.pageSize),
4990
5895
  options
4991
5896
  );
4992
5897
  },
4993
- /** List all event types with automatic pagination */
4994
5898
  listAll: async (options) => {
4995
5899
  return paginateToArray(
4996
5900
  rb.createPaginatedFetcher(
4997
- getSchedulingEventTypes,
5901
+ getWatcherClaims,
4998
5902
  (page, pageSize) => ({
4999
5903
  query: { page: { number: page, size: pageSize } }
5000
5904
  }),
@@ -5002,65 +5906,68 @@ function createSchedulingNamespace(rb) {
5002
5906
  )
5003
5907
  );
5004
5908
  },
5005
- /** Get an event type by ID */
5006
- get: async (id, options) => {
5007
- return rb.execute(
5008
- getSchedulingEventTypesById,
5009
- { path: { id } },
5010
- options
5011
- );
5909
+ claim: async (options) => {
5910
+ return rb.execute(postWatcherClaims, {}, options);
5012
5911
  },
5013
- /**
5014
- * Create a new event type.
5015
- * @example
5016
- * ```typescript
5017
- * const client = new GptClient({ apiKey: 'sk_tenant_...' });
5018
- * const eventType = await client.scheduling.eventTypes.create({
5019
- * name: '30-Minute Consultation',
5020
- * slug: '30min-consult',
5021
- * duration_minutes: 30,
5022
- * location_type: 'video',
5023
- * });
5024
- * ```
5025
- */
5026
5912
  create: async (attributes, options) => {
5027
5913
  return rb.execute(
5028
- postSchedulingEventTypes,
5029
- {
5030
- body: { data: { type: "scheduling_event_type", attributes } }
5031
- },
5914
+ postWatcherClaims,
5915
+ { body: { data: { type: "watcher_claim", attributes } } },
5032
5916
  options
5033
5917
  );
5034
5918
  },
5035
- /** Update an event type */
5036
5919
  update: async (id, attributes, options) => {
5037
5920
  return rb.execute(
5038
- patchSchedulingEventTypesById,
5921
+ patchWatcherClaimsById,
5039
5922
  {
5040
5923
  path: { id },
5041
- body: { data: { id, type: "scheduling_event_type", attributes } }
5924
+ body: { data: { id, type: "watcher_claim", attributes } }
5042
5925
  },
5043
5926
  options
5044
5927
  );
5928
+ },
5929
+ delete: async (id, options) => {
5930
+ return rb.executeDelete(
5931
+ getWatcherClaimsById,
5932
+ { path: { id } },
5933
+ options
5934
+ );
5935
+ },
5936
+ /** Register a completed claim for a document (used by ProcessDocument worker) */
5937
+ registerCompleted: async (options) => {
5938
+ return rb.execute(postWatcherClaims, {}, options);
5939
+ },
5940
+ /** Get ingestion status for a workspace */
5941
+ readStatus: async (options) => {
5942
+ return rb.execute(postWatcherClaims, {}, options);
5943
+ },
5944
+ get: async (id, options) => {
5945
+ return rb.execute(
5946
+ getWatcherClaimsById,
5947
+ { path: { id } },
5948
+ options
5949
+ );
5045
5950
  }
5046
5951
  },
5047
- /**
5048
- * Events — scheduled occurrences
5049
- */
5050
5952
  events: {
5051
- /** List events with optional pagination */
5953
+ create: async (attributes, options) => {
5954
+ return rb.execute(
5955
+ postWatcherEvents,
5956
+ { body: { data: { type: "watcher_event", attributes } } },
5957
+ options
5958
+ );
5959
+ },
5052
5960
  list: async (options) => {
5053
5961
  return rb.execute(
5054
- getSchedulingEvents,
5962
+ getWatcherEvents,
5055
5963
  buildPageQuery(options?.page, options?.pageSize),
5056
5964
  options
5057
5965
  );
5058
5966
  },
5059
- /** List all events with automatic pagination */
5060
5967
  listAll: async (options) => {
5061
5968
  return paginateToArray(
5062
5969
  rb.createPaginatedFetcher(
5063
- getSchedulingEvents,
5970
+ getWatcherEvents,
5064
5971
  (page, pageSize) => ({
5065
5972
  query: { page: { number: page, size: pageSize } }
5066
5973
  }),
@@ -5068,56 +5975,46 @@ function createSchedulingNamespace(rb) {
5068
5975
  )
5069
5976
  );
5070
5977
  },
5071
- /** Get an event by ID */
5978
+ delete: async (options) => {
5979
+ return rb.executeDelete(getWatcherEvents, { path: {} }, options);
5980
+ },
5981
+ /** Create multiple events in batch */
5982
+ batchCreate: async (options) => {
5983
+ return rb.execute(postWatcherEvents, {}, options);
5984
+ },
5072
5985
  get: async (id, options) => {
5073
5986
  return rb.execute(
5074
- getSchedulingEventsById,
5987
+ getWatcherEventsById,
5075
5988
  { path: { id } },
5076
5989
  options
5077
5990
  );
5078
- },
5079
- /**
5080
- * Create an internal event directly.
5081
- * Use for meetings between known users in the workspace.
5082
- */
5083
- create: async (attributes, options) => {
5084
- return rb.execute(
5085
- postSchedulingEvents,
5086
- {
5087
- body: { data: { type: "scheduling_event", attributes } }
5088
- },
5991
+ }
5992
+ }
5993
+ };
5994
+ }
5995
+
5996
+ // src/namespaces/webhooks-ns.ts
5997
+ function createWebhooksNamespace(rb) {
5998
+ return {
5999
+ configs: {
6000
+ delete: async (id, options) => {
6001
+ return rb.executeDelete(
6002
+ deleteWebhookConfigsById,
6003
+ { path: { id } },
5089
6004
  options
5090
6005
  );
5091
6006
  },
5092
- /** Update an event */
5093
- update: async (id, attributes, options) => {
5094
- return rb.execute(
5095
- patchSchedulingEventsById,
5096
- {
5097
- path: { id },
5098
- body: { data: { id, type: "scheduling_event", attributes } }
5099
- },
5100
- options
5101
- );
5102
- }
5103
- },
5104
- /**
5105
- * Participants — people attending events
5106
- */
5107
- participants: {
5108
- /** List participants with optional pagination */
5109
6007
  list: async (options) => {
5110
6008
  return rb.execute(
5111
- getSchedulingParticipants,
6009
+ getWebhookConfigs,
5112
6010
  buildPageQuery(options?.page, options?.pageSize),
5113
6011
  options
5114
6012
  );
5115
6013
  },
5116
- /** List all participants with automatic pagination */
5117
6014
  listAll: async (options) => {
5118
6015
  return paginateToArray(
5119
6016
  rb.createPaginatedFetcher(
5120
- getSchedulingParticipants,
6017
+ getWebhookConfigs,
5121
6018
  (page, pageSize) => ({
5122
6019
  query: { page: { number: page, size: pageSize } }
5123
6020
  }),
@@ -5125,145 +6022,80 @@ function createSchedulingNamespace(rb) {
5125
6022
  )
5126
6023
  );
5127
6024
  },
5128
- /** Get a participant by ID */
5129
- get: async (id, options) => {
5130
- return rb.execute(
5131
- getSchedulingParticipantsById,
5132
- { path: { id } },
5133
- options
5134
- );
5135
- },
5136
- /** Add a participant to an event */
5137
6025
  create: async (attributes, options) => {
5138
6026
  return rb.execute(
5139
- postSchedulingParticipants,
5140
- {
5141
- body: { data: { type: "scheduling_participant", attributes } }
5142
- },
6027
+ postWebhookConfigs,
6028
+ { body: { data: { type: "webhook_config", attributes } } },
5143
6029
  options
5144
6030
  );
5145
6031
  },
5146
- /** Update a participant (e.g., confirm attendance, respond to invite) */
5147
6032
  update: async (id, attributes, options) => {
5148
6033
  return rb.execute(
5149
- patchSchedulingParticipantsById,
6034
+ patchWebhookConfigsById,
5150
6035
  {
5151
6036
  path: { id },
5152
- body: { data: { id, type: "scheduling_participant", attributes } }
6037
+ body: { data: { id, type: "webhook_config", attributes } }
5153
6038
  },
5154
6039
  options
5155
6040
  );
5156
- }
5157
- },
5158
- /**
5159
- * Bookings — external party requests for appointments
5160
- */
5161
- bookings: {
5162
- /** List bookings with optional pagination */
5163
- list: async (options) => {
6041
+ },
6042
+ test: async (id, options) => {
5164
6043
  return rb.execute(
5165
- getSchedulingBookings,
5166
- buildPageQuery(options?.page, options?.pageSize),
6044
+ postWebhookConfigsByIdTest,
6045
+ { path: { id }, body: {} },
5167
6046
  options
5168
6047
  );
5169
6048
  },
5170
- /** List all bookings with automatic pagination */
5171
- listAll: async (options) => {
5172
- return paginateToArray(
5173
- rb.createPaginatedFetcher(
5174
- getSchedulingBookings,
5175
- (page, pageSize) => ({
5176
- query: { page: { number: page, size: pageSize } }
5177
- }),
5178
- options
5179
- )
5180
- );
5181
- },
5182
- /** Get a booking by ID */
5183
- get: async (id, options) => {
6049
+ bulkEnable: async (options) => {
5184
6050
  return rb.execute(
5185
- getSchedulingBookingsById,
5186
- { path: { id } },
6051
+ postWebhookConfigsBulkEnable,
6052
+ {},
5187
6053
  options
5188
6054
  );
5189
6055
  },
5190
- /**
5191
- * Create a booking request.
5192
- * Use when someone outside the platform requests an appointment.
5193
- * @example
5194
- * ```typescript
5195
- * const booking = await client.scheduling.bookings.create({
5196
- * event_type_id: 'event_123',
5197
- * start_time: '2025-03-01T10:00:00Z',
5198
- * booker_name: 'John Doe',
5199
- * booker_email: 'john@example.com',
5200
- * });
5201
- * ```
5202
- */
5203
- create: async (attributes, options) => {
6056
+ bulkDisable: async (options) => {
5204
6057
  return rb.execute(
5205
- postSchedulingBookings,
5206
- {
5207
- body: { data: { type: "scheduling_booking", attributes } }
5208
- },
6058
+ postWebhookConfigsBulkDisable,
6059
+ {},
5209
6060
  options
5210
6061
  );
5211
6062
  },
5212
- /**
5213
- * Confirm a pending booking.
5214
- * For EventTypes with requires_approval=true.
5215
- */
5216
- confirm: async (id, options) => {
6063
+ /** Replay historical events to this webhook */
6064
+ replay: async (id, options) => {
5217
6065
  return rb.execute(
5218
- patchSchedulingBookingsSchedulingBookingsByIdConfirm,
6066
+ postWebhookConfigsByIdReplay,
5219
6067
  { path: { id }, body: {} },
5220
6068
  options
5221
6069
  );
5222
6070
  },
5223
- /**
5224
- * Cancel or reject a booking.
5225
- */
5226
- cancel: async (id, attributes, options) => {
6071
+ get: async (id, options) => {
5227
6072
  return rb.execute(
5228
- patchSchedulingBookingsSchedulingBookingsByIdCancel,
5229
- {
5230
- path: { id },
5231
- body: attributes ? { data: { type: "scheduling_booking", attributes } } : {}
5232
- },
6073
+ getWebhookConfigsById,
6074
+ { path: { id } },
5233
6075
  options
5234
6076
  );
5235
6077
  },
5236
- /**
5237
- * Reschedule a booking to a new time.
5238
- */
5239
- reschedule: async (id, attributes, options) => {
6078
+ /** Rotate the signing secret for a webhook config */
6079
+ rotateSecret: async (id, options) => {
5240
6080
  return rb.execute(
5241
- patchSchedulingBookingsSchedulingBookingsByIdReschedule,
5242
- {
5243
- path: { id },
5244
- body: { data: { type: "scheduling_booking", attributes } }
5245
- },
6081
+ patchWebhookConfigsByIdRotateSecret,
6082
+ { path: { id }, body: {} },
5246
6083
  options
5247
6084
  );
5248
6085
  }
5249
6086
  },
5250
- /**
5251
- * Calendar Syncs — external calendar integrations
5252
- */
5253
- calendarSyncs: {
5254
- /** List calendar syncs with optional pagination */
6087
+ deliveries: {
5255
6088
  list: async (options) => {
5256
6089
  return rb.execute(
5257
- getSchedulingCalendarSyncs,
6090
+ getWebhookDeliveries,
5258
6091
  buildPageQuery(options?.page, options?.pageSize),
5259
6092
  options
5260
6093
  );
5261
6094
  },
5262
- /** List all calendar syncs with automatic pagination */
5263
6095
  listAll: async (options) => {
5264
6096
  return paginateToArray(
5265
6097
  rb.createPaginatedFetcher(
5266
- getSchedulingCalendarSyncs,
6098
+ getWebhookDeliveries,
5267
6099
  (page, pageSize) => ({
5268
6100
  query: { page: { number: page, size: pageSize } }
5269
6101
  }),
@@ -5271,61 +6103,31 @@ function createSchedulingNamespace(rb) {
5271
6103
  )
5272
6104
  );
5273
6105
  },
5274
- /** Get a calendar sync by ID */
5275
- get: async (id, options) => {
5276
- return rb.execute(
5277
- getSchedulingCalendarSyncsById,
5278
- { path: { id } },
5279
- options
5280
- );
5281
- },
5282
- /**
5283
- * Create a calendar sync.
5284
- * For bi-directional sync with external calendars (Google, Outlook).
5285
- */
5286
6106
  create: async (attributes, options) => {
5287
6107
  return rb.execute(
5288
- postSchedulingCalendarSyncs,
5289
- {
5290
- body: { data: { type: "scheduling_calendar_sync", attributes } }
5291
- },
6108
+ postWebhookDeliveriesBulkRetry,
6109
+ { body: { data: { type: "webhook_delivery", attributes } } },
5292
6110
  options
5293
6111
  );
5294
6112
  },
5295
- /** Update a calendar sync */
5296
- update: async (id, attributes, options) => {
6113
+ retry: async (options) => {
5297
6114
  return rb.execute(
5298
- patchSchedulingCalendarSyncsSchedulingCalendarSyncsById,
5299
- {
5300
- path: { id },
5301
- body: {
5302
- data: { id, type: "scheduling_calendar_sync", attributes }
5303
- }
5304
- },
5305
- options
5306
- );
5307
- },
5308
- /** Delete a calendar sync */
5309
- delete: async (id, options) => {
5310
- return rb.executeDelete(
5311
- deleteSchedulingCalendarSyncsSchedulingCalendarSyncsById,
5312
- { path: { id } },
6115
+ postWebhookDeliveriesBulkRetry,
6116
+ {},
5313
6117
  options
5314
6118
  );
5315
6119
  },
5316
- /** Pause a calendar sync (stops pushing/pulling) */
5317
- pause: async (id, options) => {
6120
+ bulkRetry: async (options) => {
5318
6121
  return rb.execute(
5319
- patchSchedulingCalendarSyncsSchedulingCalendarSyncsByIdPause,
5320
- { path: { id }, body: {} },
6122
+ postWebhookDeliveriesBulkRetry,
6123
+ {},
5321
6124
  options
5322
6125
  );
5323
6126
  },
5324
- /** Resume a paused calendar sync */
5325
- resume: async (id, options) => {
6127
+ get: async (id, options) => {
5326
6128
  return rb.execute(
5327
- patchSchedulingCalendarSyncsSchedulingCalendarSyncsByIdResume,
5328
- { path: { id }, body: {} },
6129
+ getWebhookDeliveriesById,
6130
+ { path: { id } },
5329
6131
  options
5330
6132
  );
5331
6133
  }
@@ -5513,6 +6315,30 @@ var RequestBuilder = class {
5513
6315
  throw handleApiError(error);
5514
6316
  }
5515
6317
  }
6318
+ /**
6319
+ * Execute a raw multipart/form-data POST request.
6320
+ * Used for file upload endpoints (custom Phoenix controllers).
6321
+ * Content-Type is omitted from headers so the browser sets the correct
6322
+ * multipart boundary automatically from the FormData body.
6323
+ */
6324
+ async rawPostMultipart(url, body, options) {
6325
+ const headers = buildHeaders(this.getHeaders, options);
6326
+ delete headers["Content-Type"];
6327
+ delete headers["content-type"];
6328
+ try {
6329
+ const { data } = await this.requestWithRetry(
6330
+ () => this.clientInstance.post({
6331
+ url,
6332
+ headers,
6333
+ body,
6334
+ ...options?.signal && { signal: options.signal }
6335
+ })
6336
+ );
6337
+ return this.unwrap(data?.data);
6338
+ } catch (error) {
6339
+ throw handleApiError(error);
6340
+ }
6341
+ }
5516
6342
  /**
5517
6343
  * Execute a raw POST request to a custom (non-generated) endpoint.
5518
6344
  * Used for endpoints implemented as custom Phoenix controllers.
@@ -5672,11 +6498,14 @@ var GptClient = class extends BaseClient {
5672
6498
  this.extraction = createExtractionNamespace(rb);
5673
6499
  this.identity = createIdentityNamespace(rb);
5674
6500
  this.platform = createPlatformNamespace(rb);
6501
+ this.scheduling = createSchedulingNamespace(rb);
5675
6502
  this.search = createSearchNamespace(rb);
5676
6503
  this.storage = createStorageNamespace(rb);
5677
6504
  this.threads = createThreadsNamespace(rb);
6505
+ this.training = createTrainingNamespace(rb);
6506
+ this.voice = createVoiceNamespace(rb);
6507
+ this.watcher = createWatcherNamespace(rb);
5678
6508
  this.webhooks = createWebhooksNamespace(rb);
5679
- this.scheduling = createSchedulingNamespace(rb);
5680
6509
  }
5681
6510
  /**
5682
6511
  * Subscribe to SDK lifecycle events.