@gpt-platform/client 0.8.5 → 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.5";
1273
- var DEFAULT_API_VERSION = "2026-03-19";
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,7 +8817,8 @@ 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.
8519
- * @param opts.workspace_id - The workspace to execute in. Required for `sk_app_` key auth.
8820
+ * @param opts.workspace_id - The workspace to execute in. **Required** unless
8821
+ * `workspaceId` was set in the `GptClient` constructor config.
8520
8822
  * @param opts.model_id - Override model for this execution only (e.g., "anthropic/claude-sonnet-4").
8521
8823
  * Highest priority in the model resolution chain.
8522
8824
  * @returns The created execution record with status `pending`.
@@ -9020,7 +9322,7 @@ function createAiNamespace(rb) {
9020
9322
  {
9021
9323
  body: {
9022
9324
  data: {
9023
- type: "conversation",
9325
+ type: "chat-conversation",
9024
9326
  attributes: attributes ?? {}
9025
9327
  }
9026
9328
  }
@@ -9099,7 +9401,7 @@ function createAiNamespace(rb) {
9099
9401
  {
9100
9402
  body: {
9101
9403
  data: {
9102
- type: "ai-message",
9404
+ type: "chat-ai-message",
9103
9405
  ...body,
9104
9406
  conversation_id: conversationId
9105
9407
  }
@@ -10114,8 +10416,8 @@ function createBillingNamespace(rb) {
10114
10416
  /**
10115
10417
  * Feature usage records — per-tenant usage tracking for metered features.
10116
10418
  *
10117
- * Read-only access to usage records that track how many times each tenant
10118
- * 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.
10119
10421
  */
10120
10422
  featureUsages: {
10121
10423
  /** List all feature usage records. */
@@ -10139,6 +10441,37 @@ function createBillingNamespace(rb) {
10139
10441
  options
10140
10442
  );
10141
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;
10142
10475
  }
10143
10476
  },
10144
10477
  /**
@@ -11331,7 +11664,7 @@ function createClinicalNamespace(rb) {
11331
11664
  }
11332
11665
  },
11333
11666
  /**
11334
- * Manage clinical sessions (practitionerpatient encounters).
11667
+ * Manage clinical sessions (practitioner-patient encounters).
11335
11668
  */
11336
11669
  sessions: {
11337
11670
  /**
@@ -11500,13 +11833,76 @@ function createClinicalNamespace(rb) {
11500
11833
  options
11501
11834
  ),
11502
11835
  /**
11503
- * Delete a clinical note.
11836
+ * Archive (soft-delete) a note.
11504
11837
  *
11838
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
11839
+ * Use `permanentDelete()` for irreversible removal.
11505
11840
  * @param id - Note UUID
11506
11841
  * @param options - Request options
11507
- * @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
11508
11900
  */
11509
- delete: async (id, options) => rb.executeDelete(deleteClinicalNotesById, { path: { id } }, options),
11901
+ listArchived: async (params, options) => rb.execute(
11902
+ getClinicalNotesArchived,
11903
+ params ?? {},
11904
+ options
11905
+ ),
11510
11906
  /**
11511
11907
  * Approve a clinical note (HITL workflow).
11512
11908
  *
@@ -11668,16 +12064,81 @@ function createClinicalNamespace(rb) {
11668
12064
  options
11669
12065
  ),
11670
12066
  /**
11671
- * Delete a health metric entry.
12067
+ * Archive (soft-delete) a health metric.
11672
12068
  *
12069
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12070
+ * Use `permanentDelete()` for irreversible removal.
11673
12071
  * @param id - HealthMetric UUID
11674
12072
  * @param options - Request options
11675
- * @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
11676
12125
  */
11677
- delete: async (id, options) => rb.executeDelete(
11678
- deleteClinicalHealthMetricsById,
12126
+ permanentDelete: async (id, options) => rb.executeDelete(
12127
+ deleteClinicalHealthMetricsByIdPermanent,
11679
12128
  { path: { id } },
11680
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
11681
12142
  )
11682
12143
  },
11683
12144
  /**
@@ -11737,16 +12198,75 @@ function createClinicalNamespace(rb) {
11737
12198
  options
11738
12199
  ),
11739
12200
  /**
11740
- * Delete a meal plan.
12201
+ * Archive (soft-delete) a meal plan.
11741
12202
  *
12203
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12204
+ * Use `permanentDelete()` for irreversible removal.
11742
12205
  * @param id - MealPlan UUID
11743
12206
  * @param options - Request options
11744
- * @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
12238
+ */
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
11745
12253
  */
11746
- delete: async (id, options) => rb.executeDelete(
11747
- deleteClinicalMealPlansById,
12254
+ permanentDelete: async (id, options) => rb.executeDelete(
12255
+ deleteClinicalMealPlansByIdPermanent,
11748
12256
  { path: { id } },
11749
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
11750
12270
  )
11751
12271
  },
11752
12272
  /**
@@ -11806,17 +12326,82 @@ function createClinicalNamespace(rb) {
11806
12326
  options
11807
12327
  ),
11808
12328
  /**
11809
- * Delete a client goal.
12329
+ * Archive (soft-delete) a client goal.
11810
12330
  *
12331
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12332
+ * Use `permanentDelete()` for irreversible removal.
11811
12333
  * @param id - ClientGoal UUID
11812
12334
  * @param options - Request options
11813
- * @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
11814
12387
  */
11815
- delete: async (id, options) => rb.executeDelete(
11816
- deleteClinicalClientGoalsById,
12388
+ permanentDelete: async (id, options) => rb.executeDelete(
12389
+ deleteClinicalClientGoalsByIdPermanent,
11817
12390
  { path: { id } },
11818
12391
  options
11819
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
+ ),
11820
12405
  /**
11821
12406
  * Batch reorder client goals by updating their positions.
11822
12407
  *
@@ -11901,38 +12486,103 @@ function createClinicalNamespace(rb) {
11901
12486
  options
11902
12487
  ),
11903
12488
  /**
11904
- * Delete a supplement prescription.
12489
+ * Archive (soft-delete) a supplement prescription.
11905
12490
  *
12491
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12492
+ * Use `permanentDelete()` for irreversible removal.
11906
12493
  * @param id - ClientSupplement UUID
11907
12494
  * @param options - Request options
11908
- * @returns `true` on successful deletion
12495
+ * @returns Archived {@link ClinicalClientSupplement} record
11909
12496
  */
11910
- delete: async (id, options) => rb.executeDelete(
11911
- deleteClinicalClientSupplementsById,
11912
- { path: { id } },
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
+ },
11913
12505
  options
11914
- )
11915
- },
11916
- /**
11917
- * Manage clinical deliveries (care plan items sent to patients).
11918
- */
11919
- deliveries: {
12506
+ ),
11920
12507
  /**
11921
- * List deliveries, filtered by patient/workspace.
12508
+ * Archive (soft-delete) a supplement prescription.
11922
12509
  *
11923
- * @param params - Filter/pagination parameters
12510
+ * @param id - ClientSupplement UUID
11924
12511
  * @param options - Request options
11925
- * @returns Array of {@link ClinicalDelivery} records
12512
+ * @returns Archived {@link ClinicalClientSupplement} record
11926
12513
  */
11927
- list: async (params, options) => rb.execute(
11928
- getClinicalDeliveries,
11929
- params ?? {},
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
+ },
11930
12522
  options
11931
12523
  ),
11932
12524
  /**
11933
- * Get a single delivery by ID.
12525
+ * Restore an archived supplement prescription.
11934
12526
  *
11935
- * @param id - Delivery UUID
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
+ /**
12567
+ * Manage clinical deliveries (care plan items sent to patients).
12568
+ */
12569
+ deliveries: {
12570
+ /**
12571
+ * List deliveries, filtered by patient/workspace.
12572
+ *
12573
+ * @param params - Filter/pagination parameters
12574
+ * @param options - Request options
12575
+ * @returns Array of {@link ClinicalDelivery} records
12576
+ */
12577
+ list: async (params, options) => rb.execute(
12578
+ getClinicalDeliveries,
12579
+ params ?? {},
12580
+ options
12581
+ ),
12582
+ /**
12583
+ * Get a single delivery by ID.
12584
+ *
12585
+ * @param id - Delivery UUID
11936
12586
  * @param options - Request options
11937
12587
  * @returns {@link ClinicalDelivery} record
11938
12588
  */
@@ -12032,17 +12682,82 @@ function createClinicalNamespace(rb) {
12032
12682
  options
12033
12683
  ),
12034
12684
  /**
12035
- * Delete a practice resource.
12685
+ * Archive (soft-delete) a practice resource.
12036
12686
  *
12687
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
12688
+ * Use `permanentDelete()` for irreversible removal.
12037
12689
  * @param id - PracticeResource UUID
12038
12690
  * @param options - Request options
12039
- * @returns `true` on successful deletion
12691
+ * @returns Archived {@link ClinicalPracticeResource} record
12040
12692
  */
12041
- delete: async (id, options) => rb.executeDelete(
12042
- 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,
12043
12746
  { path: { id } },
12044
12747
  options
12045
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
+ ),
12046
12761
  /**
12047
12762
  * List application-level catalog practice resources.
12048
12763
  *
@@ -12055,6 +12770,64 @@ function createClinicalNamespace(rb) {
12055
12770
  { query: params ?? {} },
12056
12771
  options
12057
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
+ ),
12058
12831
  /**
12059
12832
  * List distinct practice resource categories in a workspace.
12060
12833
  *
@@ -12094,7 +12867,88 @@ function createClinicalNamespace(rb) {
12094
12867
  listCatalogCategories: async (options) => rb.rawGet(
12095
12868
  `/clinical/practice-resources/categories/catalog`,
12096
12869
  options
12097
- )
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)
12098
12952
  },
12099
12953
  /**
12100
12954
  * Manage practice-level assessment and therapeutic tools.
@@ -12153,17 +13007,82 @@ function createClinicalNamespace(rb) {
12153
13007
  options
12154
13008
  ),
12155
13009
  /**
12156
- * Delete a practice tool.
13010
+ * Archive (soft-delete) a practice tool.
12157
13011
  *
13012
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13013
+ * Use `permanentDelete()` for irreversible removal.
12158
13014
  * @param id - PracticeTool UUID
12159
13015
  * @param options - Request options
12160
- * @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
13051
+ */
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
12161
13068
  */
12162
- delete: async (id, options) => rb.executeDelete(
12163
- deleteClinicalPracticeToolsById,
13069
+ permanentDelete: async (id, options) => rb.executeDelete(
13070
+ deleteClinicalPracticeToolsByIdPermanent,
12164
13071
  { path: { id } },
12165
13072
  options
12166
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
+ ),
12167
13086
  /**
12168
13087
  * List distinct practice tool categories in a workspace.
12169
13088
  *
@@ -12198,6 +13117,64 @@ function createClinicalNamespace(rb) {
12198
13117
  { query: params ?? {} },
12199
13118
  options
12200
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
+ ),
12201
13178
  /**
12202
13179
  * List distinct catalog practice tool categories.
12203
13180
  *
@@ -12215,7 +13192,87 @@ function createClinicalNamespace(rb) {
12215
13192
  listCatalogCategories: async (options) => rb.rawGet(
12216
13193
  `/clinical/practice-tools/categories/catalog`,
12217
13194
  options
12218
- )
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)
12219
13276
  },
12220
13277
  /**
12221
13278
  * Manage assignments of practice resources to patients.
@@ -12285,16 +13342,93 @@ function createClinicalNamespace(rb) {
12285
13342
  options
12286
13343
  ),
12287
13344
  /**
12288
- * Delete a resource assignment.
13345
+ * Archive (soft-delete) a resource assignment.
12289
13346
  *
13347
+ * @deprecated Use `archive()` instead. Now performs soft-delete, not permanent deletion.
13348
+ * Use `permanentDelete()` for irreversible removal.
12290
13349
  * @param id - ClientResourceAssignment UUID
12291
13350
  * @param options - Request options
12292
- * @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
13373
+ */
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
12293
13415
  */
12294
- delete: async (id, options) => rb.executeDelete(
12295
- deleteClinicalClientResourceAssignmentsById,
13416
+ permanentDelete: async (id, options) => rb.executeDelete(
13417
+ deleteClinicalClientResourceAssignmentsByIdPermanent,
12296
13418
  { path: { id } },
12297
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
12298
13432
  )
12299
13433
  },
12300
13434
  /**
@@ -12427,72 +13561,195 @@ function createClinicalNamespace(rb) {
12427
13561
  * @param options - Request options
12428
13562
  * @returns Created {@link ClinicalGoalTemplate} record
12429
13563
  */
12430
- create: async (attributes, options) => rb.execute(
12431
- postClinicalGoalTemplates,
12432
- { body: { data: { type: "clinical-goal-template", attributes } } },
13564
+ create: async (attributes, options) => rb.execute(
13565
+ postClinicalGoalTemplates,
13566
+ { body: { data: { type: "clinical-goal-template", attributes } } },
13567
+ options
13568
+ ),
13569
+ /**
13570
+ * Create a personalized template from an existing one.
13571
+ *
13572
+ * Copies all fields from the source template, sets `created_by_id` to the
13573
+ * current actor, and sets `source_template_id` as a reference.
13574
+ *
13575
+ * @param attributes - Must include `workspace_id` and `source_template_id`
13576
+ * @param options - Request options
13577
+ * @returns Created {@link ClinicalGoalTemplate} record
13578
+ *
13579
+ * @example
13580
+ * ```typescript
13581
+ * const personal = await client.clinical.goalTemplates.createFromExisting({
13582
+ * workspace_id: "ws_123",
13583
+ * source_template_id: "tmpl_abc",
13584
+ * });
13585
+ * ```
13586
+ */
13587
+ createFromExisting: async (attributes, options) => rb.execute(
13588
+ postClinicalGoalTemplatesFromExisting,
13589
+ { body: { data: { type: "clinical-goal-template", attributes } } },
13590
+ options
13591
+ ),
13592
+ /**
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 ?? {} },
12433
13695
  options
12434
13696
  ),
12435
13697
  /**
12436
- * Create a personalized template from an existing one.
12437
- *
12438
- * Copies all fields from the source template, sets `created_by_id` to the
12439
- * current actor, and sets `source_template_id` as a reference.
13698
+ * Archive (soft-delete) a catalog goal template.
12440
13699
  *
12441
- * @param attributes - Must include `workspace_id` and `source_template_id`
13700
+ * @param id - GoalTemplate UUID
12442
13701
  * @param options - Request options
12443
- * @returns Created {@link ClinicalGoalTemplate} record
12444
- *
12445
- * @example
12446
- * ```typescript
12447
- * const personal = await client.clinical.goalTemplates.createFromExisting({
12448
- * workspace_id: "ws_123",
12449
- * source_template_id: "tmpl_abc",
12450
- * });
12451
- * ```
13702
+ * @returns Archived {@link ClinicalGoalTemplate} record
12452
13703
  */
12453
- createFromExisting: async (attributes, options) => rb.execute(
12454
- postClinicalGoalTemplatesFromExisting,
12455
- { body: { data: { type: "clinical-goal-template", attributes } } },
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
+ },
12456
13712
  options
12457
13713
  ),
12458
13714
  /**
12459
- * Update a goal template.
13715
+ * Restore an archived catalog goal template.
12460
13716
  *
12461
13717
  * @param id - GoalTemplate UUID
12462
- * @param attributes - Fields to update (PATCH semantics)
12463
13718
  * @param options - Request options
12464
- * @returns Updated {@link ClinicalGoalTemplate} record
13719
+ * @returns Restored {@link ClinicalGoalTemplate} record
12465
13720
  */
12466
- update: async (id, attributes, options) => rb.execute(
12467
- patchClinicalGoalTemplatesById,
13721
+ restoreCatalog: async (id, options) => rb.execute(
13722
+ patchClinicalGoalTemplatesCatalogByIdRestore,
12468
13723
  {
12469
13724
  path: { id },
12470
- body: { data: { type: "clinical-goal-template", id, attributes } }
13725
+ body: {
13726
+ data: { type: "clinical-goal-template", id, attributes: {} }
13727
+ }
12471
13728
  },
12472
13729
  options
12473
13730
  ),
12474
13731
  /**
12475
- * Delete a goal template.
13732
+ * Permanently delete a catalog goal template. Irreversible.
12476
13733
  *
12477
13734
  * @param id - GoalTemplate UUID
12478
13735
  * @param options - Request options
12479
- * @returns `true` on successful deletion
13736
+ * @returns `true` on success
12480
13737
  */
12481
- delete: async (id, options) => rb.executeDelete(
12482
- deleteClinicalGoalTemplatesById,
13738
+ permanentDeleteCatalog: async (id, options) => rb.executeDelete(
13739
+ deleteClinicalGoalTemplatesCatalogByIdPermanent,
12483
13740
  { path: { id } },
12484
13741
  options
12485
13742
  ),
12486
13743
  /**
12487
- * List application-level catalog goal templates.
13744
+ * List archived (soft-deleted) catalog goal templates.
12488
13745
  *
12489
- * @param params - Optional filter/sort params. Application ID is resolved from the API key context.
13746
+ * @param params - Filter/pagination parameters
12490
13747
  * @param options - Request options
12491
- * @returns Array of {@link ClinicalGoalTemplate} catalog records
13748
+ * @returns Array of archived {@link ClinicalGoalTemplate} catalog records
12492
13749
  */
12493
- listCatalog: async (params, options) => rb.execute(
12494
- getClinicalGoalTemplatesCatalog,
12495
- { query: params ?? {} },
13750
+ listArchivedCatalog: async (params, options) => rb.execute(
13751
+ getClinicalGoalTemplatesCatalogArchived,
13752
+ params ?? {},
12496
13753
  options
12497
13754
  ),
12498
13755
  /**
@@ -12512,7 +13769,87 @@ function createClinicalNamespace(rb) {
12512
13769
  listCatalogCategories: async (options) => rb.rawGet(
12513
13770
  `/clinical/goal-templates/categories/catalog`,
12514
13771
  options
12515
- )
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)
12516
13853
  },
12517
13854
  /**
12518
13855
  * Recipe search via configured Edamam connector.
@@ -16691,131 +18028,353 @@ function createConnectorsNamespace(rb) {
16691
18028
  */
16692
18029
  fullscript: {
16693
18030
  /**
16694
- * Check whether a patient record exists in Fullscript by email address.
16695
- *
16696
- * Returns the patient object if found in the Fullscript account linked
16697
- * to the connector, or `null` if no patient with that email exists.
18031
+ * Check whether a patient record exists in Fullscript by email address.
18032
+ *
18033
+ * Returns the patient object if found in the Fullscript account linked
18034
+ * to the connector, or `null` if no patient with that email exists.
18035
+ *
18036
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18037
+ * @param workspaceId - UUID of the current workspace.
18038
+ * @param email - The patient's email address to look up.
18039
+ * @param options - Optional request options.
18040
+ * @returns A `FullscriptPatient` if found, or `null` if not found.
18041
+ *
18042
+ * @example
18043
+ * ```typescript
18044
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18045
+ * const patient = await client.connectors.fullscript.checkPatient(
18046
+ * 'ci_fs_123',
18047
+ * 'ws_abc123',
18048
+ * 'jane@example.com',
18049
+ * );
18050
+ * if (patient) {
18051
+ * console.log('Found:', patient.fullscript_id);
18052
+ * } else {
18053
+ * console.log('Patient not in Fullscript yet');
18054
+ * }
18055
+ * ```
18056
+ */
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.
16698
18263
  *
16699
18264
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16700
18265
  * @param workspaceId - UUID of the current workspace.
16701
- * @param email - The patient's email address to look up.
18266
+ * @param productId - The Fullscript product ID.
16702
18267
  * @param options - Optional request options.
16703
- * @returns A `FullscriptPatient` if found, or `null` if not found.
18268
+ * @returns The `FullscriptProduct` with full details.
16704
18269
  *
16705
18270
  * @example
16706
18271
  * ```typescript
16707
18272
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16708
- * const patient = await client.connectors.fullscript.checkPatient(
18273
+ * const product = await client.connectors.fullscript.getProduct(
16709
18274
  * 'ci_fs_123',
16710
18275
  * 'ws_abc123',
16711
- * 'jane@example.com',
18276
+ * 'prod_789',
16712
18277
  * );
16713
- * if (patient) {
16714
- * console.log('Found:', patient.fullscript_id);
16715
- * } else {
16716
- * console.log('Patient not in Fullscript yet');
16717
- * }
18278
+ * console.log(product.name, product.brand);
16718
18279
  * ```
16719
18280
  */
16720
- checkPatient: async (connectorId, workspaceId, email, options) => rb.execute(
16721
- postConnectorsFullscriptCheckPatient,
18281
+ getProduct: async (connectorId, workspaceId, productId, options) => rb.rawPost(
18282
+ `/connectors/fullscript/products/get`,
16722
18283
  {
16723
- body: {
16724
- data: {
16725
- type: "connector_instance",
16726
- connector_id: connectorId,
16727
- workspace_id: workspaceId,
16728
- email
16729
- }
16730
- }
18284
+ workspace_id: workspaceId,
18285
+ connector_id: connectorId,
18286
+ product_id: productId
16731
18287
  },
16732
18288
  options
16733
- ),
18289
+ ).then((r) => r.data),
16734
18290
  /**
16735
- * Create a new patient record in Fullscript.
16736
- *
16737
- * Creates the patient in the Fullscript account linked to the connector
16738
- * and returns the resulting patient object including the assigned
16739
- * `fullscript_id`. Use this when a patient does not yet have a Fullscript
16740
- * account (confirmed via `checkPatient`).
18291
+ * List similar products curated by Fullscript's health professionals.
16741
18292
  *
16742
18293
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16743
18294
  * @param workspaceId - UUID of the current workspace.
16744
- * @param attrs - Patient attributes: `first_name`, `last_name`, `email`
16745
- * (all required), and optional `date_of_birth` (ISO 8601 date string).
18295
+ * @param productId - The Fullscript product ID to find similar products for.
16746
18296
  * @param options - Optional request options.
16747
- * @returns The newly created `FullscriptPatient`.
18297
+ * @returns An array of similar `FullscriptProduct` records.
16748
18298
  *
16749
18299
  * @example
16750
18300
  * ```typescript
16751
18301
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16752
- * const patient = await client.connectors.fullscript.createPatient(
18302
+ * const similar = await client.connectors.fullscript.listSimilarProducts(
16753
18303
  * 'ci_fs_123',
16754
18304
  * 'ws_abc123',
16755
- * {
16756
- * first_name: 'Jane',
16757
- * last_name: 'Smith',
16758
- * email: 'jane@example.com',
16759
- * date_of_birth: '1985-04-12',
16760
- * },
18305
+ * 'prod_789',
16761
18306
  * );
16762
- * console.log('Created Fullscript patient:', patient.fullscript_id);
18307
+ * similar.forEach(p => console.log(p.name));
16763
18308
  * ```
16764
18309
  */
16765
- createPatient: async (connectorId, workspaceId, attrs, options) => rb.execute(
16766
- postConnectorsFullscriptCreatePatient,
18310
+ listSimilarProducts: async (connectorId, workspaceId, productId, options) => rb.rawPost(
18311
+ `/connectors/fullscript/products/similar`,
16767
18312
  {
16768
- body: {
16769
- data: {
16770
- type: "connector_instance",
16771
- connector_id: connectorId,
16772
- workspace_id: workspaceId,
16773
- ...attrs
16774
- }
16775
- }
18313
+ workspace_id: workspaceId,
18314
+ connector_id: connectorId,
18315
+ product_id: productId
16776
18316
  },
16777
18317
  options
16778
- ),
18318
+ ).then((r) => r.data),
18319
+ // ── Orders ──
16779
18320
  /**
16780
- * Obtain a short-lived embed session grant for the Fullscript prescribing widget.
16781
- *
16782
- * The returned `token` is used to embed the Fullscript prescribing UI for a
16783
- * specific patient within your application. Tokens are valid for 5–15 minutes
16784
- * and are cached server-side for up to 2 minutes to avoid token proliferation
16785
- * on repeated calls.
18321
+ * List all orders for a patient in Fullscript.
16786
18322
  *
16787
18323
  * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
16788
18324
  * @param workspaceId - UUID of the current workspace.
16789
- * @param patientId - The Fullscript patient ID (from `FullscriptPatient.fullscript_id`).
18325
+ * @param patientId - The Fullscript patient ID.
16790
18326
  * @param options - Optional request options.
16791
- * @returns A `FullscriptSessionGrant` with `token`, `expires_at`, and `patient_id`.
18327
+ * @returns An array of `FullscriptOrder` records for the patient.
16792
18328
  *
16793
18329
  * @example
16794
18330
  * ```typescript
16795
18331
  * const client = new GptClient({ apiKey: 'sk_app_...' });
16796
- * const grant = await client.connectors.fullscript.sessionGrant(
18332
+ * const orders = await client.connectors.fullscript.listPatientOrders(
16797
18333
  * 'ci_fs_123',
16798
18334
  * 'ws_abc123',
16799
18335
  * 'fs_patient_456',
16800
18336
  * );
16801
- * // Embed: `https://app.fullscript.com/embed?token=${grant.token}`
16802
- * console.log('Token expires:', grant.expires_at);
18337
+ * orders.forEach(o => console.log(o.id, o.payment_total));
16803
18338
  * ```
16804
18339
  */
16805
- sessionGrant: async (connectorId, workspaceId, patientId, options) => rb.execute(
16806
- postConnectorsFullscriptSessionGrant,
18340
+ listPatientOrders: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
18341
+ `/connectors/fullscript/orders/list`,
16807
18342
  {
16808
- body: {
16809
- data: {
16810
- type: "connector_instance",
16811
- connector_id: connectorId,
16812
- workspace_id: workspaceId,
16813
- patient_id: patientId
16814
- }
16815
- }
18343
+ workspace_id: workspaceId,
18344
+ connector_id: connectorId,
18345
+ patient_id: patientId
16816
18346
  },
16817
18347
  options
16818
- ),
18348
+ ).then((r) => r.data),
18349
+ /**
18350
+ * Get order details from Fullscript by order ID.
18351
+ *
18352
+ * @param connectorId - UUID of the Fullscript `ConnectorInstance`.
18353
+ * @param workspaceId - UUID of the current workspace.
18354
+ * @param orderId - The Fullscript order ID.
18355
+ * @param options - Optional request options.
18356
+ * @returns The `FullscriptOrder` with line items and totals.
18357
+ *
18358
+ * @example
18359
+ * ```typescript
18360
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
18361
+ * const order = await client.connectors.fullscript.getOrder(
18362
+ * 'ci_fs_123',
18363
+ * 'ws_abc123',
18364
+ * 'ord_789',
18365
+ * );
18366
+ * console.log(order.payment_total, order.line_items);
18367
+ * ```
18368
+ */
18369
+ getOrder: async (connectorId, workspaceId, orderId, options) => rb.rawPost(
18370
+ `/connectors/fullscript/orders/get`,
18371
+ {
18372
+ workspace_id: workspaceId,
18373
+ connector_id: connectorId,
18374
+ order_id: orderId
18375
+ },
18376
+ options
18377
+ ).then((r) => r.data),
16819
18378
  /**
16820
18379
  * Fullscript-specific OAuth helpers.
16821
18380
  *
@@ -22403,6 +23962,9 @@ var ConfirmEmailSchema = z2.object({
22403
23962
  email: z2.string().email(),
22404
23963
  confirmation_token: z2.string().min(1)
22405
23964
  });
23965
+ var RefreshTokenSchema = z2.object({
23966
+ refresh_token: z2.string().min(1)
23967
+ });
22406
23968
  var ResetPasswordWithTokenSchema = z2.object({
22407
23969
  token: z2.string().min(1),
22408
23970
  password: z2.string().min(8),
@@ -22446,6 +24008,30 @@ function createIdentityNamespace(rb, baseUrl) {
22446
24008
  options
22447
24009
  );
22448
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
+ },
22449
24035
  /**
22450
24036
  * Register a new user account — returns the newly created user.
22451
24037
  * The session token is available as `result.token` (flattened from `data.attributes.token`).
@@ -24088,19 +25674,41 @@ function createPlatformNamespace(rb) {
24088
25674
  *
24089
25675
  * @example
24090
25676
  * ```typescript
24091
- * const client = new GptClient({ apiKey: 'sk_app_...' });
25677
+ * // Using workspace_id shorthand (recommended):
24092
25678
  * const invite = await client.platform.invitations.create({
24093
25679
  * email: 'new.clinician@hospital.org',
24094
25680
  * workspace_id: 'ws_abc123',
24095
25681
  * role: 'member',
24096
25682
  * });
24097
- * 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
+ * });
24098
25691
  * ```
24099
25692
  */
24100
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
+ }
24101
25709
  return rb.execute(
24102
25710
  postInvitations,
24103
- { body: { data: { type: "invitation", attributes } } },
25711
+ { body: { data: { type: "invitation", attributes: resolved } } },
24104
25712
  options
24105
25713
  );
24106
25714
  },
@@ -26908,6 +28516,29 @@ function createThreadsNamespace(rb) {
26908
28516
  options
26909
28517
  );
26910
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
+ },
26911
28542
  /**
26912
28543
  * Fetches all threads in the workspace by transparently paginating through
26913
28544
  * every page until exhausted.
@@ -26959,7 +28590,7 @@ function createThreadsNamespace(rb) {
26959
28590
  create: async (attributes, options) => {
26960
28591
  return rb.execute(
26961
28592
  postThreads,
26962
- { body: { data: { type: "thread", attributes } } },
28593
+ { body: { data: { type: "chat-thread", attributes } } },
26963
28594
  options
26964
28595
  );
26965
28596
  },
@@ -26985,7 +28616,10 @@ function createThreadsNamespace(rb) {
26985
28616
  update: async (id, attributes, options) => {
26986
28617
  return rb.execute(
26987
28618
  patchThreadsById,
26988
- { path: { id }, body: { data: { id, type: "thread", attributes } } },
28619
+ {
28620
+ path: { id },
28621
+ body: { data: { id, type: "chat-thread", attributes } }
28622
+ },
26989
28623
  options
26990
28624
  );
26991
28625
  },
@@ -27145,7 +28779,7 @@ function createThreadsNamespace(rb) {
27145
28779
  * // Streaming
27146
28780
  * const stream = await client.threads.messages.stream('thr_01HXYZ...', { content: 'Hello!' });
27147
28781
  * for await (const chunk of stream) {
27148
- * process.stdout.write(chunk.delta ?? '');
28782
+ * if (chunk.type === 'token') process.stdout.write(chunk.content ?? '');
27149
28783
  * }
27150
28784
  */
27151
28785
  messages: {
@@ -27207,7 +28841,7 @@ function createThreadsNamespace(rb) {
27207
28841
  path: { id: threadId },
27208
28842
  body: {
27209
28843
  data: {
27210
- type: "thread",
28844
+ type: "chat-thread",
27211
28845
  content,
27212
28846
  ...rest,
27213
28847
  metadata: mergeWithBrowserContext(
@@ -27220,38 +28854,48 @@ function createThreadsNamespace(rb) {
27220
28854
  );
27221
28855
  },
27222
28856
  /**
27223
- * Sends a message to a thread and streams the AI response token-by-token
27224
- * 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
27225
28867
  *
27226
- * Returns an `AsyncIterableIterator` that yields `StreamMessageChunk`
27227
- * objects as tokens are generated. Consume with a `for await` loop. The
27228
- * stream closes automatically when the assistant finishes generating its
27229
- * response.
28868
+ * For RAG threads (no agent), only `token`, `done`, and `error` are emitted.
27230
28869
  *
27231
28870
  * SSE security limits: 5-minute idle timeout, 10,000 chunk maximum,
27232
28871
  * 10 MB buffer size limit.
27233
28872
  *
27234
28873
  * @param threadId - The UUID of the thread to stream a message to.
27235
28874
  * @param body - The message payload, including at minimum `content` (string).
27236
- * Additional fields such as `role` or `metadata` are passed through.
27237
28875
  * @param options - Optional request options (e.g. custom headers, abort signal).
27238
28876
  * @param streamOptions - Optional streaming configuration (e.g. chunk timeout).
27239
28877
  * @returns A promise that resolves to an `AsyncIterableIterator<StreamMessageChunk>`.
27240
- * Each yielded chunk contains a `delta` string (the new token text) and
27241
- * optional event metadata.
27242
28878
  *
27243
28879
  * @example
27244
- * const client = new GptClient({ apiKey: 'sk_app_...' });
27245
- *
27246
- * const stream = await client.threads.messages.stream(
27247
- * 'thr_01HXYZ...',
27248
- * { content: 'Summarize the key clauses in this contract.' },
27249
- * );
27250
- *
27251
- * for await (const chunk of stream) {
27252
- * 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
+ * }
27253
28897
  * }
27254
- * console.log(); // newline after streaming completes
28898
+ * ```
27255
28899
  */
27256
28900
  stream: async (threadId, body, options, streamOptions) => {
27257
28901
  const { content, metadata, ...rest } = body;
@@ -27259,7 +28903,7 @@ function createThreadsNamespace(rb) {
27259
28903
  `/threads/${threadId}/messages/stream`,
27260
28904
  {
27261
28905
  data: {
27262
- type: "message",
28906
+ type: "chat-message",
27263
28907
  content,
27264
28908
  ...rest,
27265
28909
  metadata: mergeWithBrowserContext(
@@ -27342,7 +28986,7 @@ function createThreadsNamespace(rb) {
27342
28986
  postThreadsByIdComplete,
27343
28987
  {
27344
28988
  path: { id: threadId },
27345
- body: { data: { type: "thread" } }
28989
+ body: { data: { type: "chat-thread" } }
27346
28990
  },
27347
28991
  options
27348
28992
  );
@@ -27350,13 +28994,12 @@ function createThreadsNamespace(rb) {
27350
28994
  /**
27351
28995
  * Trigger AI inference on a thread and receive the response via Server-Sent Events.
27352
28996
  *
27353
- * Identical to {@link complete} in behavior but delivers the result as an SSE
27354
- * stream. The stream yields a single `StreamMessageChunk` with `done: true`
27355
- * 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.
27356
29000
  *
27357
- * Note: This endpoint delivers the full response as one event (not token-by-token).
27358
- * It gives the frontend a consistent SSE interface for uniform handling of both
27359
- * 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.
27360
29003
  *
27361
29004
  * @param threadId - The UUID of the thread to run AI completion on.
27362
29005
  * @param options - Optional request options (e.g. abort signal).
@@ -27365,11 +29008,19 @@ function createThreadsNamespace(rb) {
27365
29008
  *
27366
29009
  * @example
27367
29010
  * ```typescript
27368
- * const client = new GptClient({ apiKey: 'sk_app_...' });
27369
- *
27370
29011
  * const stream = await client.threads.completeStream('thr_01HXYZ...');
27371
- * for await (const chunk of stream) {
27372
- * 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
+ * }
27373
29024
  * }
27374
29025
  * ```
27375
29026
  */
@@ -29617,7 +31268,6 @@ function createSocialNamespace(rb) {
29617
31268
  path: { id },
29618
31269
  body: {
29619
31270
  data: {
29620
- type: "social_campaign",
29621
31271
  campaign_id: id,
29622
31272
  workspace_id: workspaceId
29623
31273
  }
@@ -29634,7 +31284,6 @@ function createSocialNamespace(rb) {
29634
31284
  path: { id },
29635
31285
  body: {
29636
31286
  data: {
29637
- type: "social_campaign",
29638
31287
  campaign_id: id,
29639
31288
  workspace_id: workspaceId,
29640
31289
  social_account_id: socialAccountId
@@ -29711,6 +31360,26 @@ function createSocialNamespace(rb) {
29711
31360
  options
29712
31361
  );
29713
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
+ },
29714
31383
  /** Trending snapshot items — individual content pieces within a snapshot. */
29715
31384
  items: {
29716
31385
  /** Get a single trending item by ID. */
@@ -29819,22 +31488,6 @@ function createSocialNamespace(rb) {
29819
31488
  { path: { id } },
29820
31489
  options
29821
31490
  );
29822
- },
29823
- /**
29824
- * Mark a watch as triggered (updates last_triggered_at).
29825
- * @param id - Watch UUID
29826
- */
29827
- markTriggered: async (id, options) => {
29828
- return rb.execute(
29829
- patchSocialTrendingWatchesByIdMarkTriggered,
29830
- {
29831
- path: { id },
29832
- body: {
29833
- data: { type: "trending-watch", id, attributes: {} }
29834
- }
29835
- },
29836
- options
29837
- );
29838
31491
  }
29839
31492
  }
29840
31493
  };
@@ -30264,6 +31917,235 @@ function createPermissionsNamespace(rb) {
30264
31917
  };
30265
31918
  }
30266
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
+
30267
32149
  // src/streaming.ts
30268
32150
  var DEFAULT_STREAM_TIMEOUT = 3e5;
30269
32151
  var DEFAULT_MAX_CHUNKS = 1e4;
@@ -30354,10 +32236,16 @@ async function* streamMessage(response, options = {}) {
30354
32236
  async function collectStreamedMessage(stream) {
30355
32237
  let fullMessage = "";
30356
32238
  for await (const chunk of stream) {
30357
- if (chunk.type === "content" && chunk.content) {
32239
+ if ((chunk.type === "token" || chunk.type === "content") && "content" in chunk && chunk.content) {
30358
32240
  fullMessage += chunk.content;
30359
32241
  } else if (chunk.type === "error") {
30360
- 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;
30361
32249
  }
30362
32250
  }
30363
32251
  return fullMessage;
@@ -30745,6 +32633,8 @@ var GptClient = class extends BaseClient {
30745
32633
  this.roles = createRolesNamespace(rb);
30746
32634
  this.permissions = createPermissionsNamespace(rb);
30747
32635
  this.memory = createMemoryNamespace(rb);
32636
+ this.channels = createChannelsNamespace(rb);
32637
+ this.imports = createImportsNamespace(rb);
30748
32638
  }
30749
32639
  /**
30750
32640
  * Subscribe to SDK lifecycle events.
@@ -30976,6 +32866,7 @@ export {
30976
32866
  buildHeaders,
30977
32867
  buildUserAgent,
30978
32868
  collectStreamedMessage,
32869
+ createImportsNamespace,
30979
32870
  handleApiError,
30980
32871
  isBrowserEnvironment,
30981
32872
  isSecureUrl,