@gpt-platform/client 0.8.4 → 0.9.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
@@ -49,6 +49,7 @@ __export(index_exports, {
49
49
  buildHeaders: () => buildHeaders,
50
50
  buildUserAgent: () => buildUserAgent,
51
51
  collectStreamedMessage: () => collectStreamedMessage,
52
+ createImportsNamespace: () => createImportsNamespace,
52
53
  handleApiError: () => handleApiError,
53
54
  isBrowserEnvironment: () => isBrowserEnvironment,
54
55
  isSecureUrl: () => isSecureUrl,
@@ -1333,8 +1334,8 @@ function buildUserAgent(sdkVersion, appInfo) {
1333
1334
  }
1334
1335
 
1335
1336
  // src/version.ts
1336
- var SDK_VERSION = "0.8.4";
1337
- var DEFAULT_API_VERSION = "2026-03-11";
1337
+ var SDK_VERSION = "0.9.0";
1338
+ var DEFAULT_API_VERSION = "2026-03-21";
1338
1339
 
1339
1340
  // src/base-client.ts
1340
1341
  function generateUUID() {
@@ -1643,7 +1644,7 @@ function createAuditNamespace(rb) {
1643
1644
  * Fetch a paginated, time-sorted activity feed scoped to a tenant.
1644
1645
  *
1645
1646
  * Optionally filter by workspace, action type, actor, or date range.
1646
- * Results are sorted by `inserted_at` descending (most recent first).
1647
+ * Results are sorted by `created_at` descending (most recent first).
1647
1648
  *
1648
1649
  * @param params - Feed parameters. `tenantId` is required.
1649
1650
  * @param options - Optional request options.
@@ -1754,6 +1755,11 @@ var getSocialTrendingWatchesWorkspaceByWorkspaceId = (options) => (options.clien
1754
1755
  url: "/social/trending/watches/workspace/{workspace_id}",
1755
1756
  ...options
1756
1757
  });
1758
+ var getSocialTrendingHistoryRange = (options) => (options.client ?? client).get({
1759
+ security: [{ scheme: "bearer", type: "http" }],
1760
+ url: "/social/trending/history/range",
1761
+ ...options
1762
+ });
1757
1763
  var getAgentDeploymentsById = (options) => (options.client ?? client).get({
1758
1764
  security: [{ scheme: "bearer", type: "http" }],
1759
1765
  url: "/agent-deployments/{id}",
@@ -1834,6 +1840,15 @@ var postRiskAssessments = (options) => (options.client ?? client).post({
1834
1840
  ...options.headers
1835
1841
  }
1836
1842
  });
1843
+ var patchClinicalClientResourceAssignmentsByIdArchive = (options) => (options.client ?? client).patch({
1844
+ security: [{ scheme: "bearer", type: "http" }],
1845
+ url: "/clinical/client-resource-assignments/{id}/archive",
1846
+ ...options,
1847
+ headers: {
1848
+ "Content-Type": "application/vnd.api+json",
1849
+ ...options.headers
1850
+ }
1851
+ });
1837
1852
  var postCatalogTaxonomyNodes = (options) => (options.client ?? client).post({
1838
1853
  security: [{ scheme: "bearer", type: "http" }],
1839
1854
  url: "/catalog/taxonomy-nodes",
@@ -1938,11 +1953,6 @@ var getClinicalNotesByNoteIdVersionsById = (options) => (options.client ?? clien
1938
1953
  url: "/clinical/notes/{note_id}/versions/{id}",
1939
1954
  ...options
1940
1955
  });
1941
- var deleteClinicalMealPlansById = (options) => (options.client ?? client).delete({
1942
- security: [{ scheme: "bearer", type: "http" }],
1943
- url: "/clinical/meal-plans/{id}",
1944
- ...options
1945
- });
1946
1956
  var getClinicalMealPlansById = (options) => (options.client ?? client).get({
1947
1957
  security: [{ scheme: "bearer", type: "http" }],
1948
1958
  url: "/clinical/meal-plans/{id}",
@@ -2004,6 +2014,11 @@ var getApplicationsCurrent = (options) => (options.client ?? client).get({
2004
2014
  url: "/applications/current",
2005
2015
  ...options
2006
2016
  });
2017
+ var getClinicalPracticeResourcesArchived = (options) => (options.client ?? client).get({
2018
+ security: [{ scheme: "bearer", type: "http" }],
2019
+ url: "/clinical/practice-resources/archived",
2020
+ ...options
2021
+ });
2007
2022
  var patchTenantsByIdConvertToOrg = (options) => (options.client ?? client).patch({
2008
2023
  security: [{ scheme: "bearer", type: "http" }],
2009
2024
  url: "/tenants/{id}/convert-to-org",
@@ -2013,6 +2028,15 @@ var patchTenantsByIdConvertToOrg = (options) => (options.client ?? client).patch
2013
2028
  ...options.headers
2014
2029
  }
2015
2030
  });
2031
+ var patchClinicalHealthMetricsByIdRestore = (options) => (options.client ?? client).patch({
2032
+ security: [{ scheme: "bearer", type: "http" }],
2033
+ url: "/clinical/health-metrics/{id}/restore",
2034
+ ...options,
2035
+ headers: {
2036
+ "Content-Type": "application/vnd.api+json",
2037
+ ...options.headers
2038
+ }
2039
+ });
2016
2040
  var getBrandIdentitiesByTenantByTenantId = (options) => (options.client ?? client).get({
2017
2041
  security: [{ scheme: "bearer", type: "http" }],
2018
2042
  url: "/brand-identities/by-tenant/{tenant_id}",
@@ -2131,6 +2155,15 @@ var getCrawlerResults = (options) => (options.client ?? client).get({
2131
2155
  url: "/crawler/results",
2132
2156
  ...options
2133
2157
  });
2158
+ var patchClinicalNotesByIdArchive = (options) => (options.client ?? client).patch({
2159
+ security: [{ scheme: "bearer", type: "http" }],
2160
+ url: "/clinical/notes/{id}/archive",
2161
+ ...options,
2162
+ headers: {
2163
+ "Content-Type": "application/vnd.api+json",
2164
+ ...options.headers
2165
+ }
2166
+ });
2134
2167
  var getCrmExportsById = (options) => (options.client ?? client).get({
2135
2168
  security: [{ scheme: "bearer", type: "http" }],
2136
2169
  url: "/crm/exports/{id}",
@@ -2150,11 +2183,6 @@ var postBusinessAssociateAgreements = (options) => (options.client ?? client).po
2150
2183
  ...options.headers
2151
2184
  }
2152
2185
  });
2153
- var deleteClinicalPracticeResourcesById = (options) => (options.client ?? client).delete({
2154
- security: [{ scheme: "bearer", type: "http" }],
2155
- url: "/clinical/practice-resources/{id}",
2156
- ...options
2157
- });
2158
2186
  var getClinicalPracticeResourcesById = (options) => (options.client ?? client).get({
2159
2187
  security: [{ scheme: "bearer", type: "http" }],
2160
2188
  url: "/clinical/practice-resources/{id}",
@@ -2296,10 +2324,14 @@ var postClinicalNotes = (options) => (options.client ?? client).post({
2296
2324
  ...options.headers
2297
2325
  }
2298
2326
  });
2299
- var deleteClinicalClientGoalsById = (options) => (options.client ?? client).delete({
2327
+ var patchClinicalPracticeToolsCatalogByIdRestore = (options) => (options.client ?? client).patch({
2300
2328
  security: [{ scheme: "bearer", type: "http" }],
2301
- url: "/clinical/client-goals/{id}",
2302
- ...options
2329
+ url: "/clinical/practice-tools/catalog/{id}/restore",
2330
+ ...options,
2331
+ headers: {
2332
+ "Content-Type": "application/vnd.api+json",
2333
+ ...options.headers
2334
+ }
2303
2335
  });
2304
2336
  var getClinicalClientGoalsById = (options) => (options.client ?? client).get({
2305
2337
  security: [{ scheme: "bearer", type: "http" }],
@@ -2315,6 +2347,11 @@ var patchClinicalClientGoalsById = (options) => (options.client ?? client).patch
2315
2347
  ...options.headers
2316
2348
  }
2317
2349
  });
2350
+ var deleteClinicalGoalTemplatesByIdPermanent = (options) => (options.client ?? client).delete({
2351
+ security: [{ scheme: "bearer", type: "http" }],
2352
+ url: "/clinical/goal-templates/{id}/permanent",
2353
+ ...options
2354
+ });
2318
2355
  var postAgentsImport = (options) => (options.client ?? client).post({
2319
2356
  security: [{ scheme: "bearer", type: "http" }],
2320
2357
  url: "/agents/import",
@@ -2333,6 +2370,16 @@ var postUsersAuthPasswordResetRequest = (options) => (options.client ?? client).
2333
2370
  ...options.headers
2334
2371
  }
2335
2372
  });
2373
+ var getClinicalClientSupplementsArchived = (options) => (options.client ?? client).get({
2374
+ security: [{ scheme: "bearer", type: "http" }],
2375
+ url: "/clinical/client-supplements/archived",
2376
+ ...options
2377
+ });
2378
+ var getClinicalClientResourceAssignmentsArchived = (options) => (options.client ?? client).get({
2379
+ security: [{ scheme: "bearer", type: "http" }],
2380
+ url: "/clinical/client-resource-assignments/archived",
2381
+ ...options
2382
+ });
2336
2383
  var patchPolicyReviewSchedulesByIdMarkOverdue = (options) => (options.client ?? client).patch({
2337
2384
  security: [{ scheme: "bearer", type: "http" }],
2338
2385
  url: "/policy-review-schedules/{id}/mark-overdue",
@@ -2347,6 +2394,11 @@ var getExtractionBatchesWorkspaceByWorkspaceId = (options) => (options.client ??
2347
2394
  url: "/extraction/batches/workspace/{workspace_id}",
2348
2395
  ...options
2349
2396
  });
2397
+ var deleteClinicalPracticeResourcesByIdPermanent = (options) => (options.client ?? client).delete({
2398
+ security: [{ scheme: "bearer", type: "http" }],
2399
+ url: "/clinical/practice-resources/{id}/permanent",
2400
+ ...options
2401
+ });
2350
2402
  var patchUserProfilesByIdAcceptTos = (options) => (options.client ?? client).patch({
2351
2403
  security: [{ scheme: "bearer", type: "http" }],
2352
2404
  url: "/user-profiles/{id}/accept-tos",
@@ -2515,6 +2567,15 @@ var patchWorkspacesByIdAllocate = (options) => (options.client ?? client).patch(
2515
2567
  ...options.headers
2516
2568
  }
2517
2569
  });
2570
+ var patchClinicalPracticeResourcesCatalogByIdRestore = (options) => (options.client ?? client).patch({
2571
+ security: [{ scheme: "bearer", type: "http" }],
2572
+ url: "/clinical/practice-resources/catalog/{id}/restore",
2573
+ ...options,
2574
+ headers: {
2575
+ "Content-Type": "application/vnd.api+json",
2576
+ ...options.headers
2577
+ }
2578
+ });
2518
2579
  var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2519
2580
  security: [{ scheme: "bearer", type: "http" }],
2520
2581
  url: "/invitations/{id}/revoke",
@@ -2579,6 +2640,15 @@ var getMemoryDocumentSections = (options) => (options.client ?? client).get({
2579
2640
  url: "/memory/document-sections",
2580
2641
  ...options
2581
2642
  });
2643
+ var patchClinicalPracticeToolsCatalogByIdArchive = (options) => (options.client ?? client).patch({
2644
+ security: [{ scheme: "bearer", type: "http" }],
2645
+ url: "/clinical/practice-tools/catalog/{id}/archive",
2646
+ ...options,
2647
+ headers: {
2648
+ "Content-Type": "application/vnd.api+json",
2649
+ ...options.headers
2650
+ }
2651
+ });
2582
2652
  var postConnectorsCredentialsByIdRefresh = (options) => (options.client ?? client).post({
2583
2653
  security: [{ scheme: "bearer", type: "http" }],
2584
2654
  url: "/connectors/credentials/{id}/refresh",
@@ -2681,6 +2751,15 @@ var postAgentsByIdRestoreVersion = (options) => (options.client ?? client).post(
2681
2751
  ...options.headers
2682
2752
  }
2683
2753
  });
2754
+ var patchClinicalGoalTemplatesCatalogByIdArchive = (options) => (options.client ?? client).patch({
2755
+ security: [{ scheme: "bearer", type: "http" }],
2756
+ url: "/clinical/goal-templates/catalog/{id}/archive",
2757
+ ...options,
2758
+ headers: {
2759
+ "Content-Type": "application/vnd.api+json",
2760
+ ...options.headers
2761
+ }
2762
+ });
2684
2763
  var getWorkspaceAgentConfigsById = (options) => (options.client ?? client).get({
2685
2764
  security: [{ scheme: "bearer", type: "http" }],
2686
2765
  url: "/workspace-agent-configs/{id}",
@@ -2695,6 +2774,15 @@ var patchWorkspaceAgentConfigsById = (options) => (options.client ?? client).pat
2695
2774
  ...options.headers
2696
2775
  }
2697
2776
  });
2777
+ var patchClinicalPracticeResourcesByIdArchive = (options) => (options.client ?? client).patch({
2778
+ security: [{ scheme: "bearer", type: "http" }],
2779
+ url: "/clinical/practice-resources/{id}/archive",
2780
+ ...options,
2781
+ headers: {
2782
+ "Content-Type": "application/vnd.api+json",
2783
+ ...options.headers
2784
+ }
2785
+ });
2698
2786
  var patchWalletAutoTopUp = (options) => (options.client ?? client).patch({
2699
2787
  security: [{ scheme: "bearer", type: "http" }],
2700
2788
  url: "/wallet/auto-top-up",
@@ -2999,6 +3087,15 @@ var getStorageFiles = (options) => (options.client ?? client).get({
2999
3087
  url: "/storage-files",
3000
3088
  ...options
3001
3089
  });
3090
+ var patchClinicalNotesByIdRestore = (options) => (options.client ?? client).patch({
3091
+ security: [{ scheme: "bearer", type: "http" }],
3092
+ url: "/clinical/notes/{id}/restore",
3093
+ ...options,
3094
+ headers: {
3095
+ "Content-Type": "application/vnd.api+json",
3096
+ ...options.headers
3097
+ }
3098
+ });
3002
3099
  var getSocialAccountsPlatformByPlatform = (options) => (options.client ?? client).get({
3003
3100
  security: [{ scheme: "bearer", type: "http" }],
3004
3101
  url: "/social/accounts/platform/{platform}",
@@ -3111,11 +3208,6 @@ var patchAmendmentRequestsByIdReview = (options) => (options.client ?? client).p
3111
3208
  ...options.headers
3112
3209
  }
3113
3210
  });
3114
- var deleteClinicalPracticeToolsById = (options) => (options.client ?? client).delete({
3115
- security: [{ scheme: "bearer", type: "http" }],
3116
- url: "/clinical/practice-tools/{id}",
3117
- ...options
3118
- });
3119
3211
  var getClinicalPracticeToolsById = (options) => (options.client ?? client).get({
3120
3212
  security: [{ scheme: "bearer", type: "http" }],
3121
3213
  url: "/clinical/practice-tools/{id}",
@@ -3224,11 +3316,29 @@ var patchRiskAssessmentsByIdStatus = (options) => (options.client ?? client).pat
3224
3316
  ...options.headers
3225
3317
  }
3226
3318
  });
3319
+ var patchClinicalClientGoalsByIdRestore = (options) => (options.client ?? client).patch({
3320
+ security: [{ scheme: "bearer", type: "http" }],
3321
+ url: "/clinical/client-goals/{id}/restore",
3322
+ ...options,
3323
+ headers: {
3324
+ "Content-Type": "application/vnd.api+json",
3325
+ ...options.headers
3326
+ }
3327
+ });
3227
3328
  var getPermissionsMeta = (options) => (options.client ?? client).get({
3228
3329
  security: [{ scheme: "bearer", type: "http" }],
3229
3330
  url: "/permissions/meta",
3230
3331
  ...options
3231
3332
  });
3333
+ var patchClinicalMealPlansByIdArchive = (options) => (options.client ?? client).patch({
3334
+ security: [{ scheme: "bearer", type: "http" }],
3335
+ url: "/clinical/meal-plans/{id}/archive",
3336
+ ...options,
3337
+ headers: {
3338
+ "Content-Type": "application/vnd.api+json",
3339
+ ...options.headers
3340
+ }
3341
+ });
3232
3342
  var getEmailMarketingGeneratedEmailsById = (options) => (options.client ?? client).get({
3233
3343
  security: [{ scheme: "bearer", type: "http" }],
3234
3344
  url: "/email-marketing/generated-emails/{id}",
@@ -3319,6 +3429,15 @@ var patchCatalogTaxonomiesById = (options) => (options.client ?? client).patch({
3319
3429
  ...options.headers
3320
3430
  }
3321
3431
  });
3432
+ var patchClinicalPracticeToolsByIdArchive = (options) => (options.client ?? client).patch({
3433
+ security: [{ scheme: "bearer", type: "http" }],
3434
+ url: "/clinical/practice-tools/{id}/archive",
3435
+ ...options,
3436
+ headers: {
3437
+ "Content-Type": "application/vnd.api+json",
3438
+ ...options.headers
3439
+ }
3440
+ });
3322
3441
  var deleteSocialTrendingWatchesById = (options) => (options.client ?? client).delete({
3323
3442
  security: [{ scheme: "bearer", type: "http" }],
3324
3443
  url: "/social/trending/watches/{id}",
@@ -3409,11 +3528,6 @@ var postContentGenerateHashtags = (options) => (options.client ?? client).post({
3409
3528
  ...options.headers
3410
3529
  }
3411
3530
  });
3412
- var deleteClinicalNotesById = (options) => (options.client ?? client).delete({
3413
- security: [{ scheme: "bearer", type: "http" }],
3414
- url: "/clinical/notes/{id}",
3415
- ...options
3416
- });
3417
3531
  var getClinicalNotesById = (options) => (options.client ?? client).get({
3418
3532
  security: [{ scheme: "bearer", type: "http" }],
3419
3533
  url: "/clinical/notes/{id}",
@@ -3478,6 +3592,15 @@ var patchBusinessAssociateAgreementsByIdTerminate = (options) => (options.client
3478
3592
  ...options.headers
3479
3593
  }
3480
3594
  });
3595
+ var patchClinicalPracticeResourcesByIdRestore = (options) => (options.client ?? client).patch({
3596
+ security: [{ scheme: "bearer", type: "http" }],
3597
+ url: "/clinical/practice-resources/{id}/restore",
3598
+ ...options,
3599
+ headers: {
3600
+ "Content-Type": "application/vnd.api+json",
3601
+ ...options.headers
3602
+ }
3603
+ });
3481
3604
  var postConnectorsByIdEdamamRecipesGet = (options) => (options.client ?? client).post({
3482
3605
  security: [{ scheme: "bearer", type: "http" }],
3483
3606
  url: "/connectors/{id}/edamam/recipes/get",
@@ -3567,6 +3690,15 @@ var patchExtractionResultsById = (options) => (options.client ?? client).patch({
3567
3690
  ...options.headers
3568
3691
  }
3569
3692
  });
3693
+ var postFeatureUsagesIncrement = (options) => (options.client ?? client).post({
3694
+ security: [{ scheme: "bearer", type: "http" }],
3695
+ url: "/feature-usages/increment",
3696
+ ...options,
3697
+ headers: {
3698
+ "Content-Type": "application/vnd.api+json",
3699
+ ...options.headers
3700
+ }
3701
+ });
3570
3702
  var postAgentsByIdValidate = (options) => (options.client ?? client).post({
3571
3703
  security: [{ scheme: "bearer", type: "http" }],
3572
3704
  url: "/agents/{id}/validate",
@@ -3581,6 +3713,11 @@ var getConnectorsCredentials = (options) => (options.client ?? client).get({
3581
3713
  url: "/connectors/credentials",
3582
3714
  ...options
3583
3715
  });
3716
+ var deleteClinicalMealPlansByIdPermanent = (options) => (options.client ?? client).delete({
3717
+ security: [{ scheme: "bearer", type: "http" }],
3718
+ url: "/clinical/meal-plans/{id}/permanent",
3719
+ ...options
3720
+ });
3584
3721
  var getAgentsByIdSchemaVersions = (options) => (options.client ?? client).get({
3585
3722
  security: [{ scheme: "bearer", type: "http" }],
3586
3723
  url: "/agents/{id}/schema-versions",
@@ -3703,6 +3840,16 @@ var getSchedulingBookingsById = (options) => (options.client ?? client).get({
3703
3840
  url: "/scheduling/bookings/{id}",
3704
3841
  ...options
3705
3842
  });
3843
+ var deleteClinicalClientGoalsByIdPermanent = (options) => (options.client ?? client).delete({
3844
+ security: [{ scheme: "bearer", type: "http" }],
3845
+ url: "/clinical/client-goals/{id}/permanent",
3846
+ ...options
3847
+ });
3848
+ var deleteClinicalGoalTemplatesCatalogByIdPermanent = (options) => (options.client ?? client).delete({
3849
+ security: [{ scheme: "bearer", type: "http" }],
3850
+ url: "/clinical/goal-templates/catalog/{id}/permanent",
3851
+ ...options
3852
+ });
3706
3853
  var patchVoiceSessionsByIdStop = (options) => (options.client ?? client).patch({
3707
3854
  security: [{ scheme: "bearer", type: "http" }],
3708
3855
  url: "/voice/sessions/{id}/stop",
@@ -3726,6 +3873,11 @@ var patchSocialPostsByIdCancel = (options) => (options.client ?? client).patch({
3726
3873
  ...options.headers
3727
3874
  }
3728
3875
  });
3876
+ var getClinicalGoalTemplatesCatalogArchived = (options) => (options.client ?? client).get({
3877
+ security: [{ scheme: "bearer", type: "http" }],
3878
+ url: "/clinical/goal-templates/catalog/archived",
3879
+ ...options
3880
+ });
3729
3881
  var patchSocialCampaignsByIdSchedule = (options) => (options.client ?? client).patch({
3730
3882
  security: [{ scheme: "bearer", type: "http" }],
3731
3883
  url: "/social/campaigns/{id}/schedule",
@@ -3781,6 +3933,15 @@ var patchEmailMarketingSenderProfilesByIdSetDefault = (options) => (options.clie
3781
3933
  ...options.headers
3782
3934
  }
3783
3935
  });
3936
+ var patchClinicalClientResourceAssignmentsByIdRestore = (options) => (options.client ?? client).patch({
3937
+ security: [{ scheme: "bearer", type: "http" }],
3938
+ url: "/clinical/client-resource-assignments/{id}/restore",
3939
+ ...options,
3940
+ headers: {
3941
+ "Content-Type": "application/vnd.api+json",
3942
+ ...options.headers
3943
+ }
3944
+ });
3784
3945
  var deleteSocialPostsById = (options) => (options.client ?? client).delete({
3785
3946
  security: [{ scheme: "bearer", type: "http" }],
3786
3947
  url: "/social/posts/{id}",
@@ -3830,6 +3991,15 @@ var getConsentRecordsById = (options) => (options.client ?? client).get({
3830
3991
  url: "/consent-records/{id}",
3831
3992
  ...options
3832
3993
  });
3994
+ var patchClinicalHealthMetricsByIdArchive = (options) => (options.client ?? client).patch({
3995
+ security: [{ scheme: "bearer", type: "http" }],
3996
+ url: "/clinical/health-metrics/{id}/archive",
3997
+ ...options,
3998
+ headers: {
3999
+ "Content-Type": "application/vnd.api+json",
4000
+ ...options.headers
4001
+ }
4002
+ });
3833
4003
  var getCrmExportsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
3834
4004
  security: [{ scheme: "bearer", type: "http" }],
3835
4005
  url: "/crm/exports/workspace/{workspace_id}",
@@ -4039,6 +4209,11 @@ var getSocialPostsAccountBySocialAccountId = (options) => (options.client ?? cli
4039
4209
  url: "/social/posts/account/{social_account_id}",
4040
4210
  ...options
4041
4211
  });
4212
+ var deleteClinicalNotesByIdPermanent = (options) => (options.client ?? client).delete({
4213
+ security: [{ scheme: "bearer", type: "http" }],
4214
+ url: "/clinical/notes/{id}/permanent",
4215
+ ...options
4216
+ });
4042
4217
  var postConnectorsByIdEdamamRecipesSearch = (options) => (options.client ?? client).post({
4043
4218
  security: [{ scheme: "bearer", type: "http" }],
4044
4219
  url: "/connectors/{id}/edamam/recipes/search",
@@ -4053,11 +4228,6 @@ var getCrmPipelinesWorkspaceByWorkspaceId = (options) => (options.client ?? clie
4053
4228
  url: "/crm/pipelines/workspace/{workspace_id}",
4054
4229
  ...options
4055
4230
  });
4056
- var deleteClinicalClientResourceAssignmentsById = (options) => (options.client ?? client).delete({
4057
- security: [{ scheme: "bearer", type: "http" }],
4058
- url: "/clinical/client-resource-assignments/{id}",
4059
- ...options
4060
- });
4061
4231
  var getClinicalClientResourceAssignmentsById = (options) => (options.client ?? client).get({
4062
4232
  security: [{ scheme: "bearer", type: "http" }],
4063
4233
  url: "/clinical/client-resource-assignments/{id}",
@@ -4081,6 +4251,11 @@ var patchExtractionDocumentsByIdReprocess = (options) => (options.client ?? clie
4081
4251
  ...options.headers
4082
4252
  }
4083
4253
  });
4254
+ var getClinicalMealPlansArchived = (options) => (options.client ?? client).get({
4255
+ security: [{ scheme: "bearer", type: "http" }],
4256
+ url: "/clinical/meal-plans/archived",
4257
+ ...options
4258
+ });
4084
4259
  var deleteThreadsById = (options) => (options.client ?? client).delete({
4085
4260
  security: [{ scheme: "bearer", type: "http" }],
4086
4261
  url: "/threads/{id}",
@@ -4152,6 +4327,11 @@ var postWatcherClaims = (options) => (options.client ?? client).post({
4152
4327
  ...options.headers
4153
4328
  }
4154
4329
  });
4330
+ var deleteClinicalPracticeToolsCatalogByIdPermanent = (options) => (options.client ?? client).delete({
4331
+ security: [{ scheme: "bearer", type: "http" }],
4332
+ url: "/clinical/practice-tools/catalog/{id}/permanent",
4333
+ ...options
4334
+ });
4155
4335
  var getCrawlerJobs = (options) => (options.client ?? client).get({
4156
4336
  security: [{ scheme: "bearer", type: "http" }],
4157
4337
  url: "/crawler/jobs",
@@ -4260,6 +4440,11 @@ var getProcessingActivitiesById = (options) => (options.client ?? client).get({
4260
4440
  url: "/processing-activities/{id}",
4261
4441
  ...options
4262
4442
  });
4443
+ var deleteClinicalHealthMetricsByIdPermanent = (options) => (options.client ?? client).delete({
4444
+ security: [{ scheme: "bearer", type: "http" }],
4445
+ url: "/clinical/health-metrics/{id}/permanent",
4446
+ ...options
4447
+ });
4263
4448
  var postThreadsByIdExport = (options) => (options.client ?? client).post({
4264
4449
  security: [{ scheme: "bearer", type: "http" }],
4265
4450
  url: "/threads/{id}/export",
@@ -4479,11 +4664,6 @@ var postClinicalClientResourceAssignments = (options) => (options.client ?? clie
4479
4664
  ...options.headers
4480
4665
  }
4481
4666
  });
4482
- var deleteClinicalGoalTemplatesById = (options) => (options.client ?? client).delete({
4483
- security: [{ scheme: "bearer", type: "http" }],
4484
- url: "/clinical/goal-templates/{id}",
4485
- ...options
4486
- });
4487
4667
  var getClinicalGoalTemplatesById = (options) => (options.client ?? client).get({
4488
4668
  security: [{ scheme: "bearer", type: "http" }],
4489
4669
  url: "/clinical/goal-templates/{id}",
@@ -4615,15 +4795,6 @@ var postFieldTemplates = (options) => (options.client ?? client).post({
4615
4795
  ...options.headers
4616
4796
  }
4617
4797
  });
4618
- var patchSocialTrendingWatchesByIdMarkTriggered = (options) => (options.client ?? client).patch({
4619
- security: [{ scheme: "bearer", type: "http" }],
4620
- url: "/social/trending/watches/{id}/mark-triggered",
4621
- ...options,
4622
- headers: {
4623
- "Content-Type": "application/vnd.api+json",
4624
- ...options.headers
4625
- }
4626
- });
4627
4798
  var getClinicalPracticeResourcesCatalog = (options) => (options.client ?? client).get({
4628
4799
  security: [{ scheme: "bearer", type: "http" }],
4629
4800
  url: "/clinical/practice-resources/catalog",
@@ -4681,6 +4852,15 @@ var patchTenantsByIdReactivate = (options) => (options.client ?? client).patch({
4681
4852
  ...options.headers
4682
4853
  }
4683
4854
  });
4855
+ var patchClinicalGoalTemplatesCatalogByIdRestore = (options) => (options.client ?? client).patch({
4856
+ security: [{ scheme: "bearer", type: "http" }],
4857
+ url: "/clinical/goal-templates/catalog/{id}/restore",
4858
+ ...options,
4859
+ headers: {
4860
+ "Content-Type": "application/vnd.api+json",
4861
+ ...options.headers
4862
+ }
4863
+ });
4684
4864
  var getWorkspacesByWorkspaceIdExtractionExportsById = (options) => (options.client ?? client).get({
4685
4865
  security: [{ scheme: "bearer", type: "http" }],
4686
4866
  url: "/workspaces/{workspace_id}/extraction/exports/{id}",
@@ -4723,6 +4903,11 @@ var postDocumentsPresignedUpload = (options) => (options.client ?? client).post(
4723
4903
  ...options.headers
4724
4904
  }
4725
4905
  });
4906
+ var getClinicalHealthMetricsArchived = (options) => (options.client ?? client).get({
4907
+ security: [{ scheme: "bearer", type: "http" }],
4908
+ url: "/clinical/health-metrics/archived",
4909
+ ...options
4910
+ });
4726
4911
  var postPaymentMethodsTokenize = (options) => (options.client ?? client).post({
4727
4912
  security: [{ scheme: "bearer", type: "http" }],
4728
4913
  url: "/payment-methods/tokenize",
@@ -4820,11 +5005,6 @@ var postComplianceDocumentTemplatesClone = (options) => (options.client ?? clien
4820
5005
  ...options.headers
4821
5006
  }
4822
5007
  });
4823
- var deleteClinicalClientSupplementsById = (options) => (options.client ?? client).delete({
4824
- security: [{ scheme: "bearer", type: "http" }],
4825
- url: "/clinical/client-supplements/{id}",
4826
- ...options
4827
- });
4828
5008
  var getClinicalClientSupplementsById = (options) => (options.client ?? client).get({
4829
5009
  security: [{ scheme: "bearer", type: "http" }],
4830
5010
  url: "/clinical/client-supplements/{id}",
@@ -4929,6 +5109,11 @@ var getBreachNotificationsById = (options) => (options.client ?? client).get({
4929
5109
  url: "/breach-notifications/{id}",
4930
5110
  ...options
4931
5111
  });
5112
+ var deleteClinicalClientSupplementsByIdPermanent = (options) => (options.client ?? client).delete({
5113
+ security: [{ scheme: "bearer", type: "http" }],
5114
+ url: "/clinical/client-supplements/{id}/permanent",
5115
+ ...options
5116
+ });
4932
5117
  var patchStorageFilesByIdUpdateMetadata = (options) => (options.client ?? client).patch({
4933
5118
  security: [{ scheme: "bearer", type: "http" }],
4934
5119
  url: "/storage-files/{id}/update-metadata",
@@ -5000,6 +5185,15 @@ var getRiskAssessmentsById = (options) => (options.client ?? client).get({
5000
5185
  url: "/risk-assessments/{id}",
5001
5186
  ...options
5002
5187
  });
5188
+ var patchClinicalClientGoalsByIdArchive = (options) => (options.client ?? client).patch({
5189
+ security: [{ scheme: "bearer", type: "http" }],
5190
+ url: "/clinical/client-goals/{id}/archive",
5191
+ ...options,
5192
+ headers: {
5193
+ "Content-Type": "application/vnd.api+json",
5194
+ ...options.headers
5195
+ }
5196
+ });
5003
5197
  var getUserProfiles = (options) => (options.client ?? client).get({
5004
5198
  security: [{ scheme: "bearer", type: "http" }],
5005
5199
  url: "/user-profiles",
@@ -5284,6 +5478,11 @@ var getSocialPostsCampaignBySocialCampaignId = (options) => (options.client ?? c
5284
5478
  url: "/social/posts/campaign/{social_campaign_id}",
5285
5479
  ...options
5286
5480
  });
5481
+ var getClinicalPracticeToolsArchived = (options) => (options.client ?? client).get({
5482
+ security: [{ scheme: "bearer", type: "http" }],
5483
+ url: "/clinical/practice-tools/archived",
5484
+ ...options
5485
+ });
5287
5486
  var deleteDataTransferRecordsById = (options) => (options.client ?? client).delete({
5288
5487
  security: [{ scheme: "bearer", type: "http" }],
5289
5488
  url: "/data-transfer-records/{id}",
@@ -5294,6 +5493,11 @@ var getDataTransferRecordsById = (options) => (options.client ?? client).get({
5294
5493
  url: "/data-transfer-records/{id}",
5295
5494
  ...options
5296
5495
  });
5496
+ var deleteClinicalPracticeToolsByIdPermanent = (options) => (options.client ?? client).delete({
5497
+ security: [{ scheme: "bearer", type: "http" }],
5498
+ url: "/clinical/practice-tools/{id}/permanent",
5499
+ ...options
5500
+ });
5297
5501
  var patchAmendmentRequestsByIdApply = (options) => (options.client ?? client).patch({
5298
5502
  security: [{ scheme: "bearer", type: "http" }],
5299
5503
  url: "/amendment-requests/{id}/apply",
@@ -5363,6 +5567,15 @@ var patchSocialPostsByIdSeo = (options) => (options.client ?? client).patch({
5363
5567
  ...options.headers
5364
5568
  }
5365
5569
  });
5570
+ var patchClinicalGoalTemplatesByIdRestore = (options) => (options.client ?? client).patch({
5571
+ security: [{ scheme: "bearer", type: "http" }],
5572
+ url: "/clinical/goal-templates/{id}/restore",
5573
+ ...options,
5574
+ headers: {
5575
+ "Content-Type": "application/vnd.api+json",
5576
+ ...options.headers
5577
+ }
5578
+ });
5366
5579
  var postConnectorsOauthInitiate = (options) => (options.client ?? client).post({
5367
5580
  security: [{ scheme: "bearer", type: "http" }],
5368
5581
  url: "/connectors/oauth/initiate",
@@ -5465,6 +5678,11 @@ var patchSupportTicketsByIdClose = (options) => (options.client ?? client).patch
5465
5678
  ...options.headers
5466
5679
  }
5467
5680
  });
5681
+ var deleteClinicalClientResourceAssignmentsByIdPermanent = (options) => (options.client ?? client).delete({
5682
+ security: [{ scheme: "bearer", type: "http" }],
5683
+ url: "/clinical/client-resource-assignments/{id}/permanent",
5684
+ ...options
5685
+ });
5468
5686
  var getClinicalClientGoals = (options) => (options.client ?? client).get({
5469
5687
  security: [{ scheme: "bearer", type: "http" }],
5470
5688
  url: "/clinical/client-goals",
@@ -5526,6 +5744,11 @@ var patchEmailOutboundEmailsByIdCancelSchedule = (options) => (options.client ??
5526
5744
  ...options.headers
5527
5745
  }
5528
5746
  });
5747
+ var deleteClinicalPracticeResourcesCatalogByIdPermanent = (options) => (options.client ?? client).delete({
5748
+ security: [{ scheme: "bearer", type: "http" }],
5749
+ url: "/clinical/practice-resources/catalog/{id}/permanent",
5750
+ ...options
5751
+ });
5529
5752
  var postContentRefine = (options) => (options.client ?? client).post({
5530
5753
  security: [{ scheme: "bearer", type: "http" }],
5531
5754
  url: "/content/refine",
@@ -5577,6 +5800,15 @@ var getCampaignsSequencesWorkspaceByWorkspaceId = (options) => (options.client ?
5577
5800
  url: "/campaigns/sequences/workspace/{workspace_id}",
5578
5801
  ...options
5579
5802
  });
5803
+ var patchClinicalClientSupplementsByIdRestore = (options) => (options.client ?? client).patch({
5804
+ security: [{ scheme: "bearer", type: "http" }],
5805
+ url: "/clinical/client-supplements/{id}/restore",
5806
+ ...options,
5807
+ headers: {
5808
+ "Content-Type": "application/vnd.api+json",
5809
+ ...options.headers
5810
+ }
5811
+ });
5580
5812
  var patchUserProfilesByIdDismissAnnouncement = (options) => (options.client ?? client).patch({
5581
5813
  security: [{ scheme: "bearer", type: "http" }],
5582
5814
  url: "/user-profiles/{id}/dismiss-announcement",
@@ -5651,11 +5883,6 @@ var postUsersAuthLogin = (options) => (options.client ?? client).post({
5651
5883
  ...options.headers
5652
5884
  }
5653
5885
  });
5654
- var deleteClinicalHealthMetricsById = (options) => (options.client ?? client).delete({
5655
- security: [{ scheme: "bearer", type: "http" }],
5656
- url: "/clinical/health-metrics/{id}",
5657
- ...options
5658
- });
5659
5886
  var getClinicalHealthMetricsById = (options) => (options.client ?? client).get({
5660
5887
  security: [{ scheme: "bearer", type: "http" }],
5661
5888
  url: "/clinical/health-metrics/{id}",
@@ -5702,6 +5929,16 @@ var postAgentVersionComparisons = (options) => (options.client ?? client).post({
5702
5929
  ...options.headers
5703
5930
  }
5704
5931
  });
5932
+ var getClinicalClientGoalsArchived = (options) => (options.client ?? client).get({
5933
+ security: [{ scheme: "bearer", type: "http" }],
5934
+ url: "/clinical/client-goals/archived",
5935
+ ...options
5936
+ });
5937
+ var getClinicalPracticeResourcesCatalogArchived = (options) => (options.client ?? client).get({
5938
+ security: [{ scheme: "bearer", type: "http" }],
5939
+ url: "/clinical/practice-resources/catalog/archived",
5940
+ ...options
5941
+ });
5705
5942
  var getSchedulingBookings = (options) => (options.client ?? client).get({
5706
5943
  security: [{ scheme: "bearer", type: "http" }],
5707
5944
  url: "/scheduling/bookings",
@@ -5730,6 +5967,11 @@ var postSchedulingCalendarSyncs = (options) => (options.client ?? client).post({
5730
5967
  ...options.headers
5731
5968
  }
5732
5969
  });
5970
+ var getClinicalNotesArchived = (options) => (options.client ?? client).get({
5971
+ security: [{ scheme: "bearer", type: "http" }],
5972
+ url: "/clinical/notes/archived",
5973
+ ...options
5974
+ });
5733
5975
  var getWorkspacesMine = (options) => (options.client ?? client).get({
5734
5976
  security: [{ scheme: "bearer", type: "http" }],
5735
5977
  url: "/workspaces/mine",
@@ -5814,6 +6056,15 @@ var postUsersAuthConfirm = (options) => (options.client ?? client).post({
5814
6056
  ...options.headers
5815
6057
  }
5816
6058
  });
6059
+ var patchClinicalClientSupplementsByIdArchive = (options) => (options.client ?? client).patch({
6060
+ security: [{ scheme: "bearer", type: "http" }],
6061
+ url: "/clinical/client-supplements/{id}/archive",
6062
+ ...options,
6063
+ headers: {
6064
+ "Content-Type": "application/vnd.api+json",
6065
+ ...options.headers
6066
+ }
6067
+ });
5817
6068
  var postAgentsCloneForWorkspace = (options) => (options.client ?? client).post({
5818
6069
  security: [{ scheme: "bearer", type: "http" }],
5819
6070
  url: "/agents/clone-for-workspace",
@@ -6301,7 +6552,16 @@ var patchExtractionResultsByIdSaveCorrections = (options) => (options.client ??
6301
6552
  ...options.headers
6302
6553
  }
6303
6554
  });
6304
- var getConsentRecords = (options) => (options.client ?? client).get({
6555
+ var patchClinicalMealPlansByIdRestore = (options) => (options.client ?? client).patch({
6556
+ security: [{ scheme: "bearer", type: "http" }],
6557
+ url: "/clinical/meal-plans/{id}/restore",
6558
+ ...options,
6559
+ headers: {
6560
+ "Content-Type": "application/vnd.api+json",
6561
+ ...options.headers
6562
+ }
6563
+ });
6564
+ var getConsentRecords = (options) => (options.client ?? client).get({
6305
6565
  security: [{ scheme: "bearer", type: "http" }],
6306
6566
  url: "/consent-records",
6307
6567
  ...options
@@ -6456,6 +6716,15 @@ var postWatcherEvents = (options) => (options.client ?? client).post({
6456
6716
  ...options.headers
6457
6717
  }
6458
6718
  });
6719
+ var patchClinicalPracticeToolsByIdRestore = (options) => (options.client ?? client).patch({
6720
+ security: [{ scheme: "bearer", type: "http" }],
6721
+ url: "/clinical/practice-tools/{id}/restore",
6722
+ ...options,
6723
+ headers: {
6724
+ "Content-Type": "application/vnd.api+json",
6725
+ ...options.headers
6726
+ }
6727
+ });
6459
6728
  var getAgentsBySlugBySlug = (options) => (options.client ?? client).get({
6460
6729
  security: [{ scheme: "bearer", type: "http" }],
6461
6730
  url: "/agents/by-slug/{slug}",
@@ -6568,6 +6837,11 @@ var postAgentsByIdClone = (options) => (options.client ?? client).post({
6568
6837
  ...options.headers
6569
6838
  }
6570
6839
  });
6840
+ var getClinicalGoalTemplatesArchived = (options) => (options.client ?? client).get({
6841
+ security: [{ scheme: "bearer", type: "http" }],
6842
+ url: "/clinical/goal-templates/archived",
6843
+ ...options
6844
+ });
6571
6845
  var getLegalDocuments = (options) => (options.client ?? client).get({
6572
6846
  security: [{ scheme: "bearer", type: "http" }],
6573
6847
  url: "/legal-documents",
@@ -6601,6 +6875,15 @@ var getEmailInboundReceivedWorkspaceByWorkspaceId = (options) => (options.client
6601
6875
  url: "/email/inbound/received/workspace/{workspace_id}",
6602
6876
  ...options
6603
6877
  });
6878
+ var patchClinicalPracticeResourcesCatalogByIdArchive = (options) => (options.client ?? client).patch({
6879
+ security: [{ scheme: "bearer", type: "http" }],
6880
+ url: "/clinical/practice-resources/catalog/{id}/archive",
6881
+ ...options,
6882
+ headers: {
6883
+ "Content-Type": "application/vnd.api+json",
6884
+ ...options.headers
6885
+ }
6886
+ });
6604
6887
  var getInvitationsMe = (options) => (options.client ?? client).get({
6605
6888
  security: [{ scheme: "bearer", type: "http" }],
6606
6889
  url: "/invitations/me",
@@ -6625,6 +6908,15 @@ var postClinicalGoalTemplates = (options) => (options.client ?? client).post({
6625
6908
  ...options.headers
6626
6909
  }
6627
6910
  });
6911
+ var patchClinicalGoalTemplatesByIdArchive = (options) => (options.client ?? client).patch({
6912
+ security: [{ scheme: "bearer", type: "http" }],
6913
+ url: "/clinical/goal-templates/{id}/archive",
6914
+ ...options,
6915
+ headers: {
6916
+ "Content-Type": "application/vnd.api+json",
6917
+ ...options.headers
6918
+ }
6919
+ });
6628
6920
  var patchClinicalNotesByIdReject = (options) => (options.client ?? client).patch({
6629
6921
  security: [{ scheme: "bearer", type: "http" }],
6630
6922
  url: "/clinical/notes/{id}/reject",
@@ -6742,6 +7034,11 @@ var getWallet = (options) => (options.client ?? client).get({
6742
7034
  url: "/wallet",
6743
7035
  ...options
6744
7036
  });
7037
+ var getClinicalPracticeToolsCatalogArchived = (options) => (options.client ?? client).get({
7038
+ security: [{ scheme: "bearer", type: "http" }],
7039
+ url: "/clinical/practice-tools/catalog/archived",
7040
+ ...options
7041
+ });
6745
7042
  var deleteCrawlerSchedulesById = (options) => (options.client ?? client).delete({
6746
7043
  security: [{ scheme: "bearer", type: "http" }],
6747
7044
  url: "/crawler/schedules/{id}",
@@ -6831,6 +7128,11 @@ var getWorkspaceAgentConfigs = (options) => (options.client ?? client).get({
6831
7128
  url: "/workspace-agent-configs",
6832
7129
  ...options
6833
7130
  });
7131
+ var getThreadsMine = (options) => (options.client ?? client).get({
7132
+ security: [{ scheme: "bearer", type: "http" }],
7133
+ url: "/threads/mine",
7134
+ ...options
7135
+ });
6834
7136
  var getDisclosureLogsById = (options) => (options.client ?? client).get({
6835
7137
  security: [{ scheme: "bearer", type: "http" }],
6836
7138
  url: "/disclosure-logs/{id}",
@@ -8580,16 +8882,17 @@ function createAgentsNamespace(rb) {
8580
8882
  * @param agentId - The UUID of the agent to execute.
8581
8883
  * @param input - Input data for the agent (task description, documents, etc.).
8582
8884
  * @param opts - Additional execution options.
8885
+ * @param opts.workspace_id - The workspace to execute in. **Required** unless
8886
+ * `workspaceId` was set in the `GptClient` constructor config.
8583
8887
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8584
8888
  * Highest priority in the model resolution chain.
8585
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
8586
8889
  * @returns The created execution record with status `pending`.
8587
8890
  *
8588
8891
  * @example
8589
8892
  * const exec = await client.agents.executions.start('agt_01...', {
8590
8893
  * task: 'Extract invoice fields',
8591
8894
  * document_id: 'doc_01...',
8592
- * });
8895
+ * }, { workspace_id: 'ws_abc123' });
8593
8896
  * console.log(exec.id, exec.status); // 'pending'
8594
8897
  *
8595
8898
  * @example
@@ -8597,12 +8900,13 @@ function createAgentsNamespace(rb) {
8597
8900
  * const exec = await client.agents.executions.start(
8598
8901
  * 'agt_01...',
8599
8902
  * { task: 'Complex reasoning' },
8600
- * { model_id: 'anthropic/claude-sonnet-4' },
8903
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
8601
8904
  * );
8602
8905
  */
8603
8906
  start: async (agentId, input, opts) => {
8604
- const { model_id, ...reqOptions } = opts ?? {};
8907
+ const { workspace_id, model_id, ...reqOptions } = opts ?? {};
8605
8908
  const body = { input };
8909
+ if (workspace_id) body.workspace_id = workspace_id;
8606
8910
  if (model_id) body.model_id = model_id;
8607
8911
  return rb.rawPost(
8608
8912
  `/agents/${agentId}/execute`,
@@ -8619,20 +8923,24 @@ function createAgentsNamespace(rb) {
8619
8923
  *
8620
8924
  * @param agentId - The UUID of the agent.
8621
8925
  * @param input - Input data (same format as {@link start}).
8622
- * @param options - Optional request options.
8926
+ * @param opts - Additional options.
8927
+ * @param opts.workspace_id - The workspace to estimate for. Required for `sk_app_` key auth.
8623
8928
  * @returns Cost estimate with min/max credit ranges.
8624
8929
  *
8625
8930
  * @example
8626
8931
  * const estimate = await client.agents.executions.estimate('agt_01...', {
8627
8932
  * task: 'Process batch',
8628
- * });
8933
+ * }, { workspace_id: 'ws_abc123' });
8629
8934
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
8630
8935
  */
8631
- estimate: async (agentId, input, options) => {
8936
+ estimate: async (agentId, input, opts) => {
8937
+ const { workspace_id, ...reqOptions } = opts ?? {};
8938
+ const body = { input };
8939
+ if (workspace_id) body.workspace_id = workspace_id;
8632
8940
  return rb.rawPost(
8633
8941
  `/agents/${agentId}/estimate`,
8634
- { input },
8635
- options
8942
+ body,
8943
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8636
8944
  );
8637
8945
  },
8638
8946
  /**
@@ -8658,14 +8966,20 @@ function createAgentsNamespace(rb) {
8658
8966
  * Returns only executions triggered by the authenticated user,
8659
8967
  * ordered by creation time descending.
8660
8968
  *
8661
- * @param options - Optional request options.
8969
+ * @param opts - Optional filtering and request options.
8970
+ * @param opts.workspace_id - Filter to a specific workspace. Required for `sk_app_` key auth.
8662
8971
  * @returns Array of execution records.
8663
8972
  *
8664
8973
  * @example
8665
- * const executions = await client.agents.executions.list();
8974
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
8666
8975
  */
8667
- list: async (options) => {
8668
- return rb.rawGet("/agent-executions", options);
8976
+ list: async (opts) => {
8977
+ const { workspace_id, ...reqOptions } = opts ?? {};
8978
+ const query = workspace_id ? `?workspace_id=${encodeURIComponent(workspace_id)}` : "";
8979
+ return rb.rawGet(
8980
+ `/agent-executions${query}`,
8981
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8982
+ );
8669
8983
  },
8670
8984
  /**
8671
8985
  * Opens an SSE stream for real-time execution events.
@@ -9073,7 +9387,7 @@ function createAiNamespace(rb) {
9073
9387
  {
9074
9388
  body: {
9075
9389
  data: {
9076
- type: "conversation",
9390
+ type: "chat-conversation",
9077
9391
  attributes: attributes ?? {}
9078
9392
  }
9079
9393
  }
@@ -9152,8 +9466,9 @@ function createAiNamespace(rb) {
9152
9466
  {
9153
9467
  body: {
9154
9468
  data: {
9155
- type: "ai-message",
9156
- attributes: { ...body, conversation_id: conversationId }
9469
+ type: "chat-ai-message",
9470
+ ...body,
9471
+ conversation_id: conversationId
9157
9472
  }
9158
9473
  }
9159
9474
  },
@@ -10166,8 +10481,8 @@ function createBillingNamespace(rb) {
10166
10481
  /**
10167
10482
  * Feature usage records — per-tenant usage tracking for metered features.
10168
10483
  *
10169
- * Read-only access to usage records that track how many times each tenant
10170
- * has used a feature in the current billing cycle.
10484
+ * Access usage records that track how many times each tenant
10485
+ * has used a feature in the current billing cycle, and increment usage.
10171
10486
  */
10172
10487
  featureUsages: {
10173
10488
  /** List all feature usage records. */
@@ -10191,6 +10506,37 @@ function createBillingNamespace(rb) {
10191
10506
  options
10192
10507
  );
10193
10508
  return result.data ?? result;
10509
+ },
10510
+ /**
10511
+ * Increment usage for a feature by key.
10512
+ *
10513
+ * Checks feature gate, enforces limits, charges credits for credit_cost
10514
+ * features, and atomically increments the usage counter. Returns the
10515
+ * updated usage count and remaining allowance.
10516
+ *
10517
+ * @param featureKey - The feature definition key (e.g., "meal_plans", "clients")
10518
+ * @returns Object with `used` (current cycle count) and `remaining` (null if unlimited)
10519
+ *
10520
+ * @example
10521
+ * ```typescript
10522
+ * const result = await client.billing.featureUsages.increment("meal_plans");
10523
+ * console.log(`Used: ${result.used}, Remaining: ${result.remaining}`);
10524
+ * ```
10525
+ */
10526
+ increment: async (featureKey, options) => {
10527
+ const result = await rb.execute(
10528
+ postFeatureUsagesIncrement,
10529
+ {
10530
+ body: {
10531
+ data: {
10532
+ type: "feature-usage",
10533
+ attributes: { feature_key: featureKey }
10534
+ }
10535
+ }
10536
+ },
10537
+ options
10538
+ );
10539
+ return result.data;
10194
10540
  }
10195
10541
  },
10196
10542
  /**
@@ -10960,7 +11306,7 @@ function createContentNamespace(rb) {
10960
11306
  postContentGenerateText,
10961
11307
  {
10962
11308
  body: {
10963
- data: { type: "content-generation", attributes }
11309
+ data: { type: "content-generation", ...attributes }
10964
11310
  }
10965
11311
  },
10966
11312
  options
@@ -10983,7 +11329,7 @@ function createContentNamespace(rb) {
10983
11329
  postContentGenerateImage,
10984
11330
  {
10985
11331
  body: {
10986
- data: { type: "content-generation", attributes }
11332
+ data: { type: "content-generation", ...attributes }
10987
11333
  }
10988
11334
  },
10989
11335
  options
@@ -11007,7 +11353,7 @@ function createContentNamespace(rb) {
11007
11353
  postContentEditImage,
11008
11354
  {
11009
11355
  body: {
11010
- data: { type: "content-generation", attributes }
11356
+ data: { type: "content-generation", ...attributes }
11011
11357
  }
11012
11358
  },
11013
11359
  options
@@ -11031,7 +11377,7 @@ function createContentNamespace(rb) {
11031
11377
  postContentRewriteTone,
11032
11378
  {
11033
11379
  body: {
11034
- data: { type: "content-generation", attributes }
11380
+ data: { type: "content-generation", ...attributes }
11035
11381
  }
11036
11382
  },
11037
11383
  options
@@ -11055,7 +11401,7 @@ function createContentNamespace(rb) {
11055
11401
  postContentShorten,
11056
11402
  {
11057
11403
  body: {
11058
- data: { type: "content-generation", attributes }
11404
+ data: { type: "content-generation", ...attributes }
11059
11405
  }
11060
11406
  },
11061
11407
  options
@@ -11079,7 +11425,7 @@ function createContentNamespace(rb) {
11079
11425
  postContentRefine,
11080
11426
  {
11081
11427
  body: {
11082
- data: { type: "content-generation", attributes }
11428
+ data: { type: "content-generation", ...attributes }
11083
11429
  }
11084
11430
  },
11085
11431
  options
@@ -11103,7 +11449,7 @@ function createContentNamespace(rb) {
11103
11449
  postContentSuggestTopics,
11104
11450
  {
11105
11451
  body: {
11106
- data: { type: "content-generation", attributes }
11452
+ data: { type: "content-generation", ...attributes }
11107
11453
  }
11108
11454
  },
11109
11455
  options
@@ -11126,7 +11472,7 @@ function createContentNamespace(rb) {
11126
11472
  postContentGenerateImagePrompt,
11127
11473
  {
11128
11474
  body: {
11129
- data: { type: "content-generation", attributes }
11475
+ data: { type: "content-generation", ...attributes }
11130
11476
  }
11131
11477
  },
11132
11478
  options
@@ -11150,7 +11496,7 @@ function createContentNamespace(rb) {
11150
11496
  postContentGenerateHashtags,
11151
11497
  {
11152
11498
  body: {
11153
- data: { type: "content-generation", attributes }
11499
+ data: { type: "content-generation", ...attributes }
11154
11500
  }
11155
11501
  },
11156
11502
  options
@@ -11174,7 +11520,7 @@ function createContentNamespace(rb) {
11174
11520
  postContentSeoEnrich,
11175
11521
  {
11176
11522
  body: {
11177
- data: { type: "content-generation", attributes }
11523
+ data: { type: "content-generation", ...attributes }
11178
11524
  }
11179
11525
  },
11180
11526
  options
@@ -11383,7 +11729,7 @@ function createClinicalNamespace(rb) {
11383
11729
  }
11384
11730
  },
11385
11731
  /**
11386
- * Manage clinical sessions (practitionerpatient encounters).
11732
+ * Manage clinical sessions (practitioner-patient encounters).
11387
11733
  */
11388
11734
  sessions: {
11389
11735
  /**
@@ -11552,13 +11898,76 @@ function createClinicalNamespace(rb) {
11552
11898
  options
11553
11899
  ),
11554
11900
  /**
11555
- * Delete a clinical note.
11901
+ * Archive (soft-delete) a note.
11556
11902
  *
11903
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
11904
+ * Use `permanentDelete()` for irreversible removal.
11557
11905
  * @param id - Note UUID
11558
11906
  * @param options - Request options
11559
- * @returns `true` on successful deletion
11907
+ * @returns Archived {@link ClinicalNote} record
11908
+ */
11909
+ delete: async (id, options) => rb.execute(
11910
+ patchClinicalNotesByIdArchive,
11911
+ {
11912
+ path: { id },
11913
+ body: { data: { type: "clinical-note", id, attributes: {} } }
11914
+ },
11915
+ options
11916
+ ),
11917
+ /**
11918
+ * Archive (soft-delete) a note.
11919
+ *
11920
+ * @param id - Note UUID
11921
+ * @param options - Request options
11922
+ * @returns Archived {@link ClinicalNote} record
11923
+ */
11924
+ archive: async (id, options) => rb.execute(
11925
+ patchClinicalNotesByIdArchive,
11926
+ {
11927
+ path: { id },
11928
+ body: { data: { type: "clinical-note", id, attributes: {} } }
11929
+ },
11930
+ options
11931
+ ),
11932
+ /**
11933
+ * Restore an archived note.
11934
+ *
11935
+ * @param id - Note UUID
11936
+ * @param options - Request options
11937
+ * @returns Restored {@link ClinicalNote} record
11938
+ */
11939
+ restore: async (id, options) => rb.execute(
11940
+ patchClinicalNotesByIdRestore,
11941
+ {
11942
+ path: { id },
11943
+ body: { data: { type: "clinical-note", id, attributes: {} } }
11944
+ },
11945
+ options
11946
+ ),
11947
+ /**
11948
+ * Permanently delete a note. Irreversible.
11949
+ *
11950
+ * @param id - Note UUID
11951
+ * @param options - Request options
11952
+ * @returns `true` on success
11953
+ */
11954
+ permanentDelete: async (id, options) => rb.executeDelete(
11955
+ deleteClinicalNotesByIdPermanent,
11956
+ { path: { id } },
11957
+ options
11958
+ ),
11959
+ /**
11960
+ * List archived (soft-deleted) notes.
11961
+ *
11962
+ * @param params - Filter/pagination parameters
11963
+ * @param options - Request options
11964
+ * @returns Array of archived {@link ClinicalNote} records
11560
11965
  */
11561
- delete: async (id, options) => rb.executeDelete(deleteClinicalNotesById, { path: { id } }, options),
11966
+ listArchived: async (params, options) => rb.execute(
11967
+ getClinicalNotesArchived,
11968
+ params ?? {},
11969
+ options
11970
+ ),
11562
11971
  /**
11563
11972
  * Approve a clinical note (HITL workflow).
11564
11973
  *
@@ -11720,16 +12129,81 @@ function createClinicalNamespace(rb) {
11720
12129
  options
11721
12130
  ),
11722
12131
  /**
11723
- * Delete a health metric entry.
12132
+ * Archive (soft-delete) a health metric.
11724
12133
  *
12134
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12135
+ * Use `permanentDelete()` for irreversible removal.
11725
12136
  * @param id - HealthMetric UUID
11726
12137
  * @param options - Request options
11727
- * @returns `true` on successful deletion
12138
+ * @returns Archived {@link ClinicalHealthMetric} record
12139
+ */
12140
+ delete: async (id, options) => rb.execute(
12141
+ patchClinicalHealthMetricsByIdArchive,
12142
+ {
12143
+ path: { id },
12144
+ body: {
12145
+ data: { type: "clinical-health-metric", id, attributes: {} }
12146
+ }
12147
+ },
12148
+ options
12149
+ ),
12150
+ /**
12151
+ * Archive (soft-delete) a health metric.
12152
+ *
12153
+ * @param id - HealthMetric UUID
12154
+ * @param options - Request options
12155
+ * @returns Archived {@link ClinicalHealthMetric} record
12156
+ */
12157
+ archive: async (id, options) => rb.execute(
12158
+ patchClinicalHealthMetricsByIdArchive,
12159
+ {
12160
+ path: { id },
12161
+ body: {
12162
+ data: { type: "clinical-health-metric", id, attributes: {} }
12163
+ }
12164
+ },
12165
+ options
12166
+ ),
12167
+ /**
12168
+ * Restore an archived health metric.
12169
+ *
12170
+ * @param id - HealthMetric UUID
12171
+ * @param options - Request options
12172
+ * @returns Restored {@link ClinicalHealthMetric} record
12173
+ */
12174
+ restore: async (id, options) => rb.execute(
12175
+ patchClinicalHealthMetricsByIdRestore,
12176
+ {
12177
+ path: { id },
12178
+ body: {
12179
+ data: { type: "clinical-health-metric", id, attributes: {} }
12180
+ }
12181
+ },
12182
+ options
12183
+ ),
12184
+ /**
12185
+ * Permanently delete a health metric. Irreversible.
12186
+ *
12187
+ * @param id - HealthMetric UUID
12188
+ * @param options - Request options
12189
+ * @returns `true` on success
11728
12190
  */
11729
- delete: async (id, options) => rb.executeDelete(
11730
- deleteClinicalHealthMetricsById,
12191
+ permanentDelete: async (id, options) => rb.executeDelete(
12192
+ deleteClinicalHealthMetricsByIdPermanent,
11731
12193
  { path: { id } },
11732
12194
  options
12195
+ ),
12196
+ /**
12197
+ * List archived (soft-deleted) health metrics.
12198
+ *
12199
+ * @param params - Filter/pagination parameters
12200
+ * @param options - Request options
12201
+ * @returns Array of archived {@link ClinicalHealthMetric} records
12202
+ */
12203
+ listArchived: async (params, options) => rb.execute(
12204
+ getClinicalHealthMetricsArchived,
12205
+ params ?? {},
12206
+ options
11733
12207
  )
11734
12208
  },
11735
12209
  /**
@@ -11789,16 +12263,75 @@ function createClinicalNamespace(rb) {
11789
12263
  options
11790
12264
  ),
11791
12265
  /**
11792
- * Delete a meal plan.
12266
+ * Archive (soft-delete) a meal plan.
11793
12267
  *
12268
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12269
+ * Use `permanentDelete()` for irreversible removal.
11794
12270
  * @param id - MealPlan UUID
11795
12271
  * @param options - Request options
11796
- * @returns `true` on successful deletion
12272
+ * @returns Archived {@link ClinicalMealPlan} record
12273
+ */
12274
+ delete: async (id, options) => rb.execute(
12275
+ patchClinicalMealPlansByIdArchive,
12276
+ {
12277
+ path: { id },
12278
+ body: { data: { type: "clinical-meal-plan", id, attributes: {} } }
12279
+ },
12280
+ options
12281
+ ),
12282
+ /**
12283
+ * Archive (soft-delete) a meal plan.
12284
+ *
12285
+ * @param id - MealPlan UUID
12286
+ * @param options - Request options
12287
+ * @returns Archived {@link ClinicalMealPlan} record
12288
+ */
12289
+ archive: async (id, options) => rb.execute(
12290
+ patchClinicalMealPlansByIdArchive,
12291
+ {
12292
+ path: { id },
12293
+ body: { data: { type: "clinical-meal-plan", id, attributes: {} } }
12294
+ },
12295
+ options
12296
+ ),
12297
+ /**
12298
+ * Restore an archived meal plan.
12299
+ *
12300
+ * @param id - MealPlan UUID
12301
+ * @param options - Request options
12302
+ * @returns Restored {@link ClinicalMealPlan} record
11797
12303
  */
11798
- delete: async (id, options) => rb.executeDelete(
11799
- deleteClinicalMealPlansById,
12304
+ restore: async (id, options) => rb.execute(
12305
+ patchClinicalMealPlansByIdRestore,
12306
+ {
12307
+ path: { id },
12308
+ body: { data: { type: "clinical-meal-plan", id, attributes: {} } }
12309
+ },
12310
+ options
12311
+ ),
12312
+ /**
12313
+ * Permanently delete a meal plan. Irreversible.
12314
+ *
12315
+ * @param id - MealPlan UUID
12316
+ * @param options - Request options
12317
+ * @returns `true` on success
12318
+ */
12319
+ permanentDelete: async (id, options) => rb.executeDelete(
12320
+ deleteClinicalMealPlansByIdPermanent,
11800
12321
  { path: { id } },
11801
12322
  options
12323
+ ),
12324
+ /**
12325
+ * List archived (soft-deleted) meal plans.
12326
+ *
12327
+ * @param params - Filter/pagination parameters
12328
+ * @param options - Request options
12329
+ * @returns Array of archived {@link ClinicalMealPlan} records
12330
+ */
12331
+ listArchived: async (params, options) => rb.execute(
12332
+ getClinicalMealPlansArchived,
12333
+ params ?? {},
12334
+ options
11802
12335
  )
11803
12336
  },
11804
12337
  /**
@@ -11858,16 +12391,102 @@ function createClinicalNamespace(rb) {
11858
12391
  options
11859
12392
  ),
11860
12393
  /**
11861
- * Delete a client goal.
12394
+ * Archive (soft-delete) a client goal.
11862
12395
  *
12396
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12397
+ * Use `permanentDelete()` for irreversible removal.
11863
12398
  * @param id - ClientGoal UUID
11864
12399
  * @param options - Request options
11865
- * @returns `true` on successful deletion
12400
+ * @returns Archived {@link ClinicalClientGoal} record
12401
+ */
12402
+ delete: async (id, options) => rb.execute(
12403
+ patchClinicalClientGoalsByIdArchive,
12404
+ {
12405
+ path: { id },
12406
+ body: {
12407
+ data: { type: "clinical-client-goal", id, attributes: {} }
12408
+ }
12409
+ },
12410
+ options
12411
+ ),
12412
+ /**
12413
+ * Archive (soft-delete) a client goal.
12414
+ *
12415
+ * @param id - ClientGoal UUID
12416
+ * @param options - Request options
12417
+ * @returns Archived {@link ClinicalClientGoal} record
12418
+ */
12419
+ archive: async (id, options) => rb.execute(
12420
+ patchClinicalClientGoalsByIdArchive,
12421
+ {
12422
+ path: { id },
12423
+ body: {
12424
+ data: { type: "clinical-client-goal", id, attributes: {} }
12425
+ }
12426
+ },
12427
+ options
12428
+ ),
12429
+ /**
12430
+ * Restore an archived client goal.
12431
+ *
12432
+ * @param id - ClientGoal UUID
12433
+ * @param options - Request options
12434
+ * @returns Restored {@link ClinicalClientGoal} record
12435
+ */
12436
+ restore: async (id, options) => rb.execute(
12437
+ patchClinicalClientGoalsByIdRestore,
12438
+ {
12439
+ path: { id },
12440
+ body: {
12441
+ data: { type: "clinical-client-goal", id, attributes: {} }
12442
+ }
12443
+ },
12444
+ options
12445
+ ),
12446
+ /**
12447
+ * Permanently delete a client goal. Irreversible.
12448
+ *
12449
+ * @param id - ClientGoal UUID
12450
+ * @param options - Request options
12451
+ * @returns `true` on success
11866
12452
  */
11867
- delete: async (id, options) => rb.executeDelete(
11868
- deleteClinicalClientGoalsById,
12453
+ permanentDelete: async (id, options) => rb.executeDelete(
12454
+ deleteClinicalClientGoalsByIdPermanent,
11869
12455
  { path: { id } },
11870
12456
  options
12457
+ ),
12458
+ /**
12459
+ * List archived (soft-deleted) client goals.
12460
+ *
12461
+ * @param params - Filter/pagination parameters
12462
+ * @param options - Request options
12463
+ * @returns Array of archived {@link ClinicalClientGoal} records
12464
+ */
12465
+ listArchived: async (params, options) => rb.execute(
12466
+ getClinicalClientGoalsArchived,
12467
+ params ?? {},
12468
+ options
12469
+ ),
12470
+ /**
12471
+ * Batch reorder client goals by updating their positions.
12472
+ *
12473
+ * @param items - Array of `{ id, position }` pairs specifying new order
12474
+ * @param options - Request options
12475
+ * @returns `{ reordered: number }` — count of updated goals
12476
+ *
12477
+ * @example
12478
+ * ```typescript
12479
+ * await client.clinical.clientGoals.reorder([
12480
+ * { id: "goal-uuid-1", position: 0 },
12481
+ * { id: "goal-uuid-2", position: 1 },
12482
+ * { id: "goal-uuid-3", position: 2 },
12483
+ * ]);
12484
+ * ```
12485
+ */
12486
+ reorder: async (items, options) => rb.rawPost(
12487
+ "/clinical/client-goals/reorder",
12488
+ { items },
12489
+ options
11871
12490
  )
11872
12491
  },
11873
12492
  /**
@@ -11932,19 +12551,84 @@ function createClinicalNamespace(rb) {
11932
12551
  options
11933
12552
  ),
11934
12553
  /**
11935
- * Delete a supplement prescription.
12554
+ * Archive (soft-delete) a supplement prescription.
11936
12555
  *
12556
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12557
+ * Use `permanentDelete()` for irreversible removal.
11937
12558
  * @param id - ClientSupplement UUID
11938
12559
  * @param options - Request options
11939
- * @returns `true` on successful deletion
12560
+ * @returns Archived {@link ClinicalClientSupplement} record
11940
12561
  */
11941
- delete: async (id, options) => rb.executeDelete(
11942
- deleteClinicalClientSupplementsById,
11943
- { path: { id } },
11944
- options
11945
- )
11946
- },
11947
- /**
12562
+ delete: async (id, options) => rb.execute(
12563
+ patchClinicalClientSupplementsByIdArchive,
12564
+ {
12565
+ path: { id },
12566
+ body: {
12567
+ data: { type: "clinical-client-supplement", id, attributes: {} }
12568
+ }
12569
+ },
12570
+ options
12571
+ ),
12572
+ /**
12573
+ * Archive (soft-delete) a supplement prescription.
12574
+ *
12575
+ * @param id - ClientSupplement UUID
12576
+ * @param options - Request options
12577
+ * @returns Archived {@link ClinicalClientSupplement} record
12578
+ */
12579
+ archive: async (id, options) => rb.execute(
12580
+ patchClinicalClientSupplementsByIdArchive,
12581
+ {
12582
+ path: { id },
12583
+ body: {
12584
+ data: { type: "clinical-client-supplement", id, attributes: {} }
12585
+ }
12586
+ },
12587
+ options
12588
+ ),
12589
+ /**
12590
+ * Restore an archived supplement prescription.
12591
+ *
12592
+ * @param id - ClientSupplement UUID
12593
+ * @param options - Request options
12594
+ * @returns Restored {@link ClinicalClientSupplement} record
12595
+ */
12596
+ restore: async (id, options) => rb.execute(
12597
+ patchClinicalClientSupplementsByIdRestore,
12598
+ {
12599
+ path: { id },
12600
+ body: {
12601
+ data: { type: "clinical-client-supplement", id, attributes: {} }
12602
+ }
12603
+ },
12604
+ options
12605
+ ),
12606
+ /**
12607
+ * Permanently delete a supplement prescription. Irreversible.
12608
+ *
12609
+ * @param id - ClientSupplement UUID
12610
+ * @param options - Request options
12611
+ * @returns `true` on success
12612
+ */
12613
+ permanentDelete: async (id, options) => rb.executeDelete(
12614
+ deleteClinicalClientSupplementsByIdPermanent,
12615
+ { path: { id } },
12616
+ options
12617
+ ),
12618
+ /**
12619
+ * List archived (soft-deleted) supplement prescriptions.
12620
+ *
12621
+ * @param params - Filter/pagination parameters
12622
+ * @param options - Request options
12623
+ * @returns Array of archived {@link ClinicalClientSupplement} records
12624
+ */
12625
+ listArchived: async (params, options) => rb.execute(
12626
+ getClinicalClientSupplementsArchived,
12627
+ params ?? {},
12628
+ options
12629
+ )
12630
+ },
12631
+ /**
11948
12632
  * Manage clinical deliveries (care plan items sent to patients).
11949
12633
  */
11950
12634
  deliveries: {
@@ -12063,17 +12747,82 @@ function createClinicalNamespace(rb) {
12063
12747
  options
12064
12748
  ),
12065
12749
  /**
12066
- * Delete a practice resource.
12750
+ * Archive (soft-delete) a practice resource.
12067
12751
  *
12752
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12753
+ * Use `permanentDelete()` for irreversible removal.
12068
12754
  * @param id - PracticeResource UUID
12069
12755
  * @param options - Request options
12070
- * @returns `true` on successful deletion
12756
+ * @returns Archived {@link ClinicalPracticeResource} record
12071
12757
  */
12072
- delete: async (id, options) => rb.executeDelete(
12073
- deleteClinicalPracticeResourcesById,
12758
+ delete: async (id, options) => rb.execute(
12759
+ patchClinicalPracticeResourcesByIdArchive,
12760
+ {
12761
+ path: { id },
12762
+ body: {
12763
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12764
+ }
12765
+ },
12766
+ options
12767
+ ),
12768
+ /**
12769
+ * Archive (soft-delete) a practice resource.
12770
+ *
12771
+ * @param id - PracticeResource UUID
12772
+ * @param options - Request options
12773
+ * @returns Archived {@link ClinicalPracticeResource} record
12774
+ */
12775
+ archive: async (id, options) => rb.execute(
12776
+ patchClinicalPracticeResourcesByIdArchive,
12777
+ {
12778
+ path: { id },
12779
+ body: {
12780
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12781
+ }
12782
+ },
12783
+ options
12784
+ ),
12785
+ /**
12786
+ * Restore an archived practice resource.
12787
+ *
12788
+ * @param id - PracticeResource UUID
12789
+ * @param options - Request options
12790
+ * @returns Restored {@link ClinicalPracticeResource} record
12791
+ */
12792
+ restore: async (id, options) => rb.execute(
12793
+ patchClinicalPracticeResourcesByIdRestore,
12794
+ {
12795
+ path: { id },
12796
+ body: {
12797
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12798
+ }
12799
+ },
12800
+ options
12801
+ ),
12802
+ /**
12803
+ * Permanently delete a practice resource. Irreversible.
12804
+ *
12805
+ * @param id - PracticeResource UUID
12806
+ * @param options - Request options
12807
+ * @returns `true` on success
12808
+ */
12809
+ permanentDelete: async (id, options) => rb.executeDelete(
12810
+ deleteClinicalPracticeResourcesByIdPermanent,
12074
12811
  { path: { id } },
12075
12812
  options
12076
12813
  ),
12814
+ /**
12815
+ * List archived (soft-deleted) practice resources.
12816
+ *
12817
+ * @param params - Filter/pagination parameters
12818
+ * @param options - Request options
12819
+ * @returns Array of archived {@link ClinicalPracticeResource} records
12820
+ */
12821
+ listArchived: async (params, options) => rb.execute(
12822
+ getClinicalPracticeResourcesArchived,
12823
+ params ?? {},
12824
+ options
12825
+ ),
12077
12826
  /**
12078
12827
  * List application-level catalog practice resources.
12079
12828
  *
@@ -12086,6 +12835,64 @@ function createClinicalNamespace(rb) {
12086
12835
  { query: params ?? {} },
12087
12836
  options
12088
12837
  ),
12838
+ /**
12839
+ * Archive (soft-delete) a catalog practice resource.
12840
+ *
12841
+ * @param id - PracticeResource UUID
12842
+ * @param options - Request options
12843
+ * @returns Archived {@link ClinicalPracticeResource} record
12844
+ */
12845
+ archiveCatalog: async (id, options) => rb.execute(
12846
+ patchClinicalPracticeResourcesCatalogByIdArchive,
12847
+ {
12848
+ path: { id },
12849
+ body: {
12850
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12851
+ }
12852
+ },
12853
+ options
12854
+ ),
12855
+ /**
12856
+ * Restore an archived catalog practice resource.
12857
+ *
12858
+ * @param id - PracticeResource UUID
12859
+ * @param options - Request options
12860
+ * @returns Restored {@link ClinicalPracticeResource} record
12861
+ */
12862
+ restoreCatalog: async (id, options) => rb.execute(
12863
+ patchClinicalPracticeResourcesCatalogByIdRestore,
12864
+ {
12865
+ path: { id },
12866
+ body: {
12867
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12868
+ }
12869
+ },
12870
+ options
12871
+ ),
12872
+ /**
12873
+ * Permanently delete a catalog practice resource. Irreversible.
12874
+ *
12875
+ * @param id - PracticeResource UUID
12876
+ * @param options - Request options
12877
+ * @returns `true` on success
12878
+ */
12879
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
12880
+ deleteClinicalPracticeResourcesCatalogByIdPermanent,
12881
+ { path: { id } },
12882
+ options
12883
+ ),
12884
+ /**
12885
+ * List archived (soft-deleted) catalog practice resources.
12886
+ *
12887
+ * @param params - Filter/pagination parameters
12888
+ * @param options - Request options
12889
+ * @returns Array of archived {@link ClinicalPracticeResource} catalog records
12890
+ */
12891
+ listArchivedCatalog: async (params, options) => rb.execute(
12892
+ getClinicalPracticeResourcesCatalogArchived,
12893
+ params ?? {},
12894
+ options
12895
+ ),
12089
12896
  /**
12090
12897
  * List distinct practice resource categories in a workspace.
12091
12898
  *
@@ -12125,7 +12932,88 @@ function createClinicalNamespace(rb) {
12125
12932
  listCatalogCategories: async (options) => rb.rawGet(
12126
12933
  `/clinical/practice-resources/categories/catalog`,
12127
12934
  options
12128
- )
12935
+ ),
12936
+ tags: {
12937
+ rename: async (workspaceId, oldTag, newTag, options) => rb.rawPatch(
12938
+ `/clinical/practice-resources/tags/rename`,
12939
+ { workspace_id: workspaceId, old_tag: oldTag, new_tag: newTag },
12940
+ options
12941
+ ),
12942
+ delete: async (workspaceId, tag, options) => rb.rawDelete(
12943
+ `/clinical/practice-resources/tags/${encodeURIComponent(tag)}?workspace_id=${encodeURIComponent(workspaceId)}`,
12944
+ options
12945
+ ),
12946
+ merge: async (workspaceId, sourceTags, targetTag, options) => rb.rawPost(
12947
+ `/clinical/practice-resources/tags/merge`,
12948
+ {
12949
+ workspace_id: workspaceId,
12950
+ source_tags: sourceTags,
12951
+ target_tag: targetTag
12952
+ },
12953
+ options
12954
+ )
12955
+ },
12956
+ imports: {
12957
+ fromFile: async (workspaceId, file, options) => {
12958
+ const formData = new FormData();
12959
+ formData.append("file", file);
12960
+ formData.append("workspace_id", workspaceId);
12961
+ return rb.rawPostMultipart(
12962
+ `/clinical/practice-resources/imports/file`,
12963
+ formData,
12964
+ options
12965
+ );
12966
+ },
12967
+ fromUrl: async (workspaceId, url, options) => rb.rawPost(
12968
+ `/clinical/practice-resources/imports/url`,
12969
+ { workspace_id: workspaceId, url },
12970
+ options
12971
+ )
12972
+ },
12973
+ duplicates: {
12974
+ getStats: async (workspaceId, options) => rb.rawGet(
12975
+ `/clinical/practice-resources/duplicates?workspace_id=${encodeURIComponent(workspaceId)}`,
12976
+ options
12977
+ ),
12978
+ listGroups: async (workspaceId, opts, options) => {
12979
+ const qs = new URLSearchParams({ workspace_id: workspaceId });
12980
+ if (opts?.threshold !== void 0)
12981
+ qs.set("threshold", String(opts.threshold));
12982
+ if (opts?.limit !== void 0) qs.set("limit", String(opts.limit));
12983
+ return rb.rawGet(
12984
+ `/clinical/practice-resources/duplicates/groups?${qs.toString()}`,
12985
+ options
12986
+ );
12987
+ },
12988
+ resolve: async (workspaceId, groupId, keepId, options) => rb.rawPost(
12989
+ `/clinical/practice-resources/duplicates/resolve`,
12990
+ { workspace_id: workspaceId, group_id: groupId, keep_id: keepId },
12991
+ options
12992
+ )
12993
+ },
12994
+ /**
12995
+ * Search practice resources using semantic similarity.
12996
+ * Finds resources matching the query by meaning, not just keywords.
12997
+ *
12998
+ * @param workspaceId - The workspace to search in
12999
+ * @param params - Search parameters
13000
+ * @param params.query - Free-text search query
13001
+ * @param params.limit - Maximum results to return (default: 10)
13002
+ * @returns Array of matching practice resources with similarity scores
13003
+ *
13004
+ * @example
13005
+ * ```typescript
13006
+ * const results = await client.clinical.practiceResources.search(workspaceId, {
13007
+ * query: "diabetes management patient education",
13008
+ * limit: 5,
13009
+ * });
13010
+ * ```
13011
+ */
13012
+ search: async (workspaceId, params, options) => rb.rawPost(
13013
+ `/clinical/practice-resources/search`,
13014
+ { ...params, workspace_id: workspaceId },
13015
+ options
13016
+ ).then((r) => r.data)
12129
13017
  },
12130
13018
  /**
12131
13019
  * Manage practice-level assessment and therapeutic tools.
@@ -12184,17 +13072,82 @@ function createClinicalNamespace(rb) {
12184
13072
  options
12185
13073
  ),
12186
13074
  /**
12187
- * Delete a practice tool.
13075
+ * Archive (soft-delete) a practice tool.
12188
13076
  *
13077
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13078
+ * Use `permanentDelete()` for irreversible removal.
12189
13079
  * @param id - PracticeTool UUID
12190
13080
  * @param options - Request options
12191
- * @returns `true` on successful deletion
13081
+ * @returns Archived {@link ClinicalPracticeTool} record
13082
+ */
13083
+ delete: async (id, options) => rb.execute(
13084
+ patchClinicalPracticeToolsByIdArchive,
13085
+ {
13086
+ path: { id },
13087
+ body: {
13088
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13089
+ }
13090
+ },
13091
+ options
13092
+ ),
13093
+ /**
13094
+ * Archive (soft-delete) a practice tool.
13095
+ *
13096
+ * @param id - PracticeTool UUID
13097
+ * @param options - Request options
13098
+ * @returns Archived {@link ClinicalPracticeTool} record
13099
+ */
13100
+ archive: async (id, options) => rb.execute(
13101
+ patchClinicalPracticeToolsByIdArchive,
13102
+ {
13103
+ path: { id },
13104
+ body: {
13105
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13106
+ }
13107
+ },
13108
+ options
13109
+ ),
13110
+ /**
13111
+ * Restore an archived practice tool.
13112
+ *
13113
+ * @param id - PracticeTool UUID
13114
+ * @param options - Request options
13115
+ * @returns Restored {@link ClinicalPracticeTool} record
12192
13116
  */
12193
- delete: async (id, options) => rb.executeDelete(
12194
- deleteClinicalPracticeToolsById,
13117
+ restore: async (id, options) => rb.execute(
13118
+ patchClinicalPracticeToolsByIdRestore,
13119
+ {
13120
+ path: { id },
13121
+ body: {
13122
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13123
+ }
13124
+ },
13125
+ options
13126
+ ),
13127
+ /**
13128
+ * Permanently delete a practice tool. Irreversible.
13129
+ *
13130
+ * @param id - PracticeTool UUID
13131
+ * @param options - Request options
13132
+ * @returns `true` on success
13133
+ */
13134
+ permanentDelete: async (id, options) => rb.executeDelete(
13135
+ deleteClinicalPracticeToolsByIdPermanent,
12195
13136
  { path: { id } },
12196
13137
  options
12197
13138
  ),
13139
+ /**
13140
+ * List archived (soft-deleted) practice tools.
13141
+ *
13142
+ * @param params - Filter/pagination parameters
13143
+ * @param options - Request options
13144
+ * @returns Array of archived {@link ClinicalPracticeTool} records
13145
+ */
13146
+ listArchived: async (params, options) => rb.execute(
13147
+ getClinicalPracticeToolsArchived,
13148
+ params ?? {},
13149
+ options
13150
+ ),
12198
13151
  /**
12199
13152
  * List distinct practice tool categories in a workspace.
12200
13153
  *
@@ -12229,6 +13182,64 @@ function createClinicalNamespace(rb) {
12229
13182
  { query: params ?? {} },
12230
13183
  options
12231
13184
  ),
13185
+ /**
13186
+ * Archive (soft-delete) a catalog practice tool.
13187
+ *
13188
+ * @param id - PracticeTool UUID
13189
+ * @param options - Request options
13190
+ * @returns Archived {@link ClinicalPracticeTool} record
13191
+ */
13192
+ archiveCatalog: async (id, options) => rb.execute(
13193
+ patchClinicalPracticeToolsCatalogByIdArchive,
13194
+ {
13195
+ path: { id },
13196
+ body: {
13197
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13198
+ }
13199
+ },
13200
+ options
13201
+ ),
13202
+ /**
13203
+ * Restore an archived catalog practice tool.
13204
+ *
13205
+ * @param id - PracticeTool UUID
13206
+ * @param options - Request options
13207
+ * @returns Restored {@link ClinicalPracticeTool} record
13208
+ */
13209
+ restoreCatalog: async (id, options) => rb.execute(
13210
+ patchClinicalPracticeToolsCatalogByIdRestore,
13211
+ {
13212
+ path: { id },
13213
+ body: {
13214
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13215
+ }
13216
+ },
13217
+ options
13218
+ ),
13219
+ /**
13220
+ * Permanently delete a catalog practice tool. Irreversible.
13221
+ *
13222
+ * @param id - PracticeTool UUID
13223
+ * @param options - Request options
13224
+ * @returns `true` on success
13225
+ */
13226
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
13227
+ deleteClinicalPracticeToolsCatalogByIdPermanent,
13228
+ { path: { id } },
13229
+ options
13230
+ ),
13231
+ /**
13232
+ * List archived (soft-deleted) catalog practice tools.
13233
+ *
13234
+ * @param params - Filter/pagination parameters
13235
+ * @param options - Request options
13236
+ * @returns Array of archived {@link ClinicalPracticeTool} catalog records
13237
+ */
13238
+ listArchivedCatalog: async (params, options) => rb.execute(
13239
+ getClinicalPracticeToolsCatalogArchived,
13240
+ params ?? {},
13241
+ options
13242
+ ),
12232
13243
  /**
12233
13244
  * List distinct catalog practice tool categories.
12234
13245
  *
@@ -12246,7 +13257,87 @@ function createClinicalNamespace(rb) {
12246
13257
  listCatalogCategories: async (options) => rb.rawGet(
12247
13258
  `/clinical/practice-tools/categories/catalog`,
12248
13259
  options
12249
- )
13260
+ ),
13261
+ tags: {
13262
+ rename: async (workspaceId, oldTag, newTag, options) => rb.rawPatch(
13263
+ `/clinical/practice-tools/tags/rename`,
13264
+ { workspace_id: workspaceId, old_tag: oldTag, new_tag: newTag },
13265
+ options
13266
+ ),
13267
+ delete: async (workspaceId, tag, options) => rb.rawDelete(
13268
+ `/clinical/practice-tools/tags/${encodeURIComponent(tag)}?workspace_id=${encodeURIComponent(workspaceId)}`,
13269
+ options
13270
+ ),
13271
+ merge: async (workspaceId, sourceTags, targetTag, options) => rb.rawPost(
13272
+ `/clinical/practice-tools/tags/merge`,
13273
+ {
13274
+ workspace_id: workspaceId,
13275
+ source_tags: sourceTags,
13276
+ target_tag: targetTag
13277
+ },
13278
+ options
13279
+ )
13280
+ },
13281
+ imports: {
13282
+ fromFile: async (workspaceId, file, options) => {
13283
+ const formData = new FormData();
13284
+ formData.append("file", file);
13285
+ formData.append("workspace_id", workspaceId);
13286
+ return rb.rawPostMultipart(
13287
+ `/clinical/practice-tools/imports/file`,
13288
+ formData,
13289
+ options
13290
+ );
13291
+ },
13292
+ fromUrl: async (workspaceId, url, options) => rb.rawPost(
13293
+ `/clinical/practice-tools/imports/url`,
13294
+ { workspace_id: workspaceId, url },
13295
+ options
13296
+ )
13297
+ },
13298
+ duplicates: {
13299
+ getStats: async (workspaceId, options) => rb.rawGet(
13300
+ `/clinical/practice-tools/duplicates?workspace_id=${encodeURIComponent(workspaceId)}`,
13301
+ options
13302
+ ),
13303
+ listGroups: async (workspaceId, opts, options) => {
13304
+ const qs = new URLSearchParams({ workspace_id: workspaceId });
13305
+ if (opts?.threshold !== void 0)
13306
+ qs.set("threshold", String(opts.threshold));
13307
+ if (opts?.limit !== void 0) qs.set("limit", String(opts.limit));
13308
+ return rb.rawGet(
13309
+ `/clinical/practice-tools/duplicates/groups?${qs.toString()}`,
13310
+ options
13311
+ );
13312
+ },
13313
+ resolve: async (workspaceId, groupId, keepId, options) => rb.rawPost(
13314
+ `/clinical/practice-tools/duplicates/resolve`,
13315
+ { workspace_id: workspaceId, group_id: groupId, keep_id: keepId },
13316
+ options
13317
+ )
13318
+ },
13319
+ /**
13320
+ * Search practice tools using semantic similarity.
13321
+ *
13322
+ * @param workspaceId - The workspace to search in
13323
+ * @param params - Search parameters
13324
+ * @param params.query - Free-text search query
13325
+ * @param params.limit - Maximum results to return (default: 10)
13326
+ * @returns Array of matching practice tools with similarity scores
13327
+ *
13328
+ * @example
13329
+ * ```typescript
13330
+ * const results = await client.clinical.practiceTools.search(workspaceId, {
13331
+ * query: "stress assessment screening tool",
13332
+ * limit: 5,
13333
+ * });
13334
+ * ```
13335
+ */
13336
+ search: async (workspaceId, params, options) => rb.rawPost(
13337
+ `/clinical/practice-tools/search`,
13338
+ { ...params, workspace_id: workspaceId },
13339
+ options
13340
+ ).then((r) => r.data)
12250
13341
  },
12251
13342
  /**
12252
13343
  * Manage assignments of practice resources to patients.
@@ -12316,16 +13407,93 @@ function createClinicalNamespace(rb) {
12316
13407
  options
12317
13408
  ),
12318
13409
  /**
12319
- * Delete a resource assignment.
13410
+ * Archive (soft-delete) a resource assignment.
12320
13411
  *
13412
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13413
+ * Use `permanentDelete()` for irreversible removal.
12321
13414
  * @param id - ClientResourceAssignment UUID
12322
13415
  * @param options - Request options
12323
- * @returns `true` on successful deletion
13416
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
13417
+ */
13418
+ delete: async (id, options) => rb.execute(
13419
+ patchClinicalClientResourceAssignmentsByIdArchive,
13420
+ {
13421
+ path: { id },
13422
+ body: {
13423
+ data: {
13424
+ type: "clinical-client-resource-assignment",
13425
+ id,
13426
+ attributes: {}
13427
+ }
13428
+ }
13429
+ },
13430
+ options
13431
+ ),
13432
+ /**
13433
+ * Archive (soft-delete) a resource assignment.
13434
+ *
13435
+ * @param id - ClientResourceAssignment UUID
13436
+ * @param options - Request options
13437
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
12324
13438
  */
12325
- delete: async (id, options) => rb.executeDelete(
12326
- deleteClinicalClientResourceAssignmentsById,
13439
+ archive: async (id, options) => rb.execute(
13440
+ patchClinicalClientResourceAssignmentsByIdArchive,
13441
+ {
13442
+ path: { id },
13443
+ body: {
13444
+ data: {
13445
+ type: "clinical-client-resource-assignment",
13446
+ id,
13447
+ attributes: {}
13448
+ }
13449
+ }
13450
+ },
13451
+ options
13452
+ ),
13453
+ /**
13454
+ * Restore an archived resource assignment.
13455
+ *
13456
+ * @param id - ClientResourceAssignment UUID
13457
+ * @param options - Request options
13458
+ * @returns Restored {@link ClinicalClientResourceAssignment} record
13459
+ */
13460
+ restore: async (id, options) => rb.execute(
13461
+ patchClinicalClientResourceAssignmentsByIdRestore,
13462
+ {
13463
+ path: { id },
13464
+ body: {
13465
+ data: {
13466
+ type: "clinical-client-resource-assignment",
13467
+ id,
13468
+ attributes: {}
13469
+ }
13470
+ }
13471
+ },
13472
+ options
13473
+ ),
13474
+ /**
13475
+ * Permanently delete a resource assignment. Irreversible.
13476
+ *
13477
+ * @param id - ClientResourceAssignment UUID
13478
+ * @param options - Request options
13479
+ * @returns `true` on success
13480
+ */
13481
+ permanentDelete: async (id, options) => rb.executeDelete(
13482
+ deleteClinicalClientResourceAssignmentsByIdPermanent,
12327
13483
  { path: { id } },
12328
13484
  options
13485
+ ),
13486
+ /**
13487
+ * List archived (soft-deleted) resource assignments.
13488
+ *
13489
+ * @param params - Filter/pagination parameters
13490
+ * @param options - Request options
13491
+ * @returns Array of archived {@link ClinicalClientResourceAssignment} records
13492
+ */
13493
+ listArchived: async (params, options) => rb.execute(
13494
+ getClinicalClientResourceAssignmentsArchived,
13495
+ params ?? {},
13496
+ options
12329
13497
  )
12330
13498
  },
12331
13499
  /**
@@ -12487,43 +13655,166 @@ function createClinicalNamespace(rb) {
12487
13655
  options
12488
13656
  ),
12489
13657
  /**
12490
- * Update a goal template.
13658
+ * Update a goal template.
13659
+ *
13660
+ * @param id - GoalTemplate UUID
13661
+ * @param attributes - Fields to update (PATCH semantics)
13662
+ * @param options - Request options
13663
+ * @returns Updated {@link ClinicalGoalTemplate} record
13664
+ */
13665
+ update: async (id, attributes, options) => rb.execute(
13666
+ patchClinicalGoalTemplatesById,
13667
+ {
13668
+ path: { id },
13669
+ body: { data: { type: "clinical-goal-template", id, attributes } }
13670
+ },
13671
+ options
13672
+ ),
13673
+ /**
13674
+ * Archive (soft-delete) a goal template.
13675
+ *
13676
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13677
+ * Use `permanentDelete()` for irreversible removal.
13678
+ * @param id - GoalTemplate UUID
13679
+ * @param options - Request options
13680
+ * @returns Archived {@link ClinicalGoalTemplate} record
13681
+ */
13682
+ delete: async (id, options) => rb.execute(
13683
+ patchClinicalGoalTemplatesByIdArchive,
13684
+ {
13685
+ path: { id },
13686
+ body: {
13687
+ data: { type: "clinical-goal-template", id, attributes: {} }
13688
+ }
13689
+ },
13690
+ options
13691
+ ),
13692
+ /**
13693
+ * Archive (soft-delete) a goal template.
13694
+ *
13695
+ * @param id - GoalTemplate UUID
13696
+ * @param options - Request options
13697
+ * @returns Archived {@link ClinicalGoalTemplate} record
13698
+ */
13699
+ archive: async (id, options) => rb.execute(
13700
+ patchClinicalGoalTemplatesByIdArchive,
13701
+ {
13702
+ path: { id },
13703
+ body: {
13704
+ data: { type: "clinical-goal-template", id, attributes: {} }
13705
+ }
13706
+ },
13707
+ options
13708
+ ),
13709
+ /**
13710
+ * Restore an archived goal template.
13711
+ *
13712
+ * @param id - GoalTemplate UUID
13713
+ * @param options - Request options
13714
+ * @returns Restored {@link ClinicalGoalTemplate} record
13715
+ */
13716
+ restore: async (id, options) => rb.execute(
13717
+ patchClinicalGoalTemplatesByIdRestore,
13718
+ {
13719
+ path: { id },
13720
+ body: {
13721
+ data: { type: "clinical-goal-template", id, attributes: {} }
13722
+ }
13723
+ },
13724
+ options
13725
+ ),
13726
+ /**
13727
+ * Permanently delete a goal template. Irreversible.
13728
+ *
13729
+ * @param id - GoalTemplate UUID
13730
+ * @param options - Request options
13731
+ * @returns `true` on success
13732
+ */
13733
+ permanentDelete: async (id, options) => rb.executeDelete(
13734
+ deleteClinicalGoalTemplatesByIdPermanent,
13735
+ { path: { id } },
13736
+ options
13737
+ ),
13738
+ /**
13739
+ * List archived (soft-deleted) goal templates.
13740
+ *
13741
+ * @param params - Filter/pagination parameters
13742
+ * @param options - Request options
13743
+ * @returns Array of archived {@link ClinicalGoalTemplate} records
13744
+ */
13745
+ listArchived: async (params, options) => rb.execute(
13746
+ getClinicalGoalTemplatesArchived,
13747
+ params ?? {},
13748
+ options
13749
+ ),
13750
+ /**
13751
+ * List application-level catalog goal templates.
13752
+ *
13753
+ * @param params - Optional filter/sort params. Application ID is resolved from the API key context.
13754
+ * @param options - Request options
13755
+ * @returns Array of {@link ClinicalGoalTemplate} catalog records
13756
+ */
13757
+ listCatalog: async (params, options) => rb.execute(
13758
+ getClinicalGoalTemplatesCatalog,
13759
+ { query: params ?? {} },
13760
+ options
13761
+ ),
13762
+ /**
13763
+ * Archive (soft-delete) a catalog goal template.
13764
+ *
13765
+ * @param id - GoalTemplate UUID
13766
+ * @param options - Request options
13767
+ * @returns Archived {@link ClinicalGoalTemplate} record
13768
+ */
13769
+ archiveCatalog: async (id, options) => rb.execute(
13770
+ patchClinicalGoalTemplatesCatalogByIdArchive,
13771
+ {
13772
+ path: { id },
13773
+ body: {
13774
+ data: { type: "clinical-goal-template", id, attributes: {} }
13775
+ }
13776
+ },
13777
+ options
13778
+ ),
13779
+ /**
13780
+ * Restore an archived catalog goal template.
12491
13781
  *
12492
13782
  * @param id - GoalTemplate UUID
12493
- * @param attributes - Fields to update (PATCH semantics)
12494
13783
  * @param options - Request options
12495
- * @returns Updated {@link ClinicalGoalTemplate} record
13784
+ * @returns Restored {@link ClinicalGoalTemplate} record
12496
13785
  */
12497
- update: async (id, attributes, options) => rb.execute(
12498
- patchClinicalGoalTemplatesById,
13786
+ restoreCatalog: async (id, options) => rb.execute(
13787
+ patchClinicalGoalTemplatesCatalogByIdRestore,
12499
13788
  {
12500
13789
  path: { id },
12501
- body: { data: { type: "clinical-goal-template", id, attributes } }
13790
+ body: {
13791
+ data: { type: "clinical-goal-template", id, attributes: {} }
13792
+ }
12502
13793
  },
12503
13794
  options
12504
13795
  ),
12505
13796
  /**
12506
- * Delete a goal template.
13797
+ * Permanently delete a catalog goal template. Irreversible.
12507
13798
  *
12508
13799
  * @param id - GoalTemplate UUID
12509
13800
  * @param options - Request options
12510
- * @returns `true` on successful deletion
13801
+ * @returns `true` on success
12511
13802
  */
12512
- delete: async (id, options) => rb.executeDelete(
12513
- deleteClinicalGoalTemplatesById,
13803
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
13804
+ deleteClinicalGoalTemplatesCatalogByIdPermanent,
12514
13805
  { path: { id } },
12515
13806
  options
12516
13807
  ),
12517
13808
  /**
12518
- * List application-level catalog goal templates.
13809
+ * List archived (soft-deleted) catalog goal templates.
12519
13810
  *
12520
- * @param params - Optional filter/sort params. Application ID is resolved from the API key context.
13811
+ * @param params - Filter/pagination parameters
12521
13812
  * @param options - Request options
12522
- * @returns Array of {@link ClinicalGoalTemplate} catalog records
13813
+ * @returns Array of archived {@link ClinicalGoalTemplate} catalog records
12523
13814
  */
12524
- listCatalog: async (params, options) => rb.execute(
12525
- getClinicalGoalTemplatesCatalog,
12526
- { query: params ?? {} },
13815
+ listArchivedCatalog: async (params, options) => rb.execute(
13816
+ getClinicalGoalTemplatesCatalogArchived,
13817
+ params ?? {},
12527
13818
  options
12528
13819
  ),
12529
13820
  /**
@@ -12543,7 +13834,87 @@ function createClinicalNamespace(rb) {
12543
13834
  listCatalogCategories: async (options) => rb.rawGet(
12544
13835
  `/clinical/goal-templates/categories/catalog`,
12545
13836
  options
12546
- )
13837
+ ),
13838
+ tags: {
13839
+ rename: async (workspaceId, oldTag, newTag, options) => rb.rawPatch(
13840
+ `/clinical/goal-templates/tags/rename`,
13841
+ { workspace_id: workspaceId, old_tag: oldTag, new_tag: newTag },
13842
+ options
13843
+ ),
13844
+ delete: async (workspaceId, tag, options) => rb.rawDelete(
13845
+ `/clinical/goal-templates/tags/${encodeURIComponent(tag)}?workspace_id=${encodeURIComponent(workspaceId)}`,
13846
+ options
13847
+ ),
13848
+ merge: async (workspaceId, sourceTags, targetTag, options) => rb.rawPost(
13849
+ `/clinical/goal-templates/tags/merge`,
13850
+ {
13851
+ workspace_id: workspaceId,
13852
+ source_tags: sourceTags,
13853
+ target_tag: targetTag
13854
+ },
13855
+ options
13856
+ )
13857
+ },
13858
+ imports: {
13859
+ fromFile: async (workspaceId, file, options) => {
13860
+ const formData = new FormData();
13861
+ formData.append("file", file);
13862
+ formData.append("workspace_id", workspaceId);
13863
+ return rb.rawPostMultipart(
13864
+ `/clinical/goal-templates/imports/file`,
13865
+ formData,
13866
+ options
13867
+ );
13868
+ },
13869
+ fromUrl: async (workspaceId, url, options) => rb.rawPost(
13870
+ `/clinical/goal-templates/imports/url`,
13871
+ { workspace_id: workspaceId, url },
13872
+ options
13873
+ )
13874
+ },
13875
+ duplicates: {
13876
+ getStats: async (workspaceId, options) => rb.rawGet(
13877
+ `/clinical/goal-templates/duplicates?workspace_id=${encodeURIComponent(workspaceId)}`,
13878
+ options
13879
+ ),
13880
+ listGroups: async (workspaceId, opts, options) => {
13881
+ const qs = new URLSearchParams({ workspace_id: workspaceId });
13882
+ if (opts?.threshold !== void 0)
13883
+ qs.set("threshold", String(opts.threshold));
13884
+ if (opts?.limit !== void 0) qs.set("limit", String(opts.limit));
13885
+ return rb.rawGet(
13886
+ `/clinical/goal-templates/duplicates/groups?${qs.toString()}`,
13887
+ options
13888
+ );
13889
+ },
13890
+ resolve: async (workspaceId, groupId, keepId, options) => rb.rawPost(
13891
+ `/clinical/goal-templates/duplicates/resolve`,
13892
+ { workspace_id: workspaceId, group_id: groupId, keep_id: keepId },
13893
+ options
13894
+ )
13895
+ },
13896
+ /**
13897
+ * Search goal templates using semantic similarity.
13898
+ *
13899
+ * @param workspaceId - The workspace to search in
13900
+ * @param params - Search parameters
13901
+ * @param params.query - Free-text search query
13902
+ * @param params.limit - Maximum results to return (default: 10)
13903
+ * @returns Array of matching goal templates with similarity scores
13904
+ *
13905
+ * @example
13906
+ * ```typescript
13907
+ * const results = await client.clinical.goalTemplates.search(workspaceId, {
13908
+ * query: "improve sleep quality and duration",
13909
+ * limit: 5,
13910
+ * });
13911
+ * ```
13912
+ */
13913
+ search: async (workspaceId, params, options) => rb.rawPost(
13914
+ `/clinical/goal-templates/search`,
13915
+ { ...params, workspace_id: workspaceId },
13916
+ options
13917
+ ).then((r) => r.data)
12547
13918
  },
12548
13919
  /**
12549
13920
  * Recipe search via configured Edamam connector.
@@ -16314,7 +17685,7 @@ function createConnectorsNamespace(rb) {
16314
17685
  body: {
16315
17686
  data: {
16316
17687
  type: "credential",
16317
- attributes: { workspace_id: workspaceId }
17688
+ workspace_id: workspaceId
16318
17689
  }
16319
17690
  }
16320
17691
  },
@@ -16348,7 +17719,7 @@ function createConnectorsNamespace(rb) {
16348
17719
  body: {
16349
17720
  data: {
16350
17721
  type: "credential",
16351
- attributes
17722
+ ...attributes
16352
17723
  }
16353
17724
  }
16354
17725
  },
@@ -16379,11 +17750,9 @@ function createConnectorsNamespace(rb) {
16379
17750
  body: {
16380
17751
  data: {
16381
17752
  type: "credential",
16382
- attributes: {
16383
- workspace_id: workspaceId,
16384
- connector_type: connectorType,
16385
- scope_level: scopeLevel
16386
- }
17753
+ workspace_id: workspaceId,
17754
+ connector_type: connectorType,
17755
+ scope_level: scopeLevel
16387
17756
  }
16388
17757
  }
16389
17758
  },
@@ -16428,10 +17797,8 @@ function createConnectorsNamespace(rb) {
16428
17797
  body: {
16429
17798
  data: {
16430
17799
  type: "connector_instance",
16431
- attributes: {
16432
- connector_type: connectorType,
16433
- workspace_id: workspaceId
16434
- }
17800
+ connector_type: connectorType,
17801
+ workspace_id: workspaceId
16435
17802
  }
16436
17803
  }
16437
17804
  },
@@ -16477,14 +17844,12 @@ function createConnectorsNamespace(rb) {
16477
17844
  body: {
16478
17845
  data: {
16479
17846
  type: "connector_instance",
16480
- attributes: {
16481
- connector_type: connectorType,
16482
- code,
16483
- state,
16484
- workspace_id: workspaceId,
16485
- ...redirectUri !== void 0 && {
16486
- redirect_uri: redirectUri
16487
- }
17847
+ connector_type: connectorType,
17848
+ code,
17849
+ state,
17850
+ workspace_id: workspaceId,
17851
+ ...redirectUri !== void 0 && {
17852
+ redirect_uri: redirectUri
16488
17853
  }
16489
17854
  }
16490
17855
  }
@@ -16754,111 +18119,327 @@ function createConnectorsNamespace(rb) {
16754
18119
  * }
16755
18120
  * ```
16756
18121
  */
16757
- checkPatient: async (connectorId, workspaceId, email, options) => rb.execute(
16758
- postConnectorsFullscriptCheckPatient,
18122
+ checkPatient: async (connectorId, workspaceId, email, options) => rb.execute(
18123
+ postConnectorsFullscriptCheckPatient,
18124
+ {
18125
+ body: {
18126
+ data: {
18127
+ type: "connector_instance",
18128
+ connector_id: connectorId,
18129
+ workspace_id: workspaceId,
18130
+ email
18131
+ }
18132
+ }
18133
+ },
18134
+ options
18135
+ ),
18136
+ /**
18137
+ * Create a new patient record in Fullscript.
18138
+ *
18139
+ * Creates the patient in the Fullscript account linked to the connector
18140
+ * and returns the resulting patient object including the assigned
18141
+ * `fullscript_id`. Use this when a patient does not yet have a Fullscript
18142
+ * account (confirmed via `checkPatient`).
18143
+ *
18144
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18145
+ * @param workspaceId - UUID of the current workspace.
18146
+ * @param attrs - Patient attributes: `first_name`, `last_name`, `email`
18147
+ * (all required), and optional `date_of_birth` (ISO 8601 date string).
18148
+ * @param options - Optional request options.
18149
+ * @returns The newly created `FullscriptPatient`.
18150
+ *
18151
+ * @example
18152
+ * ```typescript
18153
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18154
+ * const patient = await client.connectors.fullscript.createPatient(
18155
+ * 'ci_fs_123',
18156
+ * 'ws_abc123',
18157
+ * {
18158
+ * first_name: 'Jane',
18159
+ * last_name: 'Smith',
18160
+ * email: 'jane@example.com',
18161
+ * date_of_birth: '1985-04-12',
18162
+ * },
18163
+ * );
18164
+ * console.log('Created Fullscript patient:', patient.fullscript_id);
18165
+ * ```
18166
+ */
18167
+ createPatient: async (connectorId, workspaceId, attrs, options) => rb.execute(
18168
+ postConnectorsFullscriptCreatePatient,
18169
+ {
18170
+ body: {
18171
+ data: {
18172
+ type: "connector_instance",
18173
+ connector_id: connectorId,
18174
+ workspace_id: workspaceId,
18175
+ ...attrs
18176
+ }
18177
+ }
18178
+ },
18179
+ options
18180
+ ),
18181
+ /**
18182
+ * Obtain a short-lived embed session grant for the Fullscript prescribing widget.
18183
+ *
18184
+ * The returned `token` is used to embed the Fullscript prescribing UI for a
18185
+ * specific patient within your application. Tokens are valid for 5–15 minutes
18186
+ * and are cached server-side for up to 2 minutes to avoid token proliferation
18187
+ * on repeated calls.
18188
+ *
18189
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18190
+ * @param workspaceId - UUID of the current workspace.
18191
+ * @param patientId - The Fullscript patient ID (from `FullscriptPatient.fullscript_id`).
18192
+ * @param options - Optional request options.
18193
+ * @returns A `FullscriptSessionGrant` with `token`, `expires_at`, and `patient_id`.
18194
+ *
18195
+ * @example
18196
+ * ```typescript
18197
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18198
+ * const grant = await client.connectors.fullscript.sessionGrant(
18199
+ * 'ci_fs_123',
18200
+ * 'ws_abc123',
18201
+ * 'fs_patient_456',
18202
+ * );
18203
+ * // Embed: `https://app.fullscript.com/embed?token=${grant.token}`
18204
+ * console.log('Token expires:', grant.expires_at);
18205
+ * ```
18206
+ */
18207
+ sessionGrant: async (connectorId, workspaceId, patientId, options) => rb.execute(
18208
+ postConnectorsFullscriptSessionGrant,
18209
+ {
18210
+ body: {
18211
+ data: {
18212
+ type: "connector_instance",
18213
+ connector_id: connectorId,
18214
+ workspace_id: workspaceId,
18215
+ patient_id: patientId
18216
+ }
18217
+ }
18218
+ },
18219
+ options
18220
+ ),
18221
+ // ── Treatment Plans ──
18222
+ /**
18223
+ * List treatment plans for a patient.
18224
+ * @param connectorId - The Fullscript connector instance ID
18225
+ * @param workspaceId - The workspace ID
18226
+ * @param patientId - The Fullscript patient ID
18227
+ * @returns Array of treatment plans
18228
+ */
18229
+ listTreatmentPlans: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
18230
+ `/connectors/fullscript/treatment-plans/list`,
18231
+ {
18232
+ workspace_id: workspaceId,
18233
+ connector_id: connectorId,
18234
+ patient_id: patientId
18235
+ },
18236
+ options
18237
+ ).then((r) => r.data),
18238
+ /**
18239
+ * Get treatment plan details including recommendations.
18240
+ *
18241
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18242
+ * @param workspaceId - UUID of the current workspace.
18243
+ * @param treatmentPlanId - The Fullscript treatment plan ID.
18244
+ * @param options - Optional request options.
18245
+ * @returns The `FullscriptTreatmentPlan` with recommendation details.
18246
+ *
18247
+ * @example
18248
+ * ```typescript
18249
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18250
+ * const plan = await client.connectors.fullscript.getTreatmentPlan(
18251
+ * 'ci_fs_123',
18252
+ * 'ws_abc123',
18253
+ * 'tp_456',
18254
+ * );
18255
+ * console.log(plan.state, plan.recommendations);
18256
+ * ```
18257
+ */
18258
+ getTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
18259
+ `/connectors/fullscript/treatment-plans/get`,
18260
+ {
18261
+ workspace_id: workspaceId,
18262
+ connector_id: connectorId,
18263
+ treatment_plan_id: treatmentPlanId
18264
+ },
18265
+ options
18266
+ ).then((r) => r.data),
18267
+ /**
18268
+ * Cancel an active treatment plan.
18269
+ *
18270
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18271
+ * @param workspaceId - UUID of the current workspace.
18272
+ * @param treatmentPlanId - The Fullscript treatment plan ID to cancel.
18273
+ * @param options - Optional request options.
18274
+ * @returns The cancelled `FullscriptTreatmentPlan` with updated state.
18275
+ *
18276
+ * @example
18277
+ * ```typescript
18278
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18279
+ * const cancelled = await client.connectors.fullscript.cancelTreatmentPlan(
18280
+ * 'ci_fs_123',
18281
+ * 'ws_abc123',
18282
+ * 'tp_456',
18283
+ * );
18284
+ * console.log(cancelled.state); // "cancelled"
18285
+ * ```
18286
+ */
18287
+ cancelTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
18288
+ `/connectors/fullscript/treatment-plans/cancel`,
18289
+ {
18290
+ workspace_id: workspaceId,
18291
+ connector_id: connectorId,
18292
+ treatment_plan_id: treatmentPlanId
18293
+ },
18294
+ options
18295
+ ).then((r) => r.data),
18296
+ // ── Products ──
18297
+ /**
18298
+ * Search the Fullscript product catalog by keyword query.
18299
+ *
18300
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18301
+ * @param workspaceId - UUID of the current workspace.
18302
+ * @param query - Search keyword (e.g., `"vitamin D"`, `"omega 3"`).
18303
+ * @param options - Optional request options.
18304
+ * @returns An array of matching `FullscriptProduct` records.
18305
+ *
18306
+ * @example
18307
+ * ```typescript
18308
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18309
+ * const products = await client.connectors.fullscript.searchProducts(
18310
+ * 'ci_fs_123',
18311
+ * 'ws_abc123',
18312
+ * 'vitamin D',
18313
+ * );
18314
+ * products.forEach(p => console.log(p.name, p.brand));
18315
+ * ```
18316
+ */
18317
+ searchProducts: async (connectorId, workspaceId, query, options) => rb.rawPost(
18318
+ `/connectors/fullscript/products/search`,
18319
+ {
18320
+ workspace_id: workspaceId,
18321
+ connector_id: connectorId,
18322
+ query
18323
+ },
18324
+ options
18325
+ ).then((r) => r.data),
18326
+ /**
18327
+ * Get full product details from the Fullscript catalog by product ID.
18328
+ *
18329
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18330
+ * @param workspaceId - UUID of the current workspace.
18331
+ * @param productId - The Fullscript product ID.
18332
+ * @param options - Optional request options.
18333
+ * @returns The `FullscriptProduct` with full details.
18334
+ *
18335
+ * @example
18336
+ * ```typescript
18337
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18338
+ * const product = await client.connectors.fullscript.getProduct(
18339
+ * 'ci_fs_123',
18340
+ * 'ws_abc123',
18341
+ * 'prod_789',
18342
+ * );
18343
+ * console.log(product.name, product.brand);
18344
+ * ```
18345
+ */
18346
+ getProduct: async (connectorId, workspaceId, productId, options) => rb.rawPost(
18347
+ `/connectors/fullscript/products/get`,
18348
+ {
18349
+ workspace_id: workspaceId,
18350
+ connector_id: connectorId,
18351
+ product_id: productId
18352
+ },
18353
+ options
18354
+ ).then((r) => r.data),
18355
+ /**
18356
+ * List similar products curated by Fullscript's health professionals.
18357
+ *
18358
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18359
+ * @param workspaceId - UUID of the current workspace.
18360
+ * @param productId - The Fullscript product ID to find similar products for.
18361
+ * @param options - Optional request options.
18362
+ * @returns An array of similar `FullscriptProduct` records.
18363
+ *
18364
+ * @example
18365
+ * ```typescript
18366
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18367
+ * const similar = await client.connectors.fullscript.listSimilarProducts(
18368
+ * 'ci_fs_123',
18369
+ * 'ws_abc123',
18370
+ * 'prod_789',
18371
+ * );
18372
+ * similar.forEach(p => console.log(p.name));
18373
+ * ```
18374
+ */
18375
+ listSimilarProducts: async (connectorId, workspaceId, productId, options) => rb.rawPost(
18376
+ `/connectors/fullscript/products/similar`,
16759
18377
  {
16760
- body: {
16761
- data: {
16762
- type: "connector_instance",
16763
- attributes: {
16764
- connector_id: connectorId,
16765
- workspace_id: workspaceId,
16766
- email
16767
- }
16768
- }
16769
- }
18378
+ workspace_id: workspaceId,
18379
+ connector_id: connectorId,
18380
+ product_id: productId
16770
18381
  },
16771
18382
  options
16772
- ),
18383
+ ).then((r) => r.data),
18384
+ // ── Orders ──
16773
18385
  /**
16774
- * Create a new patient record in Fullscript.
16775
- *
16776
- * Creates the patient in the Fullscript account linked to the connector
16777
- * and returns the resulting patient object including the assigned
16778
- * `fullscript_id`. Use this when a patient does not yet have a Fullscript
16779
- * account (confirmed via `checkPatient`).
18386
+ * List all orders for a patient in Fullscript.
16780
18387
  *
16781
18388
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16782
18389
  * @param workspaceId - UUID of the current workspace.
16783
- * @param attrs - Patient attributes: `first_name`, `last_name`, `email`
16784
- * (all required), and optional `date_of_birth` (ISO 8601 date string).
18390
+ * @param patientId - The Fullscript patient ID.
16785
18391
  * @param options - Optional request options.
16786
- * @returns The newly created `FullscriptPatient`.
18392
+ * @returns An array of `FullscriptOrder` records for the patient.
16787
18393
  *
16788
18394
  * @example
16789
18395
  * ```typescript
16790
18396
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16791
- * const patient = await client.connectors.fullscript.createPatient(
18397
+ * const orders = await client.connectors.fullscript.listPatientOrders(
16792
18398
  * 'ci_fs_123',
16793
18399
  * 'ws_abc123',
16794
- * {
16795
- * first_name: 'Jane',
16796
- * last_name: 'Smith',
16797
- * email: 'jane@example.com',
16798
- * date_of_birth: '1985-04-12',
16799
- * },
18400
+ * 'fs_patient_456',
16800
18401
  * );
16801
- * console.log('Created Fullscript patient:', patient.fullscript_id);
18402
+ * orders.forEach(o => console.log(o.id, o.payment_total));
16802
18403
  * ```
16803
18404
  */
16804
- createPatient: async (connectorId, workspaceId, attrs, options) => rb.execute(
16805
- postConnectorsFullscriptCreatePatient,
18405
+ listPatientOrders: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
18406
+ `/connectors/fullscript/orders/list`,
16806
18407
  {
16807
- body: {
16808
- data: {
16809
- type: "connector_instance",
16810
- attributes: {
16811
- connector_id: connectorId,
16812
- workspace_id: workspaceId,
16813
- ...attrs
16814
- }
16815
- }
16816
- }
18408
+ workspace_id: workspaceId,
18409
+ connector_id: connectorId,
18410
+ patient_id: patientId
16817
18411
  },
16818
18412
  options
16819
- ),
18413
+ ).then((r) => r.data),
16820
18414
  /**
16821
- * Obtain a short-lived embed session grant for the Fullscript prescribing widget.
16822
- *
16823
- * The returned `token` is used to embed the Fullscript prescribing UI for a
16824
- * specific patient within your application. Tokens are valid for 5–15 minutes
16825
- * and are cached server-side for up to 2 minutes to avoid token proliferation
16826
- * on repeated calls.
18415
+ * Get order details from Fullscript by order ID.
16827
18416
  *
16828
18417
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16829
18418
  * @param workspaceId - UUID of the current workspace.
16830
- * @param patientId - The Fullscript patient ID (from `FullscriptPatient.fullscript_id`).
18419
+ * @param orderId - The Fullscript order ID.
16831
18420
  * @param options - Optional request options.
16832
- * @returns A `FullscriptSessionGrant` with `token`, `expires_at`, and `patient_id`.
18421
+ * @returns The `FullscriptOrder` with line items and totals.
16833
18422
  *
16834
18423
  * @example
16835
18424
  * ```typescript
16836
18425
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16837
- * const grant = await client.connectors.fullscript.sessionGrant(
18426
+ * const order = await client.connectors.fullscript.getOrder(
16838
18427
  * 'ci_fs_123',
16839
18428
  * 'ws_abc123',
16840
- * 'fs_patient_456',
18429
+ * 'ord_789',
16841
18430
  * );
16842
- * // Embed: `https://app.fullscript.com/embed?token=${grant.token}`
16843
- * console.log('Token expires:', grant.expires_at);
18431
+ * console.log(order.payment_total, order.line_items);
16844
18432
  * ```
16845
18433
  */
16846
- sessionGrant: async (connectorId, workspaceId, patientId, options) => rb.execute(
16847
- postConnectorsFullscriptSessionGrant,
18434
+ getOrder: async (connectorId, workspaceId, orderId, options) => rb.rawPost(
18435
+ `/connectors/fullscript/orders/get`,
16848
18436
  {
16849
- body: {
16850
- data: {
16851
- type: "connector_instance",
16852
- attributes: {
16853
- connector_id: connectorId,
16854
- workspace_id: workspaceId,
16855
- patient_id: patientId
16856
- }
16857
- }
16858
- }
18437
+ workspace_id: workspaceId,
18438
+ connector_id: connectorId,
18439
+ order_id: orderId
16859
18440
  },
16860
18441
  options
16861
- ),
18442
+ ).then((r) => r.data),
16862
18443
  /**
16863
18444
  * Fullscript-specific OAuth helpers.
16864
18445
  *
@@ -16893,10 +18474,8 @@ function createConnectorsNamespace(rb) {
16893
18474
  body: {
16894
18475
  data: {
16895
18476
  type: "connector_instance",
16896
- attributes: {
16897
- connector_type: "fullscript",
16898
- workspace_id: workspaceId
16899
- }
18477
+ connector_type: "fullscript",
18478
+ workspace_id: workspaceId
16900
18479
  }
16901
18480
  }
16902
18481
  },
@@ -16938,14 +18517,12 @@ function createConnectorsNamespace(rb) {
16938
18517
  body: {
16939
18518
  data: {
16940
18519
  type: "connector_instance",
16941
- attributes: {
16942
- connector_type: "fullscript",
16943
- code,
16944
- state,
16945
- workspace_id: workspaceId,
16946
- ...redirectUri !== void 0 && {
16947
- redirect_uri: redirectUri
16948
- }
18520
+ connector_type: "fullscript",
18521
+ code,
18522
+ state,
18523
+ workspace_id: workspaceId,
18524
+ ...redirectUri !== void 0 && {
18525
+ redirect_uri: redirectUri
16949
18526
  }
16950
18527
  }
16951
18528
  }
@@ -17634,7 +19211,7 @@ function createCrmNamespace(rb) {
17634
19211
  archive: async (id, options) => {
17635
19212
  return rb.execute(
17636
19213
  patchCrmContactsByIdArchive,
17637
- { path: { id } },
19214
+ { path: { id }, body: { data: { type: "crm_contact", id } } },
17638
19215
  options
17639
19216
  );
17640
19217
  },
@@ -19410,7 +20987,7 @@ function createCampaignsNamespace(rb) {
19410
20987
  postEmailMarketingCampaignsByIdCreateFollowup,
19411
20988
  {
19412
20989
  path: { id },
19413
- body: { data: { type: "email_marketing_campaign", attributes } }
20990
+ body: { data: { type: "email_marketing_campaign", ...attributes } }
19414
20991
  },
19415
20992
  options
19416
20993
  );
@@ -19472,7 +21049,7 @@ function createCampaignsNamespace(rb) {
19472
21049
  {
19473
21050
  data: {
19474
21051
  type: "campaign-template",
19475
- attributes: { body_mjml: mjml }
21052
+ body_mjml: mjml
19476
21053
  }
19477
21054
  },
19478
21055
  options
@@ -22450,6 +24027,9 @@ var ConfirmEmailSchema = import_zod2.z.object({
22450
24027
  email: import_zod2.z.string().email(),
22451
24028
  confirmation_token: import_zod2.z.string().min(1)
22452
24029
  });
24030
+ var RefreshTokenSchema = import_zod2.z.object({
24031
+ refresh_token: import_zod2.z.string().min(1)
24032
+ });
22453
24033
  var ResetPasswordWithTokenSchema = import_zod2.z.object({
22454
24034
  token: import_zod2.z.string().min(1),
22455
24035
  password: import_zod2.z.string().min(8),
@@ -22493,6 +24073,30 @@ function createIdentityNamespace(rb, baseUrl) {
22493
24073
  options
22494
24074
  );
22495
24075
  },
24076
+ /**
24077
+ * Exchange a refresh token for a new JWT + refresh token pair.
24078
+ *
24079
+ * The old refresh token is revoked on success (token rotation).
24080
+ * Use the new refresh token for subsequent refresh calls.
24081
+ *
24082
+ * @param refreshToken - The refresh token (srt_ prefix) from login or a previous refresh
24083
+ * @returns New token pair with rotated refresh token
24084
+ *
24085
+ * @example
24086
+ * ```typescript
24087
+ * const { token, refresh_token } = await client.identity.refresh(storedRefreshToken);
24088
+ * // Store the new refresh_token for next refresh
24089
+ * // Use token as the new Bearer token
24090
+ * ```
24091
+ */
24092
+ refresh: async (refreshToken, options) => {
24093
+ RefreshTokenSchema.parse({ refresh_token: refreshToken });
24094
+ return rb.rawPost(
24095
+ "/users/auth/refresh",
24096
+ { refresh_token: refreshToken },
24097
+ options
24098
+ );
24099
+ },
22496
24100
  /**
22497
24101
  * Register a new user account — returns the newly created user.
22498
24102
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
@@ -24135,19 +25739,41 @@ function createPlatformNamespace(rb) {
24135
25739
  *
24136
25740
  * @example
24137
25741
  * ```typescript
24138
- * const client = new GptClient({ apiKey: 'sk_app_...' });
25742
+ * // Using workspace_id shorthand (recommended):
24139
25743
  * const invite = await client.platform.invitations.create({
24140
25744
  * email: 'new.clinician@hospital.org',
24141
25745
  * workspace_id: 'ws_abc123',
24142
25746
  * role: 'member',
24143
25747
  * });
24144
- * console.log('Invitation sent:', invite.id);
25748
+ *
25749
+ * // Using explicit scope_type + scope_id:
25750
+ * const invite2 = await client.platform.invitations.create({
25751
+ * email: 'admin@hospital.org',
25752
+ * scope_type: 'tenant',
25753
+ * scope_id: tenantId,
25754
+ * role: 'admin',
25755
+ * });
24145
25756
  * ```
24146
25757
  */
24147
25758
  create: async (attributes, options) => {
25759
+ const { workspace_id, tenant_id, ...rest } = attributes;
25760
+ let resolved = { ...rest };
25761
+ if (workspace_id && !resolved.scope_type) {
25762
+ resolved = {
25763
+ ...resolved,
25764
+ scope_type: "workspace",
25765
+ scope_id: workspace_id
25766
+ };
25767
+ } else if (tenant_id && !resolved.scope_type) {
25768
+ resolved = {
25769
+ ...resolved,
25770
+ scope_type: "tenant",
25771
+ scope_id: tenant_id
25772
+ };
25773
+ }
24148
25774
  return rb.execute(
24149
25775
  postInvitations,
24150
- { body: { data: { type: "invitation", attributes } } },
25776
+ { body: { data: { type: "invitation", attributes: resolved } } },
24151
25777
  options
24152
25778
  );
24153
25779
  },
@@ -26955,6 +28581,29 @@ function createThreadsNamespace(rb) {
26955
28581
  options
26956
28582
  );
26957
28583
  },
28584
+ /**
28585
+ * Lists only the calling user's threads within their current workspace.
28586
+ *
28587
+ * Unlike {@link list} which returns all threads in the workspace (for admin
28588
+ * visibility), `listMine` scopes results to threads owned by the
28589
+ * authenticated user. This is the recommended method for end-user UIs.
28590
+ *
28591
+ * @param options - Optional pagination and request options.
28592
+ * @returns A promise that resolves to an array of the user's `Thread` objects.
28593
+ *
28594
+ * @example
28595
+ * ```typescript
28596
+ * const myThreads = await client.threads.listMine();
28597
+ * myThreads.forEach(t => console.log(t.attributes.title));
28598
+ * ```
28599
+ */
28600
+ listMine: async (options) => {
28601
+ return rb.execute(
28602
+ getThreadsMine,
28603
+ buildPageQuery(options?.page, options?.pageSize),
28604
+ options
28605
+ );
28606
+ },
26958
28607
  /**
26959
28608
  * Fetches all threads in the workspace by transparently paginating through
26960
28609
  * every page until exhausted.
@@ -27006,7 +28655,7 @@ function createThreadsNamespace(rb) {
27006
28655
  create: async (attributes, options) => {
27007
28656
  return rb.execute(
27008
28657
  postThreads,
27009
- { body: { data: { type: "thread", attributes } } },
28658
+ { body: { data: { type: "chat-thread", attributes } } },
27010
28659
  options
27011
28660
  );
27012
28661
  },
@@ -27032,7 +28681,10 @@ function createThreadsNamespace(rb) {
27032
28681
  update: async (id, attributes, options) => {
27033
28682
  return rb.execute(
27034
28683
  patchThreadsById,
27035
- { path: { id }, body: { data: { id, type: "thread", attributes } } },
28684
+ {
28685
+ path: { id },
28686
+ body: { data: { id, type: "chat-thread", attributes } }
28687
+ },
27036
28688
  options
27037
28689
  );
27038
28690
  },
@@ -27192,7 +28844,7 @@ function createThreadsNamespace(rb) {
27192
28844
  * // Streaming
27193
28845
  * const stream = await client.threads.messages.stream('thr_01HXYZ...', { content: 'Hello!' });
27194
28846
  * for await (const chunk of stream) {
27195
- * process.stdout.write(chunk.delta ?? '');
28847
+ * if (chunk.type === 'token') process.stdout.write(chunk.content ?? '');
27196
28848
  * }
27197
28849
  */
27198
28850
  messages: {
@@ -27254,14 +28906,12 @@ function createThreadsNamespace(rb) {
27254
28906
  path: { id: threadId },
27255
28907
  body: {
27256
28908
  data: {
27257
- type: "thread",
27258
- attributes: {
27259
- content,
27260
- ...rest,
27261
- metadata: mergeWithBrowserContext(
27262
- metadata
27263
- )
27264
- }
28909
+ type: "chat-thread",
28910
+ content,
28911
+ ...rest,
28912
+ metadata: mergeWithBrowserContext(
28913
+ metadata
28914
+ )
27265
28915
  }
27266
28916
  }
27267
28917
  },
@@ -27269,38 +28919,48 @@ function createThreadsNamespace(rb) {
27269
28919
  );
27270
28920
  },
27271
28921
  /**
27272
- * Sends a message to a thread and streams the AI response token-by-token
27273
- * via Server-Sent Events (SSE).
28922
+ * Sends a message to a thread and streams the AI response via Server-Sent Events (SSE).
28923
+ *
28924
+ * For agent-backed threads, the stream includes the full execution lifecycle:
28925
+ * - `token` — incremental LLM output tokens
28926
+ * - `tool_call` — agent is calling a tool (name + arguments)
28927
+ * - `tool_result` — tool execution completed (name + summary)
28928
+ * - `iteration_complete` — LLM loop iteration finished
28929
+ * - `approval_required` — human approval needed for a sensitive tool
28930
+ * - `done` — stream complete, includes metadata with execution_id
28931
+ * - `error` — stream error
27274
28932
  *
27275
- * Returns an `AsyncIterableIterator` that yields `StreamMessageChunk`
27276
- * objects as tokens are generated. Consume with a `for await` loop. The
27277
- * stream closes automatically when the assistant finishes generating its
27278
- * response.
28933
+ * For RAG threads (no agent), only `token`, `done`, and `error` are emitted.
27279
28934
  *
27280
28935
  * SSE security limits: 5-minute idle timeout, 10,000 chunk maximum,
27281
28936
  * 10 MB buffer size limit.
27282
28937
  *
27283
28938
  * @param threadId - The UUID of the thread to stream a message to.
27284
28939
  * @param body - The message payload, including at minimum `content` (string).
27285
- * Additional fields such as `role` or `metadata` are passed through.
27286
28940
  * @param options - Optional request options (e.g. custom headers, abort signal).
27287
28941
  * @param streamOptions - Optional streaming configuration (e.g. chunk timeout).
27288
28942
  * @returns A promise that resolves to an `AsyncIterableIterator<StreamMessageChunk>`.
27289
- * Each yielded chunk contains a `delta` string (the new token text) and
27290
- * optional event metadata.
27291
28943
  *
27292
28944
  * @example
27293
- * const client = new GptClient({ apiKey: 'sk_app_...' });
27294
- *
27295
- * const stream = await client.threads.messages.stream(
27296
- * 'thr_01HXYZ...',
27297
- * { content: 'Summarize the key clauses in this contract.' },
27298
- * );
27299
- *
27300
- * for await (const chunk of stream) {
27301
- * process.stdout.write(chunk.delta ?? '');
28945
+ * ```typescript
28946
+ * const stream = await client.threads.messages.stream(threadId, { content: 'Summarize the contract.' });
28947
+ * for await (const event of stream) {
28948
+ * switch (event.type) {
28949
+ * case 'token':
28950
+ * process.stdout.write(event.content ?? '');
28951
+ * break;
28952
+ * case 'tool_call':
28953
+ * console.log(`Tool: ${event.data.name}`, event.data.arguments);
28954
+ * break;
28955
+ * case 'tool_result':
28956
+ * console.log(`Result: ${event.data.summary}`);
28957
+ * break;
28958
+ * case 'done':
28959
+ * console.log('Complete', event.metadata);
28960
+ * break;
28961
+ * }
27302
28962
  * }
27303
- * console.log(); // newline after streaming completes
28963
+ * ```
27304
28964
  */
27305
28965
  stream: async (threadId, body, options, streamOptions) => {
27306
28966
  const { content, metadata, ...rest } = body;
@@ -27308,14 +28968,12 @@ function createThreadsNamespace(rb) {
27308
28968
  `/threads/${threadId}/messages/stream`,
27309
28969
  {
27310
28970
  data: {
27311
- type: "message",
27312
- attributes: {
27313
- content,
27314
- ...rest,
27315
- metadata: mergeWithBrowserContext(
27316
- metadata
27317
- )
27318
- }
28971
+ type: "chat-message",
28972
+ content,
28973
+ ...rest,
28974
+ metadata: mergeWithBrowserContext(
28975
+ metadata
28976
+ )
27319
28977
  }
27320
28978
  },
27321
28979
  options,
@@ -27393,7 +29051,7 @@ function createThreadsNamespace(rb) {
27393
29051
  postThreadsByIdComplete,
27394
29052
  {
27395
29053
  path: { id: threadId },
27396
- body: { data: { type: "thread", attributes: {} } }
29054
+ body: { data: { type: "chat-thread" } }
27397
29055
  },
27398
29056
  options
27399
29057
  );
@@ -27401,13 +29059,12 @@ function createThreadsNamespace(rb) {
27401
29059
  /**
27402
29060
  * Trigger AI inference on a thread and receive the response via Server-Sent Events.
27403
29061
  *
27404
- * Identical to {@link complete} in behavior but delivers the result as an SSE
27405
- * stream. The stream yields a single `StreamMessageChunk` with `done: true`
27406
- * when the AI response is ready.
29062
+ * For agent-backed threads (when execution bridge is enabled), this streams
29063
+ * the full execution lifecycle including `token`, `tool_call`, `tool_result`,
29064
+ * `iteration_complete`, `approval_required`, `done`, and `error` events.
27407
29065
  *
27408
- * Note: This endpoint delivers the full response as one event (not token-by-token).
27409
- * It gives the frontend a consistent SSE interface for uniform handling of both
27410
- * streaming and non-streaming completions.
29066
+ * For RAG threads or when the bridge is disabled, delivers the full response
29067
+ * as a single `done` event.
27411
29068
  *
27412
29069
  * @param threadId - The UUID of the thread to run AI completion on.
27413
29070
  * @param options - Optional request options (e.g. abort signal).
@@ -27416,11 +29073,19 @@ function createThreadsNamespace(rb) {
27416
29073
  *
27417
29074
  * @example
27418
29075
  * ```typescript
27419
- * const client = new GptClient({ apiKey: 'sk_app_...' });
27420
- *
27421
29076
  * const stream = await client.threads.completeStream('thr_01HXYZ...');
27422
- * for await (const chunk of stream) {
27423
- * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
29077
+ * for await (const event of stream) {
29078
+ * switch (event.type) {
29079
+ * case 'token':
29080
+ * process.stdout.write(event.content ?? '');
29081
+ * break;
29082
+ * case 'tool_call':
29083
+ * console.log(`Tool: ${event.data.name}`);
29084
+ * break;
29085
+ * case 'done':
29086
+ * console.log('Complete', event.metadata);
29087
+ * break;
29088
+ * }
27424
29089
  * }
27425
29090
  * ```
27426
29091
  */
@@ -29668,11 +31333,8 @@ function createSocialNamespace(rb) {
29668
31333
  path: { id },
29669
31334
  body: {
29670
31335
  data: {
29671
- type: "social_campaign",
29672
- attributes: {
29673
- campaign_id: id,
29674
- workspace_id: workspaceId
29675
- }
31336
+ campaign_id: id,
31337
+ workspace_id: workspaceId
29676
31338
  }
29677
31339
  }
29678
31340
  },
@@ -29687,12 +31349,9 @@ function createSocialNamespace(rb) {
29687
31349
  path: { id },
29688
31350
  body: {
29689
31351
  data: {
29690
- type: "social_campaign",
29691
- attributes: {
29692
- campaign_id: id,
29693
- workspace_id: workspaceId,
29694
- social_account_id: socialAccountId
29695
- }
31352
+ campaign_id: id,
31353
+ workspace_id: workspaceId,
31354
+ social_account_id: socialAccountId
29696
31355
  }
29697
31356
  }
29698
31357
  },
@@ -29766,6 +31425,26 @@ function createSocialNamespace(rb) {
29766
31425
  options
29767
31426
  );
29768
31427
  },
31428
+ /**
31429
+ * List trending snapshots within a date range.
31430
+ * @param from - Start date (ISO 8601 string)
31431
+ * @param to - End date (ISO 8601 string)
31432
+ * @returns Array of TrendingSnapshot records in the range
31433
+ * @example
31434
+ * ```typescript
31435
+ * const snapshots = await client.social.trending.listByDateRange(
31436
+ * '2026-03-01T00:00:00Z',
31437
+ * '2026-03-21T23:59:59Z',
31438
+ * );
31439
+ * ```
31440
+ */
31441
+ listByDateRange: async (from, to, options) => {
31442
+ return rb.execute(
31443
+ getSocialTrendingHistoryRange,
31444
+ { query: { from, to } },
31445
+ options
31446
+ );
31447
+ },
29769
31448
  /** Trending snapshot items — individual content pieces within a snapshot. */
29770
31449
  items: {
29771
31450
  /** Get a single trending item by ID. */
@@ -29874,22 +31553,6 @@ function createSocialNamespace(rb) {
29874
31553
  { path: { id } },
29875
31554
  options
29876
31555
  );
29877
- },
29878
- /**
29879
- * Mark a watch as triggered (updates last_triggered_at).
29880
- * @param id - Watch UUID
29881
- */
29882
- markTriggered: async (id, options) => {
29883
- return rb.execute(
29884
- patchSocialTrendingWatchesByIdMarkTriggered,
29885
- {
29886
- path: { id },
29887
- body: {
29888
- data: { type: "trending-watch", id, attributes: {} }
29889
- }
29890
- },
29891
- options
29892
- );
29893
31556
  }
29894
31557
  }
29895
31558
  };
@@ -30319,6 +31982,235 @@ function createPermissionsNamespace(rb) {
30319
31982
  };
30320
31983
  }
30321
31984
 
31985
+ // src/namespaces/channels.ts
31986
+ function mapResponse(raw) {
31987
+ return {
31988
+ channelToken: raw.channel_token,
31989
+ expiresAt: raw.expires_at,
31990
+ channels: raw.channels,
31991
+ workspaceId: raw.workspace_id
31992
+ };
31993
+ }
31994
+ function createChannelsNamespace(rb) {
31995
+ return {
31996
+ /**
31997
+ * Exchange the current bearer token for a scoped channel token.
31998
+ *
31999
+ * The returned token is short-lived (5 minutes) and restricted to the
32000
+ * specified workspace and channel patterns. It cannot be used for REST
32001
+ * API calls.
32002
+ *
32003
+ * @param request - Workspace and channel scope
32004
+ * @param options - Request options (signal, etc.)
32005
+ * @returns Channel token response with token string and expiry
32006
+ *
32007
+ * @example
32008
+ * ```typescript
32009
+ * const { channelToken, expiresAt } = await client.channels.authorize({
32010
+ * workspaceId: "ws-uuid",
32011
+ * channels: ["crm", "scheduling", "clinical"],
32012
+ * });
32013
+ * ```
32014
+ */
32015
+ async authorize(request, options) {
32016
+ const raw = await rb.rawPost(
32017
+ "/channels/token",
32018
+ {
32019
+ workspace_id: request.workspaceId,
32020
+ channels: request.channels
32021
+ },
32022
+ options
32023
+ );
32024
+ return mapResponse(raw);
32025
+ },
32026
+ /**
32027
+ * Create a token manager that automatically refreshes the channel token
32028
+ * before it expires. Use with Phoenix.js Socket:
32029
+ *
32030
+ * ```typescript
32031
+ * const manager = await client.channels.createTokenManager({
32032
+ * workspaceId: "ws-uuid",
32033
+ * channels: ["chat_thread"],
32034
+ * });
32035
+ *
32036
+ * const socket = new Socket(socketUrl, {
32037
+ * params: () => ({ token: manager.getToken() }),
32038
+ * });
32039
+ * socket.connect();
32040
+ *
32041
+ * // On cleanup:
32042
+ * manager.destroy();
32043
+ * socket.disconnect();
32044
+ * ```
32045
+ *
32046
+ * @param options - Workspace, channels, and optional refresh buffer
32047
+ * @returns A SocketManager with getToken(), refresh(), and destroy()
32048
+ */
32049
+ async createTokenManager(options) {
32050
+ const refreshBuffer = options.refreshBufferMs ?? 6e4;
32051
+ let currentToken = "";
32052
+ let refreshTimer = null;
32053
+ let destroyed = false;
32054
+ const fetchToken = async () => {
32055
+ const raw = await rb.rawPost(
32056
+ "/channels/token",
32057
+ {
32058
+ workspace_id: options.workspaceId,
32059
+ channels: options.channels
32060
+ }
32061
+ );
32062
+ currentToken = raw.channel_token;
32063
+ if (!destroyed) {
32064
+ const expiresAt = new Date(raw.expires_at).getTime();
32065
+ const now = Date.now();
32066
+ const delay = Math.max(expiresAt - now - refreshBuffer, 1e3);
32067
+ if (refreshTimer) clearTimeout(refreshTimer);
32068
+ refreshTimer = setTimeout(() => {
32069
+ fetchToken().catch((err) => {
32070
+ console.warn("[gpt-platform] Channel token refresh failed:", err);
32071
+ if (options.onAuthError) {
32072
+ options.onAuthError(
32073
+ err instanceof Error ? err : new Error(String(err))
32074
+ );
32075
+ }
32076
+ });
32077
+ }, delay);
32078
+ }
32079
+ return currentToken;
32080
+ };
32081
+ await fetchToken();
32082
+ return {
32083
+ getToken: () => currentToken,
32084
+ refresh: fetchToken,
32085
+ destroy: () => {
32086
+ destroyed = true;
32087
+ if (refreshTimer) {
32088
+ clearTimeout(refreshTimer);
32089
+ refreshTimer = null;
32090
+ }
32091
+ }
32092
+ };
32093
+ }
32094
+ };
32095
+ }
32096
+
32097
+ // src/namespaces/imports.ts
32098
+ function createImportsNamespace(rb) {
32099
+ return {
32100
+ /**
32101
+ * List available import adapter types for the current application.
32102
+ * @returns Array of adapter metadata objects
32103
+ * @example
32104
+ * const adapters = await sdk.imports.listAdapters();
32105
+ * // [{ key: "clinical:goal", display_name: "Clinical Goals", ... }]
32106
+ */
32107
+ listAdapters: async (options) => rb.rawGet(`/imports/adapters`, options).then((r) => r.data),
32108
+ /**
32109
+ * Submit a JSON batch import.
32110
+ * @param params - adapter key, workspace_id, and rows array
32111
+ * @returns Import job with id and initial status
32112
+ * @example
32113
+ * const result = await sdk.imports.batch({
32114
+ * adapter: "clinical:goal",
32115
+ * workspace_id: "ws_123",
32116
+ * rows: [{ contact_id: "...", title: "Increase water intake", goal_type: "hydration" }]
32117
+ * });
32118
+ */
32119
+ batch: async (params, options) => rb.rawPost(
32120
+ `/imports/batch`,
32121
+ {
32122
+ adapter_key: params.adapter,
32123
+ workspace_id: params.workspace_id,
32124
+ rows: params.rows,
32125
+ metadata: params.metadata
32126
+ },
32127
+ options
32128
+ ),
32129
+ /**
32130
+ * Upload a CSV file for import.
32131
+ * @param file - CSV file (File or Blob)
32132
+ * @param params - adapter key and workspace_id
32133
+ * @returns Import job with id and initial status
32134
+ * @example
32135
+ * const result = await sdk.imports.upload(csvFile, {
32136
+ * adapter: "clinical:patient_bundle",
32137
+ * workspace_id: "ws_123"
32138
+ * });
32139
+ */
32140
+ upload: async (file, params, options) => {
32141
+ const formData = new FormData();
32142
+ formData.append("file", file);
32143
+ formData.append("adapter_key", params.adapter);
32144
+ formData.append("workspace_id", params.workspace_id);
32145
+ if (params.column_mapping)
32146
+ formData.append(
32147
+ "column_mapping",
32148
+ JSON.stringify(params.column_mapping)
32149
+ );
32150
+ if (params.metadata)
32151
+ formData.append("metadata", JSON.stringify(params.metadata));
32152
+ return rb.rawPostMultipart(`/imports/upload`, formData, options);
32153
+ },
32154
+ /**
32155
+ * List imports for a workspace with optional filters.
32156
+ * @param params - workspace_id required, adapter and status optional
32157
+ * @returns Paginated list of imports
32158
+ * @example
32159
+ * const imports = await sdk.imports.list({ workspace_id: "ws_123", adapter: "crm:contact" });
32160
+ */
32161
+ list: async (params, options) => rb.rawGet(
32162
+ `/imports?workspace_id=${params.workspace_id}${params.adapter ? `&adapter_key=${params.adapter}` : ""}${params.status ? `&status=${params.status}` : ""}${params.offset !== void 0 ? `&offset=${params.offset}` : ""}${params.limit !== void 0 ? `&limit=${params.limit}` : ""}`,
32163
+ options
32164
+ ),
32165
+ /**
32166
+ * Get a single import by ID.
32167
+ * @param id - Import UUID
32168
+ * @returns Full import record including error_report
32169
+ * @example
32170
+ * const imp = await sdk.imports.get("uuid-here");
32171
+ */
32172
+ get: async (id, options) => rb.rawGet(`/imports/${id}`, options).then((r) => r.data),
32173
+ /**
32174
+ * Get per-row outcomes for a chunked import.
32175
+ * @param importId - Import UUID
32176
+ * @param params - Pagination options
32177
+ * @returns Paginated list of row outcomes
32178
+ * @example
32179
+ * const rows = await sdk.imports.rows("uuid-here", { offset: 0, limit: 50 });
32180
+ */
32181
+ rows: async (importId, params, options) => rb.rawGet(
32182
+ `/imports/${importId}/rows${params?.offset !== void 0 ? `?offset=${params.offset}` : ""}${params?.limit !== void 0 ? `${params?.offset !== void 0 ? "&" : "?"}limit=${params.limit}` : ""}`,
32183
+ options
32184
+ ),
32185
+ /**
32186
+ * Confirm a validated import for commit.
32187
+ * @param id - Import UUID
32188
+ * @param params - workspace_id for authorization
32189
+ * @returns Updated import with status "committing"
32190
+ * @example
32191
+ * await sdk.imports.confirm("uuid-here", { workspace_id: "ws_123" });
32192
+ */
32193
+ confirm: async (id, params, options) => rb.rawPost(
32194
+ `/imports/${id}/confirm`,
32195
+ params,
32196
+ options
32197
+ ),
32198
+ /**
32199
+ * Cancel a validated import.
32200
+ * @param id - Import UUID
32201
+ * @param params - workspace_id for authorization
32202
+ * @returns Updated import with status "cancelled"
32203
+ * @example
32204
+ * await sdk.imports.cancel("uuid-here", { workspace_id: "ws_123" });
32205
+ */
32206
+ cancel: async (id, params, options) => rb.rawPost(
32207
+ `/imports/${id}/cancel`,
32208
+ params,
32209
+ options
32210
+ )
32211
+ };
32212
+ }
32213
+
30322
32214
  // src/streaming.ts
30323
32215
  var DEFAULT_STREAM_TIMEOUT = 3e5;
30324
32216
  var DEFAULT_MAX_CHUNKS = 1e4;
@@ -30409,10 +32301,16 @@ async function* streamMessage(response, options = {}) {
30409
32301
  async function collectStreamedMessage(stream) {
30410
32302
  let fullMessage = "";
30411
32303
  for await (const chunk of stream) {
30412
- if (chunk.type === "content" && chunk.content) {
32304
+ if ((chunk.type === "token" || chunk.type === "content") && "content" in chunk && chunk.content) {
30413
32305
  fullMessage += chunk.content;
30414
32306
  } else if (chunk.type === "error") {
30415
- throw new ServerError(chunk.error || "Stream error");
32307
+ const errorMsg = "error" in chunk ? chunk.error : "content" in chunk ? chunk.content : "Stream error";
32308
+ throw new ServerError(errorMsg || "Stream error");
32309
+ } else if (chunk.type === "done") {
32310
+ if ("content" in chunk && chunk.content) {
32311
+ fullMessage = chunk.content;
32312
+ }
32313
+ break;
30416
32314
  }
30417
32315
  }
30418
32316
  return fullMessage;
@@ -30800,6 +32698,8 @@ var GptClient = class extends BaseClient {
30800
32698
  this.roles = createRolesNamespace(rb);
30801
32699
  this.permissions = createPermissionsNamespace(rb);
30802
32700
  this.memory = createMemoryNamespace(rb);
32701
+ this.channels = createChannelsNamespace(rb);
32702
+ this.imports = createImportsNamespace(rb);
30803
32703
  }
30804
32704
  /**
30805
32705
  * Subscribe to SDK lifecycle events.
@@ -31032,6 +32932,7 @@ var Webhooks = class _Webhooks {
31032
32932
  buildHeaders,
31033
32933
  buildUserAgent,
31034
32934
  collectStreamedMessage,
32935
+ createImportsNamespace,
31035
32936
  handleApiError,
31036
32937
  isBrowserEnvironment,
31037
32938
  isSecureUrl,