@gpt-platform/client 0.8.1 → 0.8.3

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,7 +1269,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1269
1269
  }
1270
1270
 
1271
1271
  // src/version.ts
1272
- var SDK_VERSION = "0.8.1";
1272
+ var SDK_VERSION = "0.8.3";
1273
1273
  var DEFAULT_API_VERSION = "2026-03-11";
1274
1274
 
1275
1275
  // src/base-client.ts
@@ -1540,6 +1540,36 @@ var BaseClient = class {
1540
1540
  clearToken() {
1541
1541
  this.config = { ...this.config, token: void 0 };
1542
1542
  }
1543
+ /**
1544
+ * Switch the workspace context for all subsequent requests.
1545
+ *
1546
+ * Sets the `workspace_id` query parameter appended to every request.
1547
+ * Use this after creating a new workspace or switching workspace context
1548
+ * without constructing a new client instance.
1549
+ *
1550
+ * @param workspaceId - The workspace UUID to scope requests to, or
1551
+ * `undefined` to clear workspace scoping.
1552
+ *
1553
+ * @example
1554
+ * ```typescript
1555
+ * const org = await sdk.platform.tenants.createOrg({ name: 'Acme' });
1556
+ * const workspaces = await sdk.platform.workspaces.mine();
1557
+ * const ws = workspaces.find(w => w.tenant_id === org.id);
1558
+ *
1559
+ * sdk.setWorkspaceId(ws.id);
1560
+ * // All subsequent calls are scoped to the new workspace
1561
+ * await sdk.scheduling.events.create({ ... });
1562
+ * ```
1563
+ */
1564
+ setWorkspaceId(workspaceId) {
1565
+ this.config = { ...this.config, workspaceId };
1566
+ }
1567
+ /**
1568
+ * Get the current workspace ID, if set.
1569
+ */
1570
+ getWorkspaceId() {
1571
+ return this.config.workspaceId;
1572
+ }
1543
1573
  };
1544
1574
 
1545
1575
  // src/namespaces/audit.ts
@@ -3306,6 +3336,15 @@ var patchCrawlerJobsByIdCancel = (options) => (options.client ?? client).patch({
3306
3336
  ...options.headers
3307
3337
  }
3308
3338
  });
3339
+ var postContentGenerateHashtags = (options) => (options.client ?? client).post({
3340
+ security: [{ scheme: "bearer", type: "http" }],
3341
+ url: "/content/generate-hashtags",
3342
+ ...options,
3343
+ headers: {
3344
+ "Content-Type": "application/vnd.api+json",
3345
+ ...options.headers
3346
+ }
3347
+ });
3309
3348
  var deleteClinicalNotesById = (options) => (options.client ?? client).delete({
3310
3349
  security: [{ scheme: "bearer", type: "http" }],
3311
3350
  url: "/clinical/notes/{id}",
@@ -3534,6 +3573,15 @@ var patchEmailInboundAddressesByIdRotateToken = (options) => (options.client ??
3534
3573
  ...options.headers
3535
3574
  }
3536
3575
  });
3576
+ var postContentSeoEnrich = (options) => (options.client ?? client).post({
3577
+ security: [{ scheme: "bearer", type: "http" }],
3578
+ url: "/content/seo-enrich",
3579
+ ...options,
3580
+ headers: {
3581
+ "Content-Type": "application/vnd.api+json",
3582
+ ...options.headers
3583
+ }
3584
+ });
3537
3585
  var deleteSchedulingParticipantsById = (options) => (options.client ?? client).delete({
3538
3586
  security: [{ scheme: "bearer", type: "http" }],
3539
3587
  url: "/scheduling/participants/{id}",
@@ -3800,6 +3848,11 @@ var postVoiceSessions = (options) => (options.client ?? client).post({
3800
3848
  ...options.headers
3801
3849
  }
3802
3850
  });
3851
+ var getInvitations = (options) => (options.client ?? client).get({
3852
+ security: [{ scheme: "bearer", type: "http" }],
3853
+ url: "/invitations",
3854
+ ...options
3855
+ });
3803
3856
  var postInvitations = (options) => (options.client ?? client).post({
3804
3857
  security: [{ scheme: "bearer", type: "http" }],
3805
3858
  url: "/invitations",
@@ -4110,6 +4163,15 @@ var postRoles = (options) => (options.client ?? client).post({
4110
4163
  ...options.headers
4111
4164
  }
4112
4165
  });
4166
+ var postContentGenerateText = (options) => (options.client ?? client).post({
4167
+ security: [{ scheme: "bearer", type: "http" }],
4168
+ url: "/content/generate-text",
4169
+ ...options,
4170
+ headers: {
4171
+ "Content-Type": "application/vnd.api+json",
4172
+ ...options.headers
4173
+ }
4174
+ });
4113
4175
  var getComplianceRequirementCompletions = (options) => (options.client ?? client).get({
4114
4176
  security: [{ scheme: "bearer", type: "http" }],
4115
4177
  url: "/compliance-requirement-completions",
@@ -4241,6 +4303,15 @@ var postSocialPosts = (options) => (options.client ?? client).post({
4241
4303
  ...options.headers
4242
4304
  }
4243
4305
  });
4306
+ var postContentShorten = (options) => (options.client ?? client).post({
4307
+ security: [{ scheme: "bearer", type: "http" }],
4308
+ url: "/content/shorten",
4309
+ ...options,
4310
+ headers: {
4311
+ "Content-Type": "application/vnd.api+json",
4312
+ ...options.headers
4313
+ }
4314
+ });
4244
4315
  var deleteClinicalPatientsById = (options) => (options.client ?? client).delete({
4245
4316
  security: [{ scheme: "bearer", type: "http" }],
4246
4317
  url: "/clinical/patients/{id}",
@@ -4537,6 +4608,15 @@ var getEmailInclusionsEmailByOutboundEmailId = (options) => (options.client ?? c
4537
4608
  url: "/email/inclusions/email/{outbound_email_id}",
4538
4609
  ...options
4539
4610
  });
4611
+ var patchTenantsByIdReactivate = (options) => (options.client ?? client).patch({
4612
+ security: [{ scheme: "bearer", type: "http" }],
4613
+ url: "/tenants/{id}/reactivate",
4614
+ ...options,
4615
+ headers: {
4616
+ "Content-Type": "application/vnd.api+json",
4617
+ ...options.headers
4618
+ }
4619
+ });
4540
4620
  var getWorkspacesByWorkspaceIdExtractionExportsById = (options) => (options.client ?? client).get({
4541
4621
  security: [{ scheme: "bearer", type: "http" }],
4542
4622
  url: "/workspaces/{workspace_id}/extraction/exports/{id}",
@@ -4561,6 +4641,15 @@ var getUserProfilesMe = (options) => (options.client ?? client).get({
4561
4641
  url: "/user-profiles/me",
4562
4642
  ...options
4563
4643
  });
4644
+ var postContentSuggestTopics = (options) => (options.client ?? client).post({
4645
+ security: [{ scheme: "bearer", type: "http" }],
4646
+ url: "/content/suggest-topics",
4647
+ ...options,
4648
+ headers: {
4649
+ "Content-Type": "application/vnd.api+json",
4650
+ ...options.headers
4651
+ }
4652
+ });
4564
4653
  var postDocumentsPresignedUpload = (options) => (options.client ?? client).post({
4565
4654
  security: [{ scheme: "bearer", type: "http" }],
4566
4655
  url: "/documents/presigned-upload",
@@ -4630,6 +4719,15 @@ var postConnectorsFullscriptCheckPatient = (options) => (options.client ?? clien
4630
4719
  ...options.headers
4631
4720
  }
4632
4721
  });
4722
+ var patchTenantsByIdDeactivate = (options) => (options.client ?? client).patch({
4723
+ security: [{ scheme: "bearer", type: "http" }],
4724
+ url: "/tenants/{id}/deactivate",
4725
+ ...options,
4726
+ headers: {
4727
+ "Content-Type": "application/vnd.api+json",
4728
+ ...options.headers
4729
+ }
4730
+ });
4633
4731
  var getSchedulingEventTypes = (options) => (options.client ?? client).get({
4634
4732
  security: [{ scheme: "bearer", type: "http" }],
4635
4733
  url: "/scheduling/event-types",
@@ -5151,6 +5249,15 @@ var getTransactions = (options) => (options.client ?? client).get({
5151
5249
  url: "/transactions",
5152
5250
  ...options
5153
5251
  });
5252
+ var postContentGenerateImagePrompt = (options) => (options.client ?? client).post({
5253
+ security: [{ scheme: "bearer", type: "http" }],
5254
+ url: "/content/generate-image-prompt",
5255
+ ...options,
5256
+ headers: {
5257
+ "Content-Type": "application/vnd.api+json",
5258
+ ...options.headers
5259
+ }
5260
+ });
5154
5261
  var postSocialTrendingHistory = (options) => (options.client ?? client).post({
5155
5262
  security: [{ scheme: "bearer", type: "http" }],
5156
5263
  url: "/social/trending/history",
@@ -5355,6 +5462,15 @@ var patchEmailOutboundEmailsByIdCancelSchedule = (options) => (options.client ??
5355
5462
  ...options.headers
5356
5463
  }
5357
5464
  });
5465
+ var postContentRefine = (options) => (options.client ?? client).post({
5466
+ security: [{ scheme: "bearer", type: "http" }],
5467
+ url: "/content/refine",
5468
+ ...options,
5469
+ headers: {
5470
+ "Content-Type": "application/vnd.api+json",
5471
+ ...options.headers
5472
+ }
5473
+ });
5358
5474
  var getLegalDocumentsByLocale = (options) => (options.client ?? client).get({
5359
5475
  security: [{ scheme: "bearer", type: "http" }],
5360
5476
  url: "/legal-documents/by-locale",
@@ -5657,6 +5773,15 @@ var patchSchedulingEventsById = (options) => (options.client ?? client).patch({
5657
5773
  ...options.headers
5658
5774
  }
5659
5775
  });
5776
+ var postContentRewriteTone = (options) => (options.client ?? client).post({
5777
+ security: [{ scheme: "bearer", type: "http" }],
5778
+ url: "/content/rewrite-tone",
5779
+ ...options,
5780
+ headers: {
5781
+ "Content-Type": "application/vnd.api+json",
5782
+ ...options.headers
5783
+ }
5784
+ });
5660
5785
  var patchStorageFilesByIdSoftDelete = (options) => (options.client ?? client).patch({
5661
5786
  security: [{ scheme: "bearer", type: "http" }],
5662
5787
  url: "/storage-files/{id}/soft-delete",
@@ -5685,6 +5810,15 @@ var patchConnectorsById = (options) => (options.client ?? client).patch({
5685
5810
  ...options.headers
5686
5811
  }
5687
5812
  });
5813
+ var postContentGenerateImage = (options) => (options.client ?? client).post({
5814
+ security: [{ scheme: "bearer", type: "http" }],
5815
+ url: "/content/generate-image",
5816
+ ...options,
5817
+ headers: {
5818
+ "Content-Type": "application/vnd.api+json",
5819
+ ...options.headers
5820
+ }
5821
+ });
5688
5822
  var patchWalletPlanCancel = (options) => (options.client ?? client).patch({
5689
5823
  security: [{ scheme: "bearer", type: "http" }],
5690
5824
  url: "/wallet/plan/cancel",
@@ -5912,11 +6046,6 @@ var patchBrandIdentitiesByIdUnsetDefault = (options) => (options.client ?? clien
5912
6046
  ...options.headers
5913
6047
  }
5914
6048
  });
5915
- var deleteTenantsById = (options) => (options.client ?? client).delete({
5916
- security: [{ scheme: "bearer", type: "http" }],
5917
- url: "/tenants/{id}",
5918
- ...options
5919
- });
5920
6049
  var getTenantsById = (options) => (options.client ?? client).get({
5921
6050
  security: [{ scheme: "bearer", type: "http" }],
5922
6051
  url: "/tenants/{id}",
@@ -5973,6 +6102,15 @@ var postSchedulingEvents = (options) => (options.client ?? client).post({
5973
6102
  ...options.headers
5974
6103
  }
5975
6104
  });
6105
+ var postContentEditImage = (options) => (options.client ?? client).post({
6106
+ security: [{ scheme: "bearer", type: "http" }],
6107
+ url: "/content/edit-image",
6108
+ ...options,
6109
+ headers: {
6110
+ "Content-Type": "application/vnd.api+json",
6111
+ ...options.headers
6112
+ }
6113
+ });
5976
6114
  var postEmailRecipients = (options) => (options.client ?? client).post({
5977
6115
  security: [{ scheme: "bearer", type: "http" }],
5978
6116
  url: "/email/recipients",
@@ -6759,6 +6897,15 @@ var postAgentsByIdExport = (options) => (options.client ?? client).post({
6759
6897
  url: "/agents/{id}/export",
6760
6898
  ...options
6761
6899
  });
6900
+ var postUsersAuthRegisterViaInvitation = (options) => (options.client ?? client).post({
6901
+ security: [{ scheme: "bearer", type: "http" }],
6902
+ url: "/users/auth/register-via-invitation",
6903
+ ...options,
6904
+ headers: {
6905
+ "Content-Type": "application/vnd.api+json",
6906
+ ...options.headers
6907
+ }
6908
+ });
6762
6909
  var postEmailInboundAddresses = (options) => (options.client ?? client).post({
6763
6910
  security: [{ scheme: "bearer", type: "http" }],
6764
6911
  url: "/email/inbound-addresses",
@@ -10049,6 +10196,31 @@ function createBillingNamespace(rb) {
10049
10196
  );
10050
10197
  return result.data ?? result;
10051
10198
  }
10199
+ },
10200
+ /**
10201
+ * Get capacity estimates for a plan's monthly credits.
10202
+ *
10203
+ * Returns how many of each ISV-defined feature the plan supports per month.
10204
+ * No Bearer token required — uses application key only.
10205
+ *
10206
+ * @param planSlug - The plan slug to calculate capacity for.
10207
+ * @param options - Optional request-level overrides.
10208
+ * @returns Plan details and capacity breakdown per composite operation.
10209
+ *
10210
+ * @example
10211
+ * ```typescript
10212
+ * const result = await client.billing.capacityCalculator("pro-plan");
10213
+ * console.log(`Plan: ${result.plan.name}`);
10214
+ * for (const item of result.capacity) {
10215
+ * console.log(`${item.display_name}: ~${item.estimated_monthly_count}/month`);
10216
+ * }
10217
+ * ```
10218
+ */
10219
+ capacityCalculator: async (planSlug, options) => {
10220
+ return rb.rawGet(
10221
+ `/billing/capacity-calculator?plan_slug=${encodeURIComponent(planSlug)}`,
10222
+ options
10223
+ );
10052
10224
  }
10053
10225
  };
10054
10226
  }
@@ -10679,6 +10851,249 @@ function createCatalogNamespace(rb) {
10679
10851
  };
10680
10852
  }
10681
10853
 
10854
+ // src/namespaces/content.ts
10855
+ function createContentNamespace(rb) {
10856
+ return {
10857
+ /**
10858
+ * Generate text from a prompt, optionally informed by brand identity.
10859
+ * @param attributes - { prompt, workspace_id, brand_identity_id?, task? }
10860
+ * @returns { text: string }
10861
+ * @example
10862
+ * ```typescript
10863
+ * const result = await client.content.generateText({
10864
+ * prompt: "Write about AI analytics",
10865
+ * workspace_id: "ws_abc",
10866
+ * });
10867
+ * ```
10868
+ */
10869
+ generateText: async (attributes, options) => {
10870
+ return rb.execute(
10871
+ postContentGenerateText,
10872
+ {
10873
+ body: {
10874
+ data: { type: "content-generation", attributes }
10875
+ }
10876
+ },
10877
+ options
10878
+ );
10879
+ },
10880
+ /**
10881
+ * Generate an image from a text prompt via Gemini.
10882
+ * @param attributes - { prompt, workspace_id, style? }
10883
+ * @returns { url: string, provider: string }
10884
+ * @example
10885
+ * ```typescript
10886
+ * const result = await client.content.generateImage({
10887
+ * prompt: "A futuristic city skyline",
10888
+ * workspace_id: "ws_abc",
10889
+ * });
10890
+ * ```
10891
+ */
10892
+ generateImage: async (attributes, options) => {
10893
+ return rb.execute(
10894
+ postContentGenerateImage,
10895
+ {
10896
+ body: {
10897
+ data: { type: "content-generation", attributes }
10898
+ }
10899
+ },
10900
+ options
10901
+ );
10902
+ },
10903
+ /**
10904
+ * Edit an existing image using natural language instructions.
10905
+ * @param attributes - { image_url, instructions, workspace_id }
10906
+ * @returns { url: string, provider: string }
10907
+ * @example
10908
+ * ```typescript
10909
+ * const result = await client.content.editImage({
10910
+ * image_url: "https://example.com/photo.png",
10911
+ * instructions: "Remove the background",
10912
+ * workspace_id: "ws_abc",
10913
+ * });
10914
+ * ```
10915
+ */
10916
+ editImage: async (attributes, options) => {
10917
+ return rb.execute(
10918
+ postContentEditImage,
10919
+ {
10920
+ body: {
10921
+ data: { type: "content-generation", attributes }
10922
+ }
10923
+ },
10924
+ options
10925
+ );
10926
+ },
10927
+ /**
10928
+ * Rewrite text in a different tone.
10929
+ * @param attributes - { text, target_tone, workspace_id, max_length? }
10930
+ * @returns { rewritten_text: string }
10931
+ * @example
10932
+ * ```typescript
10933
+ * const result = await client.content.rewriteTone({
10934
+ * text: "We are pleased to announce our new product.",
10935
+ * target_tone: "casual",
10936
+ * workspace_id: "ws_abc",
10937
+ * });
10938
+ * ```
10939
+ */
10940
+ rewriteTone: async (attributes, options) => {
10941
+ return rb.execute(
10942
+ postContentRewriteTone,
10943
+ {
10944
+ body: {
10945
+ data: { type: "content-generation", attributes }
10946
+ }
10947
+ },
10948
+ options
10949
+ );
10950
+ },
10951
+ /**
10952
+ * Shorten text to a target character count.
10953
+ * @param attributes - { text, max_chars, workspace_id, platform? }
10954
+ * @returns { shortened_text: string }
10955
+ * @example
10956
+ * ```typescript
10957
+ * const result = await client.content.shorten({
10958
+ * text: "This is a long piece of content that needs shortening.",
10959
+ * max_chars: 280,
10960
+ * workspace_id: "ws_abc",
10961
+ * });
10962
+ * ```
10963
+ */
10964
+ shorten: async (attributes, options) => {
10965
+ return rb.execute(
10966
+ postContentShorten,
10967
+ {
10968
+ body: {
10969
+ data: { type: "content-generation", attributes }
10970
+ }
10971
+ },
10972
+ options
10973
+ );
10974
+ },
10975
+ /**
10976
+ * Refine text based on freeform instructions.
10977
+ * @param attributes - { text, instructions, workspace_id }
10978
+ * @returns { refined_text: string }
10979
+ * @example
10980
+ * ```typescript
10981
+ * const result = await client.content.refine({
10982
+ * text: "Draft blog post content here.",
10983
+ * instructions: "Make it more engaging and add a call to action",
10984
+ * workspace_id: "ws_abc",
10985
+ * });
10986
+ * ```
10987
+ */
10988
+ refine: async (attributes, options) => {
10989
+ return rb.execute(
10990
+ postContentRefine,
10991
+ {
10992
+ body: {
10993
+ data: { type: "content-generation", attributes }
10994
+ }
10995
+ },
10996
+ options
10997
+ );
10998
+ },
10999
+ /**
11000
+ * Suggest content topics based on industry and audience.
11001
+ * @param attributes - { workspace_id, industry?, brand_identity_id?, count? }
11002
+ * @returns { suggestions: string }
11003
+ * @example
11004
+ * ```typescript
11005
+ * const result = await client.content.suggestTopics({
11006
+ * workspace_id: "ws_abc",
11007
+ * industry: "fintech",
11008
+ * count: 5,
11009
+ * });
11010
+ * ```
11011
+ */
11012
+ suggestTopics: async (attributes, options) => {
11013
+ return rb.execute(
11014
+ postContentSuggestTopics,
11015
+ {
11016
+ body: {
11017
+ data: { type: "content-generation", attributes }
11018
+ }
11019
+ },
11020
+ options
11021
+ );
11022
+ },
11023
+ /**
11024
+ * Generate an image generation prompt from marketing copy.
11025
+ * @param attributes - { marketing_copy, workspace_id, style? }
11026
+ * @returns { image_prompt: string }
11027
+ * @example
11028
+ * ```typescript
11029
+ * const result = await client.content.generateImagePrompt({
11030
+ * marketing_copy: "Launch your brand into the future",
11031
+ * workspace_id: "ws_abc",
11032
+ * });
11033
+ * ```
11034
+ */
11035
+ generateImagePrompt: async (attributes, options) => {
11036
+ return rb.execute(
11037
+ postContentGenerateImagePrompt,
11038
+ {
11039
+ body: {
11040
+ data: { type: "content-generation", attributes }
11041
+ }
11042
+ },
11043
+ options
11044
+ );
11045
+ },
11046
+ /**
11047
+ * Generate scored hashtags for content.
11048
+ * @param attributes - { text, platform, workspace_id, industry?, count? }
11049
+ * @returns { hashtags: Array<{ tag: string, score: number }> }
11050
+ * @example
11051
+ * ```typescript
11052
+ * const result = await client.content.generateHashtags({
11053
+ * text: "Check out our new AI-powered analytics tool",
11054
+ * platform: "instagram",
11055
+ * workspace_id: "ws_abc",
11056
+ * });
11057
+ * ```
11058
+ */
11059
+ generateHashtags: async (attributes, options) => {
11060
+ return rb.execute(
11061
+ postContentGenerateHashtags,
11062
+ {
11063
+ body: {
11064
+ data: { type: "content-generation", attributes }
11065
+ }
11066
+ },
11067
+ options
11068
+ );
11069
+ },
11070
+ /**
11071
+ * Analyze content for SEO optimization against target keywords.
11072
+ * @param attributes - { text, target_keywords, workspace_id }
11073
+ * @returns { analysis: { keyword_coverage, suggestions, seo_score } }
11074
+ * @example
11075
+ * ```typescript
11076
+ * const result = await client.content.seoEnrich({
11077
+ * text: "Our product helps businesses grow",
11078
+ * target_keywords: ["growth", "business", "scale"],
11079
+ * workspace_id: "ws_abc",
11080
+ * });
11081
+ * ```
11082
+ */
11083
+ seoEnrich: async (attributes, options) => {
11084
+ return rb.execute(
11085
+ postContentSeoEnrich,
11086
+ {
11087
+ body: {
11088
+ data: { type: "content-generation", attributes }
11089
+ }
11090
+ },
11091
+ options
11092
+ );
11093
+ }
11094
+ };
11095
+ }
11096
+
10682
11097
  // src/namespaces/clinical.ts
10683
11098
  function createClinicalNamespace(rb) {
10684
11099
  return {
@@ -10779,6 +11194,27 @@ function createClinicalNamespace(rb) {
10779
11194
  * ```
10780
11195
  */
10781
11196
  delete: async (id, options) => rb.executeDelete(deleteClinicalPatientsById, { path: { id } }, options),
11197
+ /**
11198
+ * Look up a patient by their CRM Contact ID.
11199
+ *
11200
+ * Most ISV apps work with CRM Contact IDs, not Clinical Patient UUIDs.
11201
+ * Use this to resolve the patient record for a given contact.
11202
+ *
11203
+ * @param contactId - CRM Contact UUID
11204
+ * @param options - Request options
11205
+ * @returns {@link ClinicalPatient} record linked to the contact
11206
+ * @throws {@link NotFoundError} if no patient exists for the contact
11207
+ *
11208
+ * @example
11209
+ * ```typescript
11210
+ * const patient = await client.clinical.patients.getByContact('c7da2056-...');
11211
+ * console.log(patient.id); // Clinical Patient UUID
11212
+ * ```
11213
+ */
11214
+ getByContact: async (contactId, options) => rb.rawGet(
11215
+ `/clinical/patients/by-contact/${contactId}`,
11216
+ options
11217
+ ),
10782
11218
  /**
10783
11219
  * List health metrics for a patient (related resource).
10784
11220
  *
@@ -11560,6 +11996,46 @@ function createClinicalNamespace(rb) {
11560
11996
  getClinicalPracticeResourcesCatalog,
11561
11997
  { query: params ?? {} },
11562
11998
  options
11999
+ ),
12000
+ /**
12001
+ * List distinct practice resource categories in a workspace.
12002
+ *
12003
+ * Returns unique `resource_type` values with their active resource counts,
12004
+ * sorted by count descending.
12005
+ *
12006
+ * @param params - Must include `workspace_id`
12007
+ * @param options - Request options
12008
+ * @returns Array of {@link PracticeResourceCategory} records
12009
+ *
12010
+ * @example
12011
+ * ```typescript
12012
+ * const categories = await client.clinical.practiceResources.listCategories({
12013
+ * workspace_id: "..."
12014
+ * });
12015
+ * // [{ category: "article", resource_count: 5 }, { category: "video", resource_count: 3 }]
12016
+ * ```
12017
+ */
12018
+ listCategories: async (params, options) => rb.rawGet(
12019
+ `/clinical/practice-resources/categories?workspace_id=${encodeURIComponent(params.workspace_id)}`,
12020
+ options
12021
+ ),
12022
+ /**
12023
+ * List distinct catalog practice resource categories.
12024
+ *
12025
+ * Returns unique `resource_type` values from application-level catalog resources.
12026
+ * Application ID is resolved from the API key context.
12027
+ *
12028
+ * @param options - Request options
12029
+ * @returns Array of {@link PracticeResourceCategory} records
12030
+ *
12031
+ * @example
12032
+ * ```typescript
12033
+ * const cats = await client.clinical.practiceResources.listCatalogCategories();
12034
+ * ```
12035
+ */
12036
+ listCatalogCategories: async (options) => rb.rawGet(
12037
+ `/clinical/practice-resources/categories/catalog`,
12038
+ options
11563
12039
  )
11564
12040
  },
11565
12041
  /**
@@ -11663,6 +12139,24 @@ function createClinicalNamespace(rb) {
11663
12139
  getClinicalPracticeToolsCatalog,
11664
12140
  { query: params ?? {} },
11665
12141
  options
12142
+ ),
12143
+ /**
12144
+ * List distinct catalog practice tool categories.
12145
+ *
12146
+ * Returns unique `tool_type` values from application-level catalog tools.
12147
+ * Application ID is resolved from the API key context.
12148
+ *
12149
+ * @param options - Request options
12150
+ * @returns Array of {@link PracticeToolCategory} records
12151
+ *
12152
+ * @example
12153
+ * ```typescript
12154
+ * const cats = await client.clinical.practiceTools.listCatalogCategories();
12155
+ * ```
12156
+ */
12157
+ listCatalogCategories: async (options) => rb.rawGet(
12158
+ `/clinical/practice-tools/categories/catalog`,
12159
+ options
11666
12160
  )
11667
12161
  },
11668
12162
  /**
@@ -11942,6 +12436,24 @@ function createClinicalNamespace(rb) {
11942
12436
  getClinicalGoalTemplatesCatalog,
11943
12437
  { query: params ?? {} },
11944
12438
  options
12439
+ ),
12440
+ /**
12441
+ * List distinct catalog goal template categories.
12442
+ *
12443
+ * Returns unique `category` values from application-level catalog templates.
12444
+ * Application ID is resolved from the API key context.
12445
+ *
12446
+ * @param options - Request options
12447
+ * @returns Array of {@link ClinicalGoalTemplateCategory} records
12448
+ *
12449
+ * @example
12450
+ * ```typescript
12451
+ * const cats = await client.clinical.goalTemplates.listCatalogCategories();
12452
+ * ```
12453
+ */
12454
+ listCatalogCategories: async (options) => rb.rawGet(
12455
+ `/clinical/goal-templates/categories/catalog`,
12456
+ options
11945
12457
  )
11946
12458
  },
11947
12459
  /**
@@ -21865,6 +22377,15 @@ var ChangePasswordSchema = z2.object({
21865
22377
  message: "Passwords do not match",
21866
22378
  path: ["password_confirmation"]
21867
22379
  });
22380
+ var RegisterViaInvitationSchema = z2.object({
22381
+ email: z2.string().email(),
22382
+ password: z2.string().min(8),
22383
+ password_confirmation: z2.string().min(8),
22384
+ invitation_token: z2.string().min(1)
22385
+ }).refine((data) => data.password === data.password_confirmation, {
22386
+ message: "Passwords do not match",
22387
+ path: ["password_confirmation"]
22388
+ });
21868
22389
  function createIdentityNamespace(rb, baseUrl) {
21869
22390
  return {
21870
22391
  /**
@@ -21953,6 +22474,57 @@ function createIdentityNamespace(rb, baseUrl) {
21953
22474
  options
21954
22475
  );
21955
22476
  },
22477
+ /**
22478
+ * Register a new user via invitation — skips personal tenant creation.
22479
+ *
22480
+ * Creates the user account, accepts the invitation (creating tenant/workspace
22481
+ * memberships), and returns the authenticated user with a session token.
22482
+ * The email must match the invitation's recipient email.
22483
+ *
22484
+ * @param email - Must match the invitation recipient email
22485
+ * @param password - Minimum 8 characters
22486
+ * @param passwordConfirmation - Must match password
22487
+ * @param invitationToken - Raw token from the invitation email link
22488
+ * @param attrs - Optional extra attributes (first_name, last_name)
22489
+ * @param options - Optional request options
22490
+ * @returns The newly created `User` with session token
22491
+ *
22492
+ * @example
22493
+ * ```typescript
22494
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
22495
+ * const user = await client.identity.registerViaInvitation(
22496
+ * 'invited@example.com', 'securepass', 'securepass', 'raw-token-from-email',
22497
+ * { first_name: 'Jane', last_name: 'Doe' },
22498
+ * );
22499
+ * console.log(user.token); // JWT session token
22500
+ * ```
22501
+ */
22502
+ registerViaInvitation: async (email, password, passwordConfirmation, invitationToken, attrs, options) => {
22503
+ RegisterViaInvitationSchema.parse({
22504
+ email,
22505
+ password,
22506
+ password_confirmation: passwordConfirmation,
22507
+ invitation_token: invitationToken
22508
+ });
22509
+ return rb.execute(
22510
+ postUsersAuthRegisterViaInvitation,
22511
+ {
22512
+ body: {
22513
+ data: {
22514
+ type: "user",
22515
+ attributes: {
22516
+ email,
22517
+ password,
22518
+ password_confirmation: passwordConfirmation,
22519
+ invitation_token: invitationToken,
22520
+ ...attrs
22521
+ }
22522
+ }
22523
+ }
22524
+ },
22525
+ options
22526
+ );
22527
+ },
21956
22528
  /** Get the currently authenticated user */
21957
22529
  me: async (options) => {
21958
22530
  return rb.execute(getUsersMe, {}, options);
@@ -23103,26 +23675,56 @@ function createPlatformNamespace(rb) {
23103
23675
  );
23104
23676
  },
23105
23677
  /**
23106
- * Delete a tenant and all associated data.
23678
+ * Deactivate a tenant (hide from user's account).
23679
+ *
23680
+ * Sets `deactivated_at` on the tenant. The tenant and its workspaces
23681
+ * disappear from `workspaces.mine()` and tenant listings. Billing and
23682
+ * data are completely unaffected. Reversible via `reactivate()`.
23107
23683
  *
23108
- * Permanently removes the tenant, all their workspaces, documents, and
23109
- * billing records. This operation is irreversible. For a graceful
23110
- * off-boarding, prefer `schedulePurge` which allows data export before
23111
- * deletion.
23684
+ * Only the tenant owner can deactivate.
23112
23685
  *
23113
- * @param id - The UUID of the tenant to delete.
23686
+ * @param id - The UUID of the tenant to deactivate.
23114
23687
  * @param options - Optional request options.
23115
- * @returns `true` on successful deletion.
23688
+ * @returns The updated tenant record.
23116
23689
  *
23117
23690
  * @example
23118
23691
  * ```typescript
23119
- * const client = new GptClient({ apiKey: 'sk_app_...' });
23120
- * await client.platform.tenants.delete('tenant_abc123');
23692
+ * await client.platform.tenants.deactivate('tenant_abc123');
23121
23693
  * ```
23122
23694
  */
23123
- delete: async (id, options) => {
23124
- return rb.executeDelete(deleteTenantsById, { path: { id } }, options);
23125
- },
23695
+ deactivate: async (id, options) => rb.execute(
23696
+ patchTenantsByIdDeactivate,
23697
+ {
23698
+ path: { id },
23699
+ body: { data: { type: "tenant", id, attributes: {} } }
23700
+ },
23701
+ options
23702
+ ),
23703
+ /**
23704
+ * Reactivate a previously deactivated tenant.
23705
+ *
23706
+ * Clears `deactivated_at`, restoring the tenant and its workspaces
23707
+ * to the user's account. Only works on deactivated tenants.
23708
+ *
23709
+ * Only the tenant owner can reactivate.
23710
+ *
23711
+ * @param id - The UUID of the tenant to reactivate.
23712
+ * @param options - Optional request options.
23713
+ * @returns The updated tenant record.
23714
+ *
23715
+ * @example
23716
+ * ```typescript
23717
+ * await client.platform.tenants.reactivate('tenant_abc123');
23718
+ * ```
23719
+ */
23720
+ reactivate: async (id, options) => rb.execute(
23721
+ patchTenantsByIdReactivate,
23722
+ {
23723
+ path: { id },
23724
+ body: { data: { type: "tenant", id, attributes: {} } }
23725
+ },
23726
+ options
23727
+ ),
23126
23728
  /**
23127
23729
  * Create a new tenant (ISV provisioning flow).
23128
23730
  *
@@ -23493,6 +24095,52 @@ function createPlatformNamespace(rb) {
23493
24095
  options
23494
24096
  );
23495
24097
  },
24098
+ /**
24099
+ * List invitations visible to the current actor.
24100
+ *
24101
+ * Returns invitations where the actor is the inviter, the tenant owner,
24102
+ * or the recipient (matched by email). Use this to build admin views
24103
+ * of pending/accepted invitations for a tenant or workspace.
24104
+ *
24105
+ * @param options - Optional page number, page size, and request options.
24106
+ * @returns A page of `Invitation` records.
24107
+ *
24108
+ * @example
24109
+ * ```typescript
24110
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
24111
+ * const invites = await client.platform.invitations.list();
24112
+ * ```
24113
+ */
24114
+ list: async (options) => {
24115
+ return rb.execute(
24116
+ getInvitations,
24117
+ buildPageQuery(options?.page, options?.pageSize),
24118
+ options
24119
+ );
24120
+ },
24121
+ /**
24122
+ * List all invitations visible to the current actor, auto-paginating.
24123
+ *
24124
+ * @param options - Optional request options.
24125
+ * @returns All visible `Invitation` records as a flat array.
24126
+ *
24127
+ * @example
24128
+ * ```typescript
24129
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
24130
+ * const all = await client.platform.invitations.listAll();
24131
+ * ```
24132
+ */
24133
+ listAll: async (options) => {
24134
+ return paginateToArray(
24135
+ rb.createPaginatedFetcher(
24136
+ getInvitations,
24137
+ (page, pageSize) => ({
24138
+ query: { page: { number: page, size: pageSize } }
24139
+ }),
24140
+ options
24141
+ )
24142
+ );
24143
+ },
23496
24144
  /**
23497
24145
  * Look up a pending invitation by its raw token.
23498
24146
  *
@@ -29692,6 +30340,15 @@ function buildHeaders(getHeaders, options) {
29692
30340
  }
29693
30341
  return headers;
29694
30342
  }
30343
+ function enrichError(error, result) {
30344
+ if (typeof error === "object" && error !== null && typeof result === "object" && result !== null) {
30345
+ const res = result.response;
30346
+ if (res && typeof res === "object" && "status" in res) {
30347
+ error.statusCode = res.status;
30348
+ }
30349
+ }
30350
+ return error;
30351
+ }
29695
30352
  var RequestBuilder = class {
29696
30353
  constructor(clientInstance, getHeaders, unwrap, requestWithRetry) {
29697
30354
  this.clientInstance = clientInstance;
@@ -29706,7 +30363,7 @@ var RequestBuilder = class {
29706
30363
  async execute(fn, params, options) {
29707
30364
  const headers = buildHeaders(this.getHeaders, options);
29708
30365
  try {
29709
- const response = await this.requestWithRetry(
30366
+ const result = await this.requestWithRetry(
29710
30367
  () => fn({
29711
30368
  client: this.clientInstance,
29712
30369
  throwOnError: true,
@@ -29715,9 +30372,9 @@ var RequestBuilder = class {
29715
30372
  ...options?.signal && { signal: options.signal }
29716
30373
  })
29717
30374
  );
29718
- const { data, error } = response;
30375
+ const { data, error } = result;
29719
30376
  if (error) {
29720
- throw error;
30377
+ throw enrichError(error, result);
29721
30378
  }
29722
30379
  const innerData = data?.data;
29723
30380
  return this.unwrap(innerData);
@@ -29751,13 +30408,17 @@ var RequestBuilder = class {
29751
30408
  async rawGet(url, options) {
29752
30409
  const headers = buildHeaders(this.getHeaders, options);
29753
30410
  try {
29754
- const { data } = await this.requestWithRetry(
30411
+ const result = await this.requestWithRetry(
29755
30412
  () => this.clientInstance.get({
29756
30413
  url,
29757
30414
  headers,
29758
30415
  ...options?.signal && { signal: options.signal }
29759
30416
  })
29760
30417
  );
30418
+ const { data, error } = result;
30419
+ if (error) {
30420
+ throw handleApiError(enrichError(error, result));
30421
+ }
29761
30422
  return this.unwrap(data?.data);
29762
30423
  } catch (error) {
29763
30424
  throw handleApiError(error);
@@ -29772,7 +30433,7 @@ var RequestBuilder = class {
29772
30433
  async rawPostMultipart(url, body, options) {
29773
30434
  const headers = buildHeaders(this.getHeaders, options);
29774
30435
  headers["Content-Type"] = null;
29775
- const { data, error } = await this.requestWithRetry(
30436
+ const result = await this.requestWithRetry(
29776
30437
  () => this.clientInstance.post({
29777
30438
  url,
29778
30439
  headers,
@@ -29781,8 +30442,9 @@ var RequestBuilder = class {
29781
30442
  ...options?.signal && { signal: options.signal }
29782
30443
  })
29783
30444
  );
30445
+ const { data, error } = result;
29784
30446
  if (error) {
29785
- throw handleApiError(error);
30447
+ throw handleApiError(enrichError(error, result));
29786
30448
  }
29787
30449
  return data;
29788
30450
  }
@@ -29793,7 +30455,7 @@ var RequestBuilder = class {
29793
30455
  async rawPost(url, body, options) {
29794
30456
  const headers = buildHeaders(this.getHeaders, options);
29795
30457
  try {
29796
- const { data } = await this.requestWithRetry(
30458
+ const result = await this.requestWithRetry(
29797
30459
  () => this.clientInstance.post({
29798
30460
  url,
29799
30461
  headers,
@@ -29801,6 +30463,10 @@ var RequestBuilder = class {
29801
30463
  ...options?.signal && { signal: options.signal }
29802
30464
  })
29803
30465
  );
30466
+ const { data, error } = result;
30467
+ if (error) {
30468
+ throw handleApiError(enrichError(error, result));
30469
+ }
29804
30470
  return this.unwrap(data?.data);
29805
30471
  } catch (error) {
29806
30472
  throw handleApiError(error);
@@ -29812,7 +30478,7 @@ var RequestBuilder = class {
29812
30478
  async rawPut(url, body, options) {
29813
30479
  const headers = buildHeaders(this.getHeaders, options);
29814
30480
  try {
29815
- const { data } = await this.requestWithRetry(
30481
+ const result = await this.requestWithRetry(
29816
30482
  () => this.clientInstance.put({
29817
30483
  url,
29818
30484
  headers,
@@ -29820,6 +30486,10 @@ var RequestBuilder = class {
29820
30486
  ...options?.signal && { signal: options.signal }
29821
30487
  })
29822
30488
  );
30489
+ const { data, error } = result;
30490
+ if (error) {
30491
+ throw handleApiError(enrichError(error, result));
30492
+ }
29823
30493
  return this.unwrap(data?.data);
29824
30494
  } catch (error) {
29825
30495
  throw handleApiError(error);
@@ -29831,7 +30501,7 @@ var RequestBuilder = class {
29831
30501
  async rawPatch(url, body, options) {
29832
30502
  const headers = buildHeaders(this.getHeaders, options);
29833
30503
  try {
29834
- const { data } = await this.requestWithRetry(
30504
+ const result = await this.requestWithRetry(
29835
30505
  () => this.clientInstance.patch({
29836
30506
  url,
29837
30507
  headers,
@@ -29839,6 +30509,10 @@ var RequestBuilder = class {
29839
30509
  ...options?.signal && { signal: options.signal }
29840
30510
  })
29841
30511
  );
30512
+ const { data, error } = result;
30513
+ if (error) {
30514
+ throw handleApiError(enrichError(error, result));
30515
+ }
29842
30516
  return this.unwrap(data?.data);
29843
30517
  } catch (error) {
29844
30518
  throw handleApiError(error);
@@ -29850,13 +30524,17 @@ var RequestBuilder = class {
29850
30524
  async rawDelete(url, options) {
29851
30525
  const headers = buildHeaders(this.getHeaders, options);
29852
30526
  try {
29853
- const { data } = await this.requestWithRetry(
30527
+ const result = await this.requestWithRetry(
29854
30528
  () => this.clientInstance.delete({
29855
30529
  url,
29856
30530
  headers,
29857
30531
  ...options?.signal && { signal: options.signal }
29858
30532
  })
29859
30533
  );
30534
+ const { data, error } = result;
30535
+ if (error) {
30536
+ throw handleApiError(enrichError(error, result));
30537
+ }
29860
30538
  return this.unwrap(data?.data);
29861
30539
  } catch (error) {
29862
30540
  throw handleApiError(error);
@@ -29874,7 +30552,7 @@ var RequestBuilder = class {
29874
30552
  createPaginatedFetcher(fn, queryBuilder, options) {
29875
30553
  return async (page, pageSize) => {
29876
30554
  const headers = buildHeaders(this.getHeaders, options);
29877
- const { data } = await this.requestWithRetry(
30555
+ const result = await this.requestWithRetry(
29878
30556
  () => fn({
29879
30557
  client: this.clientInstance,
29880
30558
  headers,
@@ -29882,6 +30560,10 @@ var RequestBuilder = class {
29882
30560
  ...queryBuilder(page, pageSize)
29883
30561
  })
29884
30562
  );
30563
+ const { data, error } = result;
30564
+ if (error) {
30565
+ throw handleApiError(enrichError(error, result));
30566
+ }
29885
30567
  const envelope = data;
29886
30568
  const items = this.unwrap(envelope.data) || [];
29887
30569
  return { data: items, links: envelope.links };
@@ -29999,6 +30681,7 @@ var GptClient = class extends BaseClient {
29999
30681
  this.ai = createAiNamespace(rb);
30000
30682
  this.billing = createBillingNamespace(rb);
30001
30683
  this.catalog = createCatalogNamespace(rb);
30684
+ this.content = createContentNamespace(rb);
30002
30685
  this.clinical = createClinicalNamespace(rb);
30003
30686
  this.compliance = createComplianceNamespace(rb);
30004
30687
  this.communication = createCommunicationNamespace(rb);