@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.mjs CHANGED
@@ -1269,8 +1269,8 @@ function buildUserAgent(sdkVersion, appInfo) {
1269
1269
  }
1270
1270
 
1271
1271
  // src/version.ts
1272
- var SDK_VERSION = "0.8.4";
1273
- var DEFAULT_API_VERSION = "2026-03-11";
1272
+ var SDK_VERSION = "0.9.0";
1273
+ var DEFAULT_API_VERSION = "2026-03-21";
1274
1274
 
1275
1275
  // src/base-client.ts
1276
1276
  function generateUUID() {
@@ -1579,7 +1579,7 @@ function createAuditNamespace(rb) {
1579
1579
  * Fetch a paginated, time-sorted activity feed scoped to a tenant.
1580
1580
  *
1581
1581
  * Optionally filter by workspace, action type, actor, or date range.
1582
- * Results are sorted by `inserted_at` descending (most recent first).
1582
+ * Results are sorted by `created_at` descending (most recent first).
1583
1583
  *
1584
1584
  * @param params - Feed parameters. `tenantId` is required.
1585
1585
  * @param options - Optional request options.
@@ -1690,6 +1690,11 @@ var getSocialTrendingWatchesWorkspaceByWorkspaceId = (options) => (options.clien
1690
1690
  url: "/social/trending/watches/workspace/{workspace_id}",
1691
1691
  ...options
1692
1692
  });
1693
+ var getSocialTrendingHistoryRange = (options) => (options.client ?? client).get({
1694
+ security: [{ scheme: "bearer", type: "http" }],
1695
+ url: "/social/trending/history/range",
1696
+ ...options
1697
+ });
1693
1698
  var getAgentDeploymentsById = (options) => (options.client ?? client).get({
1694
1699
  security: [{ scheme: "bearer", type: "http" }],
1695
1700
  url: "/agent-deployments/{id}",
@@ -1770,6 +1775,15 @@ var postRiskAssessments = (options) => (options.client ?? client).post({
1770
1775
  ...options.headers
1771
1776
  }
1772
1777
  });
1778
+ var patchClinicalClientResourceAssignmentsByIdArchive = (options) => (options.client ?? client).patch({
1779
+ security: [{ scheme: "bearer", type: "http" }],
1780
+ url: "/clinical/client-resource-assignments/{id}/archive",
1781
+ ...options,
1782
+ headers: {
1783
+ "Content-Type": "application/vnd.api+json",
1784
+ ...options.headers
1785
+ }
1786
+ });
1773
1787
  var postCatalogTaxonomyNodes = (options) => (options.client ?? client).post({
1774
1788
  security: [{ scheme: "bearer", type: "http" }],
1775
1789
  url: "/catalog/taxonomy-nodes",
@@ -1874,11 +1888,6 @@ var getClinicalNotesByNoteIdVersionsById = (options) => (options.client ?? clien
1874
1888
  url: "/clinical/notes/{note_id}/versions/{id}",
1875
1889
  ...options
1876
1890
  });
1877
- var deleteClinicalMealPlansById = (options) => (options.client ?? client).delete({
1878
- security: [{ scheme: "bearer", type: "http" }],
1879
- url: "/clinical/meal-plans/{id}",
1880
- ...options
1881
- });
1882
1891
  var getClinicalMealPlansById = (options) => (options.client ?? client).get({
1883
1892
  security: [{ scheme: "bearer", type: "http" }],
1884
1893
  url: "/clinical/meal-plans/{id}",
@@ -1940,6 +1949,11 @@ var getApplicationsCurrent = (options) => (options.client ?? client).get({
1940
1949
  url: "/applications/current",
1941
1950
  ...options
1942
1951
  });
1952
+ var getClinicalPracticeResourcesArchived = (options) => (options.client ?? client).get({
1953
+ security: [{ scheme: "bearer", type: "http" }],
1954
+ url: "/clinical/practice-resources/archived",
1955
+ ...options
1956
+ });
1943
1957
  var patchTenantsByIdConvertToOrg = (options) => (options.client ?? client).patch({
1944
1958
  security: [{ scheme: "bearer", type: "http" }],
1945
1959
  url: "/tenants/{id}/convert-to-org",
@@ -1949,6 +1963,15 @@ var patchTenantsByIdConvertToOrg = (options) => (options.client ?? client).patch
1949
1963
  ...options.headers
1950
1964
  }
1951
1965
  });
1966
+ var patchClinicalHealthMetricsByIdRestore = (options) => (options.client ?? client).patch({
1967
+ security: [{ scheme: "bearer", type: "http" }],
1968
+ url: "/clinical/health-metrics/{id}/restore",
1969
+ ...options,
1970
+ headers: {
1971
+ "Content-Type": "application/vnd.api+json",
1972
+ ...options.headers
1973
+ }
1974
+ });
1952
1975
  var getBrandIdentitiesByTenantByTenantId = (options) => (options.client ?? client).get({
1953
1976
  security: [{ scheme: "bearer", type: "http" }],
1954
1977
  url: "/brand-identities/by-tenant/{tenant_id}",
@@ -2067,6 +2090,15 @@ var getCrawlerResults = (options) => (options.client ?? client).get({
2067
2090
  url: "/crawler/results",
2068
2091
  ...options
2069
2092
  });
2093
+ var patchClinicalNotesByIdArchive = (options) => (options.client ?? client).patch({
2094
+ security: [{ scheme: "bearer", type: "http" }],
2095
+ url: "/clinical/notes/{id}/archive",
2096
+ ...options,
2097
+ headers: {
2098
+ "Content-Type": "application/vnd.api+json",
2099
+ ...options.headers
2100
+ }
2101
+ });
2070
2102
  var getCrmExportsById = (options) => (options.client ?? client).get({
2071
2103
  security: [{ scheme: "bearer", type: "http" }],
2072
2104
  url: "/crm/exports/{id}",
@@ -2086,11 +2118,6 @@ var postBusinessAssociateAgreements = (options) => (options.client ?? client).po
2086
2118
  ...options.headers
2087
2119
  }
2088
2120
  });
2089
- var deleteClinicalPracticeResourcesById = (options) => (options.client ?? client).delete({
2090
- security: [{ scheme: "bearer", type: "http" }],
2091
- url: "/clinical/practice-resources/{id}",
2092
- ...options
2093
- });
2094
2121
  var getClinicalPracticeResourcesById = (options) => (options.client ?? client).get({
2095
2122
  security: [{ scheme: "bearer", type: "http" }],
2096
2123
  url: "/clinical/practice-resources/{id}",
@@ -2232,10 +2259,14 @@ var postClinicalNotes = (options) => (options.client ?? client).post({
2232
2259
  ...options.headers
2233
2260
  }
2234
2261
  });
2235
- var deleteClinicalClientGoalsById = (options) => (options.client ?? client).delete({
2262
+ var patchClinicalPracticeToolsCatalogByIdRestore = (options) => (options.client ?? client).patch({
2236
2263
  security: [{ scheme: "bearer", type: "http" }],
2237
- url: "/clinical/client-goals/{id}",
2238
- ...options
2264
+ url: "/clinical/practice-tools/catalog/{id}/restore",
2265
+ ...options,
2266
+ headers: {
2267
+ "Content-Type": "application/vnd.api+json",
2268
+ ...options.headers
2269
+ }
2239
2270
  });
2240
2271
  var getClinicalClientGoalsById = (options) => (options.client ?? client).get({
2241
2272
  security: [{ scheme: "bearer", type: "http" }],
@@ -2251,6 +2282,11 @@ var patchClinicalClientGoalsById = (options) => (options.client ?? client).patch
2251
2282
  ...options.headers
2252
2283
  }
2253
2284
  });
2285
+ var deleteClinicalGoalTemplatesByIdPermanent = (options) => (options.client ?? client).delete({
2286
+ security: [{ scheme: "bearer", type: "http" }],
2287
+ url: "/clinical/goal-templates/{id}/permanent",
2288
+ ...options
2289
+ });
2254
2290
  var postAgentsImport = (options) => (options.client ?? client).post({
2255
2291
  security: [{ scheme: "bearer", type: "http" }],
2256
2292
  url: "/agents/import",
@@ -2269,6 +2305,16 @@ var postUsersAuthPasswordResetRequest = (options) => (options.client ?? client).
2269
2305
  ...options.headers
2270
2306
  }
2271
2307
  });
2308
+ var getClinicalClientSupplementsArchived = (options) => (options.client ?? client).get({
2309
+ security: [{ scheme: "bearer", type: "http" }],
2310
+ url: "/clinical/client-supplements/archived",
2311
+ ...options
2312
+ });
2313
+ var getClinicalClientResourceAssignmentsArchived = (options) => (options.client ?? client).get({
2314
+ security: [{ scheme: "bearer", type: "http" }],
2315
+ url: "/clinical/client-resource-assignments/archived",
2316
+ ...options
2317
+ });
2272
2318
  var patchPolicyReviewSchedulesByIdMarkOverdue = (options) => (options.client ?? client).patch({
2273
2319
  security: [{ scheme: "bearer", type: "http" }],
2274
2320
  url: "/policy-review-schedules/{id}/mark-overdue",
@@ -2283,6 +2329,11 @@ var getExtractionBatchesWorkspaceByWorkspaceId = (options) => (options.client ??
2283
2329
  url: "/extraction/batches/workspace/{workspace_id}",
2284
2330
  ...options
2285
2331
  });
2332
+ var deleteClinicalPracticeResourcesByIdPermanent = (options) => (options.client ?? client).delete({
2333
+ security: [{ scheme: "bearer", type: "http" }],
2334
+ url: "/clinical/practice-resources/{id}/permanent",
2335
+ ...options
2336
+ });
2286
2337
  var patchUserProfilesByIdAcceptTos = (options) => (options.client ?? client).patch({
2287
2338
  security: [{ scheme: "bearer", type: "http" }],
2288
2339
  url: "/user-profiles/{id}/accept-tos",
@@ -2451,6 +2502,15 @@ var patchWorkspacesByIdAllocate = (options) => (options.client ?? client).patch(
2451
2502
  ...options.headers
2452
2503
  }
2453
2504
  });
2505
+ var patchClinicalPracticeResourcesCatalogByIdRestore = (options) => (options.client ?? client).patch({
2506
+ security: [{ scheme: "bearer", type: "http" }],
2507
+ url: "/clinical/practice-resources/catalog/{id}/restore",
2508
+ ...options,
2509
+ headers: {
2510
+ "Content-Type": "application/vnd.api+json",
2511
+ ...options.headers
2512
+ }
2513
+ });
2454
2514
  var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2455
2515
  security: [{ scheme: "bearer", type: "http" }],
2456
2516
  url: "/invitations/{id}/revoke",
@@ -2515,6 +2575,15 @@ var getMemoryDocumentSections = (options) => (options.client ?? client).get({
2515
2575
  url: "/memory/document-sections",
2516
2576
  ...options
2517
2577
  });
2578
+ var patchClinicalPracticeToolsCatalogByIdArchive = (options) => (options.client ?? client).patch({
2579
+ security: [{ scheme: "bearer", type: "http" }],
2580
+ url: "/clinical/practice-tools/catalog/{id}/archive",
2581
+ ...options,
2582
+ headers: {
2583
+ "Content-Type": "application/vnd.api+json",
2584
+ ...options.headers
2585
+ }
2586
+ });
2518
2587
  var postConnectorsCredentialsByIdRefresh = (options) => (options.client ?? client).post({
2519
2588
  security: [{ scheme: "bearer", type: "http" }],
2520
2589
  url: "/connectors/credentials/{id}/refresh",
@@ -2617,6 +2686,15 @@ var postAgentsByIdRestoreVersion = (options) => (options.client ?? client).post(
2617
2686
  ...options.headers
2618
2687
  }
2619
2688
  });
2689
+ var patchClinicalGoalTemplatesCatalogByIdArchive = (options) => (options.client ?? client).patch({
2690
+ security: [{ scheme: "bearer", type: "http" }],
2691
+ url: "/clinical/goal-templates/catalog/{id}/archive",
2692
+ ...options,
2693
+ headers: {
2694
+ "Content-Type": "application/vnd.api+json",
2695
+ ...options.headers
2696
+ }
2697
+ });
2620
2698
  var getWorkspaceAgentConfigsById = (options) => (options.client ?? client).get({
2621
2699
  security: [{ scheme: "bearer", type: "http" }],
2622
2700
  url: "/workspace-agent-configs/{id}",
@@ -2631,6 +2709,15 @@ var patchWorkspaceAgentConfigsById = (options) => (options.client ?? client).pat
2631
2709
  ...options.headers
2632
2710
  }
2633
2711
  });
2712
+ var patchClinicalPracticeResourcesByIdArchive = (options) => (options.client ?? client).patch({
2713
+ security: [{ scheme: "bearer", type: "http" }],
2714
+ url: "/clinical/practice-resources/{id}/archive",
2715
+ ...options,
2716
+ headers: {
2717
+ "Content-Type": "application/vnd.api+json",
2718
+ ...options.headers
2719
+ }
2720
+ });
2634
2721
  var patchWalletAutoTopUp = (options) => (options.client ?? client).patch({
2635
2722
  security: [{ scheme: "bearer", type: "http" }],
2636
2723
  url: "/wallet/auto-top-up",
@@ -2935,6 +3022,15 @@ var getStorageFiles = (options) => (options.client ?? client).get({
2935
3022
  url: "/storage-files",
2936
3023
  ...options
2937
3024
  });
3025
+ var patchClinicalNotesByIdRestore = (options) => (options.client ?? client).patch({
3026
+ security: [{ scheme: "bearer", type: "http" }],
3027
+ url: "/clinical/notes/{id}/restore",
3028
+ ...options,
3029
+ headers: {
3030
+ "Content-Type": "application/vnd.api+json",
3031
+ ...options.headers
3032
+ }
3033
+ });
2938
3034
  var getSocialAccountsPlatformByPlatform = (options) => (options.client ?? client).get({
2939
3035
  security: [{ scheme: "bearer", type: "http" }],
2940
3036
  url: "/social/accounts/platform/{platform}",
@@ -3047,11 +3143,6 @@ var patchAmendmentRequestsByIdReview = (options) => (options.client ?? client).p
3047
3143
  ...options.headers
3048
3144
  }
3049
3145
  });
3050
- var deleteClinicalPracticeToolsById = (options) => (options.client ?? client).delete({
3051
- security: [{ scheme: "bearer", type: "http" }],
3052
- url: "/clinical/practice-tools/{id}",
3053
- ...options
3054
- });
3055
3146
  var getClinicalPracticeToolsById = (options) => (options.client ?? client).get({
3056
3147
  security: [{ scheme: "bearer", type: "http" }],
3057
3148
  url: "/clinical/practice-tools/{id}",
@@ -3160,11 +3251,29 @@ var patchRiskAssessmentsByIdStatus = (options) => (options.client ?? client).pat
3160
3251
  ...options.headers
3161
3252
  }
3162
3253
  });
3254
+ var patchClinicalClientGoalsByIdRestore = (options) => (options.client ?? client).patch({
3255
+ security: [{ scheme: "bearer", type: "http" }],
3256
+ url: "/clinical/client-goals/{id}/restore",
3257
+ ...options,
3258
+ headers: {
3259
+ "Content-Type": "application/vnd.api+json",
3260
+ ...options.headers
3261
+ }
3262
+ });
3163
3263
  var getPermissionsMeta = (options) => (options.client ?? client).get({
3164
3264
  security: [{ scheme: "bearer", type: "http" }],
3165
3265
  url: "/permissions/meta",
3166
3266
  ...options
3167
3267
  });
3268
+ var patchClinicalMealPlansByIdArchive = (options) => (options.client ?? client).patch({
3269
+ security: [{ scheme: "bearer", type: "http" }],
3270
+ url: "/clinical/meal-plans/{id}/archive",
3271
+ ...options,
3272
+ headers: {
3273
+ "Content-Type": "application/vnd.api+json",
3274
+ ...options.headers
3275
+ }
3276
+ });
3168
3277
  var getEmailMarketingGeneratedEmailsById = (options) => (options.client ?? client).get({
3169
3278
  security: [{ scheme: "bearer", type: "http" }],
3170
3279
  url: "/email-marketing/generated-emails/{id}",
@@ -3255,6 +3364,15 @@ var patchCatalogTaxonomiesById = (options) => (options.client ?? client).patch({
3255
3364
  ...options.headers
3256
3365
  }
3257
3366
  });
3367
+ var patchClinicalPracticeToolsByIdArchive = (options) => (options.client ?? client).patch({
3368
+ security: [{ scheme: "bearer", type: "http" }],
3369
+ url: "/clinical/practice-tools/{id}/archive",
3370
+ ...options,
3371
+ headers: {
3372
+ "Content-Type": "application/vnd.api+json",
3373
+ ...options.headers
3374
+ }
3375
+ });
3258
3376
  var deleteSocialTrendingWatchesById = (options) => (options.client ?? client).delete({
3259
3377
  security: [{ scheme: "bearer", type: "http" }],
3260
3378
  url: "/social/trending/watches/{id}",
@@ -3345,11 +3463,6 @@ var postContentGenerateHashtags = (options) => (options.client ?? client).post({
3345
3463
  ...options.headers
3346
3464
  }
3347
3465
  });
3348
- var deleteClinicalNotesById = (options) => (options.client ?? client).delete({
3349
- security: [{ scheme: "bearer", type: "http" }],
3350
- url: "/clinical/notes/{id}",
3351
- ...options
3352
- });
3353
3466
  var getClinicalNotesById = (options) => (options.client ?? client).get({
3354
3467
  security: [{ scheme: "bearer", type: "http" }],
3355
3468
  url: "/clinical/notes/{id}",
@@ -3414,6 +3527,15 @@ var patchBusinessAssociateAgreementsByIdTerminate = (options) => (options.client
3414
3527
  ...options.headers
3415
3528
  }
3416
3529
  });
3530
+ var patchClinicalPracticeResourcesByIdRestore = (options) => (options.client ?? client).patch({
3531
+ security: [{ scheme: "bearer", type: "http" }],
3532
+ url: "/clinical/practice-resources/{id}/restore",
3533
+ ...options,
3534
+ headers: {
3535
+ "Content-Type": "application/vnd.api+json",
3536
+ ...options.headers
3537
+ }
3538
+ });
3417
3539
  var postConnectorsByIdEdamamRecipesGet = (options) => (options.client ?? client).post({
3418
3540
  security: [{ scheme: "bearer", type: "http" }],
3419
3541
  url: "/connectors/{id}/edamam/recipes/get",
@@ -3503,6 +3625,15 @@ var patchExtractionResultsById = (options) => (options.client ?? client).patch({
3503
3625
  ...options.headers
3504
3626
  }
3505
3627
  });
3628
+ var postFeatureUsagesIncrement = (options) => (options.client ?? client).post({
3629
+ security: [{ scheme: "bearer", type: "http" }],
3630
+ url: "/feature-usages/increment",
3631
+ ...options,
3632
+ headers: {
3633
+ "Content-Type": "application/vnd.api+json",
3634
+ ...options.headers
3635
+ }
3636
+ });
3506
3637
  var postAgentsByIdValidate = (options) => (options.client ?? client).post({
3507
3638
  security: [{ scheme: "bearer", type: "http" }],
3508
3639
  url: "/agents/{id}/validate",
@@ -3517,6 +3648,11 @@ var getConnectorsCredentials = (options) => (options.client ?? client).get({
3517
3648
  url: "/connectors/credentials",
3518
3649
  ...options
3519
3650
  });
3651
+ var deleteClinicalMealPlansByIdPermanent = (options) => (options.client ?? client).delete({
3652
+ security: [{ scheme: "bearer", type: "http" }],
3653
+ url: "/clinical/meal-plans/{id}/permanent",
3654
+ ...options
3655
+ });
3520
3656
  var getAgentsByIdSchemaVersions = (options) => (options.client ?? client).get({
3521
3657
  security: [{ scheme: "bearer", type: "http" }],
3522
3658
  url: "/agents/{id}/schema-versions",
@@ -3639,6 +3775,16 @@ var getSchedulingBookingsById = (options) => (options.client ?? client).get({
3639
3775
  url: "/scheduling/bookings/{id}",
3640
3776
  ...options
3641
3777
  });
3778
+ var deleteClinicalClientGoalsByIdPermanent = (options) => (options.client ?? client).delete({
3779
+ security: [{ scheme: "bearer", type: "http" }],
3780
+ url: "/clinical/client-goals/{id}/permanent",
3781
+ ...options
3782
+ });
3783
+ var deleteClinicalGoalTemplatesCatalogByIdPermanent = (options) => (options.client ?? client).delete({
3784
+ security: [{ scheme: "bearer", type: "http" }],
3785
+ url: "/clinical/goal-templates/catalog/{id}/permanent",
3786
+ ...options
3787
+ });
3642
3788
  var patchVoiceSessionsByIdStop = (options) => (options.client ?? client).patch({
3643
3789
  security: [{ scheme: "bearer", type: "http" }],
3644
3790
  url: "/voice/sessions/{id}/stop",
@@ -3662,6 +3808,11 @@ var patchSocialPostsByIdCancel = (options) => (options.client ?? client).patch({
3662
3808
  ...options.headers
3663
3809
  }
3664
3810
  });
3811
+ var getClinicalGoalTemplatesCatalogArchived = (options) => (options.client ?? client).get({
3812
+ security: [{ scheme: "bearer", type: "http" }],
3813
+ url: "/clinical/goal-templates/catalog/archived",
3814
+ ...options
3815
+ });
3665
3816
  var patchSocialCampaignsByIdSchedule = (options) => (options.client ?? client).patch({
3666
3817
  security: [{ scheme: "bearer", type: "http" }],
3667
3818
  url: "/social/campaigns/{id}/schedule",
@@ -3717,6 +3868,15 @@ var patchEmailMarketingSenderProfilesByIdSetDefault = (options) => (options.clie
3717
3868
  ...options.headers
3718
3869
  }
3719
3870
  });
3871
+ var patchClinicalClientResourceAssignmentsByIdRestore = (options) => (options.client ?? client).patch({
3872
+ security: [{ scheme: "bearer", type: "http" }],
3873
+ url: "/clinical/client-resource-assignments/{id}/restore",
3874
+ ...options,
3875
+ headers: {
3876
+ "Content-Type": "application/vnd.api+json",
3877
+ ...options.headers
3878
+ }
3879
+ });
3720
3880
  var deleteSocialPostsById = (options) => (options.client ?? client).delete({
3721
3881
  security: [{ scheme: "bearer", type: "http" }],
3722
3882
  url: "/social/posts/{id}",
@@ -3766,6 +3926,15 @@ var getConsentRecordsById = (options) => (options.client ?? client).get({
3766
3926
  url: "/consent-records/{id}",
3767
3927
  ...options
3768
3928
  });
3929
+ var patchClinicalHealthMetricsByIdArchive = (options) => (options.client ?? client).patch({
3930
+ security: [{ scheme: "bearer", type: "http" }],
3931
+ url: "/clinical/health-metrics/{id}/archive",
3932
+ ...options,
3933
+ headers: {
3934
+ "Content-Type": "application/vnd.api+json",
3935
+ ...options.headers
3936
+ }
3937
+ });
3769
3938
  var getCrmExportsWorkspaceByWorkspaceId = (options) => (options.client ?? client).get({
3770
3939
  security: [{ scheme: "bearer", type: "http" }],
3771
3940
  url: "/crm/exports/workspace/{workspace_id}",
@@ -3975,6 +4144,11 @@ var getSocialPostsAccountBySocialAccountId = (options) => (options.client ?? cli
3975
4144
  url: "/social/posts/account/{social_account_id}",
3976
4145
  ...options
3977
4146
  });
4147
+ var deleteClinicalNotesByIdPermanent = (options) => (options.client ?? client).delete({
4148
+ security: [{ scheme: "bearer", type: "http" }],
4149
+ url: "/clinical/notes/{id}/permanent",
4150
+ ...options
4151
+ });
3978
4152
  var postConnectorsByIdEdamamRecipesSearch = (options) => (options.client ?? client).post({
3979
4153
  security: [{ scheme: "bearer", type: "http" }],
3980
4154
  url: "/connectors/{id}/edamam/recipes/search",
@@ -3989,11 +4163,6 @@ var getCrmPipelinesWorkspaceByWorkspaceId = (options) => (options.client ?? clie
3989
4163
  url: "/crm/pipelines/workspace/{workspace_id}",
3990
4164
  ...options
3991
4165
  });
3992
- var deleteClinicalClientResourceAssignmentsById = (options) => (options.client ?? client).delete({
3993
- security: [{ scheme: "bearer", type: "http" }],
3994
- url: "/clinical/client-resource-assignments/{id}",
3995
- ...options
3996
- });
3997
4166
  var getClinicalClientResourceAssignmentsById = (options) => (options.client ?? client).get({
3998
4167
  security: [{ scheme: "bearer", type: "http" }],
3999
4168
  url: "/clinical/client-resource-assignments/{id}",
@@ -4017,6 +4186,11 @@ var patchExtractionDocumentsByIdReprocess = (options) => (options.client ?? clie
4017
4186
  ...options.headers
4018
4187
  }
4019
4188
  });
4189
+ var getClinicalMealPlansArchived = (options) => (options.client ?? client).get({
4190
+ security: [{ scheme: "bearer", type: "http" }],
4191
+ url: "/clinical/meal-plans/archived",
4192
+ ...options
4193
+ });
4020
4194
  var deleteThreadsById = (options) => (options.client ?? client).delete({
4021
4195
  security: [{ scheme: "bearer", type: "http" }],
4022
4196
  url: "/threads/{id}",
@@ -4088,6 +4262,11 @@ var postWatcherClaims = (options) => (options.client ?? client).post({
4088
4262
  ...options.headers
4089
4263
  }
4090
4264
  });
4265
+ var deleteClinicalPracticeToolsCatalogByIdPermanent = (options) => (options.client ?? client).delete({
4266
+ security: [{ scheme: "bearer", type: "http" }],
4267
+ url: "/clinical/practice-tools/catalog/{id}/permanent",
4268
+ ...options
4269
+ });
4091
4270
  var getCrawlerJobs = (options) => (options.client ?? client).get({
4092
4271
  security: [{ scheme: "bearer", type: "http" }],
4093
4272
  url: "/crawler/jobs",
@@ -4196,6 +4375,11 @@ var getProcessingActivitiesById = (options) => (options.client ?? client).get({
4196
4375
  url: "/processing-activities/{id}",
4197
4376
  ...options
4198
4377
  });
4378
+ var deleteClinicalHealthMetricsByIdPermanent = (options) => (options.client ?? client).delete({
4379
+ security: [{ scheme: "bearer", type: "http" }],
4380
+ url: "/clinical/health-metrics/{id}/permanent",
4381
+ ...options
4382
+ });
4199
4383
  var postThreadsByIdExport = (options) => (options.client ?? client).post({
4200
4384
  security: [{ scheme: "bearer", type: "http" }],
4201
4385
  url: "/threads/{id}/export",
@@ -4415,11 +4599,6 @@ var postClinicalClientResourceAssignments = (options) => (options.client ?? clie
4415
4599
  ...options.headers
4416
4600
  }
4417
4601
  });
4418
- var deleteClinicalGoalTemplatesById = (options) => (options.client ?? client).delete({
4419
- security: [{ scheme: "bearer", type: "http" }],
4420
- url: "/clinical/goal-templates/{id}",
4421
- ...options
4422
- });
4423
4602
  var getClinicalGoalTemplatesById = (options) => (options.client ?? client).get({
4424
4603
  security: [{ scheme: "bearer", type: "http" }],
4425
4604
  url: "/clinical/goal-templates/{id}",
@@ -4551,15 +4730,6 @@ var postFieldTemplates = (options) => (options.client ?? client).post({
4551
4730
  ...options.headers
4552
4731
  }
4553
4732
  });
4554
- var patchSocialTrendingWatchesByIdMarkTriggered = (options) => (options.client ?? client).patch({
4555
- security: [{ scheme: "bearer", type: "http" }],
4556
- url: "/social/trending/watches/{id}/mark-triggered",
4557
- ...options,
4558
- headers: {
4559
- "Content-Type": "application/vnd.api+json",
4560
- ...options.headers
4561
- }
4562
- });
4563
4733
  var getClinicalPracticeResourcesCatalog = (options) => (options.client ?? client).get({
4564
4734
  security: [{ scheme: "bearer", type: "http" }],
4565
4735
  url: "/clinical/practice-resources/catalog",
@@ -4617,6 +4787,15 @@ var patchTenantsByIdReactivate = (options) => (options.client ?? client).patch({
4617
4787
  ...options.headers
4618
4788
  }
4619
4789
  });
4790
+ var patchClinicalGoalTemplatesCatalogByIdRestore = (options) => (options.client ?? client).patch({
4791
+ security: [{ scheme: "bearer", type: "http" }],
4792
+ url: "/clinical/goal-templates/catalog/{id}/restore",
4793
+ ...options,
4794
+ headers: {
4795
+ "Content-Type": "application/vnd.api+json",
4796
+ ...options.headers
4797
+ }
4798
+ });
4620
4799
  var getWorkspacesByWorkspaceIdExtractionExportsById = (options) => (options.client ?? client).get({
4621
4800
  security: [{ scheme: "bearer", type: "http" }],
4622
4801
  url: "/workspaces/{workspace_id}/extraction/exports/{id}",
@@ -4659,6 +4838,11 @@ var postDocumentsPresignedUpload = (options) => (options.client ?? client).post(
4659
4838
  ...options.headers
4660
4839
  }
4661
4840
  });
4841
+ var getClinicalHealthMetricsArchived = (options) => (options.client ?? client).get({
4842
+ security: [{ scheme: "bearer", type: "http" }],
4843
+ url: "/clinical/health-metrics/archived",
4844
+ ...options
4845
+ });
4662
4846
  var postPaymentMethodsTokenize = (options) => (options.client ?? client).post({
4663
4847
  security: [{ scheme: "bearer", type: "http" }],
4664
4848
  url: "/payment-methods/tokenize",
@@ -4756,11 +4940,6 @@ var postComplianceDocumentTemplatesClone = (options) => (options.client ?? clien
4756
4940
  ...options.headers
4757
4941
  }
4758
4942
  });
4759
- var deleteClinicalClientSupplementsById = (options) => (options.client ?? client).delete({
4760
- security: [{ scheme: "bearer", type: "http" }],
4761
- url: "/clinical/client-supplements/{id}",
4762
- ...options
4763
- });
4764
4943
  var getClinicalClientSupplementsById = (options) => (options.client ?? client).get({
4765
4944
  security: [{ scheme: "bearer", type: "http" }],
4766
4945
  url: "/clinical/client-supplements/{id}",
@@ -4865,6 +5044,11 @@ var getBreachNotificationsById = (options) => (options.client ?? client).get({
4865
5044
  url: "/breach-notifications/{id}",
4866
5045
  ...options
4867
5046
  });
5047
+ var deleteClinicalClientSupplementsByIdPermanent = (options) => (options.client ?? client).delete({
5048
+ security: [{ scheme: "bearer", type: "http" }],
5049
+ url: "/clinical/client-supplements/{id}/permanent",
5050
+ ...options
5051
+ });
4868
5052
  var patchStorageFilesByIdUpdateMetadata = (options) => (options.client ?? client).patch({
4869
5053
  security: [{ scheme: "bearer", type: "http" }],
4870
5054
  url: "/storage-files/{id}/update-metadata",
@@ -4936,6 +5120,15 @@ var getRiskAssessmentsById = (options) => (options.client ?? client).get({
4936
5120
  url: "/risk-assessments/{id}",
4937
5121
  ...options
4938
5122
  });
5123
+ var patchClinicalClientGoalsByIdArchive = (options) => (options.client ?? client).patch({
5124
+ security: [{ scheme: "bearer", type: "http" }],
5125
+ url: "/clinical/client-goals/{id}/archive",
5126
+ ...options,
5127
+ headers: {
5128
+ "Content-Type": "application/vnd.api+json",
5129
+ ...options.headers
5130
+ }
5131
+ });
4939
5132
  var getUserProfiles = (options) => (options.client ?? client).get({
4940
5133
  security: [{ scheme: "bearer", type: "http" }],
4941
5134
  url: "/user-profiles",
@@ -5220,6 +5413,11 @@ var getSocialPostsCampaignBySocialCampaignId = (options) => (options.client ?? c
5220
5413
  url: "/social/posts/campaign/{social_campaign_id}",
5221
5414
  ...options
5222
5415
  });
5416
+ var getClinicalPracticeToolsArchived = (options) => (options.client ?? client).get({
5417
+ security: [{ scheme: "bearer", type: "http" }],
5418
+ url: "/clinical/practice-tools/archived",
5419
+ ...options
5420
+ });
5223
5421
  var deleteDataTransferRecordsById = (options) => (options.client ?? client).delete({
5224
5422
  security: [{ scheme: "bearer", type: "http" }],
5225
5423
  url: "/data-transfer-records/{id}",
@@ -5230,6 +5428,11 @@ var getDataTransferRecordsById = (options) => (options.client ?? client).get({
5230
5428
  url: "/data-transfer-records/{id}",
5231
5429
  ...options
5232
5430
  });
5431
+ var deleteClinicalPracticeToolsByIdPermanent = (options) => (options.client ?? client).delete({
5432
+ security: [{ scheme: "bearer", type: "http" }],
5433
+ url: "/clinical/practice-tools/{id}/permanent",
5434
+ ...options
5435
+ });
5233
5436
  var patchAmendmentRequestsByIdApply = (options) => (options.client ?? client).patch({
5234
5437
  security: [{ scheme: "bearer", type: "http" }],
5235
5438
  url: "/amendment-requests/{id}/apply",
@@ -5299,6 +5502,15 @@ var patchSocialPostsByIdSeo = (options) => (options.client ?? client).patch({
5299
5502
  ...options.headers
5300
5503
  }
5301
5504
  });
5505
+ var patchClinicalGoalTemplatesByIdRestore = (options) => (options.client ?? client).patch({
5506
+ security: [{ scheme: "bearer", type: "http" }],
5507
+ url: "/clinical/goal-templates/{id}/restore",
5508
+ ...options,
5509
+ headers: {
5510
+ "Content-Type": "application/vnd.api+json",
5511
+ ...options.headers
5512
+ }
5513
+ });
5302
5514
  var postConnectorsOauthInitiate = (options) => (options.client ?? client).post({
5303
5515
  security: [{ scheme: "bearer", type: "http" }],
5304
5516
  url: "/connectors/oauth/initiate",
@@ -5401,6 +5613,11 @@ var patchSupportTicketsByIdClose = (options) => (options.client ?? client).patch
5401
5613
  ...options.headers
5402
5614
  }
5403
5615
  });
5616
+ var deleteClinicalClientResourceAssignmentsByIdPermanent = (options) => (options.client ?? client).delete({
5617
+ security: [{ scheme: "bearer", type: "http" }],
5618
+ url: "/clinical/client-resource-assignments/{id}/permanent",
5619
+ ...options
5620
+ });
5404
5621
  var getClinicalClientGoals = (options) => (options.client ?? client).get({
5405
5622
  security: [{ scheme: "bearer", type: "http" }],
5406
5623
  url: "/clinical/client-goals",
@@ -5462,6 +5679,11 @@ var patchEmailOutboundEmailsByIdCancelSchedule = (options) => (options.client ??
5462
5679
  ...options.headers
5463
5680
  }
5464
5681
  });
5682
+ var deleteClinicalPracticeResourcesCatalogByIdPermanent = (options) => (options.client ?? client).delete({
5683
+ security: [{ scheme: "bearer", type: "http" }],
5684
+ url: "/clinical/practice-resources/catalog/{id}/permanent",
5685
+ ...options
5686
+ });
5465
5687
  var postContentRefine = (options) => (options.client ?? client).post({
5466
5688
  security: [{ scheme: "bearer", type: "http" }],
5467
5689
  url: "/content/refine",
@@ -5513,6 +5735,15 @@ var getCampaignsSequencesWorkspaceByWorkspaceId = (options) => (options.client ?
5513
5735
  url: "/campaigns/sequences/workspace/{workspace_id}",
5514
5736
  ...options
5515
5737
  });
5738
+ var patchClinicalClientSupplementsByIdRestore = (options) => (options.client ?? client).patch({
5739
+ security: [{ scheme: "bearer", type: "http" }],
5740
+ url: "/clinical/client-supplements/{id}/restore",
5741
+ ...options,
5742
+ headers: {
5743
+ "Content-Type": "application/vnd.api+json",
5744
+ ...options.headers
5745
+ }
5746
+ });
5516
5747
  var patchUserProfilesByIdDismissAnnouncement = (options) => (options.client ?? client).patch({
5517
5748
  security: [{ scheme: "bearer", type: "http" }],
5518
5749
  url: "/user-profiles/{id}/dismiss-announcement",
@@ -5587,11 +5818,6 @@ var postUsersAuthLogin = (options) => (options.client ?? client).post({
5587
5818
  ...options.headers
5588
5819
  }
5589
5820
  });
5590
- var deleteClinicalHealthMetricsById = (options) => (options.client ?? client).delete({
5591
- security: [{ scheme: "bearer", type: "http" }],
5592
- url: "/clinical/health-metrics/{id}",
5593
- ...options
5594
- });
5595
5821
  var getClinicalHealthMetricsById = (options) => (options.client ?? client).get({
5596
5822
  security: [{ scheme: "bearer", type: "http" }],
5597
5823
  url: "/clinical/health-metrics/{id}",
@@ -5638,6 +5864,16 @@ var postAgentVersionComparisons = (options) => (options.client ?? client).post({
5638
5864
  ...options.headers
5639
5865
  }
5640
5866
  });
5867
+ var getClinicalClientGoalsArchived = (options) => (options.client ?? client).get({
5868
+ security: [{ scheme: "bearer", type: "http" }],
5869
+ url: "/clinical/client-goals/archived",
5870
+ ...options
5871
+ });
5872
+ var getClinicalPracticeResourcesCatalogArchived = (options) => (options.client ?? client).get({
5873
+ security: [{ scheme: "bearer", type: "http" }],
5874
+ url: "/clinical/practice-resources/catalog/archived",
5875
+ ...options
5876
+ });
5641
5877
  var getSchedulingBookings = (options) => (options.client ?? client).get({
5642
5878
  security: [{ scheme: "bearer", type: "http" }],
5643
5879
  url: "/scheduling/bookings",
@@ -5666,6 +5902,11 @@ var postSchedulingCalendarSyncs = (options) => (options.client ?? client).post({
5666
5902
  ...options.headers
5667
5903
  }
5668
5904
  });
5905
+ var getClinicalNotesArchived = (options) => (options.client ?? client).get({
5906
+ security: [{ scheme: "bearer", type: "http" }],
5907
+ url: "/clinical/notes/archived",
5908
+ ...options
5909
+ });
5669
5910
  var getWorkspacesMine = (options) => (options.client ?? client).get({
5670
5911
  security: [{ scheme: "bearer", type: "http" }],
5671
5912
  url: "/workspaces/mine",
@@ -5750,6 +5991,15 @@ var postUsersAuthConfirm = (options) => (options.client ?? client).post({
5750
5991
  ...options.headers
5751
5992
  }
5752
5993
  });
5994
+ var patchClinicalClientSupplementsByIdArchive = (options) => (options.client ?? client).patch({
5995
+ security: [{ scheme: "bearer", type: "http" }],
5996
+ url: "/clinical/client-supplements/{id}/archive",
5997
+ ...options,
5998
+ headers: {
5999
+ "Content-Type": "application/vnd.api+json",
6000
+ ...options.headers
6001
+ }
6002
+ });
5753
6003
  var postAgentsCloneForWorkspace = (options) => (options.client ?? client).post({
5754
6004
  security: [{ scheme: "bearer", type: "http" }],
5755
6005
  url: "/agents/clone-for-workspace",
@@ -6237,7 +6487,16 @@ var patchExtractionResultsByIdSaveCorrections = (options) => (options.client ??
6237
6487
  ...options.headers
6238
6488
  }
6239
6489
  });
6240
- var getConsentRecords = (options) => (options.client ?? client).get({
6490
+ var patchClinicalMealPlansByIdRestore = (options) => (options.client ?? client).patch({
6491
+ security: [{ scheme: "bearer", type: "http" }],
6492
+ url: "/clinical/meal-plans/{id}/restore",
6493
+ ...options,
6494
+ headers: {
6495
+ "Content-Type": "application/vnd.api+json",
6496
+ ...options.headers
6497
+ }
6498
+ });
6499
+ var getConsentRecords = (options) => (options.client ?? client).get({
6241
6500
  security: [{ scheme: "bearer", type: "http" }],
6242
6501
  url: "/consent-records",
6243
6502
  ...options
@@ -6392,6 +6651,15 @@ var postWatcherEvents = (options) => (options.client ?? client).post({
6392
6651
  ...options.headers
6393
6652
  }
6394
6653
  });
6654
+ var patchClinicalPracticeToolsByIdRestore = (options) => (options.client ?? client).patch({
6655
+ security: [{ scheme: "bearer", type: "http" }],
6656
+ url: "/clinical/practice-tools/{id}/restore",
6657
+ ...options,
6658
+ headers: {
6659
+ "Content-Type": "application/vnd.api+json",
6660
+ ...options.headers
6661
+ }
6662
+ });
6395
6663
  var getAgentsBySlugBySlug = (options) => (options.client ?? client).get({
6396
6664
  security: [{ scheme: "bearer", type: "http" }],
6397
6665
  url: "/agents/by-slug/{slug}",
@@ -6504,6 +6772,11 @@ var postAgentsByIdClone = (options) => (options.client ?? client).post({
6504
6772
  ...options.headers
6505
6773
  }
6506
6774
  });
6775
+ var getClinicalGoalTemplatesArchived = (options) => (options.client ?? client).get({
6776
+ security: [{ scheme: "bearer", type: "http" }],
6777
+ url: "/clinical/goal-templates/archived",
6778
+ ...options
6779
+ });
6507
6780
  var getLegalDocuments = (options) => (options.client ?? client).get({
6508
6781
  security: [{ scheme: "bearer", type: "http" }],
6509
6782
  url: "/legal-documents",
@@ -6537,6 +6810,15 @@ var getEmailInboundReceivedWorkspaceByWorkspaceId = (options) => (options.client
6537
6810
  url: "/email/inbound/received/workspace/{workspace_id}",
6538
6811
  ...options
6539
6812
  });
6813
+ var patchClinicalPracticeResourcesCatalogByIdArchive = (options) => (options.client ?? client).patch({
6814
+ security: [{ scheme: "bearer", type: "http" }],
6815
+ url: "/clinical/practice-resources/catalog/{id}/archive",
6816
+ ...options,
6817
+ headers: {
6818
+ "Content-Type": "application/vnd.api+json",
6819
+ ...options.headers
6820
+ }
6821
+ });
6540
6822
  var getInvitationsMe = (options) => (options.client ?? client).get({
6541
6823
  security: [{ scheme: "bearer", type: "http" }],
6542
6824
  url: "/invitations/me",
@@ -6561,6 +6843,15 @@ var postClinicalGoalTemplates = (options) => (options.client ?? client).post({
6561
6843
  ...options.headers
6562
6844
  }
6563
6845
  });
6846
+ var patchClinicalGoalTemplatesByIdArchive = (options) => (options.client ?? client).patch({
6847
+ security: [{ scheme: "bearer", type: "http" }],
6848
+ url: "/clinical/goal-templates/{id}/archive",
6849
+ ...options,
6850
+ headers: {
6851
+ "Content-Type": "application/vnd.api+json",
6852
+ ...options.headers
6853
+ }
6854
+ });
6564
6855
  var patchClinicalNotesByIdReject = (options) => (options.client ?? client).patch({
6565
6856
  security: [{ scheme: "bearer", type: "http" }],
6566
6857
  url: "/clinical/notes/{id}/reject",
@@ -6678,6 +6969,11 @@ var getWallet = (options) => (options.client ?? client).get({
6678
6969
  url: "/wallet",
6679
6970
  ...options
6680
6971
  });
6972
+ var getClinicalPracticeToolsCatalogArchived = (options) => (options.client ?? client).get({
6973
+ security: [{ scheme: "bearer", type: "http" }],
6974
+ url: "/clinical/practice-tools/catalog/archived",
6975
+ ...options
6976
+ });
6681
6977
  var deleteCrawlerSchedulesById = (options) => (options.client ?? client).delete({
6682
6978
  security: [{ scheme: "bearer", type: "http" }],
6683
6979
  url: "/crawler/schedules/{id}",
@@ -6767,6 +7063,11 @@ var getWorkspaceAgentConfigs = (options) => (options.client ?? client).get({
6767
7063
  url: "/workspace-agent-configs",
6768
7064
  ...options
6769
7065
  });
7066
+ var getThreadsMine = (options) => (options.client ?? client).get({
7067
+ security: [{ scheme: "bearer", type: "http" }],
7068
+ url: "/threads/mine",
7069
+ ...options
7070
+ });
6770
7071
  var getDisclosureLogsById = (options) => (options.client ?? client).get({
6771
7072
  security: [{ scheme: "bearer", type: "http" }],
6772
7073
  url: "/disclosure-logs/{id}",
@@ -8516,16 +8817,17 @@ function createAgentsNamespace(rb) {
8516
8817
  * @param agentId - The UUID of the agent to execute.
8517
8818
  * @param input - Input data for the agent (task description, documents, etc.).
8518
8819
  * @param opts - Additional execution options.
8820
+ * @param opts.workspace_id - The workspace to execute in. **Required** unless
8821
+ * `workspaceId` was set in the `GptClient` constructor config.
8519
8822
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8520
8823
  * Highest priority in the model resolution chain.
8521
- * @param reqOptions - Optional request options. Use `idempotencyKey` to prevent duplicate executions.
8522
8824
  * @returns The created execution record with status `pending`.
8523
8825
  *
8524
8826
  * @example
8525
8827
  * const exec = await client.agents.executions.start('agt_01...', {
8526
8828
  * task: 'Extract invoice fields',
8527
8829
  * document_id: 'doc_01...',
8528
- * });
8830
+ * }, { workspace_id: 'ws_abc123' });
8529
8831
  * console.log(exec.id, exec.status); // 'pending'
8530
8832
  *
8531
8833
  * @example
@@ -8533,12 +8835,13 @@ function createAgentsNamespace(rb) {
8533
8835
  * const exec = await client.agents.executions.start(
8534
8836
  * 'agt_01...',
8535
8837
  * { task: 'Complex reasoning' },
8536
- * { model_id: 'anthropic/claude-sonnet-4' },
8838
+ * { workspace_id: 'ws_abc123', model_id: 'anthropic/claude-sonnet-4' },
8537
8839
  * );
8538
8840
  */
8539
8841
  start: async (agentId, input, opts) => {
8540
- const { model_id, ...reqOptions } = opts ?? {};
8842
+ const { workspace_id, model_id, ...reqOptions } = opts ?? {};
8541
8843
  const body = { input };
8844
+ if (workspace_id) body.workspace_id = workspace_id;
8542
8845
  if (model_id) body.model_id = model_id;
8543
8846
  return rb.rawPost(
8544
8847
  `/agents/${agentId}/execute`,
@@ -8555,20 +8858,24 @@ function createAgentsNamespace(rb) {
8555
8858
  *
8556
8859
  * @param agentId - The UUID of the agent.
8557
8860
  * @param input - Input data (same format as {@link start}).
8558
- * @param options - Optional request options.
8861
+ * @param opts - Additional options.
8862
+ * @param opts.workspace_id - The workspace to estimate for. Required for `sk_app_` key auth.
8559
8863
  * @returns Cost estimate with min/max credit ranges.
8560
8864
  *
8561
8865
  * @example
8562
8866
  * const estimate = await client.agents.executions.estimate('agt_01...', {
8563
8867
  * task: 'Process batch',
8564
- * });
8868
+ * }, { workspace_id: 'ws_abc123' });
8565
8869
  * console.log(`Estimated cost: ${estimate.min_credits} - ${estimate.max_credits}`);
8566
8870
  */
8567
- estimate: async (agentId, input, options) => {
8871
+ estimate: async (agentId, input, opts) => {
8872
+ const { workspace_id, ...reqOptions } = opts ?? {};
8873
+ const body = { input };
8874
+ if (workspace_id) body.workspace_id = workspace_id;
8568
8875
  return rb.rawPost(
8569
8876
  `/agents/${agentId}/estimate`,
8570
- { input },
8571
- options
8877
+ body,
8878
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8572
8879
  );
8573
8880
  },
8574
8881
  /**
@@ -8594,14 +8901,20 @@ function createAgentsNamespace(rb) {
8594
8901
  * Returns only executions triggered by the authenticated user,
8595
8902
  * ordered by creation time descending.
8596
8903
  *
8597
- * @param options - Optional request options.
8904
+ * @param opts - Optional filtering and request options.
8905
+ * @param opts.workspace_id - Filter to a specific workspace. Required for `sk_app_` key auth.
8598
8906
  * @returns Array of execution records.
8599
8907
  *
8600
8908
  * @example
8601
- * const executions = await client.agents.executions.list();
8909
+ * const executions = await client.agents.executions.list({ workspace_id: 'ws_abc123' });
8602
8910
  */
8603
- list: async (options) => {
8604
- return rb.rawGet("/agent-executions", options);
8911
+ list: async (opts) => {
8912
+ const { workspace_id, ...reqOptions } = opts ?? {};
8913
+ const query = workspace_id ? `?workspace_id=${encodeURIComponent(workspace_id)}` : "";
8914
+ return rb.rawGet(
8915
+ `/agent-executions${query}`,
8916
+ Object.keys(reqOptions).length > 0 ? reqOptions : void 0
8917
+ );
8605
8918
  },
8606
8919
  /**
8607
8920
  * Opens an SSE stream for real-time execution events.
@@ -9009,7 +9322,7 @@ function createAiNamespace(rb) {
9009
9322
  {
9010
9323
  body: {
9011
9324
  data: {
9012
- type: "conversation",
9325
+ type: "chat-conversation",
9013
9326
  attributes: attributes ?? {}
9014
9327
  }
9015
9328
  }
@@ -9088,8 +9401,9 @@ function createAiNamespace(rb) {
9088
9401
  {
9089
9402
  body: {
9090
9403
  data: {
9091
- type: "ai-message",
9092
- attributes: { ...body, conversation_id: conversationId }
9404
+ type: "chat-ai-message",
9405
+ ...body,
9406
+ conversation_id: conversationId
9093
9407
  }
9094
9408
  }
9095
9409
  },
@@ -10102,8 +10416,8 @@ function createBillingNamespace(rb) {
10102
10416
  /**
10103
10417
  * Feature usage records — per-tenant usage tracking for metered features.
10104
10418
  *
10105
- * Read-only access to usage records that track how many times each tenant
10106
- * has used a feature in the current billing cycle.
10419
+ * Access usage records that track how many times each tenant
10420
+ * has used a feature in the current billing cycle, and increment usage.
10107
10421
  */
10108
10422
  featureUsages: {
10109
10423
  /** List all feature usage records. */
@@ -10127,6 +10441,37 @@ function createBillingNamespace(rb) {
10127
10441
  options
10128
10442
  );
10129
10443
  return result.data ?? result;
10444
+ },
10445
+ /**
10446
+ * Increment usage for a feature by key.
10447
+ *
10448
+ * Checks feature gate, enforces limits, charges credits for credit_cost
10449
+ * features, and atomically increments the usage counter. Returns the
10450
+ * updated usage count and remaining allowance.
10451
+ *
10452
+ * @param featureKey - The feature definition key (e.g., "meal_plans", "clients")
10453
+ * @returns Object with `used` (current cycle count) and `remaining` (null if unlimited)
10454
+ *
10455
+ * @example
10456
+ * ```typescript
10457
+ * const result = await client.billing.featureUsages.increment("meal_plans");
10458
+ * console.log(`Used: ${result.used}, Remaining: ${result.remaining}`);
10459
+ * ```
10460
+ */
10461
+ increment: async (featureKey, options) => {
10462
+ const result = await rb.execute(
10463
+ postFeatureUsagesIncrement,
10464
+ {
10465
+ body: {
10466
+ data: {
10467
+ type: "feature-usage",
10468
+ attributes: { feature_key: featureKey }
10469
+ }
10470
+ }
10471
+ },
10472
+ options
10473
+ );
10474
+ return result.data;
10130
10475
  }
10131
10476
  },
10132
10477
  /**
@@ -10896,7 +11241,7 @@ function createContentNamespace(rb) {
10896
11241
  postContentGenerateText,
10897
11242
  {
10898
11243
  body: {
10899
- data: { type: "content-generation", attributes }
11244
+ data: { type: "content-generation", ...attributes }
10900
11245
  }
10901
11246
  },
10902
11247
  options
@@ -10919,7 +11264,7 @@ function createContentNamespace(rb) {
10919
11264
  postContentGenerateImage,
10920
11265
  {
10921
11266
  body: {
10922
- data: { type: "content-generation", attributes }
11267
+ data: { type: "content-generation", ...attributes }
10923
11268
  }
10924
11269
  },
10925
11270
  options
@@ -10943,7 +11288,7 @@ function createContentNamespace(rb) {
10943
11288
  postContentEditImage,
10944
11289
  {
10945
11290
  body: {
10946
- data: { type: "content-generation", attributes }
11291
+ data: { type: "content-generation", ...attributes }
10947
11292
  }
10948
11293
  },
10949
11294
  options
@@ -10967,7 +11312,7 @@ function createContentNamespace(rb) {
10967
11312
  postContentRewriteTone,
10968
11313
  {
10969
11314
  body: {
10970
- data: { type: "content-generation", attributes }
11315
+ data: { type: "content-generation", ...attributes }
10971
11316
  }
10972
11317
  },
10973
11318
  options
@@ -10991,7 +11336,7 @@ function createContentNamespace(rb) {
10991
11336
  postContentShorten,
10992
11337
  {
10993
11338
  body: {
10994
- data: { type: "content-generation", attributes }
11339
+ data: { type: "content-generation", ...attributes }
10995
11340
  }
10996
11341
  },
10997
11342
  options
@@ -11015,7 +11360,7 @@ function createContentNamespace(rb) {
11015
11360
  postContentRefine,
11016
11361
  {
11017
11362
  body: {
11018
- data: { type: "content-generation", attributes }
11363
+ data: { type: "content-generation", ...attributes }
11019
11364
  }
11020
11365
  },
11021
11366
  options
@@ -11039,7 +11384,7 @@ function createContentNamespace(rb) {
11039
11384
  postContentSuggestTopics,
11040
11385
  {
11041
11386
  body: {
11042
- data: { type: "content-generation", attributes }
11387
+ data: { type: "content-generation", ...attributes }
11043
11388
  }
11044
11389
  },
11045
11390
  options
@@ -11062,7 +11407,7 @@ function createContentNamespace(rb) {
11062
11407
  postContentGenerateImagePrompt,
11063
11408
  {
11064
11409
  body: {
11065
- data: { type: "content-generation", attributes }
11410
+ data: { type: "content-generation", ...attributes }
11066
11411
  }
11067
11412
  },
11068
11413
  options
@@ -11086,7 +11431,7 @@ function createContentNamespace(rb) {
11086
11431
  postContentGenerateHashtags,
11087
11432
  {
11088
11433
  body: {
11089
- data: { type: "content-generation", attributes }
11434
+ data: { type: "content-generation", ...attributes }
11090
11435
  }
11091
11436
  },
11092
11437
  options
@@ -11110,7 +11455,7 @@ function createContentNamespace(rb) {
11110
11455
  postContentSeoEnrich,
11111
11456
  {
11112
11457
  body: {
11113
- data: { type: "content-generation", attributes }
11458
+ data: { type: "content-generation", ...attributes }
11114
11459
  }
11115
11460
  },
11116
11461
  options
@@ -11319,7 +11664,7 @@ function createClinicalNamespace(rb) {
11319
11664
  }
11320
11665
  },
11321
11666
  /**
11322
- * Manage clinical sessions (practitionerpatient encounters).
11667
+ * Manage clinical sessions (practitioner-patient encounters).
11323
11668
  */
11324
11669
  sessions: {
11325
11670
  /**
@@ -11488,13 +11833,76 @@ function createClinicalNamespace(rb) {
11488
11833
  options
11489
11834
  ),
11490
11835
  /**
11491
- * Delete a clinical note.
11836
+ * Archive (soft-delete) a note.
11492
11837
  *
11838
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
11839
+ * Use `permanentDelete()` for irreversible removal.
11493
11840
  * @param id - Note UUID
11494
11841
  * @param options - Request options
11495
- * @returns `true` on successful deletion
11842
+ * @returns Archived {@link ClinicalNote} record
11843
+ */
11844
+ delete: async (id, options) => rb.execute(
11845
+ patchClinicalNotesByIdArchive,
11846
+ {
11847
+ path: { id },
11848
+ body: { data: { type: "clinical-note", id, attributes: {} } }
11849
+ },
11850
+ options
11851
+ ),
11852
+ /**
11853
+ * Archive (soft-delete) a note.
11854
+ *
11855
+ * @param id - Note UUID
11856
+ * @param options - Request options
11857
+ * @returns Archived {@link ClinicalNote} record
11858
+ */
11859
+ archive: async (id, options) => rb.execute(
11860
+ patchClinicalNotesByIdArchive,
11861
+ {
11862
+ path: { id },
11863
+ body: { data: { type: "clinical-note", id, attributes: {} } }
11864
+ },
11865
+ options
11866
+ ),
11867
+ /**
11868
+ * Restore an archived note.
11869
+ *
11870
+ * @param id - Note UUID
11871
+ * @param options - Request options
11872
+ * @returns Restored {@link ClinicalNote} record
11873
+ */
11874
+ restore: async (id, options) => rb.execute(
11875
+ patchClinicalNotesByIdRestore,
11876
+ {
11877
+ path: { id },
11878
+ body: { data: { type: "clinical-note", id, attributes: {} } }
11879
+ },
11880
+ options
11881
+ ),
11882
+ /**
11883
+ * Permanently delete a note. Irreversible.
11884
+ *
11885
+ * @param id - Note UUID
11886
+ * @param options - Request options
11887
+ * @returns `true` on success
11888
+ */
11889
+ permanentDelete: async (id, options) => rb.executeDelete(
11890
+ deleteClinicalNotesByIdPermanent,
11891
+ { path: { id } },
11892
+ options
11893
+ ),
11894
+ /**
11895
+ * List archived (soft-deleted) notes.
11896
+ *
11897
+ * @param params - Filter/pagination parameters
11898
+ * @param options - Request options
11899
+ * @returns Array of archived {@link ClinicalNote} records
11496
11900
  */
11497
- delete: async (id, options) => rb.executeDelete(deleteClinicalNotesById, { path: { id } }, options),
11901
+ listArchived: async (params, options) => rb.execute(
11902
+ getClinicalNotesArchived,
11903
+ params ?? {},
11904
+ options
11905
+ ),
11498
11906
  /**
11499
11907
  * Approve a clinical note (HITL workflow).
11500
11908
  *
@@ -11656,16 +12064,81 @@ function createClinicalNamespace(rb) {
11656
12064
  options
11657
12065
  ),
11658
12066
  /**
11659
- * Delete a health metric entry.
12067
+ * Archive (soft-delete) a health metric.
11660
12068
  *
12069
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12070
+ * Use `permanentDelete()` for irreversible removal.
11661
12071
  * @param id - HealthMetric UUID
11662
12072
  * @param options - Request options
11663
- * @returns `true` on successful deletion
12073
+ * @returns Archived {@link ClinicalHealthMetric} record
12074
+ */
12075
+ delete: async (id, options) => rb.execute(
12076
+ patchClinicalHealthMetricsByIdArchive,
12077
+ {
12078
+ path: { id },
12079
+ body: {
12080
+ data: { type: "clinical-health-metric", id, attributes: {} }
12081
+ }
12082
+ },
12083
+ options
12084
+ ),
12085
+ /**
12086
+ * Archive (soft-delete) a health metric.
12087
+ *
12088
+ * @param id - HealthMetric UUID
12089
+ * @param options - Request options
12090
+ * @returns Archived {@link ClinicalHealthMetric} record
12091
+ */
12092
+ archive: async (id, options) => rb.execute(
12093
+ patchClinicalHealthMetricsByIdArchive,
12094
+ {
12095
+ path: { id },
12096
+ body: {
12097
+ data: { type: "clinical-health-metric", id, attributes: {} }
12098
+ }
12099
+ },
12100
+ options
12101
+ ),
12102
+ /**
12103
+ * Restore an archived health metric.
12104
+ *
12105
+ * @param id - HealthMetric UUID
12106
+ * @param options - Request options
12107
+ * @returns Restored {@link ClinicalHealthMetric} record
12108
+ */
12109
+ restore: async (id, options) => rb.execute(
12110
+ patchClinicalHealthMetricsByIdRestore,
12111
+ {
12112
+ path: { id },
12113
+ body: {
12114
+ data: { type: "clinical-health-metric", id, attributes: {} }
12115
+ }
12116
+ },
12117
+ options
12118
+ ),
12119
+ /**
12120
+ * Permanently delete a health metric. Irreversible.
12121
+ *
12122
+ * @param id - HealthMetric UUID
12123
+ * @param options - Request options
12124
+ * @returns `true` on success
11664
12125
  */
11665
- delete: async (id, options) => rb.executeDelete(
11666
- deleteClinicalHealthMetricsById,
12126
+ permanentDelete: async (id, options) => rb.executeDelete(
12127
+ deleteClinicalHealthMetricsByIdPermanent,
11667
12128
  { path: { id } },
11668
12129
  options
12130
+ ),
12131
+ /**
12132
+ * List archived (soft-deleted) health metrics.
12133
+ *
12134
+ * @param params - Filter/pagination parameters
12135
+ * @param options - Request options
12136
+ * @returns Array of archived {@link ClinicalHealthMetric} records
12137
+ */
12138
+ listArchived: async (params, options) => rb.execute(
12139
+ getClinicalHealthMetricsArchived,
12140
+ params ?? {},
12141
+ options
11669
12142
  )
11670
12143
  },
11671
12144
  /**
@@ -11725,16 +12198,75 @@ function createClinicalNamespace(rb) {
11725
12198
  options
11726
12199
  ),
11727
12200
  /**
11728
- * Delete a meal plan.
12201
+ * Archive (soft-delete) a meal plan.
11729
12202
  *
12203
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12204
+ * Use `permanentDelete()` for irreversible removal.
11730
12205
  * @param id - MealPlan UUID
11731
12206
  * @param options - Request options
11732
- * @returns `true` on successful deletion
12207
+ * @returns Archived {@link ClinicalMealPlan} record
12208
+ */
12209
+ delete: async (id, options) => rb.execute(
12210
+ patchClinicalMealPlansByIdArchive,
12211
+ {
12212
+ path: { id },
12213
+ body: { data: { type: "clinical-meal-plan", id, attributes: {} } }
12214
+ },
12215
+ options
12216
+ ),
12217
+ /**
12218
+ * Archive (soft-delete) a meal plan.
12219
+ *
12220
+ * @param id - MealPlan UUID
12221
+ * @param options - Request options
12222
+ * @returns Archived {@link ClinicalMealPlan} record
12223
+ */
12224
+ archive: async (id, options) => rb.execute(
12225
+ patchClinicalMealPlansByIdArchive,
12226
+ {
12227
+ path: { id },
12228
+ body: { data: { type: "clinical-meal-plan", id, attributes: {} } }
12229
+ },
12230
+ options
12231
+ ),
12232
+ /**
12233
+ * Restore an archived meal plan.
12234
+ *
12235
+ * @param id - MealPlan UUID
12236
+ * @param options - Request options
12237
+ * @returns Restored {@link ClinicalMealPlan} record
11733
12238
  */
11734
- delete: async (id, options) => rb.executeDelete(
11735
- deleteClinicalMealPlansById,
12239
+ restore: async (id, options) => rb.execute(
12240
+ patchClinicalMealPlansByIdRestore,
12241
+ {
12242
+ path: { id },
12243
+ body: { data: { type: "clinical-meal-plan", id, attributes: {} } }
12244
+ },
12245
+ options
12246
+ ),
12247
+ /**
12248
+ * Permanently delete a meal plan. Irreversible.
12249
+ *
12250
+ * @param id - MealPlan UUID
12251
+ * @param options - Request options
12252
+ * @returns `true` on success
12253
+ */
12254
+ permanentDelete: async (id, options) => rb.executeDelete(
12255
+ deleteClinicalMealPlansByIdPermanent,
11736
12256
  { path: { id } },
11737
12257
  options
12258
+ ),
12259
+ /**
12260
+ * List archived (soft-deleted) meal plans.
12261
+ *
12262
+ * @param params - Filter/pagination parameters
12263
+ * @param options - Request options
12264
+ * @returns Array of archived {@link ClinicalMealPlan} records
12265
+ */
12266
+ listArchived: async (params, options) => rb.execute(
12267
+ getClinicalMealPlansArchived,
12268
+ params ?? {},
12269
+ options
11738
12270
  )
11739
12271
  },
11740
12272
  /**
@@ -11794,16 +12326,102 @@ function createClinicalNamespace(rb) {
11794
12326
  options
11795
12327
  ),
11796
12328
  /**
11797
- * Delete a client goal.
12329
+ * Archive (soft-delete) a client goal.
11798
12330
  *
12331
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12332
+ * Use `permanentDelete()` for irreversible removal.
11799
12333
  * @param id - ClientGoal UUID
11800
12334
  * @param options - Request options
11801
- * @returns `true` on successful deletion
12335
+ * @returns Archived {@link ClinicalClientGoal} record
12336
+ */
12337
+ delete: async (id, options) => rb.execute(
12338
+ patchClinicalClientGoalsByIdArchive,
12339
+ {
12340
+ path: { id },
12341
+ body: {
12342
+ data: { type: "clinical-client-goal", id, attributes: {} }
12343
+ }
12344
+ },
12345
+ options
12346
+ ),
12347
+ /**
12348
+ * Archive (soft-delete) a client goal.
12349
+ *
12350
+ * @param id - ClientGoal UUID
12351
+ * @param options - Request options
12352
+ * @returns Archived {@link ClinicalClientGoal} record
12353
+ */
12354
+ archive: async (id, options) => rb.execute(
12355
+ patchClinicalClientGoalsByIdArchive,
12356
+ {
12357
+ path: { id },
12358
+ body: {
12359
+ data: { type: "clinical-client-goal", id, attributes: {} }
12360
+ }
12361
+ },
12362
+ options
12363
+ ),
12364
+ /**
12365
+ * Restore an archived client goal.
12366
+ *
12367
+ * @param id - ClientGoal UUID
12368
+ * @param options - Request options
12369
+ * @returns Restored {@link ClinicalClientGoal} record
12370
+ */
12371
+ restore: async (id, options) => rb.execute(
12372
+ patchClinicalClientGoalsByIdRestore,
12373
+ {
12374
+ path: { id },
12375
+ body: {
12376
+ data: { type: "clinical-client-goal", id, attributes: {} }
12377
+ }
12378
+ },
12379
+ options
12380
+ ),
12381
+ /**
12382
+ * Permanently delete a client goal. Irreversible.
12383
+ *
12384
+ * @param id - ClientGoal UUID
12385
+ * @param options - Request options
12386
+ * @returns `true` on success
11802
12387
  */
11803
- delete: async (id, options) => rb.executeDelete(
11804
- deleteClinicalClientGoalsById,
12388
+ permanentDelete: async (id, options) => rb.executeDelete(
12389
+ deleteClinicalClientGoalsByIdPermanent,
11805
12390
  { path: { id } },
11806
12391
  options
12392
+ ),
12393
+ /**
12394
+ * List archived (soft-deleted) client goals.
12395
+ *
12396
+ * @param params - Filter/pagination parameters
12397
+ * @param options - Request options
12398
+ * @returns Array of archived {@link ClinicalClientGoal} records
12399
+ */
12400
+ listArchived: async (params, options) => rb.execute(
12401
+ getClinicalClientGoalsArchived,
12402
+ params ?? {},
12403
+ options
12404
+ ),
12405
+ /**
12406
+ * Batch reorder client goals by updating their positions.
12407
+ *
12408
+ * @param items - Array of `{ id, position }` pairs specifying new order
12409
+ * @param options - Request options
12410
+ * @returns `{ reordered: number }` — count of updated goals
12411
+ *
12412
+ * @example
12413
+ * ```typescript
12414
+ * await client.clinical.clientGoals.reorder([
12415
+ * { id: "goal-uuid-1", position: 0 },
12416
+ * { id: "goal-uuid-2", position: 1 },
12417
+ * { id: "goal-uuid-3", position: 2 },
12418
+ * ]);
12419
+ * ```
12420
+ */
12421
+ reorder: async (items, options) => rb.rawPost(
12422
+ "/clinical/client-goals/reorder",
12423
+ { items },
12424
+ options
11807
12425
  )
11808
12426
  },
11809
12427
  /**
@@ -11868,19 +12486,84 @@ function createClinicalNamespace(rb) {
11868
12486
  options
11869
12487
  ),
11870
12488
  /**
11871
- * Delete a supplement prescription.
12489
+ * Archive (soft-delete) a supplement prescription.
11872
12490
  *
12491
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12492
+ * Use `permanentDelete()` for irreversible removal.
11873
12493
  * @param id - ClientSupplement UUID
11874
12494
  * @param options - Request options
11875
- * @returns `true` on successful deletion
12495
+ * @returns Archived {@link ClinicalClientSupplement} record
11876
12496
  */
11877
- delete: async (id, options) => rb.executeDelete(
11878
- deleteClinicalClientSupplementsById,
11879
- { path: { id } },
11880
- options
11881
- )
11882
- },
11883
- /**
12497
+ delete: async (id, options) => rb.execute(
12498
+ patchClinicalClientSupplementsByIdArchive,
12499
+ {
12500
+ path: { id },
12501
+ body: {
12502
+ data: { type: "clinical-client-supplement", id, attributes: {} }
12503
+ }
12504
+ },
12505
+ options
12506
+ ),
12507
+ /**
12508
+ * Archive (soft-delete) a supplement prescription.
12509
+ *
12510
+ * @param id - ClientSupplement UUID
12511
+ * @param options - Request options
12512
+ * @returns Archived {@link ClinicalClientSupplement} record
12513
+ */
12514
+ archive: async (id, options) => rb.execute(
12515
+ patchClinicalClientSupplementsByIdArchive,
12516
+ {
12517
+ path: { id },
12518
+ body: {
12519
+ data: { type: "clinical-client-supplement", id, attributes: {} }
12520
+ }
12521
+ },
12522
+ options
12523
+ ),
12524
+ /**
12525
+ * Restore an archived supplement prescription.
12526
+ *
12527
+ * @param id - ClientSupplement UUID
12528
+ * @param options - Request options
12529
+ * @returns Restored {@link ClinicalClientSupplement} record
12530
+ */
12531
+ restore: async (id, options) => rb.execute(
12532
+ patchClinicalClientSupplementsByIdRestore,
12533
+ {
12534
+ path: { id },
12535
+ body: {
12536
+ data: { type: "clinical-client-supplement", id, attributes: {} }
12537
+ }
12538
+ },
12539
+ options
12540
+ ),
12541
+ /**
12542
+ * Permanently delete a supplement prescription. Irreversible.
12543
+ *
12544
+ * @param id - ClientSupplement UUID
12545
+ * @param options - Request options
12546
+ * @returns `true` on success
12547
+ */
12548
+ permanentDelete: async (id, options) => rb.executeDelete(
12549
+ deleteClinicalClientSupplementsByIdPermanent,
12550
+ { path: { id } },
12551
+ options
12552
+ ),
12553
+ /**
12554
+ * List archived (soft-deleted) supplement prescriptions.
12555
+ *
12556
+ * @param params - Filter/pagination parameters
12557
+ * @param options - Request options
12558
+ * @returns Array of archived {@link ClinicalClientSupplement} records
12559
+ */
12560
+ listArchived: async (params, options) => rb.execute(
12561
+ getClinicalClientSupplementsArchived,
12562
+ params ?? {},
12563
+ options
12564
+ )
12565
+ },
12566
+ /**
11884
12567
  * Manage clinical deliveries (care plan items sent to patients).
11885
12568
  */
11886
12569
  deliveries: {
@@ -11999,17 +12682,82 @@ function createClinicalNamespace(rb) {
11999
12682
  options
12000
12683
  ),
12001
12684
  /**
12002
- * Delete a practice resource.
12685
+ * Archive (soft-delete) a practice resource.
12003
12686
  *
12687
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12688
+ * Use `permanentDelete()` for irreversible removal.
12004
12689
  * @param id - PracticeResource UUID
12005
12690
  * @param options - Request options
12006
- * @returns `true` on successful deletion
12691
+ * @returns Archived {@link ClinicalPracticeResource} record
12007
12692
  */
12008
- delete: async (id, options) => rb.executeDelete(
12009
- deleteClinicalPracticeResourcesById,
12693
+ delete: async (id, options) => rb.execute(
12694
+ patchClinicalPracticeResourcesByIdArchive,
12695
+ {
12696
+ path: { id },
12697
+ body: {
12698
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12699
+ }
12700
+ },
12701
+ options
12702
+ ),
12703
+ /**
12704
+ * Archive (soft-delete) a practice resource.
12705
+ *
12706
+ * @param id - PracticeResource UUID
12707
+ * @param options - Request options
12708
+ * @returns Archived {@link ClinicalPracticeResource} record
12709
+ */
12710
+ archive: async (id, options) => rb.execute(
12711
+ patchClinicalPracticeResourcesByIdArchive,
12712
+ {
12713
+ path: { id },
12714
+ body: {
12715
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12716
+ }
12717
+ },
12718
+ options
12719
+ ),
12720
+ /**
12721
+ * Restore an archived practice resource.
12722
+ *
12723
+ * @param id - PracticeResource UUID
12724
+ * @param options - Request options
12725
+ * @returns Restored {@link ClinicalPracticeResource} record
12726
+ */
12727
+ restore: async (id, options) => rb.execute(
12728
+ patchClinicalPracticeResourcesByIdRestore,
12729
+ {
12730
+ path: { id },
12731
+ body: {
12732
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12733
+ }
12734
+ },
12735
+ options
12736
+ ),
12737
+ /**
12738
+ * Permanently delete a practice resource. Irreversible.
12739
+ *
12740
+ * @param id - PracticeResource UUID
12741
+ * @param options - Request options
12742
+ * @returns `true` on success
12743
+ */
12744
+ permanentDelete: async (id, options) => rb.executeDelete(
12745
+ deleteClinicalPracticeResourcesByIdPermanent,
12010
12746
  { path: { id } },
12011
12747
  options
12012
12748
  ),
12749
+ /**
12750
+ * List archived (soft-deleted) practice resources.
12751
+ *
12752
+ * @param params - Filter/pagination parameters
12753
+ * @param options - Request options
12754
+ * @returns Array of archived {@link ClinicalPracticeResource} records
12755
+ */
12756
+ listArchived: async (params, options) => rb.execute(
12757
+ getClinicalPracticeResourcesArchived,
12758
+ params ?? {},
12759
+ options
12760
+ ),
12013
12761
  /**
12014
12762
  * List application-level catalog practice resources.
12015
12763
  *
@@ -12022,6 +12770,64 @@ function createClinicalNamespace(rb) {
12022
12770
  { query: params ?? {} },
12023
12771
  options
12024
12772
  ),
12773
+ /**
12774
+ * Archive (soft-delete) a catalog practice resource.
12775
+ *
12776
+ * @param id - PracticeResource UUID
12777
+ * @param options - Request options
12778
+ * @returns Archived {@link ClinicalPracticeResource} record
12779
+ */
12780
+ archiveCatalog: async (id, options) => rb.execute(
12781
+ patchClinicalPracticeResourcesCatalogByIdArchive,
12782
+ {
12783
+ path: { id },
12784
+ body: {
12785
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12786
+ }
12787
+ },
12788
+ options
12789
+ ),
12790
+ /**
12791
+ * Restore an archived catalog practice resource.
12792
+ *
12793
+ * @param id - PracticeResource UUID
12794
+ * @param options - Request options
12795
+ * @returns Restored {@link ClinicalPracticeResource} record
12796
+ */
12797
+ restoreCatalog: async (id, options) => rb.execute(
12798
+ patchClinicalPracticeResourcesCatalogByIdRestore,
12799
+ {
12800
+ path: { id },
12801
+ body: {
12802
+ data: { type: "clinical-practice-resource", id, attributes: {} }
12803
+ }
12804
+ },
12805
+ options
12806
+ ),
12807
+ /**
12808
+ * Permanently delete a catalog practice resource. Irreversible.
12809
+ *
12810
+ * @param id - PracticeResource UUID
12811
+ * @param options - Request options
12812
+ * @returns `true` on success
12813
+ */
12814
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
12815
+ deleteClinicalPracticeResourcesCatalogByIdPermanent,
12816
+ { path: { id } },
12817
+ options
12818
+ ),
12819
+ /**
12820
+ * List archived (soft-deleted) catalog practice resources.
12821
+ *
12822
+ * @param params - Filter/pagination parameters
12823
+ * @param options - Request options
12824
+ * @returns Array of archived {@link ClinicalPracticeResource} catalog records
12825
+ */
12826
+ listArchivedCatalog: async (params, options) => rb.execute(
12827
+ getClinicalPracticeResourcesCatalogArchived,
12828
+ params ?? {},
12829
+ options
12830
+ ),
12025
12831
  /**
12026
12832
  * List distinct practice resource categories in a workspace.
12027
12833
  *
@@ -12061,7 +12867,88 @@ function createClinicalNamespace(rb) {
12061
12867
  listCatalogCategories: async (options) => rb.rawGet(
12062
12868
  `/clinical/practice-resources/categories/catalog`,
12063
12869
  options
12064
- )
12870
+ ),
12871
+ tags: {
12872
+ rename: async (workspaceId, oldTag, newTag, options) => rb.rawPatch(
12873
+ `/clinical/practice-resources/tags/rename`,
12874
+ { workspace_id: workspaceId, old_tag: oldTag, new_tag: newTag },
12875
+ options
12876
+ ),
12877
+ delete: async (workspaceId, tag, options) => rb.rawDelete(
12878
+ `/clinical/practice-resources/tags/${encodeURIComponent(tag)}?workspace_id=${encodeURIComponent(workspaceId)}`,
12879
+ options
12880
+ ),
12881
+ merge: async (workspaceId, sourceTags, targetTag, options) => rb.rawPost(
12882
+ `/clinical/practice-resources/tags/merge`,
12883
+ {
12884
+ workspace_id: workspaceId,
12885
+ source_tags: sourceTags,
12886
+ target_tag: targetTag
12887
+ },
12888
+ options
12889
+ )
12890
+ },
12891
+ imports: {
12892
+ fromFile: async (workspaceId, file, options) => {
12893
+ const formData = new FormData();
12894
+ formData.append("file", file);
12895
+ formData.append("workspace_id", workspaceId);
12896
+ return rb.rawPostMultipart(
12897
+ `/clinical/practice-resources/imports/file`,
12898
+ formData,
12899
+ options
12900
+ );
12901
+ },
12902
+ fromUrl: async (workspaceId, url, options) => rb.rawPost(
12903
+ `/clinical/practice-resources/imports/url`,
12904
+ { workspace_id: workspaceId, url },
12905
+ options
12906
+ )
12907
+ },
12908
+ duplicates: {
12909
+ getStats: async (workspaceId, options) => rb.rawGet(
12910
+ `/clinical/practice-resources/duplicates?workspace_id=${encodeURIComponent(workspaceId)}`,
12911
+ options
12912
+ ),
12913
+ listGroups: async (workspaceId, opts, options) => {
12914
+ const qs = new URLSearchParams({ workspace_id: workspaceId });
12915
+ if (opts?.threshold !== void 0)
12916
+ qs.set("threshold", String(opts.threshold));
12917
+ if (opts?.limit !== void 0) qs.set("limit", String(opts.limit));
12918
+ return rb.rawGet(
12919
+ `/clinical/practice-resources/duplicates/groups?${qs.toString()}`,
12920
+ options
12921
+ );
12922
+ },
12923
+ resolve: async (workspaceId, groupId, keepId, options) => rb.rawPost(
12924
+ `/clinical/practice-resources/duplicates/resolve`,
12925
+ { workspace_id: workspaceId, group_id: groupId, keep_id: keepId },
12926
+ options
12927
+ )
12928
+ },
12929
+ /**
12930
+ * Search practice resources using semantic similarity.
12931
+ * Finds resources matching the query by meaning, not just keywords.
12932
+ *
12933
+ * @param workspaceId - The workspace to search in
12934
+ * @param params - Search parameters
12935
+ * @param params.query - Free-text search query
12936
+ * @param params.limit - Maximum results to return (default: 10)
12937
+ * @returns Array of matching practice resources with similarity scores
12938
+ *
12939
+ * @example
12940
+ * ```typescript
12941
+ * const results = await client.clinical.practiceResources.search(workspaceId, {
12942
+ * query: "diabetes management patient education",
12943
+ * limit: 5,
12944
+ * });
12945
+ * ```
12946
+ */
12947
+ search: async (workspaceId, params, options) => rb.rawPost(
12948
+ `/clinical/practice-resources/search`,
12949
+ { ...params, workspace_id: workspaceId },
12950
+ options
12951
+ ).then((r) => r.data)
12065
12952
  },
12066
12953
  /**
12067
12954
  * Manage practice-level assessment and therapeutic tools.
@@ -12120,17 +13007,82 @@ function createClinicalNamespace(rb) {
12120
13007
  options
12121
13008
  ),
12122
13009
  /**
12123
- * Delete a practice tool.
13010
+ * Archive (soft-delete) a practice tool.
12124
13011
  *
13012
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13013
+ * Use `permanentDelete()` for irreversible removal.
12125
13014
  * @param id - PracticeTool UUID
12126
13015
  * @param options - Request options
12127
- * @returns `true` on successful deletion
13016
+ * @returns Archived {@link ClinicalPracticeTool} record
13017
+ */
13018
+ delete: async (id, options) => rb.execute(
13019
+ patchClinicalPracticeToolsByIdArchive,
13020
+ {
13021
+ path: { id },
13022
+ body: {
13023
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13024
+ }
13025
+ },
13026
+ options
13027
+ ),
13028
+ /**
13029
+ * Archive (soft-delete) a practice tool.
13030
+ *
13031
+ * @param id - PracticeTool UUID
13032
+ * @param options - Request options
13033
+ * @returns Archived {@link ClinicalPracticeTool} record
13034
+ */
13035
+ archive: async (id, options) => rb.execute(
13036
+ patchClinicalPracticeToolsByIdArchive,
13037
+ {
13038
+ path: { id },
13039
+ body: {
13040
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13041
+ }
13042
+ },
13043
+ options
13044
+ ),
13045
+ /**
13046
+ * Restore an archived practice tool.
13047
+ *
13048
+ * @param id - PracticeTool UUID
13049
+ * @param options - Request options
13050
+ * @returns Restored {@link ClinicalPracticeTool} record
12128
13051
  */
12129
- delete: async (id, options) => rb.executeDelete(
12130
- deleteClinicalPracticeToolsById,
13052
+ restore: async (id, options) => rb.execute(
13053
+ patchClinicalPracticeToolsByIdRestore,
13054
+ {
13055
+ path: { id },
13056
+ body: {
13057
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13058
+ }
13059
+ },
13060
+ options
13061
+ ),
13062
+ /**
13063
+ * Permanently delete a practice tool. Irreversible.
13064
+ *
13065
+ * @param id - PracticeTool UUID
13066
+ * @param options - Request options
13067
+ * @returns `true` on success
13068
+ */
13069
+ permanentDelete: async (id, options) => rb.executeDelete(
13070
+ deleteClinicalPracticeToolsByIdPermanent,
12131
13071
  { path: { id } },
12132
13072
  options
12133
13073
  ),
13074
+ /**
13075
+ * List archived (soft-deleted) practice tools.
13076
+ *
13077
+ * @param params - Filter/pagination parameters
13078
+ * @param options - Request options
13079
+ * @returns Array of archived {@link ClinicalPracticeTool} records
13080
+ */
13081
+ listArchived: async (params, options) => rb.execute(
13082
+ getClinicalPracticeToolsArchived,
13083
+ params ?? {},
13084
+ options
13085
+ ),
12134
13086
  /**
12135
13087
  * List distinct practice tool categories in a workspace.
12136
13088
  *
@@ -12165,6 +13117,64 @@ function createClinicalNamespace(rb) {
12165
13117
  { query: params ?? {} },
12166
13118
  options
12167
13119
  ),
13120
+ /**
13121
+ * Archive (soft-delete) a catalog practice tool.
13122
+ *
13123
+ * @param id - PracticeTool UUID
13124
+ * @param options - Request options
13125
+ * @returns Archived {@link ClinicalPracticeTool} record
13126
+ */
13127
+ archiveCatalog: async (id, options) => rb.execute(
13128
+ patchClinicalPracticeToolsCatalogByIdArchive,
13129
+ {
13130
+ path: { id },
13131
+ body: {
13132
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13133
+ }
13134
+ },
13135
+ options
13136
+ ),
13137
+ /**
13138
+ * Restore an archived catalog practice tool.
13139
+ *
13140
+ * @param id - PracticeTool UUID
13141
+ * @param options - Request options
13142
+ * @returns Restored {@link ClinicalPracticeTool} record
13143
+ */
13144
+ restoreCatalog: async (id, options) => rb.execute(
13145
+ patchClinicalPracticeToolsCatalogByIdRestore,
13146
+ {
13147
+ path: { id },
13148
+ body: {
13149
+ data: { type: "clinical-practice-tool", id, attributes: {} }
13150
+ }
13151
+ },
13152
+ options
13153
+ ),
13154
+ /**
13155
+ * Permanently delete a catalog practice tool. Irreversible.
13156
+ *
13157
+ * @param id - PracticeTool UUID
13158
+ * @param options - Request options
13159
+ * @returns `true` on success
13160
+ */
13161
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
13162
+ deleteClinicalPracticeToolsCatalogByIdPermanent,
13163
+ { path: { id } },
13164
+ options
13165
+ ),
13166
+ /**
13167
+ * List archived (soft-deleted) catalog practice tools.
13168
+ *
13169
+ * @param params - Filter/pagination parameters
13170
+ * @param options - Request options
13171
+ * @returns Array of archived {@link ClinicalPracticeTool} catalog records
13172
+ */
13173
+ listArchivedCatalog: async (params, options) => rb.execute(
13174
+ getClinicalPracticeToolsCatalogArchived,
13175
+ params ?? {},
13176
+ options
13177
+ ),
12168
13178
  /**
12169
13179
  * List distinct catalog practice tool categories.
12170
13180
  *
@@ -12182,7 +13192,87 @@ function createClinicalNamespace(rb) {
12182
13192
  listCatalogCategories: async (options) => rb.rawGet(
12183
13193
  `/clinical/practice-tools/categories/catalog`,
12184
13194
  options
12185
- )
13195
+ ),
13196
+ tags: {
13197
+ rename: async (workspaceId, oldTag, newTag, options) => rb.rawPatch(
13198
+ `/clinical/practice-tools/tags/rename`,
13199
+ { workspace_id: workspaceId, old_tag: oldTag, new_tag: newTag },
13200
+ options
13201
+ ),
13202
+ delete: async (workspaceId, tag, options) => rb.rawDelete(
13203
+ `/clinical/practice-tools/tags/${encodeURIComponent(tag)}?workspace_id=${encodeURIComponent(workspaceId)}`,
13204
+ options
13205
+ ),
13206
+ merge: async (workspaceId, sourceTags, targetTag, options) => rb.rawPost(
13207
+ `/clinical/practice-tools/tags/merge`,
13208
+ {
13209
+ workspace_id: workspaceId,
13210
+ source_tags: sourceTags,
13211
+ target_tag: targetTag
13212
+ },
13213
+ options
13214
+ )
13215
+ },
13216
+ imports: {
13217
+ fromFile: async (workspaceId, file, options) => {
13218
+ const formData = new FormData();
13219
+ formData.append("file", file);
13220
+ formData.append("workspace_id", workspaceId);
13221
+ return rb.rawPostMultipart(
13222
+ `/clinical/practice-tools/imports/file`,
13223
+ formData,
13224
+ options
13225
+ );
13226
+ },
13227
+ fromUrl: async (workspaceId, url, options) => rb.rawPost(
13228
+ `/clinical/practice-tools/imports/url`,
13229
+ { workspace_id: workspaceId, url },
13230
+ options
13231
+ )
13232
+ },
13233
+ duplicates: {
13234
+ getStats: async (workspaceId, options) => rb.rawGet(
13235
+ `/clinical/practice-tools/duplicates?workspace_id=${encodeURIComponent(workspaceId)}`,
13236
+ options
13237
+ ),
13238
+ listGroups: async (workspaceId, opts, options) => {
13239
+ const qs = new URLSearchParams({ workspace_id: workspaceId });
13240
+ if (opts?.threshold !== void 0)
13241
+ qs.set("threshold", String(opts.threshold));
13242
+ if (opts?.limit !== void 0) qs.set("limit", String(opts.limit));
13243
+ return rb.rawGet(
13244
+ `/clinical/practice-tools/duplicates/groups?${qs.toString()}`,
13245
+ options
13246
+ );
13247
+ },
13248
+ resolve: async (workspaceId, groupId, keepId, options) => rb.rawPost(
13249
+ `/clinical/practice-tools/duplicates/resolve`,
13250
+ { workspace_id: workspaceId, group_id: groupId, keep_id: keepId },
13251
+ options
13252
+ )
13253
+ },
13254
+ /**
13255
+ * Search practice tools using semantic similarity.
13256
+ *
13257
+ * @param workspaceId - The workspace to search in
13258
+ * @param params - Search parameters
13259
+ * @param params.query - Free-text search query
13260
+ * @param params.limit - Maximum results to return (default: 10)
13261
+ * @returns Array of matching practice tools with similarity scores
13262
+ *
13263
+ * @example
13264
+ * ```typescript
13265
+ * const results = await client.clinical.practiceTools.search(workspaceId, {
13266
+ * query: "stress assessment screening tool",
13267
+ * limit: 5,
13268
+ * });
13269
+ * ```
13270
+ */
13271
+ search: async (workspaceId, params, options) => rb.rawPost(
13272
+ `/clinical/practice-tools/search`,
13273
+ { ...params, workspace_id: workspaceId },
13274
+ options
13275
+ ).then((r) => r.data)
12186
13276
  },
12187
13277
  /**
12188
13278
  * Manage assignments of practice resources to patients.
@@ -12252,16 +13342,93 @@ function createClinicalNamespace(rb) {
12252
13342
  options
12253
13343
  ),
12254
13344
  /**
12255
- * Delete a resource assignment.
13345
+ * Archive (soft-delete) a resource assignment.
12256
13346
  *
13347
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13348
+ * Use `permanentDelete()` for irreversible removal.
12257
13349
  * @param id - ClientResourceAssignment UUID
12258
13350
  * @param options - Request options
12259
- * @returns `true` on successful deletion
13351
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
13352
+ */
13353
+ delete: async (id, options) => rb.execute(
13354
+ patchClinicalClientResourceAssignmentsByIdArchive,
13355
+ {
13356
+ path: { id },
13357
+ body: {
13358
+ data: {
13359
+ type: "clinical-client-resource-assignment",
13360
+ id,
13361
+ attributes: {}
13362
+ }
13363
+ }
13364
+ },
13365
+ options
13366
+ ),
13367
+ /**
13368
+ * Archive (soft-delete) a resource assignment.
13369
+ *
13370
+ * @param id - ClientResourceAssignment UUID
13371
+ * @param options - Request options
13372
+ * @returns Archived {@link ClinicalClientResourceAssignment} record
12260
13373
  */
12261
- delete: async (id, options) => rb.executeDelete(
12262
- deleteClinicalClientResourceAssignmentsById,
13374
+ archive: async (id, options) => rb.execute(
13375
+ patchClinicalClientResourceAssignmentsByIdArchive,
13376
+ {
13377
+ path: { id },
13378
+ body: {
13379
+ data: {
13380
+ type: "clinical-client-resource-assignment",
13381
+ id,
13382
+ attributes: {}
13383
+ }
13384
+ }
13385
+ },
13386
+ options
13387
+ ),
13388
+ /**
13389
+ * Restore an archived resource assignment.
13390
+ *
13391
+ * @param id - ClientResourceAssignment UUID
13392
+ * @param options - Request options
13393
+ * @returns Restored {@link ClinicalClientResourceAssignment} record
13394
+ */
13395
+ restore: async (id, options) => rb.execute(
13396
+ patchClinicalClientResourceAssignmentsByIdRestore,
13397
+ {
13398
+ path: { id },
13399
+ body: {
13400
+ data: {
13401
+ type: "clinical-client-resource-assignment",
13402
+ id,
13403
+ attributes: {}
13404
+ }
13405
+ }
13406
+ },
13407
+ options
13408
+ ),
13409
+ /**
13410
+ * Permanently delete a resource assignment. Irreversible.
13411
+ *
13412
+ * @param id - ClientResourceAssignment UUID
13413
+ * @param options - Request options
13414
+ * @returns `true` on success
13415
+ */
13416
+ permanentDelete: async (id, options) => rb.executeDelete(
13417
+ deleteClinicalClientResourceAssignmentsByIdPermanent,
12263
13418
  { path: { id } },
12264
13419
  options
13420
+ ),
13421
+ /**
13422
+ * List archived (soft-deleted) resource assignments.
13423
+ *
13424
+ * @param params - Filter/pagination parameters
13425
+ * @param options - Request options
13426
+ * @returns Array of archived {@link ClinicalClientResourceAssignment} records
13427
+ */
13428
+ listArchived: async (params, options) => rb.execute(
13429
+ getClinicalClientResourceAssignmentsArchived,
13430
+ params ?? {},
13431
+ options
12265
13432
  )
12266
13433
  },
12267
13434
  /**
@@ -12423,43 +13590,166 @@ function createClinicalNamespace(rb) {
12423
13590
  options
12424
13591
  ),
12425
13592
  /**
12426
- * Update a goal template.
13593
+ * Update a goal template.
13594
+ *
13595
+ * @param id - GoalTemplate UUID
13596
+ * @param attributes - Fields to update (PATCH semantics)
13597
+ * @param options - Request options
13598
+ * @returns Updated {@link ClinicalGoalTemplate} record
13599
+ */
13600
+ update: async (id, attributes, options) => rb.execute(
13601
+ patchClinicalGoalTemplatesById,
13602
+ {
13603
+ path: { id },
13604
+ body: { data: { type: "clinical-goal-template", id, attributes } }
13605
+ },
13606
+ options
13607
+ ),
13608
+ /**
13609
+ * Archive (soft-delete) a goal template.
13610
+ *
13611
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13612
+ * Use `permanentDelete()` for irreversible removal.
13613
+ * @param id - GoalTemplate UUID
13614
+ * @param options - Request options
13615
+ * @returns Archived {@link ClinicalGoalTemplate} record
13616
+ */
13617
+ delete: async (id, options) => rb.execute(
13618
+ patchClinicalGoalTemplatesByIdArchive,
13619
+ {
13620
+ path: { id },
13621
+ body: {
13622
+ data: { type: "clinical-goal-template", id, attributes: {} }
13623
+ }
13624
+ },
13625
+ options
13626
+ ),
13627
+ /**
13628
+ * Archive (soft-delete) a goal template.
13629
+ *
13630
+ * @param id - GoalTemplate UUID
13631
+ * @param options - Request options
13632
+ * @returns Archived {@link ClinicalGoalTemplate} record
13633
+ */
13634
+ archive: async (id, options) => rb.execute(
13635
+ patchClinicalGoalTemplatesByIdArchive,
13636
+ {
13637
+ path: { id },
13638
+ body: {
13639
+ data: { type: "clinical-goal-template", id, attributes: {} }
13640
+ }
13641
+ },
13642
+ options
13643
+ ),
13644
+ /**
13645
+ * Restore an archived goal template.
13646
+ *
13647
+ * @param id - GoalTemplate UUID
13648
+ * @param options - Request options
13649
+ * @returns Restored {@link ClinicalGoalTemplate} record
13650
+ */
13651
+ restore: async (id, options) => rb.execute(
13652
+ patchClinicalGoalTemplatesByIdRestore,
13653
+ {
13654
+ path: { id },
13655
+ body: {
13656
+ data: { type: "clinical-goal-template", id, attributes: {} }
13657
+ }
13658
+ },
13659
+ options
13660
+ ),
13661
+ /**
13662
+ * Permanently delete a goal template. Irreversible.
13663
+ *
13664
+ * @param id - GoalTemplate UUID
13665
+ * @param options - Request options
13666
+ * @returns `true` on success
13667
+ */
13668
+ permanentDelete: async (id, options) => rb.executeDelete(
13669
+ deleteClinicalGoalTemplatesByIdPermanent,
13670
+ { path: { id } },
13671
+ options
13672
+ ),
13673
+ /**
13674
+ * List archived (soft-deleted) goal templates.
13675
+ *
13676
+ * @param params - Filter/pagination parameters
13677
+ * @param options - Request options
13678
+ * @returns Array of archived {@link ClinicalGoalTemplate} records
13679
+ */
13680
+ listArchived: async (params, options) => rb.execute(
13681
+ getClinicalGoalTemplatesArchived,
13682
+ params ?? {},
13683
+ options
13684
+ ),
13685
+ /**
13686
+ * List application-level catalog goal templates.
13687
+ *
13688
+ * @param params - Optional filter/sort params. Application ID is resolved from the API key context.
13689
+ * @param options - Request options
13690
+ * @returns Array of {@link ClinicalGoalTemplate} catalog records
13691
+ */
13692
+ listCatalog: async (params, options) => rb.execute(
13693
+ getClinicalGoalTemplatesCatalog,
13694
+ { query: params ?? {} },
13695
+ options
13696
+ ),
13697
+ /**
13698
+ * Archive (soft-delete) a catalog goal template.
13699
+ *
13700
+ * @param id - GoalTemplate UUID
13701
+ * @param options - Request options
13702
+ * @returns Archived {@link ClinicalGoalTemplate} record
13703
+ */
13704
+ archiveCatalog: async (id, options) => rb.execute(
13705
+ patchClinicalGoalTemplatesCatalogByIdArchive,
13706
+ {
13707
+ path: { id },
13708
+ body: {
13709
+ data: { type: "clinical-goal-template", id, attributes: {} }
13710
+ }
13711
+ },
13712
+ options
13713
+ ),
13714
+ /**
13715
+ * Restore an archived catalog goal template.
12427
13716
  *
12428
13717
  * @param id - GoalTemplate UUID
12429
- * @param attributes - Fields to update (PATCH semantics)
12430
13718
  * @param options - Request options
12431
- * @returns Updated {@link ClinicalGoalTemplate} record
13719
+ * @returns Restored {@link ClinicalGoalTemplate} record
12432
13720
  */
12433
- update: async (id, attributes, options) => rb.execute(
12434
- patchClinicalGoalTemplatesById,
13721
+ restoreCatalog: async (id, options) => rb.execute(
13722
+ patchClinicalGoalTemplatesCatalogByIdRestore,
12435
13723
  {
12436
13724
  path: { id },
12437
- body: { data: { type: "clinical-goal-template", id, attributes } }
13725
+ body: {
13726
+ data: { type: "clinical-goal-template", id, attributes: {} }
13727
+ }
12438
13728
  },
12439
13729
  options
12440
13730
  ),
12441
13731
  /**
12442
- * Delete a goal template.
13732
+ * Permanently delete a catalog goal template. Irreversible.
12443
13733
  *
12444
13734
  * @param id - GoalTemplate UUID
12445
13735
  * @param options - Request options
12446
- * @returns `true` on successful deletion
13736
+ * @returns `true` on success
12447
13737
  */
12448
- delete: async (id, options) => rb.executeDelete(
12449
- deleteClinicalGoalTemplatesById,
13738
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
13739
+ deleteClinicalGoalTemplatesCatalogByIdPermanent,
12450
13740
  { path: { id } },
12451
13741
  options
12452
13742
  ),
12453
13743
  /**
12454
- * List application-level catalog goal templates.
13744
+ * List archived (soft-deleted) catalog goal templates.
12455
13745
  *
12456
- * @param params - Optional filter/sort params. Application ID is resolved from the API key context.
13746
+ * @param params - Filter/pagination parameters
12457
13747
  * @param options - Request options
12458
- * @returns Array of {@link ClinicalGoalTemplate} catalog records
13748
+ * @returns Array of archived {@link ClinicalGoalTemplate} catalog records
12459
13749
  */
12460
- listCatalog: async (params, options) => rb.execute(
12461
- getClinicalGoalTemplatesCatalog,
12462
- { query: params ?? {} },
13750
+ listArchivedCatalog: async (params, options) => rb.execute(
13751
+ getClinicalGoalTemplatesCatalogArchived,
13752
+ params ?? {},
12463
13753
  options
12464
13754
  ),
12465
13755
  /**
@@ -12479,7 +13769,87 @@ function createClinicalNamespace(rb) {
12479
13769
  listCatalogCategories: async (options) => rb.rawGet(
12480
13770
  `/clinical/goal-templates/categories/catalog`,
12481
13771
  options
12482
- )
13772
+ ),
13773
+ tags: {
13774
+ rename: async (workspaceId, oldTag, newTag, options) => rb.rawPatch(
13775
+ `/clinical/goal-templates/tags/rename`,
13776
+ { workspace_id: workspaceId, old_tag: oldTag, new_tag: newTag },
13777
+ options
13778
+ ),
13779
+ delete: async (workspaceId, tag, options) => rb.rawDelete(
13780
+ `/clinical/goal-templates/tags/${encodeURIComponent(tag)}?workspace_id=${encodeURIComponent(workspaceId)}`,
13781
+ options
13782
+ ),
13783
+ merge: async (workspaceId, sourceTags, targetTag, options) => rb.rawPost(
13784
+ `/clinical/goal-templates/tags/merge`,
13785
+ {
13786
+ workspace_id: workspaceId,
13787
+ source_tags: sourceTags,
13788
+ target_tag: targetTag
13789
+ },
13790
+ options
13791
+ )
13792
+ },
13793
+ imports: {
13794
+ fromFile: async (workspaceId, file, options) => {
13795
+ const formData = new FormData();
13796
+ formData.append("file", file);
13797
+ formData.append("workspace_id", workspaceId);
13798
+ return rb.rawPostMultipart(
13799
+ `/clinical/goal-templates/imports/file`,
13800
+ formData,
13801
+ options
13802
+ );
13803
+ },
13804
+ fromUrl: async (workspaceId, url, options) => rb.rawPost(
13805
+ `/clinical/goal-templates/imports/url`,
13806
+ { workspace_id: workspaceId, url },
13807
+ options
13808
+ )
13809
+ },
13810
+ duplicates: {
13811
+ getStats: async (workspaceId, options) => rb.rawGet(
13812
+ `/clinical/goal-templates/duplicates?workspace_id=${encodeURIComponent(workspaceId)}`,
13813
+ options
13814
+ ),
13815
+ listGroups: async (workspaceId, opts, options) => {
13816
+ const qs = new URLSearchParams({ workspace_id: workspaceId });
13817
+ if (opts?.threshold !== void 0)
13818
+ qs.set("threshold", String(opts.threshold));
13819
+ if (opts?.limit !== void 0) qs.set("limit", String(opts.limit));
13820
+ return rb.rawGet(
13821
+ `/clinical/goal-templates/duplicates/groups?${qs.toString()}`,
13822
+ options
13823
+ );
13824
+ },
13825
+ resolve: async (workspaceId, groupId, keepId, options) => rb.rawPost(
13826
+ `/clinical/goal-templates/duplicates/resolve`,
13827
+ { workspace_id: workspaceId, group_id: groupId, keep_id: keepId },
13828
+ options
13829
+ )
13830
+ },
13831
+ /**
13832
+ * Search goal templates using semantic similarity.
13833
+ *
13834
+ * @param workspaceId - The workspace to search in
13835
+ * @param params - Search parameters
13836
+ * @param params.query - Free-text search query
13837
+ * @param params.limit - Maximum results to return (default: 10)
13838
+ * @returns Array of matching goal templates with similarity scores
13839
+ *
13840
+ * @example
13841
+ * ```typescript
13842
+ * const results = await client.clinical.goalTemplates.search(workspaceId, {
13843
+ * query: "improve sleep quality and duration",
13844
+ * limit: 5,
13845
+ * });
13846
+ * ```
13847
+ */
13848
+ search: async (workspaceId, params, options) => rb.rawPost(
13849
+ `/clinical/goal-templates/search`,
13850
+ { ...params, workspace_id: workspaceId },
13851
+ options
13852
+ ).then((r) => r.data)
12483
13853
  },
12484
13854
  /**
12485
13855
  * Recipe search via configured Edamam connector.
@@ -16250,7 +17620,7 @@ function createConnectorsNamespace(rb) {
16250
17620
  body: {
16251
17621
  data: {
16252
17622
  type: "credential",
16253
- attributes: { workspace_id: workspaceId }
17623
+ workspace_id: workspaceId
16254
17624
  }
16255
17625
  }
16256
17626
  },
@@ -16284,7 +17654,7 @@ function createConnectorsNamespace(rb) {
16284
17654
  body: {
16285
17655
  data: {
16286
17656
  type: "credential",
16287
- attributes
17657
+ ...attributes
16288
17658
  }
16289
17659
  }
16290
17660
  },
@@ -16315,11 +17685,9 @@ function createConnectorsNamespace(rb) {
16315
17685
  body: {
16316
17686
  data: {
16317
17687
  type: "credential",
16318
- attributes: {
16319
- workspace_id: workspaceId,
16320
- connector_type: connectorType,
16321
- scope_level: scopeLevel
16322
- }
17688
+ workspace_id: workspaceId,
17689
+ connector_type: connectorType,
17690
+ scope_level: scopeLevel
16323
17691
  }
16324
17692
  }
16325
17693
  },
@@ -16364,10 +17732,8 @@ function createConnectorsNamespace(rb) {
16364
17732
  body: {
16365
17733
  data: {
16366
17734
  type: "connector_instance",
16367
- attributes: {
16368
- connector_type: connectorType,
16369
- workspace_id: workspaceId
16370
- }
17735
+ connector_type: connectorType,
17736
+ workspace_id: workspaceId
16371
17737
  }
16372
17738
  }
16373
17739
  },
@@ -16413,14 +17779,12 @@ function createConnectorsNamespace(rb) {
16413
17779
  body: {
16414
17780
  data: {
16415
17781
  type: "connector_instance",
16416
- attributes: {
16417
- connector_type: connectorType,
16418
- code,
16419
- state,
16420
- workspace_id: workspaceId,
16421
- ...redirectUri !== void 0 && {
16422
- redirect_uri: redirectUri
16423
- }
17782
+ connector_type: connectorType,
17783
+ code,
17784
+ state,
17785
+ workspace_id: workspaceId,
17786
+ ...redirectUri !== void 0 && {
17787
+ redirect_uri: redirectUri
16424
17788
  }
16425
17789
  }
16426
17790
  }
@@ -16690,111 +18054,327 @@ function createConnectorsNamespace(rb) {
16690
18054
  * }
16691
18055
  * ```
16692
18056
  */
16693
- checkPatient: async (connectorId, workspaceId, email, options) => rb.execute(
16694
- postConnectorsFullscriptCheckPatient,
18057
+ checkPatient: async (connectorId, workspaceId, email, options) => rb.execute(
18058
+ postConnectorsFullscriptCheckPatient,
18059
+ {
18060
+ body: {
18061
+ data: {
18062
+ type: "connector_instance",
18063
+ connector_id: connectorId,
18064
+ workspace_id: workspaceId,
18065
+ email
18066
+ }
18067
+ }
18068
+ },
18069
+ options
18070
+ ),
18071
+ /**
18072
+ * Create a new patient record in Fullscript.
18073
+ *
18074
+ * Creates the patient in the Fullscript account linked to the connector
18075
+ * and returns the resulting patient object including the assigned
18076
+ * `fullscript_id`. Use this when a patient does not yet have a Fullscript
18077
+ * account (confirmed via `checkPatient`).
18078
+ *
18079
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18080
+ * @param workspaceId - UUID of the current workspace.
18081
+ * @param attrs - Patient attributes: `first_name`, `last_name`, `email`
18082
+ * (all required), and optional `date_of_birth` (ISO 8601 date string).
18083
+ * @param options - Optional request options.
18084
+ * @returns The newly created `FullscriptPatient`.
18085
+ *
18086
+ * @example
18087
+ * ```typescript
18088
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18089
+ * const patient = await client.connectors.fullscript.createPatient(
18090
+ * 'ci_fs_123',
18091
+ * 'ws_abc123',
18092
+ * {
18093
+ * first_name: 'Jane',
18094
+ * last_name: 'Smith',
18095
+ * email: 'jane@example.com',
18096
+ * date_of_birth: '1985-04-12',
18097
+ * },
18098
+ * );
18099
+ * console.log('Created Fullscript patient:', patient.fullscript_id);
18100
+ * ```
18101
+ */
18102
+ createPatient: async (connectorId, workspaceId, attrs, options) => rb.execute(
18103
+ postConnectorsFullscriptCreatePatient,
18104
+ {
18105
+ body: {
18106
+ data: {
18107
+ type: "connector_instance",
18108
+ connector_id: connectorId,
18109
+ workspace_id: workspaceId,
18110
+ ...attrs
18111
+ }
18112
+ }
18113
+ },
18114
+ options
18115
+ ),
18116
+ /**
18117
+ * Obtain a short-lived embed session grant for the Fullscript prescribing widget.
18118
+ *
18119
+ * The returned `token` is used to embed the Fullscript prescribing UI for a
18120
+ * specific patient within your application. Tokens are valid for 5–15 minutes
18121
+ * and are cached server-side for up to 2 minutes to avoid token proliferation
18122
+ * on repeated calls.
18123
+ *
18124
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18125
+ * @param workspaceId - UUID of the current workspace.
18126
+ * @param patientId - The Fullscript patient ID (from `FullscriptPatient.fullscript_id`).
18127
+ * @param options - Optional request options.
18128
+ * @returns A `FullscriptSessionGrant` with `token`, `expires_at`, and `patient_id`.
18129
+ *
18130
+ * @example
18131
+ * ```typescript
18132
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18133
+ * const grant = await client.connectors.fullscript.sessionGrant(
18134
+ * 'ci_fs_123',
18135
+ * 'ws_abc123',
18136
+ * 'fs_patient_456',
18137
+ * );
18138
+ * // Embed: `https://app.fullscript.com/embed?token=${grant.token}`
18139
+ * console.log('Token expires:', grant.expires_at);
18140
+ * ```
18141
+ */
18142
+ sessionGrant: async (connectorId, workspaceId, patientId, options) => rb.execute(
18143
+ postConnectorsFullscriptSessionGrant,
18144
+ {
18145
+ body: {
18146
+ data: {
18147
+ type: "connector_instance",
18148
+ connector_id: connectorId,
18149
+ workspace_id: workspaceId,
18150
+ patient_id: patientId
18151
+ }
18152
+ }
18153
+ },
18154
+ options
18155
+ ),
18156
+ // ── Treatment Plans ──
18157
+ /**
18158
+ * List treatment plans for a patient.
18159
+ * @param connectorId - The Fullscript connector instance ID
18160
+ * @param workspaceId - The workspace ID
18161
+ * @param patientId - The Fullscript patient ID
18162
+ * @returns Array of treatment plans
18163
+ */
18164
+ listTreatmentPlans: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
18165
+ `/connectors/fullscript/treatment-plans/list`,
18166
+ {
18167
+ workspace_id: workspaceId,
18168
+ connector_id: connectorId,
18169
+ patient_id: patientId
18170
+ },
18171
+ options
18172
+ ).then((r) => r.data),
18173
+ /**
18174
+ * Get treatment plan details including recommendations.
18175
+ *
18176
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18177
+ * @param workspaceId - UUID of the current workspace.
18178
+ * @param treatmentPlanId - The Fullscript treatment plan ID.
18179
+ * @param options - Optional request options.
18180
+ * @returns The `FullscriptTreatmentPlan` with recommendation details.
18181
+ *
18182
+ * @example
18183
+ * ```typescript
18184
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18185
+ * const plan = await client.connectors.fullscript.getTreatmentPlan(
18186
+ * 'ci_fs_123',
18187
+ * 'ws_abc123',
18188
+ * 'tp_456',
18189
+ * );
18190
+ * console.log(plan.state, plan.recommendations);
18191
+ * ```
18192
+ */
18193
+ getTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
18194
+ `/connectors/fullscript/treatment-plans/get`,
18195
+ {
18196
+ workspace_id: workspaceId,
18197
+ connector_id: connectorId,
18198
+ treatment_plan_id: treatmentPlanId
18199
+ },
18200
+ options
18201
+ ).then((r) => r.data),
18202
+ /**
18203
+ * Cancel an active treatment plan.
18204
+ *
18205
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18206
+ * @param workspaceId - UUID of the current workspace.
18207
+ * @param treatmentPlanId - The Fullscript treatment plan ID to cancel.
18208
+ * @param options - Optional request options.
18209
+ * @returns The cancelled `FullscriptTreatmentPlan` with updated state.
18210
+ *
18211
+ * @example
18212
+ * ```typescript
18213
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18214
+ * const cancelled = await client.connectors.fullscript.cancelTreatmentPlan(
18215
+ * 'ci_fs_123',
18216
+ * 'ws_abc123',
18217
+ * 'tp_456',
18218
+ * );
18219
+ * console.log(cancelled.state); // "cancelled"
18220
+ * ```
18221
+ */
18222
+ cancelTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
18223
+ `/connectors/fullscript/treatment-plans/cancel`,
18224
+ {
18225
+ workspace_id: workspaceId,
18226
+ connector_id: connectorId,
18227
+ treatment_plan_id: treatmentPlanId
18228
+ },
18229
+ options
18230
+ ).then((r) => r.data),
18231
+ // ── Products ──
18232
+ /**
18233
+ * Search the Fullscript product catalog by keyword query.
18234
+ *
18235
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18236
+ * @param workspaceId - UUID of the current workspace.
18237
+ * @param query - Search keyword (e.g., `"vitamin D"`, `"omega 3"`).
18238
+ * @param options - Optional request options.
18239
+ * @returns An array of matching `FullscriptProduct` records.
18240
+ *
18241
+ * @example
18242
+ * ```typescript
18243
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18244
+ * const products = await client.connectors.fullscript.searchProducts(
18245
+ * 'ci_fs_123',
18246
+ * 'ws_abc123',
18247
+ * 'vitamin D',
18248
+ * );
18249
+ * products.forEach(p => console.log(p.name, p.brand));
18250
+ * ```
18251
+ */
18252
+ searchProducts: async (connectorId, workspaceId, query, options) => rb.rawPost(
18253
+ `/connectors/fullscript/products/search`,
18254
+ {
18255
+ workspace_id: workspaceId,
18256
+ connector_id: connectorId,
18257
+ query
18258
+ },
18259
+ options
18260
+ ).then((r) => r.data),
18261
+ /**
18262
+ * Get full product details from the Fullscript catalog by product ID.
18263
+ *
18264
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18265
+ * @param workspaceId - UUID of the current workspace.
18266
+ * @param productId - The Fullscript product ID.
18267
+ * @param options - Optional request options.
18268
+ * @returns The `FullscriptProduct` with full details.
18269
+ *
18270
+ * @example
18271
+ * ```typescript
18272
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18273
+ * const product = await client.connectors.fullscript.getProduct(
18274
+ * 'ci_fs_123',
18275
+ * 'ws_abc123',
18276
+ * 'prod_789',
18277
+ * );
18278
+ * console.log(product.name, product.brand);
18279
+ * ```
18280
+ */
18281
+ getProduct: async (connectorId, workspaceId, productId, options) => rb.rawPost(
18282
+ `/connectors/fullscript/products/get`,
18283
+ {
18284
+ workspace_id: workspaceId,
18285
+ connector_id: connectorId,
18286
+ product_id: productId
18287
+ },
18288
+ options
18289
+ ).then((r) => r.data),
18290
+ /**
18291
+ * List similar products curated by Fullscript's health professionals.
18292
+ *
18293
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18294
+ * @param workspaceId - UUID of the current workspace.
18295
+ * @param productId - The Fullscript product ID to find similar products for.
18296
+ * @param options - Optional request options.
18297
+ * @returns An array of similar `FullscriptProduct` records.
18298
+ *
18299
+ * @example
18300
+ * ```typescript
18301
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18302
+ * const similar = await client.connectors.fullscript.listSimilarProducts(
18303
+ * 'ci_fs_123',
18304
+ * 'ws_abc123',
18305
+ * 'prod_789',
18306
+ * );
18307
+ * similar.forEach(p => console.log(p.name));
18308
+ * ```
18309
+ */
18310
+ listSimilarProducts: async (connectorId, workspaceId, productId, options) => rb.rawPost(
18311
+ `/connectors/fullscript/products/similar`,
16695
18312
  {
16696
- body: {
16697
- data: {
16698
- type: "connector_instance",
16699
- attributes: {
16700
- connector_id: connectorId,
16701
- workspace_id: workspaceId,
16702
- email
16703
- }
16704
- }
16705
- }
18313
+ workspace_id: workspaceId,
18314
+ connector_id: connectorId,
18315
+ product_id: productId
16706
18316
  },
16707
18317
  options
16708
- ),
18318
+ ).then((r) => r.data),
18319
+ // ── Orders ──
16709
18320
  /**
16710
- * Create a new patient record in Fullscript.
16711
- *
16712
- * Creates the patient in the Fullscript account linked to the connector
16713
- * and returns the resulting patient object including the assigned
16714
- * `fullscript_id`. Use this when a patient does not yet have a Fullscript
16715
- * account (confirmed via `checkPatient`).
18321
+ * List all orders for a patient in Fullscript.
16716
18322
  *
16717
18323
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16718
18324
  * @param workspaceId - UUID of the current workspace.
16719
- * @param attrs - Patient attributes: `first_name`, `last_name`, `email`
16720
- * (all required), and optional `date_of_birth` (ISO 8601 date string).
18325
+ * @param patientId - The Fullscript patient ID.
16721
18326
  * @param options - Optional request options.
16722
- * @returns The newly created `FullscriptPatient`.
18327
+ * @returns An array of `FullscriptOrder` records for the patient.
16723
18328
  *
16724
18329
  * @example
16725
18330
  * ```typescript
16726
18331
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16727
- * const patient = await client.connectors.fullscript.createPatient(
18332
+ * const orders = await client.connectors.fullscript.listPatientOrders(
16728
18333
  * 'ci_fs_123',
16729
18334
  * 'ws_abc123',
16730
- * {
16731
- * first_name: 'Jane',
16732
- * last_name: 'Smith',
16733
- * email: 'jane@example.com',
16734
- * date_of_birth: '1985-04-12',
16735
- * },
18335
+ * 'fs_patient_456',
16736
18336
  * );
16737
- * console.log('Created Fullscript patient:', patient.fullscript_id);
18337
+ * orders.forEach(o => console.log(o.id, o.payment_total));
16738
18338
  * ```
16739
18339
  */
16740
- createPatient: async (connectorId, workspaceId, attrs, options) => rb.execute(
16741
- postConnectorsFullscriptCreatePatient,
18340
+ listPatientOrders: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
18341
+ `/connectors/fullscript/orders/list`,
16742
18342
  {
16743
- body: {
16744
- data: {
16745
- type: "connector_instance",
16746
- attributes: {
16747
- connector_id: connectorId,
16748
- workspace_id: workspaceId,
16749
- ...attrs
16750
- }
16751
- }
16752
- }
18343
+ workspace_id: workspaceId,
18344
+ connector_id: connectorId,
18345
+ patient_id: patientId
16753
18346
  },
16754
18347
  options
16755
- ),
18348
+ ).then((r) => r.data),
16756
18349
  /**
16757
- * Obtain a short-lived embed session grant for the Fullscript prescribing widget.
16758
- *
16759
- * The returned `token` is used to embed the Fullscript prescribing UI for a
16760
- * specific patient within your application. Tokens are valid for 5–15 minutes
16761
- * and are cached server-side for up to 2 minutes to avoid token proliferation
16762
- * on repeated calls.
18350
+ * Get order details from Fullscript by order ID.
16763
18351
  *
16764
18352
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16765
18353
  * @param workspaceId - UUID of the current workspace.
16766
- * @param patientId - The Fullscript patient ID (from `FullscriptPatient.fullscript_id`).
18354
+ * @param orderId - The Fullscript order ID.
16767
18355
  * @param options - Optional request options.
16768
- * @returns A `FullscriptSessionGrant` with `token`, `expires_at`, and `patient_id`.
18356
+ * @returns The `FullscriptOrder` with line items and totals.
16769
18357
  *
16770
18358
  * @example
16771
18359
  * ```typescript
16772
18360
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16773
- * const grant = await client.connectors.fullscript.sessionGrant(
18361
+ * const order = await client.connectors.fullscript.getOrder(
16774
18362
  * 'ci_fs_123',
16775
18363
  * 'ws_abc123',
16776
- * 'fs_patient_456',
18364
+ * 'ord_789',
16777
18365
  * );
16778
- * // Embed: `https://app.fullscript.com/embed?token=${grant.token}`
16779
- * console.log('Token expires:', grant.expires_at);
18366
+ * console.log(order.payment_total, order.line_items);
16780
18367
  * ```
16781
18368
  */
16782
- sessionGrant: async (connectorId, workspaceId, patientId, options) => rb.execute(
16783
- postConnectorsFullscriptSessionGrant,
18369
+ getOrder: async (connectorId, workspaceId, orderId, options) => rb.rawPost(
18370
+ `/connectors/fullscript/orders/get`,
16784
18371
  {
16785
- body: {
16786
- data: {
16787
- type: "connector_instance",
16788
- attributes: {
16789
- connector_id: connectorId,
16790
- workspace_id: workspaceId,
16791
- patient_id: patientId
16792
- }
16793
- }
16794
- }
18372
+ workspace_id: workspaceId,
18373
+ connector_id: connectorId,
18374
+ order_id: orderId
16795
18375
  },
16796
18376
  options
16797
- ),
18377
+ ).then((r) => r.data),
16798
18378
  /**
16799
18379
  * Fullscript-specific OAuth helpers.
16800
18380
  *
@@ -16829,10 +18409,8 @@ function createConnectorsNamespace(rb) {
16829
18409
  body: {
16830
18410
  data: {
16831
18411
  type: "connector_instance",
16832
- attributes: {
16833
- connector_type: "fullscript",
16834
- workspace_id: workspaceId
16835
- }
18412
+ connector_type: "fullscript",
18413
+ workspace_id: workspaceId
16836
18414
  }
16837
18415
  }
16838
18416
  },
@@ -16874,14 +18452,12 @@ function createConnectorsNamespace(rb) {
16874
18452
  body: {
16875
18453
  data: {
16876
18454
  type: "connector_instance",
16877
- attributes: {
16878
- connector_type: "fullscript",
16879
- code,
16880
- state,
16881
- workspace_id: workspaceId,
16882
- ...redirectUri !== void 0 && {
16883
- redirect_uri: redirectUri
16884
- }
18455
+ connector_type: "fullscript",
18456
+ code,
18457
+ state,
18458
+ workspace_id: workspaceId,
18459
+ ...redirectUri !== void 0 && {
18460
+ redirect_uri: redirectUri
16885
18461
  }
16886
18462
  }
16887
18463
  }
@@ -17570,7 +19146,7 @@ function createCrmNamespace(rb) {
17570
19146
  archive: async (id, options) => {
17571
19147
  return rb.execute(
17572
19148
  patchCrmContactsByIdArchive,
17573
- { path: { id } },
19149
+ { path: { id }, body: { data: { type: "crm_contact", id } } },
17574
19150
  options
17575
19151
  );
17576
19152
  },
@@ -19346,7 +20922,7 @@ function createCampaignsNamespace(rb) {
19346
20922
  postEmailMarketingCampaignsByIdCreateFollowup,
19347
20923
  {
19348
20924
  path: { id },
19349
- body: { data: { type: "email_marketing_campaign", attributes } }
20925
+ body: { data: { type: "email_marketing_campaign", ...attributes } }
19350
20926
  },
19351
20927
  options
19352
20928
  );
@@ -19408,7 +20984,7 @@ function createCampaignsNamespace(rb) {
19408
20984
  {
19409
20985
  data: {
19410
20986
  type: "campaign-template",
19411
- attributes: { body_mjml: mjml }
20987
+ body_mjml: mjml
19412
20988
  }
19413
20989
  },
19414
20990
  options
@@ -22386,6 +23962,9 @@ var ConfirmEmailSchema = z2.object({
22386
23962
  email: z2.string().email(),
22387
23963
  confirmation_token: z2.string().min(1)
22388
23964
  });
23965
+ var RefreshTokenSchema = z2.object({
23966
+ refresh_token: z2.string().min(1)
23967
+ });
22389
23968
  var ResetPasswordWithTokenSchema = z2.object({
22390
23969
  token: z2.string().min(1),
22391
23970
  password: z2.string().min(8),
@@ -22429,6 +24008,30 @@ function createIdentityNamespace(rb, baseUrl) {
22429
24008
  options
22430
24009
  );
22431
24010
  },
24011
+ /**
24012
+ * Exchange a refresh token for a new JWT + refresh token pair.
24013
+ *
24014
+ * The old refresh token is revoked on success (token rotation).
24015
+ * Use the new refresh token for subsequent refresh calls.
24016
+ *
24017
+ * @param refreshToken - The refresh token (srt_ prefix) from login or a previous refresh
24018
+ * @returns New token pair with rotated refresh token
24019
+ *
24020
+ * @example
24021
+ * ```typescript
24022
+ * const { token, refresh_token } = await client.identity.refresh(storedRefreshToken);
24023
+ * // Store the new refresh_token for next refresh
24024
+ * // Use token as the new Bearer token
24025
+ * ```
24026
+ */
24027
+ refresh: async (refreshToken, options) => {
24028
+ RefreshTokenSchema.parse({ refresh_token: refreshToken });
24029
+ return rb.rawPost(
24030
+ "/users/auth/refresh",
24031
+ { refresh_token: refreshToken },
24032
+ options
24033
+ );
24034
+ },
22432
24035
  /**
22433
24036
  * Register a new user account — returns the newly created user.
22434
24037
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
@@ -24071,19 +25674,41 @@ function createPlatformNamespace(rb) {
24071
25674
  *
24072
25675
  * @example
24073
25676
  * ```typescript
24074
- * const client = new GptClient({ apiKey: 'sk_app_...' });
25677
+ * // Using workspace_id shorthand (recommended):
24075
25678
  * const invite = await client.platform.invitations.create({
24076
25679
  * email: 'new.clinician@hospital.org',
24077
25680
  * workspace_id: 'ws_abc123',
24078
25681
  * role: 'member',
24079
25682
  * });
24080
- * console.log('Invitation sent:', invite.id);
25683
+ *
25684
+ * // Using explicit scope_type + scope_id:
25685
+ * const invite2 = await client.platform.invitations.create({
25686
+ * email: 'admin@hospital.org',
25687
+ * scope_type: 'tenant',
25688
+ * scope_id: tenantId,
25689
+ * role: 'admin',
25690
+ * });
24081
25691
  * ```
24082
25692
  */
24083
25693
  create: async (attributes, options) => {
25694
+ const { workspace_id, tenant_id, ...rest } = attributes;
25695
+ let resolved = { ...rest };
25696
+ if (workspace_id && !resolved.scope_type) {
25697
+ resolved = {
25698
+ ...resolved,
25699
+ scope_type: "workspace",
25700
+ scope_id: workspace_id
25701
+ };
25702
+ } else if (tenant_id && !resolved.scope_type) {
25703
+ resolved = {
25704
+ ...resolved,
25705
+ scope_type: "tenant",
25706
+ scope_id: tenant_id
25707
+ };
25708
+ }
24084
25709
  return rb.execute(
24085
25710
  postInvitations,
24086
- { body: { data: { type: "invitation", attributes } } },
25711
+ { body: { data: { type: "invitation", attributes: resolved } } },
24087
25712
  options
24088
25713
  );
24089
25714
  },
@@ -26891,6 +28516,29 @@ function createThreadsNamespace(rb) {
26891
28516
  options
26892
28517
  );
26893
28518
  },
28519
+ /**
28520
+ * Lists only the calling user's threads within their current workspace.
28521
+ *
28522
+ * Unlike {@link list} which returns all threads in the workspace (for admin
28523
+ * visibility), `listMine` scopes results to threads owned by the
28524
+ * authenticated user. This is the recommended method for end-user UIs.
28525
+ *
28526
+ * @param options - Optional pagination and request options.
28527
+ * @returns A promise that resolves to an array of the user's `Thread` objects.
28528
+ *
28529
+ * @example
28530
+ * ```typescript
28531
+ * const myThreads = await client.threads.listMine();
28532
+ * myThreads.forEach(t => console.log(t.attributes.title));
28533
+ * ```
28534
+ */
28535
+ listMine: async (options) => {
28536
+ return rb.execute(
28537
+ getThreadsMine,
28538
+ buildPageQuery(options?.page, options?.pageSize),
28539
+ options
28540
+ );
28541
+ },
26894
28542
  /**
26895
28543
  * Fetches all threads in the workspace by transparently paginating through
26896
28544
  * every page until exhausted.
@@ -26942,7 +28590,7 @@ function createThreadsNamespace(rb) {
26942
28590
  create: async (attributes, options) => {
26943
28591
  return rb.execute(
26944
28592
  postThreads,
26945
- { body: { data: { type: "thread", attributes } } },
28593
+ { body: { data: { type: "chat-thread", attributes } } },
26946
28594
  options
26947
28595
  );
26948
28596
  },
@@ -26968,7 +28616,10 @@ function createThreadsNamespace(rb) {
26968
28616
  update: async (id, attributes, options) => {
26969
28617
  return rb.execute(
26970
28618
  patchThreadsById,
26971
- { path: { id }, body: { data: { id, type: "thread", attributes } } },
28619
+ {
28620
+ path: { id },
28621
+ body: { data: { id, type: "chat-thread", attributes } }
28622
+ },
26972
28623
  options
26973
28624
  );
26974
28625
  },
@@ -27128,7 +28779,7 @@ function createThreadsNamespace(rb) {
27128
28779
  * // Streaming
27129
28780
  * const stream = await client.threads.messages.stream('thr_01HXYZ...', { content: 'Hello!' });
27130
28781
  * for await (const chunk of stream) {
27131
- * process.stdout.write(chunk.delta ?? '');
28782
+ * if (chunk.type === 'token') process.stdout.write(chunk.content ?? '');
27132
28783
  * }
27133
28784
  */
27134
28785
  messages: {
@@ -27190,14 +28841,12 @@ function createThreadsNamespace(rb) {
27190
28841
  path: { id: threadId },
27191
28842
  body: {
27192
28843
  data: {
27193
- type: "thread",
27194
- attributes: {
27195
- content,
27196
- ...rest,
27197
- metadata: mergeWithBrowserContext(
27198
- metadata
27199
- )
27200
- }
28844
+ type: "chat-thread",
28845
+ content,
28846
+ ...rest,
28847
+ metadata: mergeWithBrowserContext(
28848
+ metadata
28849
+ )
27201
28850
  }
27202
28851
  }
27203
28852
  },
@@ -27205,38 +28854,48 @@ function createThreadsNamespace(rb) {
27205
28854
  );
27206
28855
  },
27207
28856
  /**
27208
- * Sends a message to a thread and streams the AI response token-by-token
27209
- * via Server-Sent Events (SSE).
28857
+ * Sends a message to a thread and streams the AI response via Server-Sent Events (SSE).
28858
+ *
28859
+ * For agent-backed threads, the stream includes the full execution lifecycle:
28860
+ * - `token` — incremental LLM output tokens
28861
+ * - `tool_call` — agent is calling a tool (name + arguments)
28862
+ * - `tool_result` — tool execution completed (name + summary)
28863
+ * - `iteration_complete` — LLM loop iteration finished
28864
+ * - `approval_required` — human approval needed for a sensitive tool
28865
+ * - `done` — stream complete, includes metadata with execution_id
28866
+ * - `error` — stream error
27210
28867
  *
27211
- * Returns an `AsyncIterableIterator` that yields `StreamMessageChunk`
27212
- * objects as tokens are generated. Consume with a `for await` loop. The
27213
- * stream closes automatically when the assistant finishes generating its
27214
- * response.
28868
+ * For RAG threads (no agent), only `token`, `done`, and `error` are emitted.
27215
28869
  *
27216
28870
  * SSE security limits: 5-minute idle timeout, 10,000 chunk maximum,
27217
28871
  * 10 MB buffer size limit.
27218
28872
  *
27219
28873
  * @param threadId - The UUID of the thread to stream a message to.
27220
28874
  * @param body - The message payload, including at minimum `content` (string).
27221
- * Additional fields such as `role` or `metadata` are passed through.
27222
28875
  * @param options - Optional request options (e.g. custom headers, abort signal).
27223
28876
  * @param streamOptions - Optional streaming configuration (e.g. chunk timeout).
27224
28877
  * @returns A promise that resolves to an `AsyncIterableIterator<StreamMessageChunk>`.
27225
- * Each yielded chunk contains a `delta` string (the new token text) and
27226
- * optional event metadata.
27227
28878
  *
27228
28879
  * @example
27229
- * const client = new GptClient({ apiKey: 'sk_app_...' });
27230
- *
27231
- * const stream = await client.threads.messages.stream(
27232
- * 'thr_01HXYZ...',
27233
- * { content: 'Summarize the key clauses in this contract.' },
27234
- * );
27235
- *
27236
- * for await (const chunk of stream) {
27237
- * process.stdout.write(chunk.delta ?? '');
28880
+ * ```typescript
28881
+ * const stream = await client.threads.messages.stream(threadId, { content: 'Summarize the contract.' });
28882
+ * for await (const event of stream) {
28883
+ * switch (event.type) {
28884
+ * case 'token':
28885
+ * process.stdout.write(event.content ?? '');
28886
+ * break;
28887
+ * case 'tool_call':
28888
+ * console.log(`Tool: ${event.data.name}`, event.data.arguments);
28889
+ * break;
28890
+ * case 'tool_result':
28891
+ * console.log(`Result: ${event.data.summary}`);
28892
+ * break;
28893
+ * case 'done':
28894
+ * console.log('Complete', event.metadata);
28895
+ * break;
28896
+ * }
27238
28897
  * }
27239
- * console.log(); // newline after streaming completes
28898
+ * ```
27240
28899
  */
27241
28900
  stream: async (threadId, body, options, streamOptions) => {
27242
28901
  const { content, metadata, ...rest } = body;
@@ -27244,14 +28903,12 @@ function createThreadsNamespace(rb) {
27244
28903
  `/threads/${threadId}/messages/stream`,
27245
28904
  {
27246
28905
  data: {
27247
- type: "message",
27248
- attributes: {
27249
- content,
27250
- ...rest,
27251
- metadata: mergeWithBrowserContext(
27252
- metadata
27253
- )
27254
- }
28906
+ type: "chat-message",
28907
+ content,
28908
+ ...rest,
28909
+ metadata: mergeWithBrowserContext(
28910
+ metadata
28911
+ )
27255
28912
  }
27256
28913
  },
27257
28914
  options,
@@ -27329,7 +28986,7 @@ function createThreadsNamespace(rb) {
27329
28986
  postThreadsByIdComplete,
27330
28987
  {
27331
28988
  path: { id: threadId },
27332
- body: { data: { type: "thread", attributes: {} } }
28989
+ body: { data: { type: "chat-thread" } }
27333
28990
  },
27334
28991
  options
27335
28992
  );
@@ -27337,13 +28994,12 @@ function createThreadsNamespace(rb) {
27337
28994
  /**
27338
28995
  * Trigger AI inference on a thread and receive the response via Server-Sent Events.
27339
28996
  *
27340
- * Identical to {@link complete} in behavior but delivers the result as an SSE
27341
- * stream. The stream yields a single `StreamMessageChunk` with `done: true`
27342
- * when the AI response is ready.
28997
+ * For agent-backed threads (when execution bridge is enabled), this streams
28998
+ * the full execution lifecycle including `token`, `tool_call`, `tool_result`,
28999
+ * `iteration_complete`, `approval_required`, `done`, and `error` events.
27343
29000
  *
27344
- * Note: This endpoint delivers the full response as one event (not token-by-token).
27345
- * It gives the frontend a consistent SSE interface for uniform handling of both
27346
- * streaming and non-streaming completions.
29001
+ * For RAG threads or when the bridge is disabled, delivers the full response
29002
+ * as a single `done` event.
27347
29003
  *
27348
29004
  * @param threadId - The UUID of the thread to run AI completion on.
27349
29005
  * @param options - Optional request options (e.g. abort signal).
@@ -27352,11 +29008,19 @@ function createThreadsNamespace(rb) {
27352
29008
  *
27353
29009
  * @example
27354
29010
  * ```typescript
27355
- * const client = new GptClient({ apiKey: 'sk_app_...' });
27356
- *
27357
29011
  * const stream = await client.threads.completeStream('thr_01HXYZ...');
27358
- * for await (const chunk of stream) {
27359
- * if (chunk.type === 'done') console.log(`AI response: ${chunk.content}`);
29012
+ * for await (const event of stream) {
29013
+ * switch (event.type) {
29014
+ * case 'token':
29015
+ * process.stdout.write(event.content ?? '');
29016
+ * break;
29017
+ * case 'tool_call':
29018
+ * console.log(`Tool: ${event.data.name}`);
29019
+ * break;
29020
+ * case 'done':
29021
+ * console.log('Complete', event.metadata);
29022
+ * break;
29023
+ * }
27360
29024
  * }
27361
29025
  * ```
27362
29026
  */
@@ -29604,11 +31268,8 @@ function createSocialNamespace(rb) {
29604
31268
  path: { id },
29605
31269
  body: {
29606
31270
  data: {
29607
- type: "social_campaign",
29608
- attributes: {
29609
- campaign_id: id,
29610
- workspace_id: workspaceId
29611
- }
31271
+ campaign_id: id,
31272
+ workspace_id: workspaceId
29612
31273
  }
29613
31274
  }
29614
31275
  },
@@ -29623,12 +31284,9 @@ function createSocialNamespace(rb) {
29623
31284
  path: { id },
29624
31285
  body: {
29625
31286
  data: {
29626
- type: "social_campaign",
29627
- attributes: {
29628
- campaign_id: id,
29629
- workspace_id: workspaceId,
29630
- social_account_id: socialAccountId
29631
- }
31287
+ campaign_id: id,
31288
+ workspace_id: workspaceId,
31289
+ social_account_id: socialAccountId
29632
31290
  }
29633
31291
  }
29634
31292
  },
@@ -29702,6 +31360,26 @@ function createSocialNamespace(rb) {
29702
31360
  options
29703
31361
  );
29704
31362
  },
31363
+ /**
31364
+ * List trending snapshots within a date range.
31365
+ * @param from - Start date (ISO 8601 string)
31366
+ * @param to - End date (ISO 8601 string)
31367
+ * @returns Array of TrendingSnapshot records in the range
31368
+ * @example
31369
+ * ```typescript
31370
+ * const snapshots = await client.social.trending.listByDateRange(
31371
+ * '2026-03-01T00:00:00Z',
31372
+ * '2026-03-21T23:59:59Z',
31373
+ * );
31374
+ * ```
31375
+ */
31376
+ listByDateRange: async (from, to, options) => {
31377
+ return rb.execute(
31378
+ getSocialTrendingHistoryRange,
31379
+ { query: { from, to } },
31380
+ options
31381
+ );
31382
+ },
29705
31383
  /** Trending snapshot items — individual content pieces within a snapshot. */
29706
31384
  items: {
29707
31385
  /** Get a single trending item by ID. */
@@ -29810,22 +31488,6 @@ function createSocialNamespace(rb) {
29810
31488
  { path: { id } },
29811
31489
  options
29812
31490
  );
29813
- },
29814
- /**
29815
- * Mark a watch as triggered (updates last_triggered_at).
29816
- * @param id - Watch UUID
29817
- */
29818
- markTriggered: async (id, options) => {
29819
- return rb.execute(
29820
- patchSocialTrendingWatchesByIdMarkTriggered,
29821
- {
29822
- path: { id },
29823
- body: {
29824
- data: { type: "trending-watch", id, attributes: {} }
29825
- }
29826
- },
29827
- options
29828
- );
29829
31491
  }
29830
31492
  }
29831
31493
  };
@@ -30255,6 +31917,235 @@ function createPermissionsNamespace(rb) {
30255
31917
  };
30256
31918
  }
30257
31919
 
31920
+ // src/namespaces/channels.ts
31921
+ function mapResponse(raw) {
31922
+ return {
31923
+ channelToken: raw.channel_token,
31924
+ expiresAt: raw.expires_at,
31925
+ channels: raw.channels,
31926
+ workspaceId: raw.workspace_id
31927
+ };
31928
+ }
31929
+ function createChannelsNamespace(rb) {
31930
+ return {
31931
+ /**
31932
+ * Exchange the current bearer token for a scoped channel token.
31933
+ *
31934
+ * The returned token is short-lived (5 minutes) and restricted to the
31935
+ * specified workspace and channel patterns. It cannot be used for REST
31936
+ * API calls.
31937
+ *
31938
+ * @param request - Workspace and channel scope
31939
+ * @param options - Request options (signal, etc.)
31940
+ * @returns Channel token response with token string and expiry
31941
+ *
31942
+ * @example
31943
+ * ```typescript
31944
+ * const { channelToken, expiresAt } = await client.channels.authorize({
31945
+ * workspaceId: "ws-uuid",
31946
+ * channels: ["crm", "scheduling", "clinical"],
31947
+ * });
31948
+ * ```
31949
+ */
31950
+ async authorize(request, options) {
31951
+ const raw = await rb.rawPost(
31952
+ "/channels/token",
31953
+ {
31954
+ workspace_id: request.workspaceId,
31955
+ channels: request.channels
31956
+ },
31957
+ options
31958
+ );
31959
+ return mapResponse(raw);
31960
+ },
31961
+ /**
31962
+ * Create a token manager that automatically refreshes the channel token
31963
+ * before it expires. Use with Phoenix.js Socket:
31964
+ *
31965
+ * ```typescript
31966
+ * const manager = await client.channels.createTokenManager({
31967
+ * workspaceId: "ws-uuid",
31968
+ * channels: ["chat_thread"],
31969
+ * });
31970
+ *
31971
+ * const socket = new Socket(socketUrl, {
31972
+ * params: () => ({ token: manager.getToken() }),
31973
+ * });
31974
+ * socket.connect();
31975
+ *
31976
+ * // On cleanup:
31977
+ * manager.destroy();
31978
+ * socket.disconnect();
31979
+ * ```
31980
+ *
31981
+ * @param options - Workspace, channels, and optional refresh buffer
31982
+ * @returns A SocketManager with getToken(), refresh(), and destroy()
31983
+ */
31984
+ async createTokenManager(options) {
31985
+ const refreshBuffer = options.refreshBufferMs ?? 6e4;
31986
+ let currentToken = "";
31987
+ let refreshTimer = null;
31988
+ let destroyed = false;
31989
+ const fetchToken = async () => {
31990
+ const raw = await rb.rawPost(
31991
+ "/channels/token",
31992
+ {
31993
+ workspace_id: options.workspaceId,
31994
+ channels: options.channels
31995
+ }
31996
+ );
31997
+ currentToken = raw.channel_token;
31998
+ if (!destroyed) {
31999
+ const expiresAt = new Date(raw.expires_at).getTime();
32000
+ const now = Date.now();
32001
+ const delay = Math.max(expiresAt - now - refreshBuffer, 1e3);
32002
+ if (refreshTimer) clearTimeout(refreshTimer);
32003
+ refreshTimer = setTimeout(() => {
32004
+ fetchToken().catch((err) => {
32005
+ console.warn("[gpt-platform] Channel token refresh failed:", err);
32006
+ if (options.onAuthError) {
32007
+ options.onAuthError(
32008
+ err instanceof Error ? err : new Error(String(err))
32009
+ );
32010
+ }
32011
+ });
32012
+ }, delay);
32013
+ }
32014
+ return currentToken;
32015
+ };
32016
+ await fetchToken();
32017
+ return {
32018
+ getToken: () => currentToken,
32019
+ refresh: fetchToken,
32020
+ destroy: () => {
32021
+ destroyed = true;
32022
+ if (refreshTimer) {
32023
+ clearTimeout(refreshTimer);
32024
+ refreshTimer = null;
32025
+ }
32026
+ }
32027
+ };
32028
+ }
32029
+ };
32030
+ }
32031
+
32032
+ // src/namespaces/imports.ts
32033
+ function createImportsNamespace(rb) {
32034
+ return {
32035
+ /**
32036
+ * List available import adapter types for the current application.
32037
+ * @returns Array of adapter metadata objects
32038
+ * @example
32039
+ * const adapters = await sdk.imports.listAdapters();
32040
+ * // [{ key: "clinical:goal", display_name: "Clinical Goals", ... }]
32041
+ */
32042
+ listAdapters: async (options) => rb.rawGet(`/imports/adapters`, options).then((r) => r.data),
32043
+ /**
32044
+ * Submit a JSON batch import.
32045
+ * @param params - adapter key, workspace_id, and rows array
32046
+ * @returns Import job with id and initial status
32047
+ * @example
32048
+ * const result = await sdk.imports.batch({
32049
+ * adapter: "clinical:goal",
32050
+ * workspace_id: "ws_123",
32051
+ * rows: [{ contact_id: "...", title: "Increase water intake", goal_type: "hydration" }]
32052
+ * });
32053
+ */
32054
+ batch: async (params, options) => rb.rawPost(
32055
+ `/imports/batch`,
32056
+ {
32057
+ adapter_key: params.adapter,
32058
+ workspace_id: params.workspace_id,
32059
+ rows: params.rows,
32060
+ metadata: params.metadata
32061
+ },
32062
+ options
32063
+ ),
32064
+ /**
32065
+ * Upload a CSV file for import.
32066
+ * @param file - CSV file (File or Blob)
32067
+ * @param params - adapter key and workspace_id
32068
+ * @returns Import job with id and initial status
32069
+ * @example
32070
+ * const result = await sdk.imports.upload(csvFile, {
32071
+ * adapter: "clinical:patient_bundle",
32072
+ * workspace_id: "ws_123"
32073
+ * });
32074
+ */
32075
+ upload: async (file, params, options) => {
32076
+ const formData = new FormData();
32077
+ formData.append("file", file);
32078
+ formData.append("adapter_key", params.adapter);
32079
+ formData.append("workspace_id", params.workspace_id);
32080
+ if (params.column_mapping)
32081
+ formData.append(
32082
+ "column_mapping",
32083
+ JSON.stringify(params.column_mapping)
32084
+ );
32085
+ if (params.metadata)
32086
+ formData.append("metadata", JSON.stringify(params.metadata));
32087
+ return rb.rawPostMultipart(`/imports/upload`, formData, options);
32088
+ },
32089
+ /**
32090
+ * List imports for a workspace with optional filters.
32091
+ * @param params - workspace_id required, adapter and status optional
32092
+ * @returns Paginated list of imports
32093
+ * @example
32094
+ * const imports = await sdk.imports.list({ workspace_id: "ws_123", adapter: "crm:contact" });
32095
+ */
32096
+ list: async (params, options) => rb.rawGet(
32097
+ `/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}` : ""}`,
32098
+ options
32099
+ ),
32100
+ /**
32101
+ * Get a single import by ID.
32102
+ * @param id - Import UUID
32103
+ * @returns Full import record including error_report
32104
+ * @example
32105
+ * const imp = await sdk.imports.get("uuid-here");
32106
+ */
32107
+ get: async (id, options) => rb.rawGet(`/imports/${id}`, options).then((r) => r.data),
32108
+ /**
32109
+ * Get per-row outcomes for a chunked import.
32110
+ * @param importId - Import UUID
32111
+ * @param params - Pagination options
32112
+ * @returns Paginated list of row outcomes
32113
+ * @example
32114
+ * const rows = await sdk.imports.rows("uuid-here", { offset: 0, limit: 50 });
32115
+ */
32116
+ rows: async (importId, params, options) => rb.rawGet(
32117
+ `/imports/${importId}/rows${params?.offset !== void 0 ? `?offset=${params.offset}` : ""}${params?.limit !== void 0 ? `${params?.offset !== void 0 ? "&" : "?"}limit=${params.limit}` : ""}`,
32118
+ options
32119
+ ),
32120
+ /**
32121
+ * Confirm a validated import for commit.
32122
+ * @param id - Import UUID
32123
+ * @param params - workspace_id for authorization
32124
+ * @returns Updated import with status "committing"
32125
+ * @example
32126
+ * await sdk.imports.confirm("uuid-here", { workspace_id: "ws_123" });
32127
+ */
32128
+ confirm: async (id, params, options) => rb.rawPost(
32129
+ `/imports/${id}/confirm`,
32130
+ params,
32131
+ options
32132
+ ),
32133
+ /**
32134
+ * Cancel a validated import.
32135
+ * @param id - Import UUID
32136
+ * @param params - workspace_id for authorization
32137
+ * @returns Updated import with status "cancelled"
32138
+ * @example
32139
+ * await sdk.imports.cancel("uuid-here", { workspace_id: "ws_123" });
32140
+ */
32141
+ cancel: async (id, params, options) => rb.rawPost(
32142
+ `/imports/${id}/cancel`,
32143
+ params,
32144
+ options
32145
+ )
32146
+ };
32147
+ }
32148
+
30258
32149
  // src/streaming.ts
30259
32150
  var DEFAULT_STREAM_TIMEOUT = 3e5;
30260
32151
  var DEFAULT_MAX_CHUNKS = 1e4;
@@ -30345,10 +32236,16 @@ async function* streamMessage(response, options = {}) {
30345
32236
  async function collectStreamedMessage(stream) {
30346
32237
  let fullMessage = "";
30347
32238
  for await (const chunk of stream) {
30348
- if (chunk.type === "content" && chunk.content) {
32239
+ if ((chunk.type === "token" || chunk.type === "content") && "content" in chunk && chunk.content) {
30349
32240
  fullMessage += chunk.content;
30350
32241
  } else if (chunk.type === "error") {
30351
- throw new ServerError(chunk.error || "Stream error");
32242
+ const errorMsg = "error" in chunk ? chunk.error : "content" in chunk ? chunk.content : "Stream error";
32243
+ throw new ServerError(errorMsg || "Stream error");
32244
+ } else if (chunk.type === "done") {
32245
+ if ("content" in chunk && chunk.content) {
32246
+ fullMessage = chunk.content;
32247
+ }
32248
+ break;
30352
32249
  }
30353
32250
  }
30354
32251
  return fullMessage;
@@ -30736,6 +32633,8 @@ var GptClient = class extends BaseClient {
30736
32633
  this.roles = createRolesNamespace(rb);
30737
32634
  this.permissions = createPermissionsNamespace(rb);
30738
32635
  this.memory = createMemoryNamespace(rb);
32636
+ this.channels = createChannelsNamespace(rb);
32637
+ this.imports = createImportsNamespace(rb);
30739
32638
  }
30740
32639
  /**
30741
32640
  * Subscribe to SDK lifecycle events.
@@ -30967,6 +32866,7 @@ export {
30967
32866
  buildHeaders,
30968
32867
  buildUserAgent,
30969
32868
  collectStreamedMessage,
32869
+ createImportsNamespace,
30970
32870
  handleApiError,
30971
32871
  isBrowserEnvironment,
30972
32872
  isSecureUrl,