@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.js CHANGED
@@ -1339,7 +1339,7 @@ function buildUserAgent(sdkVersion, appInfo) {
1339
1339
  }
1340
1340
 
1341
1341
  // src/version.ts
1342
- var SDK_VERSION = "0.10.2";
1342
+ var SDK_VERSION = "0.10.4";
1343
1343
  var DEFAULT_API_VERSION = "2026-03-23";
1344
1344
 
1345
1345
  // src/base-client.ts
@@ -1971,6 +1971,11 @@ var getCatalogTaxonomyNodesTaxonomyByTaxonomyId = (options) => (options.client ?
1971
1971
  url: "/catalog/taxonomy-nodes/taxonomy/{taxonomy_id}",
1972
1972
  ...options
1973
1973
  });
1974
+ var getClinicalNotesByPatient = (options) => (options.client ?? client).get({
1975
+ security: [{ scheme: "bearer", type: "http" }],
1976
+ url: "/clinical/notes/by-patient",
1977
+ ...options
1978
+ });
1974
1979
  var getClinicalNotesByNoteIdVersionsById = (options) => (options.client ?? client).get({
1975
1980
  security: [{ scheme: "bearer", type: "http" }],
1976
1981
  url: "/clinical/notes/{note_id}/versions/{id}",
@@ -2177,6 +2182,11 @@ var postTenantsPersonal = (options) => (options.client ?? client).post({
2177
2182
  ...options.headers
2178
2183
  }
2179
2184
  });
2185
+ var getClinicalMealPlansByPatient = (options) => (options.client ?? client).get({
2186
+ security: [{ scheme: "bearer", type: "http" }],
2187
+ url: "/clinical/meal-plans/by-patient",
2188
+ ...options
2189
+ });
2180
2190
  var getEmailTrackingEventsById = (options) => (options.client ?? client).get({
2181
2191
  security: [{ scheme: "bearer", type: "http" }],
2182
2192
  url: "/email/tracking-events/{id}",
@@ -2450,6 +2460,11 @@ var getExtractionBatchesWorkspaceByWorkspaceId = (options) => (options.client ??
2450
2460
  url: "/extraction/batches/workspace/{workspace_id}",
2451
2461
  ...options
2452
2462
  });
2463
+ var getExtractionAgents = (options) => (options.client ?? client).get({
2464
+ security: [{ scheme: "bearer", type: "http" }],
2465
+ url: "/extraction/agents",
2466
+ ...options
2467
+ });
2453
2468
  var deleteClinicalPracticeResourcesByIdPermanent = (options) => (options.client ?? client).delete({
2454
2469
  security: [{ scheme: "bearer", type: "http" }],
2455
2470
  url: "/clinical/practice-resources/{id}/permanent",
@@ -2641,6 +2656,15 @@ var patchInvitationsByIdRevoke = (options) => (options.client ?? client).patch({
2641
2656
  ...options.headers
2642
2657
  }
2643
2658
  });
2659
+ var postExtractionAgentsPredict = (options) => (options.client ?? client).post({
2660
+ security: [{ scheme: "bearer", type: "http" }],
2661
+ url: "/extraction/agents/predict",
2662
+ ...options,
2663
+ headers: {
2664
+ "Content-Type": "application/vnd.api+json",
2665
+ ...options.headers
2666
+ }
2667
+ });
2644
2668
  var getCatalogTaxonomiesApplicationByApplicationId = (options) => (options.client ?? client).get({
2645
2669
  security: [{ scheme: "bearer", type: "http" }],
2646
2670
  url: "/catalog/taxonomies/application/{application_id}",
@@ -2978,6 +3002,11 @@ var patchSupportTicketsByIdMerge = (options) => (options.client ?? client).patch
2978
3002
  ...options.headers
2979
3003
  }
2980
3004
  });
3005
+ var getClinicalNotesByWorkspace = (options) => (options.client ?? client).get({
3006
+ security: [{ scheme: "bearer", type: "http" }],
3007
+ url: "/clinical/notes/by-workspace",
3008
+ ...options
3009
+ });
2981
3010
  var getMemorySectionDocumentsById = (options) => (options.client ?? client).get({
2982
3011
  security: [{ scheme: "bearer", type: "http" }],
2983
3012
  url: "/memory/section-documents/{id}",
@@ -3241,6 +3270,11 @@ var patchStorageFilesByIdRestore = (options) => (options.client ?? client).patch
3241
3270
  ...options.headers
3242
3271
  }
3243
3272
  });
3273
+ var getWorkspacesByWorkspaceIdTrainingAnalytics = (options) => (options.client ?? client).get({
3274
+ security: [{ scheme: "bearer", type: "http" }],
3275
+ url: "/workspaces/{workspace_id}/training/analytics",
3276
+ ...options
3277
+ });
3244
3278
  var patchSocialCampaignsByIdCancel = (options) => (options.client ?? client).patch({
3245
3279
  security: [{ scheme: "bearer", type: "http" }],
3246
3280
  url: "/social/campaigns/{id}/cancel",
@@ -7006,6 +7040,15 @@ var postUsersAuthResendConfirmation = (options) => (options.client ?? client).po
7006
7040
  ...options.headers
7007
7041
  }
7008
7042
  });
7043
+ var postSocialCampaignsByIdPreviewAdaptations = (options) => (options.client ?? client).post({
7044
+ security: [{ scheme: "bearer", type: "http" }],
7045
+ url: "/social/campaigns/{id}/preview-adaptations",
7046
+ ...options,
7047
+ headers: {
7048
+ "Content-Type": "application/vnd.api+json",
7049
+ ...options.headers
7050
+ }
7051
+ });
7009
7052
  var getCrawlerResultsById = (options) => (options.client ?? client).get({
7010
7053
  security: [{ scheme: "bearer", type: "http" }],
7011
7054
  url: "/crawler/results/{id}",
@@ -7389,6 +7432,11 @@ var postExtractionDocumentsBulkReprocess = (options) => (options.client ?? clien
7389
7432
  ...options.headers
7390
7433
  }
7391
7434
  });
7435
+ var getExtractionAgentsById = (options) => (options.client ?? client).get({
7436
+ security: [{ scheme: "bearer", type: "http" }],
7437
+ url: "/extraction/agents/{id}",
7438
+ ...options
7439
+ });
7392
7440
  var getApplicationsBySlugBySlug = (options) => (options.client ?? client).get({
7393
7441
  security: [{ scheme: "bearer", type: "http" }],
7394
7442
  url: "/applications/by-slug/{slug}",
@@ -12761,6 +12809,32 @@ function createClinicalNamespace(rb) {
12761
12809
  { query: params ?? {} },
12762
12810
  options
12763
12811
  ),
12812
+ /**
12813
+ * List all notes for a patient across all sessions.
12814
+ *
12815
+ * @param patientId - Patient UUID
12816
+ * @param params - Filter/pagination parameters
12817
+ * @param options - Request options
12818
+ * @returns Array of {@link ClinicalNote} records
12819
+ */
12820
+ listByPatient: async (patientId, params, options) => rb.execute(
12821
+ getClinicalNotesByPatient,
12822
+ { query: { patient_id: patientId, ...params } },
12823
+ options
12824
+ ),
12825
+ /**
12826
+ * List all notes in a workspace.
12827
+ *
12828
+ * @param workspaceId - Workspace UUID
12829
+ * @param params - Filter/pagination parameters
12830
+ * @param options - Request options
12831
+ * @returns Array of {@link ClinicalNote} records
12832
+ */
12833
+ listByWorkspace: async (workspaceId, params, options) => rb.execute(
12834
+ getClinicalNotesByWorkspace,
12835
+ { query: { workspace_id: workspaceId, ...params } },
12836
+ options
12837
+ ),
12764
12838
  /**
12765
12839
  * Get a single note by ID.
12766
12840
  *
@@ -13126,6 +13200,19 @@ function createClinicalNamespace(rb) {
13126
13200
  { query: params ?? {} },
13127
13201
  options
13128
13202
  ),
13203
+ /**
13204
+ * List all meal plans for a patient across all sessions.
13205
+ *
13206
+ * @param patientId - Patient UUID
13207
+ * @param params - Filter/pagination parameters
13208
+ * @param options - Request options
13209
+ * @returns Array of {@link ClinicalMealPlan} records
13210
+ */
13211
+ listByPatient: async (patientId, params, options) => rb.execute(
13212
+ getClinicalMealPlansByPatient,
13213
+ { query: { patient_id: patientId, ...params } },
13214
+ options
13215
+ ),
13129
13216
  /**
13130
13217
  * Get a single meal plan by ID.
13131
13218
  *
@@ -13142,6 +13229,8 @@ function createClinicalNamespace(rb) {
13142
13229
  * Create a new meal plan.
13143
13230
  *
13144
13231
  * @param attributes - Meal plan creation attributes. Must include `workspace_id`.
13232
+ * Provide `patient_id` directly, or `session_id` to auto-populate
13233
+ * `patient_id` from the session's patient.
13145
13234
  * @param options - Request options
13146
13235
  * @returns Created {@link ClinicalMealPlan} record
13147
13236
  */
@@ -13530,7 +13619,26 @@ function createClinicalNamespace(rb) {
13530
13619
  getClinicalClientSupplementsArchived,
13531
13620
  { query: params ?? {} },
13532
13621
  options
13533
- )
13622
+ ),
13623
+ /**
13624
+ * Create multiple supplements in a single request.
13625
+ *
13626
+ * @param attrs - Bulk creation attributes with workspace_id and supplements array
13627
+ * @param options - Request options
13628
+ * @returns Array of creation results with id and status per supplement
13629
+ *
13630
+ * @example
13631
+ * ```typescript
13632
+ * const results = await client.clinical.clientSupplements.bulkCreate({
13633
+ * workspace_id: 'ws_123',
13634
+ * supplements: [
13635
+ * { patient_id: 'pat_1', name: 'Vitamin D3', source: 'fullscript' },
13636
+ * { patient_id: 'pat_1', name: 'Omega-3', source: 'fullscript' },
13637
+ * ],
13638
+ * });
13639
+ * ```
13640
+ */
13641
+ bulkCreate: async (attrs, options) => rb.rawPost(`/clinical/client-supplements/bulk`, { data: attrs }, options).then((r) => r.data)
13534
13642
  },
13535
13643
  /**
13536
13644
  * Manage clinical deliveries (care plan items sent to patients).
@@ -14844,7 +14952,11 @@ function createClinicalNamespace(rb) {
14844
14952
  * });
14845
14953
  * ```
14846
14954
  */
14847
- search: async (params, options) => rb.rawPost(`/clinical/recipes/search`, params, options)
14955
+ search: async (params, options) => rb.rawPost(
14956
+ `/clinical/recipes/search`,
14957
+ params,
14958
+ options
14959
+ )
14848
14960
  }
14849
14961
  };
14850
14962
  }
@@ -18466,7 +18578,10 @@ function createConnectorsNamespace(rb) {
18466
18578
  */
18467
18579
  create: async (attributes, options) => rb.execute(
18468
18580
  postConnectors,
18469
- { body: { data: { type: "connector-instance", attributes } } },
18581
+ {
18582
+ body: { data: { type: "connector-instance", attributes } },
18583
+ query: { workspace_id: attributes.workspace_id }
18584
+ },
18470
18585
  options
18471
18586
  ),
18472
18587
  /**
@@ -18588,7 +18703,6 @@ function createConnectorsNamespace(rb) {
18588
18703
  path: { id },
18589
18704
  body: {
18590
18705
  data: {
18591
- type: "credential",
18592
18706
  workspace_id: workspaceId
18593
18707
  }
18594
18708
  }
@@ -18621,10 +18735,7 @@ function createConnectorsNamespace(rb) {
18621
18735
  postConnectorsCredentialsUpsert,
18622
18736
  {
18623
18737
  body: {
18624
- data: {
18625
- type: "credential",
18626
- ...attributes
18627
- }
18738
+ data: attributes
18628
18739
  }
18629
18740
  },
18630
18741
  options
@@ -18653,7 +18764,6 @@ function createConnectorsNamespace(rb) {
18653
18764
  {
18654
18765
  body: {
18655
18766
  data: {
18656
- type: "credential",
18657
18767
  workspace_id: workspaceId,
18658
18768
  connector_type: connectorType,
18659
18769
  scope_level: scopeLevel
@@ -19136,9 +19246,11 @@ function createConnectorsNamespace(rb) {
19136
19246
  listTreatmentPlans: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
19137
19247
  `/connectors/fullscript/treatment-plans/list`,
19138
19248
  {
19139
- workspace_id: workspaceId,
19140
- connector_id: connectorId,
19141
- patient_id: patientId
19249
+ data: {
19250
+ workspace_id: workspaceId,
19251
+ connector_id: connectorId,
19252
+ patient_id: patientId
19253
+ }
19142
19254
  },
19143
19255
  options
19144
19256
  ).then((r) => r.data),
@@ -19165,9 +19277,11 @@ function createConnectorsNamespace(rb) {
19165
19277
  getTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
19166
19278
  `/connectors/fullscript/treatment-plans/get`,
19167
19279
  {
19168
- workspace_id: workspaceId,
19169
- connector_id: connectorId,
19170
- treatment_plan_id: treatmentPlanId
19280
+ data: {
19281
+ workspace_id: workspaceId,
19282
+ connector_id: connectorId,
19283
+ treatment_plan_id: treatmentPlanId
19284
+ }
19171
19285
  },
19172
19286
  options
19173
19287
  ).then((r) => r.data),
@@ -19194,13 +19308,81 @@ function createConnectorsNamespace(rb) {
19194
19308
  cancelTreatmentPlan: async (connectorId, workspaceId, treatmentPlanId, options) => rb.rawPost(
19195
19309
  `/connectors/fullscript/treatment-plans/cancel`,
19196
19310
  {
19197
- workspace_id: workspaceId,
19198
- connector_id: connectorId,
19199
- treatment_plan_id: treatmentPlanId
19311
+ data: {
19312
+ workspace_id: workspaceId,
19313
+ connector_id: connectorId,
19314
+ treatment_plan_id: treatmentPlanId
19315
+ }
19316
+ },
19317
+ options
19318
+ ).then((r) => r.data),
19319
+ /**
19320
+ * Create a treatment plan in Fullscript with product recommendations.
19321
+ *
19322
+ * @param connectorId - The Fullscript connector instance ID
19323
+ * @param workspaceId - The workspace ID
19324
+ * @param attrs - Treatment plan creation attributes
19325
+ * @param options - Optional request options.
19326
+ * @returns The created {@link FullscriptTreatmentPlan}.
19327
+ *
19328
+ * @example
19329
+ * ```typescript
19330
+ * const plan = await client.connectors.fullscript.createTreatmentPlan(
19331
+ * 'ci_fs_123',
19332
+ * 'ws_abc123',
19333
+ * {
19334
+ * patient_id: 'fs_pat_456',
19335
+ * recommendations: [{ product_id: 'prod_1', dosage: '1 cap daily' }],
19336
+ * send_invitation: true,
19337
+ * message: 'Please take as directed',
19338
+ * },
19339
+ * );
19340
+ * ```
19341
+ */
19342
+ createTreatmentPlan: async (connectorId, workspaceId, attrs, options) => rb.rawPost(
19343
+ `/connectors/fullscript/treatment-plans/create`,
19344
+ {
19345
+ data: {
19346
+ workspace_id: workspaceId,
19347
+ connector_id: connectorId,
19348
+ patient_id: attrs.patient_id,
19349
+ recommendations: attrs.recommendations,
19350
+ send_invitation: attrs.send_invitation,
19351
+ message: attrs.message
19352
+ }
19200
19353
  },
19201
19354
  options
19202
19355
  ).then((r) => r.data),
19203
19356
  // ── Products ──
19357
+ /**
19358
+ * Match AI-generated supplement names to Fullscript products.
19359
+ *
19360
+ * @param connectorId - The Fullscript connector instance ID
19361
+ * @param workspaceId - The workspace ID
19362
+ * @param queries - Array of product match queries
19363
+ * @param options - Optional request options.
19364
+ * @returns Array of {@link ProductMatchResult} with matched products per query.
19365
+ *
19366
+ * @example
19367
+ * ```typescript
19368
+ * const results = await client.connectors.fullscript.matchProducts(
19369
+ * 'ci_fs_123',
19370
+ * 'ws_abc123',
19371
+ * [{ name: 'Vitamin D3 2000 IU', form: 'capsule' }],
19372
+ * );
19373
+ * ```
19374
+ */
19375
+ matchProducts: async (connectorId, workspaceId, queries, options) => rb.rawPost(
19376
+ `/connectors/fullscript/products/match`,
19377
+ {
19378
+ data: {
19379
+ workspace_id: workspaceId,
19380
+ connector_id: connectorId,
19381
+ queries
19382
+ }
19383
+ },
19384
+ options
19385
+ ).then((r) => r.data),
19204
19386
  /**
19205
19387
  * Search the Fullscript product catalog by keyword query.
19206
19388
  *
@@ -19224,9 +19406,11 @@ function createConnectorsNamespace(rb) {
19224
19406
  searchProducts: async (connectorId, workspaceId, query, options) => rb.rawPost(
19225
19407
  `/connectors/fullscript/products/search`,
19226
19408
  {
19227
- workspace_id: workspaceId,
19228
- connector_id: connectorId,
19229
- query
19409
+ data: {
19410
+ workspace_id: workspaceId,
19411
+ connector_id: connectorId,
19412
+ query
19413
+ }
19230
19414
  },
19231
19415
  options
19232
19416
  ).then((r) => r.data),
@@ -19253,9 +19437,11 @@ function createConnectorsNamespace(rb) {
19253
19437
  getProduct: async (connectorId, workspaceId, productId, options) => rb.rawPost(
19254
19438
  `/connectors/fullscript/products/get`,
19255
19439
  {
19256
- workspace_id: workspaceId,
19257
- connector_id: connectorId,
19258
- product_id: productId
19440
+ data: {
19441
+ workspace_id: workspaceId,
19442
+ connector_id: connectorId,
19443
+ product_id: productId
19444
+ }
19259
19445
  },
19260
19446
  options
19261
19447
  ).then((r) => r.data),
@@ -19282,9 +19468,11 @@ function createConnectorsNamespace(rb) {
19282
19468
  listSimilarProducts: async (connectorId, workspaceId, productId, options) => rb.rawPost(
19283
19469
  `/connectors/fullscript/products/similar`,
19284
19470
  {
19285
- workspace_id: workspaceId,
19286
- connector_id: connectorId,
19287
- product_id: productId
19471
+ data: {
19472
+ workspace_id: workspaceId,
19473
+ connector_id: connectorId,
19474
+ product_id: productId
19475
+ }
19288
19476
  },
19289
19477
  options
19290
19478
  ).then((r) => r.data),
@@ -19312,9 +19500,11 @@ function createConnectorsNamespace(rb) {
19312
19500
  listPatientOrders: async (connectorId, workspaceId, patientId, options) => rb.rawPost(
19313
19501
  `/connectors/fullscript/orders/list`,
19314
19502
  {
19315
- workspace_id: workspaceId,
19316
- connector_id: connectorId,
19317
- patient_id: patientId
19503
+ data: {
19504
+ workspace_id: workspaceId,
19505
+ connector_id: connectorId,
19506
+ patient_id: patientId
19507
+ }
19318
19508
  },
19319
19509
  options
19320
19510
  ).then((r) => r.data),
@@ -19341,9 +19531,11 @@ function createConnectorsNamespace(rb) {
19341
19531
  getOrder: async (connectorId, workspaceId, orderId, options) => rb.rawPost(
19342
19532
  `/connectors/fullscript/orders/get`,
19343
19533
  {
19344
- workspace_id: workspaceId,
19345
- connector_id: connectorId,
19346
- order_id: orderId
19534
+ data: {
19535
+ workspace_id: workspaceId,
19536
+ connector_id: connectorId,
19537
+ order_id: orderId
19538
+ }
19347
19539
  },
19348
19540
  options
19349
19541
  ).then((r) => r.data),
@@ -25326,6 +25518,94 @@ function createExtractionNamespace(rb) {
25326
25518
  options
25327
25519
  );
25328
25520
  }
25521
+ },
25522
+ /** Extraction agents — list and predict best extraction agents for documents. */
25523
+ extractionAgents: {
25524
+ /**
25525
+ * Lists all available extraction agents (system agents tagged with
25526
+ * "extraction" category).
25527
+ *
25528
+ * @param options - Optional request options (abort signal, custom headers).
25529
+ * @returns An array of extraction agent objects.
25530
+ *
25531
+ * @example
25532
+ * ```typescript
25533
+ * const agents = await client.extraction.extractionAgents.list();
25534
+ * ```
25535
+ */
25536
+ list: async (options) => {
25537
+ return rb.execute(getExtractionAgents, {}, options);
25538
+ },
25539
+ /**
25540
+ * Retrieves a single extraction agent by its unique identifier.
25541
+ *
25542
+ * @param id - The UUID of the extraction agent.
25543
+ * @param options - Optional request options (abort signal, custom headers).
25544
+ * @returns The matching extraction agent object.
25545
+ *
25546
+ * @example
25547
+ * ```typescript
25548
+ * const agent = await client.extraction.extractionAgents.get('agent-uuid');
25549
+ * ```
25550
+ */
25551
+ get: async (id, options) => {
25552
+ return rb.execute(
25553
+ getExtractionAgentsById,
25554
+ { path: { id } },
25555
+ options
25556
+ );
25557
+ },
25558
+ /**
25559
+ * Predicts the best extraction agent for a given document based on its
25560
+ * name, description, or file content.
25561
+ *
25562
+ * @param attributes - Prediction input (name, description, file_content, document_id).
25563
+ * @param options - Optional request options (abort signal, custom headers).
25564
+ * @returns A prediction result with recommended agents.
25565
+ *
25566
+ * @example
25567
+ * ```typescript
25568
+ * const prediction = await client.extraction.extractionAgents.predict({
25569
+ * name: 'invoice.pdf',
25570
+ * file_content: 'Invoice #12345...',
25571
+ * });
25572
+ * ```
25573
+ */
25574
+ predict: async (attributes, options) => {
25575
+ return rb.execute(
25576
+ postExtractionAgentsPredict,
25577
+ {
25578
+ body: {
25579
+ data: { type: "extraction-agent", attributes }
25580
+ }
25581
+ },
25582
+ options
25583
+ );
25584
+ }
25585
+ },
25586
+ /** Training analytics — workspace-level extraction training metrics. */
25587
+ trainingAnalytics: {
25588
+ /**
25589
+ * Retrieves training analytics for a specific workspace, including
25590
+ * accuracy trends, correction counts, and low-confidence documents.
25591
+ *
25592
+ * @param workspaceId - The UUID of the workspace.
25593
+ * @param options - Optional request options (abort signal, custom headers).
25594
+ * @returns The training analytics object for the workspace.
25595
+ *
25596
+ * @example
25597
+ * ```typescript
25598
+ * const analytics = await client.extraction.trainingAnalytics.forWorkspace('ws-uuid');
25599
+ * console.log(analytics.avg_confidence, analytics.total_examples);
25600
+ * ```
25601
+ */
25602
+ forWorkspace: async (workspaceId, options) => {
25603
+ return rb.execute(
25604
+ getWorkspacesByWorkspaceIdTrainingAnalytics,
25605
+ { path: { workspace_id: workspaceId } },
25606
+ options
25607
+ );
25608
+ }
25329
25609
  }
25330
25610
  };
25331
25611
  }
@@ -29903,11 +30183,108 @@ function createStorageNamespace(rb) {
29903
30183
  { query: { parent_id: parentId } },
29904
30184
  options
29905
30185
  );
30186
+ },
30187
+ /**
30188
+ * Generate a short-lived presigned download URL for a file.
30189
+ *
30190
+ * Returns a URL that can be used to download the file directly from
30191
+ * object storage (GCS in production, MinIO in dev) without routing
30192
+ * through the application server.
30193
+ *
30194
+ * @param id - The UUID of the file to download.
30195
+ * @param params - Optional parameters (e.g., custom `expires_in` seconds).
30196
+ * @param options - Optional request options (abort signal, custom headers).
30197
+ * @returns A promise resolving to the presigned URL and its expiry.
30198
+ *
30199
+ * @example
30200
+ * ```typescript
30201
+ * const { url, expires_at } = await client.storage.files.requestDownloadUrl(
30202
+ * 'file-uuid',
30203
+ * { expires_in: 300 }, // 5 minutes
30204
+ * );
30205
+ * // Redirect browser to `url` for direct download
30206
+ * ```
30207
+ */
30208
+ requestDownloadUrl: async (id, params, options) => {
30209
+ return rb.rawPostDirect(
30210
+ `/storage-files/${id}/download-url`,
30211
+ params?.expires_in != null ? { data: { expires_in: params.expires_in } } : void 0,
30212
+ options
30213
+ );
29906
30214
  }
29907
30215
  }
29908
30216
  };
29909
30217
  }
29910
30218
 
30219
+ // src/namespaces/documents.ts
30220
+ function createDocumentsNamespace(rb) {
30221
+ return {
30222
+ /**
30223
+ * Generate a PDF from HTML content and store it in platform Storage.
30224
+ *
30225
+ * Always pass `store: true` and `workspace_id` to get a JSON response with
30226
+ * a `storage_key`. Without `store: true`, the server returns raw
30227
+ * `application/pdf` binary which cannot be parsed as JSON by this SDK method.
30228
+ *
30229
+ * HTML input is capped at 2MB by the server.
30230
+ *
30231
+ * @param params - PDF generation parameters. Set `store: true` and provide
30232
+ * `workspace_id` for JSON response.
30233
+ * @param options - Optional request options (abort signal, custom headers).
30234
+ * @returns A storage key reference for the generated PDF.
30235
+ *
30236
+ * @example
30237
+ * ```typescript
30238
+ * const { storage_key } = await client.documents.generatePdf({
30239
+ * html: '<html><body>Report</body></html>',
30240
+ * store: true,
30241
+ * workspace_id: 'ws-123',
30242
+ * });
30243
+ * ```
30244
+ */
30245
+ generatePdf: async (params, options) => {
30246
+ return rb.rawPostDirect(
30247
+ "/documents/pdf",
30248
+ params,
30249
+ options
30250
+ );
30251
+ },
30252
+ /**
30253
+ * Generate a PDF from HTML and email it as an attachment.
30254
+ *
30255
+ * The PDF is generated server-side and delivered via platform SMTP.
30256
+ * Optionally stores the PDF in platform Storage alongside the email delivery.
30257
+ *
30258
+ * If storage fails but the email succeeds, the response includes
30259
+ * `storage_error` with the failure reason (email is still delivered).
30260
+ *
30261
+ * @param params - Email report parameters.
30262
+ * @param options - Optional request options (abort signal, custom headers).
30263
+ * @returns Delivery status, optional storage key, and any storage error.
30264
+ *
30265
+ * @example
30266
+ * ```typescript
30267
+ * const result = await client.documents.emailReport({
30268
+ * html: '<html><body><h1>Q1 Summary</h1></body></html>',
30269
+ * to: 'finance@company.com',
30270
+ * subject: 'Q1 Financial Summary',
30271
+ * store: true,
30272
+ * workspace_id: 'ws-123',
30273
+ * });
30274
+ * console.log(result.sent); // true
30275
+ * console.log(result.storage_key); // 'ws-123/documents/...'
30276
+ * ```
30277
+ */
30278
+ emailReport: async (params, options) => {
30279
+ return rb.rawPostDirect(
30280
+ "/documents/pdf/email",
30281
+ params,
30282
+ options
30283
+ );
30284
+ }
30285
+ };
30286
+ }
30287
+
29911
30288
  // src/namespaces/threads.ts
29912
30289
  function getBrowserContext() {
29913
30290
  const ctx = {};
@@ -33031,13 +33408,16 @@ function createSocialNamespace(rb) {
33031
33408
  },
33032
33409
  /**
33033
33410
  * Create a new social campaign.
33034
- * Workspace is resolved from the authenticated user's context — do NOT
33035
- * pass `workspace_id` in attributes.
33411
+ *
33412
+ * @param workspaceId - Workspace ID (passed as query parameter for tenant resolution).
33413
+ * @param attributes - Campaign attributes (name, content_brief, etc.).
33414
+ * @param options - Optional request-level overrides.
33036
33415
  */
33037
- create: async (attributes, options) => {
33416
+ create: async (workspaceId, attributes, options) => {
33038
33417
  return rb.execute(
33039
33418
  postSocialCampaigns,
33040
33419
  {
33420
+ query: { workspace_id: workspaceId },
33041
33421
  body: {
33042
33422
  data: { type: "social-campaign", attributes }
33043
33423
  }
@@ -33124,6 +33504,32 @@ function createSocialNamespace(rb) {
33124
33504
  },
33125
33505
  options
33126
33506
  );
33507
+ },
33508
+ /**
33509
+ * Preview adapted copy per platform without creating SocialPost records.
33510
+ *
33511
+ * Returns the AI-adapted text for each target platform so the user can
33512
+ * review before committing via `adaptForPlatforms`.
33513
+ *
33514
+ * @param id - Campaign UUID.
33515
+ * @param workspaceId - Workspace UUID.
33516
+ * @param options - Optional request options.
33517
+ * @returns `{ adaptations: [{ platform: string, content: string }] }`
33518
+ */
33519
+ previewAdaptations: async (id, workspaceId, options) => {
33520
+ return rb.execute(
33521
+ postSocialCampaignsByIdPreviewAdaptations,
33522
+ {
33523
+ path: { id },
33524
+ body: {
33525
+ data: {
33526
+ campaign_id: id,
33527
+ workspace_id: workspaceId
33528
+ }
33529
+ }
33530
+ },
33531
+ options
33532
+ );
33127
33533
  }
33128
33534
  },
33129
33535
  /** Trending content discovery — snapshots, items, and watch alerts. */
@@ -34225,6 +34631,31 @@ var RequestBuilder = class {
34225
34631
  throw handleApiError(error);
34226
34632
  }
34227
34633
  }
34634
+ /**
34635
+ * Execute a raw POST to a custom endpoint that returns flat JSON (no data wrapper).
34636
+ * Unlike rawPost (which unwraps data.data), this returns the response body directly.
34637
+ * Used for hand-written Phoenix controllers like DocumentsController.
34638
+ */
34639
+ async rawPostDirect(url, body, options) {
34640
+ const headers = buildHeaders(this.getHeaders, options);
34641
+ try {
34642
+ const result = await this.requestWithRetry(
34643
+ () => this.clientInstance.post({
34644
+ url,
34645
+ headers,
34646
+ ...body !== void 0 && { body },
34647
+ ...options?.signal && { signal: options.signal }
34648
+ })
34649
+ );
34650
+ const { data, error } = result;
34651
+ if (error) {
34652
+ throw handleApiError(enrichError(error, result));
34653
+ }
34654
+ return data;
34655
+ } catch (error) {
34656
+ throw handleApiError(error);
34657
+ }
34658
+ }
34228
34659
  /**
34229
34660
  * Execute a raw PUT request to a custom (non-generated) endpoint.
34230
34661
  */
@@ -34444,6 +34875,7 @@ var GptClient = class extends BaseClient {
34444
34875
  this.campaigns = createCampaignsNamespace(rb);
34445
34876
  this.email = createEmailNamespace(rb);
34446
34877
  this.support = createSupportNamespace(rb);
34878
+ this.documents = createDocumentsNamespace(rb);
34447
34879
  this.extraction = createExtractionNamespace(rb);
34448
34880
  this.identity = createIdentityNamespace(rb, this.config?.baseUrl);
34449
34881
  this.portal = createPortalNamespace(rb);