@gpt-platform/client 0.10.2 → 0.10.4

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
@@ -1272,7 +1272,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1272
1272
  }
1273
1273
 
1274
1274
  // src/version.ts
1275
- var SDK_VERSION = "0.10.2";
1275
+ var SDK_VERSION = "0.10.4";
1276
1276
  var DEFAULT_API_VERSION = "2026-03-23";
1277
1277
 
1278
1278
  // src/base-client.ts
@@ -1904,6 +1904,11 @@ var getCatalogTaxonomyNodesTaxonomyByTaxonomyId = (options) => (options.client ?
1904
1904
  url: "/catalog/taxonomy-nodes/taxonomy/{taxonomy_id}",
1905
1905
  ...options
1906
1906
  });
1907
+ var getClinicalNotesByPatient = (options) => (options.client ?? client).get({
1908
+ security: [{ scheme: "bearer", type: "http" }],
1909
+ url: "/clinical/notes/by-patient",
1910
+ ...options
1911
+ });
1907
1912
  var getClinicalNotesByNoteIdVersionsById = (options) => (options.client ?? client).get({
1908
1913
  security: [{ scheme: "bearer", type: "http" }],
1909
1914
  url: "/clinical/notes/{note_id}/versions/{id}",
@@ -2110,6 +2115,11 @@ var postTenantsPersonal = (options) => (options.client ?? client).post({
2110
2115
  ...options.headers
2111
2116
  }
2112
2117
  });
2118
+ var getClinicalMealPlansByPatient = (options) => (options.client ?? client).get({
2119
+ security: [{ scheme: "bearer", type: "http" }],
2120
+ url: "/clinical/meal-plans/by-patient",
2121
+ ...options
2122
+ });
2113
2123
  var getEmailTrackingEventsById = (options) => (options.client ?? client).get({
2114
2124
  security: [{ scheme: "bearer", type: "http" }],
2115
2125
  url: "/email/tracking-events/{id}",
@@ -2383,6 +2393,11 @@ var getExtractionBatchesWorkspaceByWorkspaceId = (options) => (options.client ??
2383
2393
  url: "/extraction/batches/workspace/{workspace_id}",
2384
2394
  ...options
2385
2395
  });
2396
+ var getExtractionAgents = (options) => (options.client ?? client).get({
2397
+ security: [{ scheme: "bearer", type: "http" }],
2398
+ url: "/extraction/agents",
2399
+ ...options
2400
+ });
2386
2401
  var deleteClinicalPracticeResourcesByIdPermanent = (options) => (options.client ?? client).delete({
2387
2402
  security: [{ scheme: "bearer", type: "http" }],
2388
2403
  url: "/clinical/practice-resources/{id}/permanent",
@@ -2574,6 +2589,15 @@ var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2574
2589
  ...options.headers
2575
2590
  }
2576
2591
  });
2592
+ var postExtractionAgentsPredict = (options) => (options.client ?? client).post({
2593
+ security: [{ scheme: "bearer", type: "http" }],
2594
+ url: "/extraction/agents/predict",
2595
+ ...options,
2596
+ headers: {
2597
+ "Content-Type": "application/vnd.api+json",
2598
+ ...options.headers
2599
+ }
2600
+ });
2577
2601
  var getCatalogTaxonomiesApplicationByApplicationId = (options) => (options.client ?? client).get({
2578
2602
  security: [{ scheme: "bearer", type: "http" }],
2579
2603
  url: "/catalog/taxonomies/application/{application_id}",
@@ -2911,6 +2935,11 @@ var patchSupportTicketsByIdMerge = (options) => (options.client ?? client).patch
2911
2935
  ...options.headers
2912
2936
  }
2913
2937
  });
2938
+ var getClinicalNotesByWorkspace = (options) => (options.client ?? client).get({
2939
+ security: [{ scheme: "bearer", type: "http" }],
2940
+ url: "/clinical/notes/by-workspace",
2941
+ ...options
2942
+ });
2914
2943
  var getMemorySectionDocumentsById = (options) => (options.client ?? client).get({
2915
2944
  security: [{ scheme: "bearer", type: "http" }],
2916
2945
  url: "/memory/section-documents/{id}",
@@ -3174,6 +3203,11 @@ var patchStorageFilesByIdRestore = (options) => (options.client ?? client).patch
3174
3203
  ...options.headers
3175
3204
  }
3176
3205
  });
3206
+ var getWorkspacesByWorkspaceIdTrainingAnalytics = (options) => (options.client ?? client).get({
3207
+ security: [{ scheme: "bearer", type: "http" }],
3208
+ url: "/workspaces/{workspace_id}/training/analytics",
3209
+ ...options
3210
+ });
3177
3211
  var patchSocialCampaignsByIdCancel = (options) => (options.client ?? client).patch({
3178
3212
  security: [{ scheme: "bearer", type: "http" }],
3179
3213
  url: "/social/campaigns/{id}/cancel",
@@ -6939,6 +6973,15 @@ var postUsersAuthResendConfirmation = (options) => (options.client ?? client).po
6939
6973
  ...options.headers
6940
6974
  }
6941
6975
  });
6976
+ var postSocialCampaignsByIdPreviewAdaptations = (options) => (options.client ?? client).post({
6977
+ security: [{ scheme: "bearer", type: "http" }],
6978
+ url: "/social/campaigns/{id}/preview-adaptations",
6979
+ ...options,
6980
+ headers: {
6981
+ "Content-Type": "application/vnd.api+json",
6982
+ ...options.headers
6983
+ }
6984
+ });
6942
6985
  var getCrawlerResultsById = (options) => (options.client ?? client).get({
6943
6986
  security: [{ scheme: "bearer", type: "http" }],
6944
6987
  url: "/crawler/results/{id}",
@@ -7322,6 +7365,11 @@ var postExtractionDocumentsBulkReprocess = (options) => (options.client ?? clien
7322
7365
  ...options.headers
7323
7366
  }
7324
7367
  });
7368
+ var getExtractionAgentsById = (options) => (options.client ?? client).get({
7369
+ security: [{ scheme: "bearer", type: "http" }],
7370
+ url: "/extraction/agents/{id}",
7371
+ ...options
7372
+ });
7325
7373
  var getApplicationsBySlugBySlug = (options) => (options.client ?? client).get({
7326
7374
  security: [{ scheme: "bearer", type: "http" }],
7327
7375
  url: "/applications/by-slug/{slug}",
@@ -12694,6 +12742,32 @@ function createClinicalNamespace(rb) {
12694
12742
  { query: params ?? {} },
12695
12743
  options
12696
12744
  ),
12745
+ /**
12746
+ * List all notes for a patient across all sessions.
12747
+ *
12748
+ * @param patientId - Patient UUID
12749
+ * @param params - Filter/pagination parameters
12750
+ * @param options - Request options
12751
+ * @returns Array of {@link ClinicalNote} records
12752
+ */
12753
+ listByPatient: async (patientId, params, options) => rb.execute(
12754
+ getClinicalNotesByPatient,
12755
+ { query: { patient_id: patientId, ...params } },
12756
+ options
12757
+ ),
12758
+ /**
12759
+ * List all notes in a workspace.
12760
+ *
12761
+ * @param workspaceId - Workspace UUID
12762
+ * @param params - Filter/pagination parameters
12763
+ * @param options - Request options
12764
+ * @returns Array of {@link ClinicalNote} records
12765
+ */
12766
+ listByWorkspace: async (workspaceId, params, options) => rb.execute(
12767
+ getClinicalNotesByWorkspace,
12768
+ { query: { workspace_id: workspaceId, ...params } },
12769
+ options
12770
+ ),
12697
12771
  /**
12698
12772
  * Get a single note by ID.
12699
12773
  *
@@ -13059,6 +13133,19 @@ function createClinicalNamespace(rb) {
13059
13133
  { query: params ?? {} },
13060
13134
  options
13061
13135
  ),
13136
+ /**
13137
+ * List all meal plans for a patient across all sessions.
13138
+ *
13139
+ * @param patientId - Patient UUID
13140
+ * @param params - Filter/pagination parameters
13141
+ * @param options - Request options
13142
+ * @returns Array of {@link ClinicalMealPlan} records
13143
+ */
13144
+ listByPatient: async (patientId, params, options) => rb.execute(
13145
+ getClinicalMealPlansByPatient,
13146
+ { query: { patient_id: patientId, ...params } },
13147
+ options
13148
+ ),
13062
13149
  /**
13063
13150
  * Get a single meal plan by ID.
13064
13151
  *
@@ -13075,6 +13162,8 @@ function createClinicalNamespace(rb) {
13075
13162
  * Create a new meal plan.
13076
13163
  *
13077
13164
  * @param attributes - Meal plan creation attributes. Must include `workspace_id`.
13165
+ * Provide `patient_id` directly, or `session_id` to auto-populate
13166
+ * `patient_id` from the session's patient.
13078
13167
  * @param options - Request options
13079
13168
  * @returns Created {@link ClinicalMealPlan} record
13080
13169
  */
@@ -13463,7 +13552,26 @@ function createClinicalNamespace(rb) {
13463
13552
  getClinicalClientSupplementsArchived,
13464
13553
  { query: params ?? {} },
13465
13554
  options
13466
- )
13555
+ ),
13556
+ /**
13557
+ * Create multiple supplements in a single request.
13558
+ *
13559
+ * @param attrs - Bulk creation attributes with workspace_id and supplements array
13560
+ * @param options - Request options
13561
+ * @returns Array of creation results with id and status per supplement
13562
+ *
13563
+ * @example
13564
+ * ```typescript
13565
+ * const results = await client.clinical.clientSupplements.bulkCreate({
13566
+ * workspace_id: 'ws_123',
13567
+ * supplements: [
13568
+ * { patient_id: 'pat_1', name: 'Vitamin D3', source: 'fullscript' },
13569
+ * { patient_id: 'pat_1', name: 'Omega-3', source: 'fullscript' },
13570
+ * ],
13571
+ * });
13572
+ * ```
13573
+ */
13574
+ bulkCreate: async (attrs, options) => rb.rawPost(`/clinical/client-supplements/bulk`, { data: attrs }, options).then((r) => r.data)
13467
13575
  },
13468
13576
  /**
13469
13577
  * Manage clinical deliveries (care plan items sent to patients).
@@ -14777,7 +14885,11 @@ function createClinicalNamespace(rb) {
14777
14885
  * });
14778
14886
  * ```
14779
14887
  */
14780
- search: async (params, options) => rb.rawPost(`/clinical/recipes/search`, params, options)
14888
+ search: async (params, options) => rb.rawPost(
14889
+ `/clinical/recipes/search`,
14890
+ params,
14891
+ options
14892
+ )
14781
14893
  }
14782
14894
  };
14783
14895
  }
@@ -18399,7 +18511,10 @@ function createConnectorsNamespace(rb) {
18399
18511
  */
18400
18512
  create: async (attributes, options) => rb.execute(
18401
18513
  postConnectors,
18402
- { body: { data: { type: "connector-instance", attributes } } },
18514
+ {
18515
+ body: { data: { type: "connector-instance", attributes } },
18516
+ query: { workspace_id: attributes.workspace_id }
18517
+ },
18403
18518
  options
18404
18519
  ),
18405
18520
  /**
@@ -18521,7 +18636,6 @@ function createConnectorsNamespace(rb) {
18521
18636
  path: { id },
18522
18637
  body: {
18523
18638
  data: {
18524
- type: "credential",
18525
18639
  workspace_id: workspaceId
18526
18640
  }
18527
18641
  }
@@ -18554,10 +18668,7 @@ function createConnectorsNamespace(rb) {
18554
18668
  postConnectorsCredentialsUpsert,
18555
18669
  {
18556
18670
  body: {
18557
- data: {
18558
- type: "credential",
18559
- ...attributes
18560
- }
18671
+ data: attributes
18561
18672
  }
18562
18673
  },
18563
18674
  options
@@ -18586,7 +18697,6 @@ function createConnectorsNamespace(rb) {
18586
18697
  {
18587
18698
  body: {
18588
18699
  data: {
18589
- type: "credential",
18590
18700
  workspace_id: workspaceId,
18591
18701
  connector_type: connectorType,
18592
18702
  scope_level: scopeLevel
@@ -19069,9 +19179,11 @@ function createConnectorsNamespace(rb) {
19069
19179
  listTreatmentPlans: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
19070
19180
  `/connectors/fullscript/treatment-plans/list`,
19071
19181
  {
19072
- workspace_id: workspaceId,
19073
- connector_id: connectorId,
19074
- patient_id: patientId
19182
+ data: {
19183
+ workspace_id: workspaceId,
19184
+ connector_id: connectorId,
19185
+ patient_id: patientId
19186
+ }
19075
19187
  },
19076
19188
  options
19077
19189
  ).then((r) => r.data),
@@ -19098,9 +19210,11 @@ function createConnectorsNamespace(rb) {
19098
19210
  getTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
19099
19211
  `/connectors/fullscript/treatment-plans/get`,
19100
19212
  {
19101
- workspace_id: workspaceId,
19102
- connector_id: connectorId,
19103
- treatment_plan_id: treatmentPlanId
19213
+ data: {
19214
+ workspace_id: workspaceId,
19215
+ connector_id: connectorId,
19216
+ treatment_plan_id: treatmentPlanId
19217
+ }
19104
19218
  },
19105
19219
  options
19106
19220
  ).then((r) => r.data),
@@ -19127,13 +19241,81 @@ function createConnectorsNamespace(rb) {
19127
19241
  cancelTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
19128
19242
  `/connectors/fullscript/treatment-plans/cancel`,
19129
19243
  {
19130
- workspace_id: workspaceId,
19131
- connector_id: connectorId,
19132
- treatment_plan_id: treatmentPlanId
19244
+ data: {
19245
+ workspace_id: workspaceId,
19246
+ connector_id: connectorId,
19247
+ treatment_plan_id: treatmentPlanId
19248
+ }
19249
+ },
19250
+ options
19251
+ ).then((r) => r.data),
19252
+ /**
19253
+ * Create a treatment plan in Fullscript with product recommendations.
19254
+ *
19255
+ * @param connectorId - The Fullscript connector instance ID
19256
+ * @param workspaceId - The workspace ID
19257
+ * @param attrs - Treatment plan creation attributes
19258
+ * @param options - Optional request options.
19259
+ * @returns The created {@link FullscriptTreatmentPlan}.
19260
+ *
19261
+ * @example
19262
+ * ```typescript
19263
+ * const plan = await client.connectors.fullscript.createTreatmentPlan(
19264
+ * 'ci_fs_123',
19265
+ * 'ws_abc123',
19266
+ * {
19267
+ * patient_id: 'fs_pat_456',
19268
+ * recommendations: [{ product_id: 'prod_1', dosage: '1 cap daily' }],
19269
+ * send_invitation: true,
19270
+ * message: 'Please take as directed',
19271
+ * },
19272
+ * );
19273
+ * ```
19274
+ */
19275
+ createTreatmentPlan: async (connectorId, workspaceId, attrs, options) => rb.rawPost(
19276
+ `/connectors/fullscript/treatment-plans/create`,
19277
+ {
19278
+ data: {
19279
+ workspace_id: workspaceId,
19280
+ connector_id: connectorId,
19281
+ patient_id: attrs.patient_id,
19282
+ recommendations: attrs.recommendations,
19283
+ send_invitation: attrs.send_invitation,
19284
+ message: attrs.message
19285
+ }
19133
19286
  },
19134
19287
  options
19135
19288
  ).then((r) => r.data),
19136
19289
  // ── Products ──
19290
+ /**
19291
+ * Match AI-generated supplement names to Fullscript products.
19292
+ *
19293
+ * @param connectorId - The Fullscript connector instance ID
19294
+ * @param workspaceId - The workspace ID
19295
+ * @param queries - Array of product match queries
19296
+ * @param options - Optional request options.
19297
+ * @returns Array of {@link ProductMatchResult} with matched products per query.
19298
+ *
19299
+ * @example
19300
+ * ```typescript
19301
+ * const results = await client.connectors.fullscript.matchProducts(
19302
+ * 'ci_fs_123',
19303
+ * 'ws_abc123',
19304
+ * [{ name: 'Vitamin D3 2000 IU', form: 'capsule' }],
19305
+ * );
19306
+ * ```
19307
+ */
19308
+ matchProducts: async (connectorId, workspaceId, queries, options) => rb.rawPost(
19309
+ `/connectors/fullscript/products/match`,
19310
+ {
19311
+ data: {
19312
+ workspace_id: workspaceId,
19313
+ connector_id: connectorId,
19314
+ queries
19315
+ }
19316
+ },
19317
+ options
19318
+ ).then((r) => r.data),
19137
19319
  /**
19138
19320
  * Search the Fullscript product catalog by keyword query.
19139
19321
  *
@@ -19157,9 +19339,11 @@ function createConnectorsNamespace(rb) {
19157
19339
  searchProducts: async (connectorId, workspaceId, query, options) => rb.rawPost(
19158
19340
  `/connectors/fullscript/products/search`,
19159
19341
  {
19160
- workspace_id: workspaceId,
19161
- connector_id: connectorId,
19162
- query
19342
+ data: {
19343
+ workspace_id: workspaceId,
19344
+ connector_id: connectorId,
19345
+ query
19346
+ }
19163
19347
  },
19164
19348
  options
19165
19349
  ).then((r) => r.data),
@@ -19186,9 +19370,11 @@ function createConnectorsNamespace(rb) {
19186
19370
  getProduct: async (connectorId, workspaceId, productId, options) => rb.rawPost(
19187
19371
  `/connectors/fullscript/products/get`,
19188
19372
  {
19189
- workspace_id: workspaceId,
19190
- connector_id: connectorId,
19191
- product_id: productId
19373
+ data: {
19374
+ workspace_id: workspaceId,
19375
+ connector_id: connectorId,
19376
+ product_id: productId
19377
+ }
19192
19378
  },
19193
19379
  options
19194
19380
  ).then((r) => r.data),
@@ -19215,9 +19401,11 @@ function createConnectorsNamespace(rb) {
19215
19401
  listSimilarProducts: async (connectorId, workspaceId, productId, options) => rb.rawPost(
19216
19402
  `/connectors/fullscript/products/similar`,
19217
19403
  {
19218
- workspace_id: workspaceId,
19219
- connector_id: connectorId,
19220
- product_id: productId
19404
+ data: {
19405
+ workspace_id: workspaceId,
19406
+ connector_id: connectorId,
19407
+ product_id: productId
19408
+ }
19221
19409
  },
19222
19410
  options
19223
19411
  ).then((r) => r.data),
@@ -19245,9 +19433,11 @@ function createConnectorsNamespace(rb) {
19245
19433
  listPatientOrders: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
19246
19434
  `/connectors/fullscript/orders/list`,
19247
19435
  {
19248
- workspace_id: workspaceId,
19249
- connector_id: connectorId,
19250
- patient_id: patientId
19436
+ data: {
19437
+ workspace_id: workspaceId,
19438
+ connector_id: connectorId,
19439
+ patient_id: patientId
19440
+ }
19251
19441
  },
19252
19442
  options
19253
19443
  ).then((r) => r.data),
@@ -19274,9 +19464,11 @@ function createConnectorsNamespace(rb) {
19274
19464
  getOrder: async (connectorId, workspaceId, orderId, options) => rb.rawPost(
19275
19465
  `/connectors/fullscript/orders/get`,
19276
19466
  {
19277
- workspace_id: workspaceId,
19278
- connector_id: connectorId,
19279
- order_id: orderId
19467
+ data: {
19468
+ workspace_id: workspaceId,
19469
+ connector_id: connectorId,
19470
+ order_id: orderId
19471
+ }
19280
19472
  },
19281
19473
  options
19282
19474
  ).then((r) => r.data),
@@ -25259,6 +25451,94 @@ function createExtractionNamespace(rb) {
25259
25451
  options
25260
25452
  );
25261
25453
  }
25454
+ },
25455
+ /** Extraction agents — list and predict best extraction agents for documents. */
25456
+ extractionAgents: {
25457
+ /**
25458
+ * Lists all available extraction agents (system agents tagged with
25459
+ * "extraction" category).
25460
+ *
25461
+ * @param options - Optional request options (abort signal, custom headers).
25462
+ * @returns An array of extraction agent objects.
25463
+ *
25464
+ * @example
25465
+ * ```typescript
25466
+ * const agents = await client.extraction.extractionAgents.list();
25467
+ * ```
25468
+ */
25469
+ list: async (options) => {
25470
+ return rb.execute(getExtractionAgents, {}, options);
25471
+ },
25472
+ /**
25473
+ * Retrieves a single extraction agent by its unique identifier.
25474
+ *
25475
+ * @param id - The UUID of the extraction agent.
25476
+ * @param options - Optional request options (abort signal, custom headers).
25477
+ * @returns The matching extraction agent object.
25478
+ *
25479
+ * @example
25480
+ * ```typescript
25481
+ * const agent = await client.extraction.extractionAgents.get('agent-uuid');
25482
+ * ```
25483
+ */
25484
+ get: async (id, options) => {
25485
+ return rb.execute(
25486
+ getExtractionAgentsById,
25487
+ { path: { id } },
25488
+ options
25489
+ );
25490
+ },
25491
+ /**
25492
+ * Predicts the best extraction agent for a given document based on its
25493
+ * name, description, or file content.
25494
+ *
25495
+ * @param attributes - Prediction input (name, description, file_content, document_id).
25496
+ * @param options - Optional request options (abort signal, custom headers).
25497
+ * @returns A prediction result with recommended agents.
25498
+ *
25499
+ * @example
25500
+ * ```typescript
25501
+ * const prediction = await client.extraction.extractionAgents.predict({
25502
+ * name: 'invoice.pdf',
25503
+ * file_content: 'Invoice #12345...',
25504
+ * });
25505
+ * ```
25506
+ */
25507
+ predict: async (attributes, options) => {
25508
+ return rb.execute(
25509
+ postExtractionAgentsPredict,
25510
+ {
25511
+ body: {
25512
+ data: { type: "extraction-agent", attributes }
25513
+ }
25514
+ },
25515
+ options
25516
+ );
25517
+ }
25518
+ },
25519
+ /** Training analytics — workspace-level extraction training metrics. */
25520
+ trainingAnalytics: {
25521
+ /**
25522
+ * Retrieves training analytics for a specific workspace, including
25523
+ * accuracy trends, correction counts, and low-confidence documents.
25524
+ *
25525
+ * @param workspaceId - The UUID of the workspace.
25526
+ * @param options - Optional request options (abort signal, custom headers).
25527
+ * @returns The training analytics object for the workspace.
25528
+ *
25529
+ * @example
25530
+ * ```typescript
25531
+ * const analytics = await client.extraction.trainingAnalytics.forWorkspace('ws-uuid');
25532
+ * console.log(analytics.avg_confidence, analytics.total_examples);
25533
+ * ```
25534
+ */
25535
+ forWorkspace: async (workspaceId, options) => {
25536
+ return rb.execute(
25537
+ getWorkspacesByWorkspaceIdTrainingAnalytics,
25538
+ { path: { workspace_id: workspaceId } },
25539
+ options
25540
+ );
25541
+ }
25262
25542
  }
25263
25543
  };
25264
25544
  }
@@ -29836,11 +30116,108 @@ function createStorageNamespace(rb) {
29836
30116
  { query: { parent_id: parentId } },
29837
30117
  options
29838
30118
  );
30119
+ },
30120
+ /**
30121
+ * Generate a short-lived presigned download URL for a file.
30122
+ *
30123
+ * Returns a URL that can be used to download the file directly from
30124
+ * object storage (GCS in production, MinIO in dev) without routing
30125
+ * through the application server.
30126
+ *
30127
+ * @param id - The UUID of the file to download.
30128
+ * @param params - Optional parameters (e.g., custom `expires_in` seconds).
30129
+ * @param options - Optional request options (abort signal, custom headers).
30130
+ * @returns A promise resolving to the presigned URL and its expiry.
30131
+ *
30132
+ * @example
30133
+ * ```typescript
30134
+ * const { url, expires_at } = await client.storage.files.requestDownloadUrl(
30135
+ * 'file-uuid',
30136
+ * { expires_in: 300 }, // 5 minutes
30137
+ * );
30138
+ * // Redirect browser to `url` for direct download
30139
+ * ```
30140
+ */
30141
+ requestDownloadUrl: async (id, params, options) => {
30142
+ return rb.rawPostDirect(
30143
+ `/storage-files/${id}/download-url`,
30144
+ params?.expires_in != null ? { data: { expires_in: params.expires_in } } : void 0,
30145
+ options
30146
+ );
29839
30147
  }
29840
30148
  }
29841
30149
  };
29842
30150
  }
29843
30151
 
30152
+ // src/namespaces/documents.ts
30153
+ function createDocumentsNamespace(rb) {
30154
+ return {
30155
+ /**
30156
+ * Generate a PDF from HTML content and store it in platform Storage.
30157
+ *
30158
+ * Always pass `store: true` and `workspace_id` to get a JSON response with
30159
+ * a `storage_key`. Without `store: true`, the server returns raw
30160
+ * `application/pdf` binary which cannot be parsed as JSON by this SDK method.
30161
+ *
30162
+ * HTML input is capped at 2MB by the server.
30163
+ *
30164
+ * @param params - PDF generation parameters. Set `store: true` and provide
30165
+ * `workspace_id` for JSON response.
30166
+ * @param options - Optional request options (abort signal, custom headers).
30167
+ * @returns A storage key reference for the generated PDF.
30168
+ *
30169
+ * @example
30170
+ * ```typescript
30171
+ * const { storage_key } = await client.documents.generatePdf({
30172
+ * html: '<html><body>Report</body></html>',
30173
+ * store: true,
30174
+ * workspace_id: 'ws-123',
30175
+ * });
30176
+ * ```
30177
+ */
30178
+ generatePdf: async (params, options) => {
30179
+ return rb.rawPostDirect(
30180
+ "/documents/pdf",
30181
+ params,
30182
+ options
30183
+ );
30184
+ },
30185
+ /**
30186
+ * Generate a PDF from HTML and email it as an attachment.
30187
+ *
30188
+ * The PDF is generated server-side and delivered via platform SMTP.
30189
+ * Optionally stores the PDF in platform Storage alongside the email delivery.
30190
+ *
30191
+ * If storage fails but the email succeeds, the response includes
30192
+ * `storage_error` with the failure reason (email is still delivered).
30193
+ *
30194
+ * @param params - Email report parameters.
30195
+ * @param options - Optional request options (abort signal, custom headers).
30196
+ * @returns Delivery status, optional storage key, and any storage error.
30197
+ *
30198
+ * @example
30199
+ * ```typescript
30200
+ * const result = await client.documents.emailReport({
30201
+ * html: '<html><body><h1>Q1 Summary</h1></body></html>',
30202
+ * to: 'finance@company.com',
30203
+ * subject: 'Q1 Financial Summary',
30204
+ * store: true,
30205
+ * workspace_id: 'ws-123',
30206
+ * });
30207
+ * console.log(result.sent); // true
30208
+ * console.log(result.storage_key); // 'ws-123/documents/...'
30209
+ * ```
30210
+ */
30211
+ emailReport: async (params, options) => {
30212
+ return rb.rawPostDirect(
30213
+ "/documents/pdf/email",
30214
+ params,
30215
+ options
30216
+ );
30217
+ }
30218
+ };
30219
+ }
30220
+
29844
30221
  // src/namespaces/threads.ts
29845
30222
  function getBrowserContext() {
29846
30223
  const ctx = {};
@@ -32964,13 +33341,16 @@ function createSocialNamespace(rb) {
32964
33341
  },
32965
33342
  /**
32966
33343
  * Create a new social campaign.
32967
- * Workspace is resolved from the authenticated user's context — do NOT
32968
- * pass `workspace_id` in attributes.
33344
+ *
33345
+ * @param workspaceId - Workspace ID (passed as query parameter for tenant resolution).
33346
+ * @param attributes - Campaign attributes (name, content_brief, etc.).
33347
+ * @param options - Optional request-level overrides.
32969
33348
  */
32970
- create: async (attributes, options) => {
33349
+ create: async (workspaceId, attributes, options) => {
32971
33350
  return rb.execute(
32972
33351
  postSocialCampaigns,
32973
33352
  {
33353
+ query: { workspace_id: workspaceId },
32974
33354
  body: {
32975
33355
  data: { type: "social-campaign", attributes }
32976
33356
  }
@@ -33057,6 +33437,32 @@ function createSocialNamespace(rb) {
33057
33437
  },
33058
33438
  options
33059
33439
  );
33440
+ },
33441
+ /**
33442
+ * Preview adapted copy per platform without creating SocialPost records.
33443
+ *
33444
+ * Returns the AI-adapted text for each target platform so the user can
33445
+ * review before committing via `adaptForPlatforms`.
33446
+ *
33447
+ * @param id - Campaign UUID.
33448
+ * @param workspaceId - Workspace UUID.
33449
+ * @param options - Optional request options.
33450
+ * @returns `{ adaptations: [{ platform: string, content: string }] }`
33451
+ */
33452
+ previewAdaptations: async (id, workspaceId, options) => {
33453
+ return rb.execute(
33454
+ postSocialCampaignsByIdPreviewAdaptations,
33455
+ {
33456
+ path: { id },
33457
+ body: {
33458
+ data: {
33459
+ campaign_id: id,
33460
+ workspace_id: workspaceId
33461
+ }
33462
+ }
33463
+ },
33464
+ options
33465
+ );
33060
33466
  }
33061
33467
  },
33062
33468
  /** Trending content discovery — snapshots, items, and watch alerts. */
@@ -34158,6 +34564,31 @@ var RequestBuilder = class {
34158
34564
  throw handleApiError(error);
34159
34565
  }
34160
34566
  }
34567
+ /**
34568
+ * Execute a raw POST to a custom endpoint that returns flat JSON (no data wrapper).
34569
+ * Unlike rawPost (which unwraps data.data), this returns the response body directly.
34570
+ * Used for hand-written Phoenix controllers like DocumentsController.
34571
+ */
34572
+ async rawPostDirect(url, body, options) {
34573
+ const headers = buildHeaders(this.getHeaders, options);
34574
+ try {
34575
+ const result = await this.requestWithRetry(
34576
+ () => this.clientInstance.post({
34577
+ url,
34578
+ headers,
34579
+ ...body !== void 0 && { body },
34580
+ ...options?.signal && { signal: options.signal }
34581
+ })
34582
+ );
34583
+ const { data, error } = result;
34584
+ if (error) {
34585
+ throw handleApiError(enrichError(error, result));
34586
+ }
34587
+ return data;
34588
+ } catch (error) {
34589
+ throw handleApiError(error);
34590
+ }
34591
+ }
34161
34592
  /**
34162
34593
  * Execute a raw PUT request to a custom (non-generated) endpoint.
34163
34594
  */
@@ -34377,6 +34808,7 @@ var GptClient = class extends BaseClient {
34377
34808
  this.campaigns = createCampaignsNamespace(rb);
34378
34809
  this.email = createEmailNamespace(rb);
34379
34810
  this.support = createSupportNamespace(rb);
34811
+ this.documents = createDocumentsNamespace(rb);
34380
34812
  this.extraction = createExtractionNamespace(rb);
34381
34813
  this.identity = createIdentityNamespace(rb, this.config?.baseUrl);
34382
34814
  this.portal = createPortalNamespace(rb);