@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.js CHANGED
@@ -1333,7 +1333,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1333
1333
  }
1334
1334
 
1335
1335
  // src/version.ts
1336
- var SDK_VERSION = "0.8.1";
1336
+ var SDK_VERSION = "0.8.3";
1337
1337
  var DEFAULT_API_VERSION = "2026-03-11";
1338
1338
 
1339
1339
  // src/base-client.ts
@@ -1604,6 +1604,36 @@ var BaseClient = class {
1604
1604
  clearToken() {
1605
1605
  this.config = { ...this.config, token: void 0 };
1606
1606
  }
1607
+ /**
1608
+ * Switch the workspace context for all subsequent requests.
1609
+ *
1610
+ * Sets the `workspace_id` query parameter appended to every request.
1611
+ * Use this after creating a new workspace or switching workspace context
1612
+ * without constructing a new client instance.
1613
+ *
1614
+ * @param workspaceId - The workspace UUID to scope requests to, or
1615
+ * `undefined` to clear workspace scoping.
1616
+ *
1617
+ * @example
1618
+ * ```typescript
1619
+ * const org = await sdk.platform.tenants.createOrg({ name: 'Acme' });
1620
+ * const workspaces = await sdk.platform.workspaces.mine();
1621
+ * const ws = workspaces.find(w => w.tenant_id === org.id);
1622
+ *
1623
+ * sdk.setWorkspaceId(ws.id);
1624
+ * // All subsequent calls are scoped to the new workspace
1625
+ * await sdk.scheduling.events.create({ ... });
1626
+ * ```
1627
+ */
1628
+ setWorkspaceId(workspaceId) {
1629
+ this.config = { ...this.config, workspaceId };
1630
+ }
1631
+ /**
1632
+ * Get the current workspace ID, if set.
1633
+ */
1634
+ getWorkspaceId() {
1635
+ return this.config.workspaceId;
1636
+ }
1607
1637
  };
1608
1638
 
1609
1639
  // src/namespaces/audit.ts
@@ -3370,6 +3400,15 @@ var patchCrawlerJobsByIdCancel = (options) => (options.client ?? client).patch({
3370
3400
  ...options.headers
3371
3401
  }
3372
3402
  });
3403
+ var postContentGenerateHashtags = (options) => (options.client ?? client).post({
3404
+ security: [{ scheme: "bearer", type: "http" }],
3405
+ url: "/content/generate-hashtags",
3406
+ ...options,
3407
+ headers: {
3408
+ "Content-Type": "application/vnd.api+json",
3409
+ ...options.headers
3410
+ }
3411
+ });
3373
3412
  var deleteClinicalNotesById = (options) => (options.client ?? client).delete({
3374
3413
  security: [{ scheme: "bearer", type: "http" }],
3375
3414
  url: "/clinical/notes/{id}",
@@ -3598,6 +3637,15 @@ var patchEmailInboundAddressesByIdRotateToken = (options) => (options.client ??
3598
3637
  ...options.headers
3599
3638
  }
3600
3639
  });
3640
+ var postContentSeoEnrich = (options) => (options.client ?? client).post({
3641
+ security: [{ scheme: "bearer", type: "http" }],
3642
+ url: "/content/seo-enrich",
3643
+ ...options,
3644
+ headers: {
3645
+ "Content-Type": "application/vnd.api+json",
3646
+ ...options.headers
3647
+ }
3648
+ });
3601
3649
  var deleteSchedulingParticipantsById = (options) => (options.client ?? client).delete({
3602
3650
  security: [{ scheme: "bearer", type: "http" }],
3603
3651
  url: "/scheduling/participants/{id}",
@@ -3864,6 +3912,11 @@ var postVoiceSessions = (options) => (options.client ?? client).post({
3864
3912
  ...options.headers
3865
3913
  }
3866
3914
  });
3915
+ var getInvitations = (options) => (options.client ?? client).get({
3916
+ security: [{ scheme: "bearer", type: "http" }],
3917
+ url: "/invitations",
3918
+ ...options
3919
+ });
3867
3920
  var postInvitations = (options) => (options.client ?? client).post({
3868
3921
  security: [{ scheme: "bearer", type: "http" }],
3869
3922
  url: "/invitations",
@@ -4174,6 +4227,15 @@ var postRoles = (options) => (options.client ?? client).post({
4174
4227
  ...options.headers
4175
4228
  }
4176
4229
  });
4230
+ var postContentGenerateText = (options) => (options.client ?? client).post({
4231
+ security: [{ scheme: "bearer", type: "http" }],
4232
+ url: "/content/generate-text",
4233
+ ...options,
4234
+ headers: {
4235
+ "Content-Type": "application/vnd.api+json",
4236
+ ...options.headers
4237
+ }
4238
+ });
4177
4239
  var getComplianceRequirementCompletions = (options) => (options.client ?? client).get({
4178
4240
  security: [{ scheme: "bearer", type: "http" }],
4179
4241
  url: "/compliance-requirement-completions",
@@ -4305,6 +4367,15 @@ var postSocialPosts = (options) => (options.client ?? client).post({
4305
4367
  ...options.headers
4306
4368
  }
4307
4369
  });
4370
+ var postContentShorten = (options) => (options.client ?? client).post({
4371
+ security: [{ scheme: "bearer", type: "http" }],
4372
+ url: "/content/shorten",
4373
+ ...options,
4374
+ headers: {
4375
+ "Content-Type": "application/vnd.api+json",
4376
+ ...options.headers
4377
+ }
4378
+ });
4308
4379
  var deleteClinicalPatientsById = (options) => (options.client ?? client).delete({
4309
4380
  security: [{ scheme: "bearer", type: "http" }],
4310
4381
  url: "/clinical/patients/{id}",
@@ -4601,6 +4672,15 @@ var getEmailInclusionsEmailByOutboundEmailId = (options) => (options.client ?? c
4601
4672
  url: "/email/inclusions/email/{outbound_email_id}",
4602
4673
  ...options
4603
4674
  });
4675
+ var patchTenantsByIdReactivate = (options) => (options.client ?? client).patch({
4676
+ security: [{ scheme: "bearer", type: "http" }],
4677
+ url: "/tenants/{id}/reactivate",
4678
+ ...options,
4679
+ headers: {
4680
+ "Content-Type": "application/vnd.api+json",
4681
+ ...options.headers
4682
+ }
4683
+ });
4604
4684
  var getWorkspacesByWorkspaceIdExtractionExportsById = (options) => (options.client ?? client).get({
4605
4685
  security: [{ scheme: "bearer", type: "http" }],
4606
4686
  url: "/workspaces/{workspace_id}/extraction/exports/{id}",
@@ -4625,6 +4705,15 @@ var getUserProfilesMe = (options) => (options.client ?? client).get({
4625
4705
  url: "/user-profiles/me",
4626
4706
  ...options
4627
4707
  });
4708
+ var postContentSuggestTopics = (options) => (options.client ?? client).post({
4709
+ security: [{ scheme: "bearer", type: "http" }],
4710
+ url: "/content/suggest-topics",
4711
+ ...options,
4712
+ headers: {
4713
+ "Content-Type": "application/vnd.api+json",
4714
+ ...options.headers
4715
+ }
4716
+ });
4628
4717
  var postDocumentsPresignedUpload = (options) => (options.client ?? client).post({
4629
4718
  security: [{ scheme: "bearer", type: "http" }],
4630
4719
  url: "/documents/presigned-upload",
@@ -4694,6 +4783,15 @@ var postConnectorsFullscriptCheckPatient = (options) => (options.client ?? clien
4694
4783
  ...options.headers
4695
4784
  }
4696
4785
  });
4786
+ var patchTenantsByIdDeactivate = (options) => (options.client ?? client).patch({
4787
+ security: [{ scheme: "bearer", type: "http" }],
4788
+ url: "/tenants/{id}/deactivate",
4789
+ ...options,
4790
+ headers: {
4791
+ "Content-Type": "application/vnd.api+json",
4792
+ ...options.headers
4793
+ }
4794
+ });
4697
4795
  var getSchedulingEventTypes = (options) => (options.client ?? client).get({
4698
4796
  security: [{ scheme: "bearer", type: "http" }],
4699
4797
  url: "/scheduling/event-types",
@@ -5215,6 +5313,15 @@ var getTransactions = (options) => (options.client ?? client).get({
5215
5313
  url: "/transactions",
5216
5314
  ...options
5217
5315
  });
5316
+ var postContentGenerateImagePrompt = (options) => (options.client ?? client).post({
5317
+ security: [{ scheme: "bearer", type: "http" }],
5318
+ url: "/content/generate-image-prompt",
5319
+ ...options,
5320
+ headers: {
5321
+ "Content-Type": "application/vnd.api+json",
5322
+ ...options.headers
5323
+ }
5324
+ });
5218
5325
  var postSocialTrendingHistory = (options) => (options.client ?? client).post({
5219
5326
  security: [{ scheme: "bearer", type: "http" }],
5220
5327
  url: "/social/trending/history",
@@ -5419,6 +5526,15 @@ var patchEmailOutboundEmailsByIdCancelSchedule = (options) => (options.client ??
5419
5526
  ...options.headers
5420
5527
  }
5421
5528
  });
5529
+ var postContentRefine = (options) => (options.client ?? client).post({
5530
+ security: [{ scheme: "bearer", type: "http" }],
5531
+ url: "/content/refine",
5532
+ ...options,
5533
+ headers: {
5534
+ "Content-Type": "application/vnd.api+json",
5535
+ ...options.headers
5536
+ }
5537
+ });
5422
5538
  var getLegalDocumentsByLocale = (options) => (options.client ?? client).get({
5423
5539
  security: [{ scheme: "bearer", type: "http" }],
5424
5540
  url: "/legal-documents/by-locale",
@@ -5721,6 +5837,15 @@ var patchSchedulingEventsById = (options) => (options.client ?? client).patch({
5721
5837
  ...options.headers
5722
5838
  }
5723
5839
  });
5840
+ var postContentRewriteTone = (options) => (options.client ?? client).post({
5841
+ security: [{ scheme: "bearer", type: "http" }],
5842
+ url: "/content/rewrite-tone",
5843
+ ...options,
5844
+ headers: {
5845
+ "Content-Type": "application/vnd.api+json",
5846
+ ...options.headers
5847
+ }
5848
+ });
5724
5849
  var patchStorageFilesByIdSoftDelete = (options) => (options.client ?? client).patch({
5725
5850
  security: [{ scheme: "bearer", type: "http" }],
5726
5851
  url: "/storage-files/{id}/soft-delete",
@@ -5749,6 +5874,15 @@ var patchConnectorsById = (options) => (options.client ?? client).patch({
5749
5874
  ...options.headers
5750
5875
  }
5751
5876
  });
5877
+ var postContentGenerateImage = (options) => (options.client ?? client).post({
5878
+ security: [{ scheme: "bearer", type: "http" }],
5879
+ url: "/content/generate-image",
5880
+ ...options,
5881
+ headers: {
5882
+ "Content-Type": "application/vnd.api+json",
5883
+ ...options.headers
5884
+ }
5885
+ });
5752
5886
  var patchWalletPlanCancel = (options) => (options.client ?? client).patch({
5753
5887
  security: [{ scheme: "bearer", type: "http" }],
5754
5888
  url: "/wallet/plan/cancel",
@@ -5976,11 +6110,6 @@ var patchBrandIdentitiesByIdUnsetDefault = (options) => (options.client ?? clien
5976
6110
  ...options.headers
5977
6111
  }
5978
6112
  });
5979
- var deleteTenantsById = (options) => (options.client ?? client).delete({
5980
- security: [{ scheme: "bearer", type: "http" }],
5981
- url: "/tenants/{id}",
5982
- ...options
5983
- });
5984
6113
  var getTenantsById = (options) => (options.client ?? client).get({
5985
6114
  security: [{ scheme: "bearer", type: "http" }],
5986
6115
  url: "/tenants/{id}",
@@ -6037,6 +6166,15 @@ var postSchedulingEvents = (options) => (options.client ?? client).post({
6037
6166
  ...options.headers
6038
6167
  }
6039
6168
  });
6169
+ var postContentEditImage = (options) => (options.client ?? client).post({
6170
+ security: [{ scheme: "bearer", type: "http" }],
6171
+ url: "/content/edit-image",
6172
+ ...options,
6173
+ headers: {
6174
+ "Content-Type": "application/vnd.api+json",
6175
+ ...options.headers
6176
+ }
6177
+ });
6040
6178
  var postEmailRecipients = (options) => (options.client ?? client).post({
6041
6179
  security: [{ scheme: "bearer", type: "http" }],
6042
6180
  url: "/email/recipients",
@@ -6823,6 +6961,15 @@ var postAgentsByIdExport = (options) => (options.client ?? client).post({
6823
6961
  url: "/agents/{id}/export",
6824
6962
  ...options
6825
6963
  });
6964
+ var postUsersAuthRegisterViaInvitation = (options) => (options.client ?? client).post({
6965
+ security: [{ scheme: "bearer", type: "http" }],
6966
+ url: "/users/auth/register-via-invitation",
6967
+ ...options,
6968
+ headers: {
6969
+ "Content-Type": "application/vnd.api+json",
6970
+ ...options.headers
6971
+ }
6972
+ });
6826
6973
  var postEmailInboundAddresses = (options) => (options.client ?? client).post({
6827
6974
  security: [{ scheme: "bearer", type: "http" }],
6828
6975
  url: "/email/inbound-addresses",
@@ -10113,6 +10260,31 @@ function createBillingNamespace(rb) {
10113
10260
  );
10114
10261
  return result.data ?? result;
10115
10262
  }
10263
+ },
10264
+ /**
10265
+ * Get capacity estimates for a plan's monthly credits.
10266
+ *
10267
+ * Returns how many of each ISV-defined feature the plan supports per month.
10268
+ * No Bearer token required — uses application key only.
10269
+ *
10270
+ * @param planSlug - The plan slug to calculate capacity for.
10271
+ * @param options - Optional request-level overrides.
10272
+ * @returns Plan details and capacity breakdown per composite operation.
10273
+ *
10274
+ * @example
10275
+ * ```typescript
10276
+ * const result = await client.billing.capacityCalculator("pro-plan");
10277
+ * console.log(`Plan: ${result.plan.name}`);
10278
+ * for (const item of result.capacity) {
10279
+ * console.log(`${item.display_name}: ~${item.estimated_monthly_count}/month`);
10280
+ * }
10281
+ * ```
10282
+ */
10283
+ capacityCalculator: async (planSlug, options) => {
10284
+ return rb.rawGet(
10285
+ `/billing/capacity-calculator?plan_slug=${encodeURIComponent(planSlug)}`,
10286
+ options
10287
+ );
10116
10288
  }
10117
10289
  };
10118
10290
  }
@@ -10743,6 +10915,249 @@ function createCatalogNamespace(rb) {
10743
10915
  };
10744
10916
  }
10745
10917
 
10918
+ // src/namespaces/content.ts
10919
+ function createContentNamespace(rb) {
10920
+ return {
10921
+ /**
10922
+ * Generate text from a prompt, optionally informed by brand identity.
10923
+ * @param attributes - { prompt, workspace_id, brand_identity_id?, task? }
10924
+ * @returns { text: string }
10925
+ * @example
10926
+ * ```typescript
10927
+ * const result = await client.content.generateText({
10928
+ * prompt: "Write about AI analytics",
10929
+ * workspace_id: "ws_abc",
10930
+ * });
10931
+ * ```
10932
+ */
10933
+ generateText: async (attributes, options) => {
10934
+ return rb.execute(
10935
+ postContentGenerateText,
10936
+ {
10937
+ body: {
10938
+ data: { type: "content-generation", attributes }
10939
+ }
10940
+ },
10941
+ options
10942
+ );
10943
+ },
10944
+ /**
10945
+ * Generate an image from a text prompt via Gemini.
10946
+ * @param attributes - { prompt, workspace_id, style? }
10947
+ * @returns { url: string, provider: string }
10948
+ * @example
10949
+ * ```typescript
10950
+ * const result = await client.content.generateImage({
10951
+ * prompt: "A futuristic city skyline",
10952
+ * workspace_id: "ws_abc",
10953
+ * });
10954
+ * ```
10955
+ */
10956
+ generateImage: async (attributes, options) => {
10957
+ return rb.execute(
10958
+ postContentGenerateImage,
10959
+ {
10960
+ body: {
10961
+ data: { type: "content-generation", attributes }
10962
+ }
10963
+ },
10964
+ options
10965
+ );
10966
+ },
10967
+ /**
10968
+ * Edit an existing image using natural language instructions.
10969
+ * @param attributes - { image_url, instructions, workspace_id }
10970
+ * @returns { url: string, provider: string }
10971
+ * @example
10972
+ * ```typescript
10973
+ * const result = await client.content.editImage({
10974
+ * image_url: "https://example.com/photo.png",
10975
+ * instructions: "Remove the background",
10976
+ * workspace_id: "ws_abc",
10977
+ * });
10978
+ * ```
10979
+ */
10980
+ editImage: async (attributes, options) => {
10981
+ return rb.execute(
10982
+ postContentEditImage,
10983
+ {
10984
+ body: {
10985
+ data: { type: "content-generation", attributes }
10986
+ }
10987
+ },
10988
+ options
10989
+ );
10990
+ },
10991
+ /**
10992
+ * Rewrite text in a different tone.
10993
+ * @param attributes - { text, target_tone, workspace_id, max_length? }
10994
+ * @returns { rewritten_text: string }
10995
+ * @example
10996
+ * ```typescript
10997
+ * const result = await client.content.rewriteTone({
10998
+ * text: "We are pleased to announce our new product.",
10999
+ * target_tone: "casual",
11000
+ * workspace_id: "ws_abc",
11001
+ * });
11002
+ * ```
11003
+ */
11004
+ rewriteTone: async (attributes, options) => {
11005
+ return rb.execute(
11006
+ postContentRewriteTone,
11007
+ {
11008
+ body: {
11009
+ data: { type: "content-generation", attributes }
11010
+ }
11011
+ },
11012
+ options
11013
+ );
11014
+ },
11015
+ /**
11016
+ * Shorten text to a target character count.
11017
+ * @param attributes - { text, max_chars, workspace_id, platform? }
11018
+ * @returns { shortened_text: string }
11019
+ * @example
11020
+ * ```typescript
11021
+ * const result = await client.content.shorten({
11022
+ * text: "This is a long piece of content that needs shortening.",
11023
+ * max_chars: 280,
11024
+ * workspace_id: "ws_abc",
11025
+ * });
11026
+ * ```
11027
+ */
11028
+ shorten: async (attributes, options) => {
11029
+ return rb.execute(
11030
+ postContentShorten,
11031
+ {
11032
+ body: {
11033
+ data: { type: "content-generation", attributes }
11034
+ }
11035
+ },
11036
+ options
11037
+ );
11038
+ },
11039
+ /**
11040
+ * Refine text based on freeform instructions.
11041
+ * @param attributes - { text, instructions, workspace_id }
11042
+ * @returns { refined_text: string }
11043
+ * @example
11044
+ * ```typescript
11045
+ * const result = await client.content.refine({
11046
+ * text: "Draft blog post content here.",
11047
+ * instructions: "Make it more engaging and add a call to action",
11048
+ * workspace_id: "ws_abc",
11049
+ * });
11050
+ * ```
11051
+ */
11052
+ refine: async (attributes, options) => {
11053
+ return rb.execute(
11054
+ postContentRefine,
11055
+ {
11056
+ body: {
11057
+ data: { type: "content-generation", attributes }
11058
+ }
11059
+ },
11060
+ options
11061
+ );
11062
+ },
11063
+ /**
11064
+ * Suggest content topics based on industry and audience.
11065
+ * @param attributes - { workspace_id, industry?, brand_identity_id?, count? }
11066
+ * @returns { suggestions: string }
11067
+ * @example
11068
+ * ```typescript
11069
+ * const result = await client.content.suggestTopics({
11070
+ * workspace_id: "ws_abc",
11071
+ * industry: "fintech",
11072
+ * count: 5,
11073
+ * });
11074
+ * ```
11075
+ */
11076
+ suggestTopics: async (attributes, options) => {
11077
+ return rb.execute(
11078
+ postContentSuggestTopics,
11079
+ {
11080
+ body: {
11081
+ data: { type: "content-generation", attributes }
11082
+ }
11083
+ },
11084
+ options
11085
+ );
11086
+ },
11087
+ /**
11088
+ * Generate an image generation prompt from marketing copy.
11089
+ * @param attributes - { marketing_copy, workspace_id, style? }
11090
+ * @returns { image_prompt: string }
11091
+ * @example
11092
+ * ```typescript
11093
+ * const result = await client.content.generateImagePrompt({
11094
+ * marketing_copy: "Launch your brand into the future",
11095
+ * workspace_id: "ws_abc",
11096
+ * });
11097
+ * ```
11098
+ */
11099
+ generateImagePrompt: async (attributes, options) => {
11100
+ return rb.execute(
11101
+ postContentGenerateImagePrompt,
11102
+ {
11103
+ body: {
11104
+ data: { type: "content-generation", attributes }
11105
+ }
11106
+ },
11107
+ options
11108
+ );
11109
+ },
11110
+ /**
11111
+ * Generate scored hashtags for content.
11112
+ * @param attributes - { text, platform, workspace_id, industry?, count? }
11113
+ * @returns { hashtags: Array<{ tag: string, score: number }> }
11114
+ * @example
11115
+ * ```typescript
11116
+ * const result = await client.content.generateHashtags({
11117
+ * text: "Check out our new AI-powered analytics tool",
11118
+ * platform: "instagram",
11119
+ * workspace_id: "ws_abc",
11120
+ * });
11121
+ * ```
11122
+ */
11123
+ generateHashtags: async (attributes, options) => {
11124
+ return rb.execute(
11125
+ postContentGenerateHashtags,
11126
+ {
11127
+ body: {
11128
+ data: { type: "content-generation", attributes }
11129
+ }
11130
+ },
11131
+ options
11132
+ );
11133
+ },
11134
+ /**
11135
+ * Analyze content for SEO optimization against target keywords.
11136
+ * @param attributes - { text, target_keywords, workspace_id }
11137
+ * @returns { analysis: { keyword_coverage, suggestions, seo_score } }
11138
+ * @example
11139
+ * ```typescript
11140
+ * const result = await client.content.seoEnrich({
11141
+ * text: "Our product helps businesses grow",
11142
+ * target_keywords: ["growth", "business", "scale"],
11143
+ * workspace_id: "ws_abc",
11144
+ * });
11145
+ * ```
11146
+ */
11147
+ seoEnrich: async (attributes, options) => {
11148
+ return rb.execute(
11149
+ postContentSeoEnrich,
11150
+ {
11151
+ body: {
11152
+ data: { type: "content-generation", attributes }
11153
+ }
11154
+ },
11155
+ options
11156
+ );
11157
+ }
11158
+ };
11159
+ }
11160
+
10746
11161
  // src/namespaces/clinical.ts
10747
11162
  function createClinicalNamespace(rb) {
10748
11163
  return {
@@ -10843,6 +11258,27 @@ function createClinicalNamespace(rb) {
10843
11258
  * ```
10844
11259
  */
10845
11260
  delete: async (id, options) => rb.executeDelete(deleteClinicalPatientsById, { path: { id } }, options),
11261
+ /**
11262
+ * Look up a patient by their CRM Contact ID.
11263
+ *
11264
+ * Most ISV apps work with CRM Contact IDs, not Clinical Patient UUIDs.
11265
+ * Use this to resolve the patient record for a given contact.
11266
+ *
11267
+ * @param contactId - CRM Contact UUID
11268
+ * @param options - Request options
11269
+ * @returns {@link ClinicalPatient} record linked to the contact
11270
+ * @throws {@link NotFoundError} if no patient exists for the contact
11271
+ *
11272
+ * @example
11273
+ * ```typescript
11274
+ * const patient = await client.clinical.patients.getByContact('c7da2056-...');
11275
+ * console.log(patient.id); // Clinical Patient UUID
11276
+ * ```
11277
+ */
11278
+ getByContact: async (contactId, options) => rb.rawGet(
11279
+ `/clinical/patients/by-contact/${contactId}`,
11280
+ options
11281
+ ),
10846
11282
  /**
10847
11283
  * List health metrics for a patient (related resource).
10848
11284
  *
@@ -11624,6 +12060,46 @@ function createClinicalNamespace(rb) {
11624
12060
  getClinicalPracticeResourcesCatalog,
11625
12061
  { query: params ?? {} },
11626
12062
  options
12063
+ ),
12064
+ /**
12065
+ * List distinct practice resource categories in a workspace.
12066
+ *
12067
+ * Returns unique `resource_type` values with their active resource counts,
12068
+ * sorted by count descending.
12069
+ *
12070
+ * @param params - Must include `workspace_id`
12071
+ * @param options - Request options
12072
+ * @returns Array of {@link PracticeResourceCategory} records
12073
+ *
12074
+ * @example
12075
+ * ```typescript
12076
+ * const categories = await client.clinical.practiceResources.listCategories({
12077
+ * workspace_id: "..."
12078
+ * });
12079
+ * // [{ category: "article", resource_count: 5 }, { category: "video", resource_count: 3 }]
12080
+ * ```
12081
+ */
12082
+ listCategories: async (params, options) => rb.rawGet(
12083
+ `/clinical/practice-resources/categories?workspace_id=${encodeURIComponent(params.workspace_id)}`,
12084
+ options
12085
+ ),
12086
+ /**
12087
+ * List distinct catalog practice resource categories.
12088
+ *
12089
+ * Returns unique `resource_type` values from application-level catalog resources.
12090
+ * Application ID is resolved from the API key context.
12091
+ *
12092
+ * @param options - Request options
12093
+ * @returns Array of {@link PracticeResourceCategory} records
12094
+ *
12095
+ * @example
12096
+ * ```typescript
12097
+ * const cats = await client.clinical.practiceResources.listCatalogCategories();
12098
+ * ```
12099
+ */
12100
+ listCatalogCategories: async (options) => rb.rawGet(
12101
+ `/clinical/practice-resources/categories/catalog`,
12102
+ options
11627
12103
  )
11628
12104
  },
11629
12105
  /**
@@ -11727,6 +12203,24 @@ function createClinicalNamespace(rb) {
11727
12203
  getClinicalPracticeToolsCatalog,
11728
12204
  { query: params ?? {} },
11729
12205
  options
12206
+ ),
12207
+ /**
12208
+ * List distinct catalog practice tool categories.
12209
+ *
12210
+ * Returns unique `tool_type` values from application-level catalog tools.
12211
+ * Application ID is resolved from the API key context.
12212
+ *
12213
+ * @param options - Request options
12214
+ * @returns Array of {@link PracticeToolCategory} records
12215
+ *
12216
+ * @example
12217
+ * ```typescript
12218
+ * const cats = await client.clinical.practiceTools.listCatalogCategories();
12219
+ * ```
12220
+ */
12221
+ listCatalogCategories: async (options) => rb.rawGet(
12222
+ `/clinical/practice-tools/categories/catalog`,
12223
+ options
11730
12224
  )
11731
12225
  },
11732
12226
  /**
@@ -12006,6 +12500,24 @@ function createClinicalNamespace(rb) {
12006
12500
  getClinicalGoalTemplatesCatalog,
12007
12501
  { query: params ?? {} },
12008
12502
  options
12503
+ ),
12504
+ /**
12505
+ * List distinct catalog goal template categories.
12506
+ *
12507
+ * Returns unique `category` values from application-level catalog templates.
12508
+ * Application ID is resolved from the API key context.
12509
+ *
12510
+ * @param options - Request options
12511
+ * @returns Array of {@link ClinicalGoalTemplateCategory} records
12512
+ *
12513
+ * @example
12514
+ * ```typescript
12515
+ * const cats = await client.clinical.goalTemplates.listCatalogCategories();
12516
+ * ```
12517
+ */
12518
+ listCatalogCategories: async (options) => rb.rawGet(
12519
+ `/clinical/goal-templates/categories/catalog`,
12520
+ options
12009
12521
  )
12010
12522
  },
12011
12523
  /**
@@ -21929,6 +22441,15 @@ var ChangePasswordSchema = import_zod2.z.object({
21929
22441
  message: "Passwords do not match",
21930
22442
  path: ["password_confirmation"]
21931
22443
  });
22444
+ var RegisterViaInvitationSchema = import_zod2.z.object({
22445
+ email: import_zod2.z.string().email(),
22446
+ password: import_zod2.z.string().min(8),
22447
+ password_confirmation: import_zod2.z.string().min(8),
22448
+ invitation_token: import_zod2.z.string().min(1)
22449
+ }).refine((data) => data.password === data.password_confirmation, {
22450
+ message: "Passwords do not match",
22451
+ path: ["password_confirmation"]
22452
+ });
21932
22453
  function createIdentityNamespace(rb, baseUrl) {
21933
22454
  return {
21934
22455
  /**
@@ -22017,6 +22538,57 @@ function createIdentityNamespace(rb, baseUrl) {
22017
22538
  options
22018
22539
  );
22019
22540
  },
22541
+ /**
22542
+ * Register a new user via invitation — skips personal tenant creation.
22543
+ *
22544
+ * Creates the user account, accepts the invitation (creating tenant/workspace
22545
+ * memberships), and returns the authenticated user with a session token.
22546
+ * The email must match the invitation's recipient email.
22547
+ *
22548
+ * @param email - Must match the invitation recipient email
22549
+ * @param password - Minimum 8 characters
22550
+ * @param passwordConfirmation - Must match password
22551
+ * @param invitationToken - Raw token from the invitation email link
22552
+ * @param attrs - Optional extra attributes (first_name, last_name)
22553
+ * @param options - Optional request options
22554
+ * @returns The newly created `User` with session token
22555
+ *
22556
+ * @example
22557
+ * ```typescript
22558
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
22559
+ * const user = await client.identity.registerViaInvitation(
22560
+ * 'invited@example.com', 'securepass', 'securepass', 'raw-token-from-email',
22561
+ * { first_name: 'Jane', last_name: 'Doe' },
22562
+ * );
22563
+ * console.log(user.token); // JWT session token
22564
+ * ```
22565
+ */
22566
+ registerViaInvitation: async (email, password, passwordConfirmation, invitationToken, attrs, options) => {
22567
+ RegisterViaInvitationSchema.parse({
22568
+ email,
22569
+ password,
22570
+ password_confirmation: passwordConfirmation,
22571
+ invitation_token: invitationToken
22572
+ });
22573
+ return rb.execute(
22574
+ postUsersAuthRegisterViaInvitation,
22575
+ {
22576
+ body: {
22577
+ data: {
22578
+ type: "user",
22579
+ attributes: {
22580
+ email,
22581
+ password,
22582
+ password_confirmation: passwordConfirmation,
22583
+ invitation_token: invitationToken,
22584
+ ...attrs
22585
+ }
22586
+ }
22587
+ }
22588
+ },
22589
+ options
22590
+ );
22591
+ },
22020
22592
  /** Get the currently authenticated user */
22021
22593
  me: async (options) => {
22022
22594
  return rb.execute(getUsersMe, {}, options);
@@ -23167,26 +23739,56 @@ function createPlatformNamespace(rb) {
23167
23739
  );
23168
23740
  },
23169
23741
  /**
23170
- * Delete a tenant and all associated data.
23742
+ * Deactivate a tenant (hide from user's account).
23743
+ *
23744
+ * Sets `deactivated_at` on the tenant. The tenant and its workspaces
23745
+ * disappear from `workspaces.mine()` and tenant listings. Billing and
23746
+ * data are completely unaffected. Reversible via `reactivate()`.
23171
23747
  *
23172
- * Permanently removes the tenant, all their workspaces, documents, and
23173
- * billing records. This operation is irreversible. For a graceful
23174
- * off-boarding, prefer `schedulePurge` which allows data export before
23175
- * deletion.
23748
+ * Only the tenant owner can deactivate.
23176
23749
  *
23177
- * @param id - The UUID of the tenant to delete.
23750
+ * @param id - The UUID of the tenant to deactivate.
23178
23751
  * @param options - Optional request options.
23179
- * @returns `true` on successful deletion.
23752
+ * @returns The updated tenant record.
23180
23753
  *
23181
23754
  * @example
23182
23755
  * ```typescript
23183
- * const client = new GptClient({ apiKey: 'sk_app_...' });
23184
- * await client.platform.tenants.delete('tenant_abc123');
23756
+ * await client.platform.tenants.deactivate('tenant_abc123');
23185
23757
  * ```
23186
23758
  */
23187
- delete: async (id, options) => {
23188
- return rb.executeDelete(deleteTenantsById, { path: { id } }, options);
23189
- },
23759
+ deactivate: async (id, options) => rb.execute(
23760
+ patchTenantsByIdDeactivate,
23761
+ {
23762
+ path: { id },
23763
+ body: { data: { type: "tenant", id, attributes: {} } }
23764
+ },
23765
+ options
23766
+ ),
23767
+ /**
23768
+ * Reactivate a previously deactivated tenant.
23769
+ *
23770
+ * Clears `deactivated_at`, restoring the tenant and its workspaces
23771
+ * to the user's account. Only works on deactivated tenants.
23772
+ *
23773
+ * Only the tenant owner can reactivate.
23774
+ *
23775
+ * @param id - The UUID of the tenant to reactivate.
23776
+ * @param options - Optional request options.
23777
+ * @returns The updated tenant record.
23778
+ *
23779
+ * @example
23780
+ * ```typescript
23781
+ * await client.platform.tenants.reactivate('tenant_abc123');
23782
+ * ```
23783
+ */
23784
+ reactivate: async (id, options) => rb.execute(
23785
+ patchTenantsByIdReactivate,
23786
+ {
23787
+ path: { id },
23788
+ body: { data: { type: "tenant", id, attributes: {} } }
23789
+ },
23790
+ options
23791
+ ),
23190
23792
  /**
23191
23793
  * Create a new tenant (ISV provisioning flow).
23192
23794
  *
@@ -23557,6 +24159,52 @@ function createPlatformNamespace(rb) {
23557
24159
  options
23558
24160
  );
23559
24161
  },
24162
+ /**
24163
+ * List invitations visible to the current actor.
24164
+ *
24165
+ * Returns invitations where the actor is the inviter, the tenant owner,
24166
+ * or the recipient (matched by email). Use this to build admin views
24167
+ * of pending/accepted invitations for a tenant or workspace.
24168
+ *
24169
+ * @param options - Optional page number, page size, and request options.
24170
+ * @returns A page of `Invitation` records.
24171
+ *
24172
+ * @example
24173
+ * ```typescript
24174
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
24175
+ * const invites = await client.platform.invitations.list();
24176
+ * ```
24177
+ */
24178
+ list: async (options) => {
24179
+ return rb.execute(
24180
+ getInvitations,
24181
+ buildPageQuery(options?.page, options?.pageSize),
24182
+ options
24183
+ );
24184
+ },
24185
+ /**
24186
+ * List all invitations visible to the current actor, auto-paginating.
24187
+ *
24188
+ * @param options - Optional request options.
24189
+ * @returns All visible `Invitation` records as a flat array.
24190
+ *
24191
+ * @example
24192
+ * ```typescript
24193
+ * const client = new GptClient({ apiKey: 'sk_app_...' });
24194
+ * const all = await client.platform.invitations.listAll();
24195
+ * ```
24196
+ */
24197
+ listAll: async (options) => {
24198
+ return paginateToArray(
24199
+ rb.createPaginatedFetcher(
24200
+ getInvitations,
24201
+ (page, pageSize) => ({
24202
+ query: { page: { number: page, size: pageSize } }
24203
+ }),
24204
+ options
24205
+ )
24206
+ );
24207
+ },
23560
24208
  /**
23561
24209
  * Look up a pending invitation by its raw token.
23562
24210
  *
@@ -29756,6 +30404,15 @@ function buildHeaders(getHeaders, options) {
29756
30404
  }
29757
30405
  return headers;
29758
30406
  }
30407
+ function enrichError(error, result) {
30408
+ if (typeof error === "object" && error !== null && typeof result === "object" && result !== null) {
30409
+ const res = result.response;
30410
+ if (res && typeof res === "object" && "status" in res) {
30411
+ error.statusCode = res.status;
30412
+ }
30413
+ }
30414
+ return error;
30415
+ }
29759
30416
  var RequestBuilder = class {
29760
30417
  constructor(clientInstance, getHeaders, unwrap, requestWithRetry) {
29761
30418
  this.clientInstance = clientInstance;
@@ -29770,7 +30427,7 @@ var RequestBuilder = class {
29770
30427
  async execute(fn, params, options) {
29771
30428
  const headers = buildHeaders(this.getHeaders, options);
29772
30429
  try {
29773
- const response = await this.requestWithRetry(
30430
+ const result = await this.requestWithRetry(
29774
30431
  () => fn({
29775
30432
  client: this.clientInstance,
29776
30433
  throwOnError: true,
@@ -29779,9 +30436,9 @@ var RequestBuilder = class {
29779
30436
  ...options?.signal && { signal: options.signal }
29780
30437
  })
29781
30438
  );
29782
- const { data, error } = response;
30439
+ const { data, error } = result;
29783
30440
  if (error) {
29784
- throw error;
30441
+ throw enrichError(error, result);
29785
30442
  }
29786
30443
  const innerData = data?.data;
29787
30444
  return this.unwrap(innerData);
@@ -29815,13 +30472,17 @@ var RequestBuilder = class {
29815
30472
  async rawGet(url, options) {
29816
30473
  const headers = buildHeaders(this.getHeaders, options);
29817
30474
  try {
29818
- const { data } = await this.requestWithRetry(
30475
+ const result = await this.requestWithRetry(
29819
30476
  () => this.clientInstance.get({
29820
30477
  url,
29821
30478
  headers,
29822
30479
  ...options?.signal && { signal: options.signal }
29823
30480
  })
29824
30481
  );
30482
+ const { data, error } = result;
30483
+ if (error) {
30484
+ throw handleApiError(enrichError(error, result));
30485
+ }
29825
30486
  return this.unwrap(data?.data);
29826
30487
  } catch (error) {
29827
30488
  throw handleApiError(error);
@@ -29836,7 +30497,7 @@ var RequestBuilder = class {
29836
30497
  async rawPostMultipart(url, body, options) {
29837
30498
  const headers = buildHeaders(this.getHeaders, options);
29838
30499
  headers["Content-Type"] = null;
29839
- const { data, error } = await this.requestWithRetry(
30500
+ const result = await this.requestWithRetry(
29840
30501
  () => this.clientInstance.post({
29841
30502
  url,
29842
30503
  headers,
@@ -29845,8 +30506,9 @@ var RequestBuilder = class {
29845
30506
  ...options?.signal && { signal: options.signal }
29846
30507
  })
29847
30508
  );
30509
+ const { data, error } = result;
29848
30510
  if (error) {
29849
- throw handleApiError(error);
30511
+ throw handleApiError(enrichError(error, result));
29850
30512
  }
29851
30513
  return data;
29852
30514
  }
@@ -29857,7 +30519,7 @@ var RequestBuilder = class {
29857
30519
  async rawPost(url, body, options) {
29858
30520
  const headers = buildHeaders(this.getHeaders, options);
29859
30521
  try {
29860
- const { data } = await this.requestWithRetry(
30522
+ const result = await this.requestWithRetry(
29861
30523
  () => this.clientInstance.post({
29862
30524
  url,
29863
30525
  headers,
@@ -29865,6 +30527,10 @@ var RequestBuilder = class {
29865
30527
  ...options?.signal && { signal: options.signal }
29866
30528
  })
29867
30529
  );
30530
+ const { data, error } = result;
30531
+ if (error) {
30532
+ throw handleApiError(enrichError(error, result));
30533
+ }
29868
30534
  return this.unwrap(data?.data);
29869
30535
  } catch (error) {
29870
30536
  throw handleApiError(error);
@@ -29876,7 +30542,7 @@ var RequestBuilder = class {
29876
30542
  async rawPut(url, body, options) {
29877
30543
  const headers = buildHeaders(this.getHeaders, options);
29878
30544
  try {
29879
- const { data } = await this.requestWithRetry(
30545
+ const result = await this.requestWithRetry(
29880
30546
  () => this.clientInstance.put({
29881
30547
  url,
29882
30548
  headers,
@@ -29884,6 +30550,10 @@ var RequestBuilder = class {
29884
30550
  ...options?.signal && { signal: options.signal }
29885
30551
  })
29886
30552
  );
30553
+ const { data, error } = result;
30554
+ if (error) {
30555
+ throw handleApiError(enrichError(error, result));
30556
+ }
29887
30557
  return this.unwrap(data?.data);
29888
30558
  } catch (error) {
29889
30559
  throw handleApiError(error);
@@ -29895,7 +30565,7 @@ var RequestBuilder = class {
29895
30565
  async rawPatch(url, body, options) {
29896
30566
  const headers = buildHeaders(this.getHeaders, options);
29897
30567
  try {
29898
- const { data } = await this.requestWithRetry(
30568
+ const result = await this.requestWithRetry(
29899
30569
  () => this.clientInstance.patch({
29900
30570
  url,
29901
30571
  headers,
@@ -29903,6 +30573,10 @@ var RequestBuilder = class {
29903
30573
  ...options?.signal && { signal: options.signal }
29904
30574
  })
29905
30575
  );
30576
+ const { data, error } = result;
30577
+ if (error) {
30578
+ throw handleApiError(enrichError(error, result));
30579
+ }
29906
30580
  return this.unwrap(data?.data);
29907
30581
  } catch (error) {
29908
30582
  throw handleApiError(error);
@@ -29914,13 +30588,17 @@ var RequestBuilder = class {
29914
30588
  async rawDelete(url, options) {
29915
30589
  const headers = buildHeaders(this.getHeaders, options);
29916
30590
  try {
29917
- const { data } = await this.requestWithRetry(
30591
+ const result = await this.requestWithRetry(
29918
30592
  () => this.clientInstance.delete({
29919
30593
  url,
29920
30594
  headers,
29921
30595
  ...options?.signal && { signal: options.signal }
29922
30596
  })
29923
30597
  );
30598
+ const { data, error } = result;
30599
+ if (error) {
30600
+ throw handleApiError(enrichError(error, result));
30601
+ }
29924
30602
  return this.unwrap(data?.data);
29925
30603
  } catch (error) {
29926
30604
  throw handleApiError(error);
@@ -29938,7 +30616,7 @@ var RequestBuilder = class {
29938
30616
  createPaginatedFetcher(fn, queryBuilder, options) {
29939
30617
  return async (page, pageSize) => {
29940
30618
  const headers = buildHeaders(this.getHeaders, options);
29941
- const { data } = await this.requestWithRetry(
30619
+ const result = await this.requestWithRetry(
29942
30620
  () => fn({
29943
30621
  client: this.clientInstance,
29944
30622
  headers,
@@ -29946,6 +30624,10 @@ var RequestBuilder = class {
29946
30624
  ...queryBuilder(page, pageSize)
29947
30625
  })
29948
30626
  );
30627
+ const { data, error } = result;
30628
+ if (error) {
30629
+ throw handleApiError(enrichError(error, result));
30630
+ }
29949
30631
  const envelope = data;
29950
30632
  const items = this.unwrap(envelope.data) || [];
29951
30633
  return { data: items, links: envelope.links };
@@ -30063,6 +30745,7 @@ var GptClient = class extends BaseClient {
30063
30745
  this.ai = createAiNamespace(rb);
30064
30746
  this.billing = createBillingNamespace(rb);
30065
30747
  this.catalog = createCatalogNamespace(rb);
30748
+ this.content = createContentNamespace(rb);
30066
30749
  this.clinical = createClinicalNamespace(rb);
30067
30750
  this.compliance = createComplianceNamespace(rb);
30068
30751
  this.communication = createCommunicationNamespace(rb);