@gpt-platform/admin 0.10.3 → 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
@@ -814,7 +814,7 @@ var createClient = (config = {}) => {
814
814
  };
815
815
 
816
816
  // src/version.ts
817
- var SDK_VERSION = "0.10.3";
817
+ var SDK_VERSION = "0.10.4";
818
818
  var DEFAULT_API_VERSION = "2026-03-23";
819
819
 
820
820
  // src/base-client.ts
@@ -1276,6 +1276,31 @@ var RequestBuilder = class {
1276
1276
  throw handleApiError(error);
1277
1277
  }
1278
1278
  }
1279
+ /**
1280
+ * Execute a raw POST to a custom endpoint that returns flat JSON (no data wrapper).
1281
+ * Unlike rawPost (which unwraps data.data), this returns the response body directly.
1282
+ * Used for hand-written Phoenix controllers like DocumentsController.
1283
+ */
1284
+ async rawPostDirect(url, body, options) {
1285
+ const headers = buildHeaders(this.getHeaders, options);
1286
+ try {
1287
+ const result = await this.requestWithRetry(
1288
+ () => this.clientInstance.post({
1289
+ url,
1290
+ headers,
1291
+ ...body !== void 0 && { body },
1292
+ ...options?.signal && { signal: options.signal }
1293
+ })
1294
+ );
1295
+ const { data, error } = result;
1296
+ if (error) {
1297
+ throw handleApiError(enrichError(error, result));
1298
+ }
1299
+ return data;
1300
+ } catch (error) {
1301
+ throw handleApiError(error);
1302
+ }
1303
+ }
1279
1304
  /**
1280
1305
  * Execute a raw PATCH request to a custom (non-generated) endpoint.
1281
1306
  * Used for endpoints implemented as custom Phoenix controllers.
@@ -2103,6 +2128,11 @@ var patchAdminIsvCrmEntityTypesById = (options) => (options.client ?? client).pa
2103
2128
  ...options.headers
2104
2129
  }
2105
2130
  });
2131
+ var getAdminWorkspacesByWorkspaceIdTrainingAnalytics = (options) => (options.client ?? client).get({
2132
+ security: [{ scheme: "bearer", type: "http" }],
2133
+ url: "/admin/workspaces/{workspace_id}/training/analytics",
2134
+ ...options
2135
+ });
2106
2136
  var getAdminClinicalMealPlansByPatient = (options) => (options.client ?? client).get({
2107
2137
  security: [{ scheme: "bearer", type: "http" }],
2108
2138
  url: "/admin/clinical/meal-plans/by-patient",
@@ -2861,6 +2891,25 @@ var getAdminClinicalPracticeToolsCatalogArchived = (options) => (options.client
2861
2891
  url: "/admin/clinical/practice-tools/catalog/archived",
2862
2892
  ...options
2863
2893
  });
2894
+ var deleteAdminPostProcessingHooksById = (options) => (options.client ?? client).delete({
2895
+ security: [{ scheme: "bearer", type: "http" }],
2896
+ url: "/admin/post-processing-hooks/{id}",
2897
+ ...options
2898
+ });
2899
+ var getAdminPostProcessingHooksById = (options) => (options.client ?? client).get({
2900
+ security: [{ scheme: "bearer", type: "http" }],
2901
+ url: "/admin/post-processing-hooks/{id}",
2902
+ ...options
2903
+ });
2904
+ var patchAdminPostProcessingHooksById = (options) => (options.client ?? client).patch({
2905
+ security: [{ scheme: "bearer", type: "http" }],
2906
+ url: "/admin/post-processing-hooks/{id}",
2907
+ ...options,
2908
+ headers: {
2909
+ "Content-Type": "application/vnd.api+json",
2910
+ ...options.headers
2911
+ }
2912
+ });
2864
2913
  var getAdminVoiceRecordingsSessionBySessionId = (options) => (options.client ?? client).get({
2865
2914
  security: [{ scheme: "bearer", type: "http" }],
2866
2915
  url: "/admin/voice/recordings/session/{session_id}",
@@ -3996,6 +4045,15 @@ var getAdminEmailMarketingTemplatesWorkspaceByWorkspaceId = (options) => (option
3996
4045
  url: "/admin/email-marketing/templates/workspace/{workspace_id}",
3997
4046
  ...options
3998
4047
  });
4048
+ var postAdminExtractionAgentsPredict = (options) => (options.client ?? client).post({
4049
+ security: [{ scheme: "bearer", type: "http" }],
4050
+ url: "/admin/extraction/agents/predict",
4051
+ ...options,
4052
+ headers: {
4053
+ "Content-Type": "application/vnd.api+json",
4054
+ ...options.headers
4055
+ }
4056
+ });
3999
4057
  var postAdminSocialCampaignsByIdGenerateMasterCopy = (options) => (options.client ?? client).post({
4000
4058
  security: [{ scheme: "bearer", type: "http" }],
4001
4059
  url: "/admin/social/campaigns/{id}/generate-master-copy",
@@ -4173,6 +4231,11 @@ var patchAdminLegalDocumentsByIdUnpublish = (options) => (options.client ?? clie
4173
4231
  ...options.headers
4174
4232
  }
4175
4233
  });
4234
+ var getAdminExtractionAgents = (options) => (options.client ?? client).get({
4235
+ security: [{ scheme: "bearer", type: "http" }],
4236
+ url: "/admin/extraction/agents",
4237
+ ...options
4238
+ });
4176
4239
  var getAdminWalletUsage = (options) => (options.client ?? client).get({
4177
4240
  security: [{ scheme: "bearer", type: "http" }],
4178
4241
  url: "/admin/wallet/usage",
@@ -4805,6 +4868,11 @@ var getAdminAgentVersionRevisionsById = (options) => (options.client ?? client).
4805
4868
  url: "/admin/agent-version-revisions/{id}",
4806
4869
  ...options
4807
4870
  });
4871
+ var getAdminExtractionAgentsById = (options) => (options.client ?? client).get({
4872
+ security: [{ scheme: "bearer", type: "http" }],
4873
+ url: "/admin/extraction/agents/{id}",
4874
+ ...options
4875
+ });
4808
4876
  var getAdminSchedulingEventsByDateRange = (options) => (options.client ?? client).get({
4809
4877
  security: [{ scheme: "bearer", type: "http" }],
4810
4878
  url: "/admin/scheduling/events/by_date_range",
@@ -4953,6 +5021,11 @@ var postAdminWebhookConfigs = (options) => (options.client ?? client).post({
4953
5021
  ...options.headers
4954
5022
  }
4955
5023
  });
5024
+ var getAdminWorkspacesAnalyticsBatch = (options) => (options.client ?? client).get({
5025
+ security: [{ scheme: "bearer", type: "http" }],
5026
+ url: "/admin/workspaces/analytics-batch",
5027
+ ...options
5028
+ });
4956
5029
  var getAdminExtractionConfigEnums = (options) => (options.client ?? client).get({
4957
5030
  security: [{ scheme: "bearer", type: "http" }],
4958
5031
  url: "/admin/extraction/config-enums",
@@ -5988,6 +6061,15 @@ var postAdminEmailMarketingTemplatesCompile = (options) => (options.client ?? cl
5988
6061
  ...options.headers
5989
6062
  }
5990
6063
  });
6064
+ var postAdminSocialCampaignsByIdPreviewAdaptations = (options) => (options.client ?? client).post({
6065
+ security: [{ scheme: "bearer", type: "http" }],
6066
+ url: "/admin/social/campaigns/{id}/preview-adaptations",
6067
+ ...options,
6068
+ headers: {
6069
+ "Content-Type": "application/vnd.api+json",
6070
+ ...options.headers
6071
+ }
6072
+ });
5991
6073
  var getAdminClinicalNotesArchived = (options) => (options.client ?? client).get({
5992
6074
  security: [{ scheme: "bearer", type: "http" }],
5993
6075
  url: "/admin/clinical/notes/archived",
@@ -6607,6 +6689,20 @@ var patchAdminCrawlerSchedulesByIdEnable = (options) => (options.client ?? clien
6607
6689
  ...options.headers
6608
6690
  }
6609
6691
  });
6692
+ var getAdminPostProcessingHooks = (options) => (options.client ?? client).get({
6693
+ security: [{ scheme: "bearer", type: "http" }],
6694
+ url: "/admin/post-processing-hooks",
6695
+ ...options
6696
+ });
6697
+ var postAdminPostProcessingHooks = (options) => (options.client ?? client).post({
6698
+ security: [{ scheme: "bearer", type: "http" }],
6699
+ url: "/admin/post-processing-hooks",
6700
+ ...options,
6701
+ headers: {
6702
+ "Content-Type": "application/vnd.api+json",
6703
+ ...options.headers
6704
+ }
6705
+ });
6610
6706
  var postAdminAgentsByIdAnalyzeTraining = (options) => (options.client ?? client).post({
6611
6707
  security: [{ scheme: "bearer", type: "http" }],
6612
6708
  url: "/admin/agents/{id}/analyze-training",
@@ -9756,6 +9852,21 @@ function createStorageNamespace(rb) {
9756
9852
  { query: { parent_id: parentId } },
9757
9853
  options
9758
9854
  );
9855
+ },
9856
+ /**
9857
+ * Generate a short-lived presigned download URL for a file.
9858
+ *
9859
+ * @param id - The UUID of the file to download.
9860
+ * @param params - Optional parameters (e.g., custom `expires_in` seconds).
9861
+ * @param options - Optional request options.
9862
+ * @returns A promise resolving to the presigned URL and its expiry.
9863
+ */
9864
+ requestDownloadUrl: async (id, params, options) => {
9865
+ return rb.rawPostDirect(
9866
+ `/isv/storage-files/${id}/download-url`,
9867
+ params?.expires_in != null ? { data: { expires_in: params.expires_in } } : void 0,
9868
+ options
9869
+ );
9759
9870
  }
9760
9871
  },
9761
9872
  /**
@@ -13344,6 +13455,32 @@ function createSocialNamespace(rb) {
13344
13455
  },
13345
13456
  options
13346
13457
  );
13458
+ },
13459
+ /**
13460
+ * Preview adapted copy per platform without creating SocialPost records.
13461
+ *
13462
+ * Returns the AI-adapted text for each target platform so the user can
13463
+ * review before committing via `adaptForPlatforms`.
13464
+ *
13465
+ * @param id - Campaign UUID.
13466
+ * @param workspaceId - Workspace UUID.
13467
+ * @param options - Optional request options.
13468
+ * @returns `{ adaptations: [{ platform: string, content: string }] }`
13469
+ */
13470
+ previewAdaptations: async (id, workspaceId, options) => {
13471
+ return rb.execute(
13472
+ postAdminSocialCampaignsByIdPreviewAdaptations,
13473
+ {
13474
+ path: { id },
13475
+ body: {
13476
+ data: {
13477
+ campaign_id: id,
13478
+ workspace_id: workspaceId
13479
+ }
13480
+ }
13481
+ },
13482
+ options
13483
+ );
13347
13484
  }
13348
13485
  },
13349
13486
  /** Trending content discovery — snapshots, items, and watch alerts. */
@@ -13946,7 +14083,17 @@ function createExtractionNamespace(rb) {
13946
14083
  return {
13947
14084
  /** Document lifecycle — upload, process, review, train, bulk operations. */
13948
14085
  documents: {
13949
- /** List all extraction documents. */
14086
+ /**
14087
+ * Lists all extraction documents across the platform.
14088
+ *
14089
+ * @param options - Optional request options (abort signal, custom headers).
14090
+ * @returns An array of extraction document objects.
14091
+ *
14092
+ * @example
14093
+ * ```typescript
14094
+ * const docs = await admin.extraction.documents.list();
14095
+ * ```
14096
+ */
13950
14097
  list: async (options) => {
13951
14098
  return rb.execute(
13952
14099
  getAdminExtractionDocuments,
@@ -13954,7 +14101,19 @@ function createExtractionNamespace(rb) {
13954
14101
  options
13955
14102
  );
13956
14103
  },
13957
- /** Get a document by ID. */
14104
+ /**
14105
+ * Retrieves a single extraction document by its unique identifier.
14106
+ *
14107
+ * @param id - The UUID of the document to retrieve.
14108
+ * @param options - Optional request options (abort signal, custom headers).
14109
+ * @returns The matching extraction document object.
14110
+ *
14111
+ * @example
14112
+ * ```typescript
14113
+ * const doc = await admin.extraction.documents.get('doc-uuid');
14114
+ * console.log(doc.status, doc.filename);
14115
+ * ```
14116
+ */
13958
14117
  get: async (id, options) => {
13959
14118
  return rb.execute(
13960
14119
  getAdminExtractionDocumentsById,
@@ -13962,7 +14121,18 @@ function createExtractionNamespace(rb) {
13962
14121
  options
13963
14122
  );
13964
14123
  },
13965
- /** Delete a document. */
14124
+ /**
14125
+ * Permanently deletes an extraction document and its associated results.
14126
+ *
14127
+ * @param id - The UUID of the document to delete.
14128
+ * @param options - Optional request options (abort signal, custom headers).
14129
+ * @returns `true` when the deletion succeeds.
14130
+ *
14131
+ * @example
14132
+ * ```typescript
14133
+ * await admin.extraction.documents.delete('doc-uuid');
14134
+ * ```
14135
+ */
13966
14136
  delete: async (id, options) => {
13967
14137
  return rb.executeDelete(
13968
14138
  deleteAdminExtractionDocumentsById,
@@ -13970,7 +14140,19 @@ function createExtractionNamespace(rb) {
13970
14140
  options
13971
14141
  );
13972
14142
  },
13973
- /** Get the rendered view of a document. */
14143
+ /**
14144
+ * Retrieves the rendered view of a document, including page images and
14145
+ * overlay data for visual inspection.
14146
+ *
14147
+ * @param id - The UUID of the document.
14148
+ * @param options - Optional request options (abort signal, custom headers).
14149
+ * @returns The document object with rendered view data.
14150
+ *
14151
+ * @example
14152
+ * ```typescript
14153
+ * const view = await admin.extraction.documents.view('doc-uuid');
14154
+ * ```
14155
+ */
13974
14156
  view: async (id, options) => {
13975
14157
  return rb.execute(
13976
14158
  getAdminExtractionDocumentsByIdView,
@@ -13978,7 +14160,20 @@ function createExtractionNamespace(rb) {
13978
14160
  options
13979
14161
  );
13980
14162
  },
13981
- /** Get document processing status. */
14163
+ /**
14164
+ * Retrieves the current processing status of a document, including
14165
+ * progress percentage and any error details.
14166
+ *
14167
+ * @param id - The UUID of the document.
14168
+ * @param options - Optional request options (abort signal, custom headers).
14169
+ * @returns The document object with current status fields.
14170
+ *
14171
+ * @example
14172
+ * ```typescript
14173
+ * const { status, progress_percent } = await admin.extraction.documents.status('doc-uuid');
14174
+ * console.log(`Status: ${status} (${progress_percent}%)`);
14175
+ * ```
14176
+ */
13982
14177
  status: async (id, options) => {
13983
14178
  return rb.execute(
13984
14179
  getAdminExtractionDocumentsByIdStatus,
@@ -13986,7 +14181,22 @@ function createExtractionNamespace(rb) {
13986
14181
  options
13987
14182
  );
13988
14183
  },
13989
- /** Update document processing status. */
14184
+ /**
14185
+ * Updates the processing status of a document. Used by admin tooling to
14186
+ * manually transition a document between pipeline states.
14187
+ *
14188
+ * @param id - The UUID of the document to update.
14189
+ * @param attributes - The status attributes to set.
14190
+ * @param options - Optional request options (abort signal, custom headers).
14191
+ * @returns The updated extraction document object.
14192
+ *
14193
+ * @example
14194
+ * ```typescript
14195
+ * const doc = await admin.extraction.documents.updateStatus('doc-uuid', {
14196
+ * status: 'completed',
14197
+ * });
14198
+ * ```
14199
+ */
13990
14200
  updateStatus: async (id, attributes, options) => {
13991
14201
  return rb.execute(
13992
14202
  patchAdminExtractionDocumentsByIdStatus,
@@ -13999,7 +14209,20 @@ function createExtractionNamespace(rb) {
13999
14209
  options
14000
14210
  );
14001
14211
  },
14002
- /** Reprocess a completed document. */
14212
+ /**
14213
+ * Reprocesses a completed or failed document through the extraction
14214
+ * pipeline from scratch.
14215
+ *
14216
+ * @param id - The UUID of the document to reprocess.
14217
+ * @param options - Optional request options (abort signal, custom headers).
14218
+ * @returns The document object with its new processing status.
14219
+ *
14220
+ * @example
14221
+ * ```typescript
14222
+ * const doc = await admin.extraction.documents.reprocess('doc-uuid');
14223
+ * console.log(`Reprocessing: ${doc.status}`);
14224
+ * ```
14225
+ */
14003
14226
  reprocess: async (id, options) => {
14004
14227
  return rb.execute(
14005
14228
  patchAdminExtractionDocumentsByIdReprocess,
@@ -14007,7 +14230,18 @@ function createExtractionNamespace(rb) {
14007
14230
  options
14008
14231
  );
14009
14232
  },
14010
- /** Cancel a queued or processing document. */
14233
+ /**
14234
+ * Cancels a document that is currently queued or being processed.
14235
+ *
14236
+ * @param id - The UUID of the document to cancel.
14237
+ * @param options - Optional request options (abort signal, custom headers).
14238
+ * @returns The document object with its updated (cancelled) status.
14239
+ *
14240
+ * @example
14241
+ * ```typescript
14242
+ * const doc = await admin.extraction.documents.cancel('doc-uuid');
14243
+ * ```
14244
+ */
14011
14245
  cancel: async (id, options) => {
14012
14246
  return rb.execute(
14013
14247
  patchAdminExtractionDocumentsByIdCancel,
@@ -14015,7 +14249,19 @@ function createExtractionNamespace(rb) {
14015
14249
  options
14016
14250
  );
14017
14251
  },
14018
- /** Dismiss a document from the review queue. */
14252
+ /**
14253
+ * Dismisses a document from the review queue without changing its
14254
+ * underlying data or verification status.
14255
+ *
14256
+ * @param id - The UUID of the document to dismiss.
14257
+ * @param options - Optional request options (abort signal, custom headers).
14258
+ * @returns The updated extraction document object.
14259
+ *
14260
+ * @example
14261
+ * ```typescript
14262
+ * await admin.extraction.documents.dismiss('doc-uuid');
14263
+ * ```
14264
+ */
14019
14265
  dismiss: async (id, options) => {
14020
14266
  return rb.execute(
14021
14267
  patchAdminExtractionDocumentsByIdDismiss,
@@ -14023,7 +14269,19 @@ function createExtractionNamespace(rb) {
14023
14269
  options
14024
14270
  );
14025
14271
  },
14026
- /** Exclude a document from training. */
14272
+ /**
14273
+ * Excludes a document from the training dataset. Excluded documents are
14274
+ * not used when retraining extraction models.
14275
+ *
14276
+ * @param id - The UUID of the document to exclude.
14277
+ * @param options - Optional request options (abort signal, custom headers).
14278
+ * @returns The updated extraction document object.
14279
+ *
14280
+ * @example
14281
+ * ```typescript
14282
+ * await admin.extraction.documents.exclude('doc-uuid');
14283
+ * ```
14284
+ */
14027
14285
  exclude: async (id, options) => {
14028
14286
  return rb.execute(
14029
14287
  patchAdminExtractionDocumentsByIdExclude,
@@ -14031,7 +14289,18 @@ function createExtractionNamespace(rb) {
14031
14289
  options
14032
14290
  );
14033
14291
  },
14034
- /** Re-include a previously excluded document. */
14292
+ /**
14293
+ * Re-includes a previously excluded document in the training dataset.
14294
+ *
14295
+ * @param id - The UUID of the document to include.
14296
+ * @param options - Optional request options (abort signal, custom headers).
14297
+ * @returns The updated extraction document object.
14298
+ *
14299
+ * @example
14300
+ * ```typescript
14301
+ * await admin.extraction.documents.include('doc-uuid');
14302
+ * ```
14303
+ */
14035
14304
  include: async (id, options) => {
14036
14305
  return rb.execute(
14037
14306
  patchAdminExtractionDocumentsByIdInclude,
@@ -14039,7 +14308,19 @@ function createExtractionNamespace(rb) {
14039
14308
  options
14040
14309
  );
14041
14310
  },
14042
- /** Restore a soft-deleted document. */
14311
+ /**
14312
+ * Restores a soft-deleted (trashed) document back to active status.
14313
+ *
14314
+ * @param id - The UUID of the document to restore.
14315
+ * @param options - Optional request options (abort signal, custom headers).
14316
+ * @returns The restored extraction document object.
14317
+ *
14318
+ * @example
14319
+ * ```typescript
14320
+ * const doc = await admin.extraction.documents.restore('doc-uuid');
14321
+ * console.log(`Restored: ${doc.filename}`);
14322
+ * ```
14323
+ */
14043
14324
  restore: async (id, options) => {
14044
14325
  return rb.execute(
14045
14326
  patchAdminExtractionDocumentsByIdRestore,
@@ -14047,7 +14328,23 @@ function createExtractionNamespace(rb) {
14047
14328
  options
14048
14329
  );
14049
14330
  },
14050
- /** Update verification status of a document. */
14331
+ /**
14332
+ * Updates the verification status of a document. Used during the human
14333
+ * review step to confirm or reject extracted data.
14334
+ *
14335
+ * @param id - The UUID of the document to update.
14336
+ * @param attributes - Verification attributes to set.
14337
+ * @param options - Optional request options (abort signal, custom headers).
14338
+ * @returns The updated extraction document object.
14339
+ *
14340
+ * @example
14341
+ * ```typescript
14342
+ * const doc = await admin.extraction.documents.updateVerification('doc-uuid', {
14343
+ * verification_status: 'verified',
14344
+ * avg_confidence: 0.95,
14345
+ * });
14346
+ * ```
14347
+ */
14051
14348
  updateVerification: async (id, attributes, options) => {
14052
14349
  return rb.execute(
14053
14350
  patchAdminExtractionDocumentsByIdVerification,
@@ -14060,7 +14357,19 @@ function createExtractionNamespace(rb) {
14060
14357
  options
14061
14358
  );
14062
14359
  },
14063
- /** Mark a document as trained. */
14360
+ /**
14361
+ * Marks a document as trained, indicating its extraction results have been
14362
+ * incorporated into the model training set.
14363
+ *
14364
+ * @param id - The UUID of the document to mark as trained.
14365
+ * @param options - Optional request options (abort signal, custom headers).
14366
+ * @returns The updated extraction document object.
14367
+ *
14368
+ * @example
14369
+ * ```typescript
14370
+ * await admin.extraction.documents.markTrained('doc-uuid');
14371
+ * ```
14372
+ */
14064
14373
  markTrained: async (id, options) => {
14065
14374
  return rb.execute(
14066
14375
  patchAdminExtractionDocumentsByIdMarkTrained,
@@ -14068,7 +14377,19 @@ function createExtractionNamespace(rb) {
14068
14377
  options
14069
14378
  );
14070
14379
  },
14071
- /** Dismiss training flag on a document. */
14380
+ /**
14381
+ * Dismisses the training flag on a document without un-training it.
14382
+ * Useful for clearing training notifications in the review UI.
14383
+ *
14384
+ * @param id - The UUID of the document.
14385
+ * @param options - Optional request options (abort signal, custom headers).
14386
+ * @returns The updated extraction document object.
14387
+ *
14388
+ * @example
14389
+ * ```typescript
14390
+ * await admin.extraction.documents.dismissTraining('doc-uuid');
14391
+ * ```
14392
+ */
14072
14393
  dismissTraining: async (id, options) => {
14073
14394
  return rb.execute(
14074
14395
  patchAdminExtractionDocumentsByIdDismissTraining,
@@ -14076,7 +14397,19 @@ function createExtractionNamespace(rb) {
14076
14397
  options
14077
14398
  );
14078
14399
  },
14079
- /** Finish a multi-part upload. */
14400
+ /**
14401
+ * Signals the server that a multi-part upload has completed and the
14402
+ * document is ready for processing.
14403
+ *
14404
+ * @param id - The UUID of the document whose upload is being finalized.
14405
+ * @param options - Optional request options (abort signal, custom headers).
14406
+ * @returns The document object transitioned to processing state.
14407
+ *
14408
+ * @example
14409
+ * ```typescript
14410
+ * await admin.extraction.documents.finishUpload('doc-uuid');
14411
+ * ```
14412
+ */
14080
14413
  finishUpload: async (id, options) => {
14081
14414
  return rb.execute(
14082
14415
  patchAdminExtractionDocumentsByIdFinishUpload,
@@ -14084,31 +14417,82 @@ function createExtractionNamespace(rb) {
14084
14417
  options
14085
14418
  );
14086
14419
  },
14087
- /** Begin a new document upload and get a presigned URL. */
14420
+ /**
14421
+ * Begins a new document upload and returns a presigned URL for direct
14422
+ * browser-to-storage upload.
14423
+ *
14424
+ * @param attributes - Upload attributes including the filename and optional metadata.
14425
+ * @param options - Optional request options (abort signal, custom headers).
14426
+ * @returns A presigned URL object for uploading the file.
14427
+ *
14428
+ * @example
14429
+ * ```typescript
14430
+ * const presigned = await admin.extraction.documents.beginUpload({
14431
+ * filename: 'invoice-2026.pdf',
14432
+ * content_type: 'application/pdf',
14433
+ * agent_id: 'agent-uuid',
14434
+ * workspace_id: 'ws-uuid',
14435
+ * });
14436
+ * // Upload file to presigned.upload_url
14437
+ * ```
14438
+ */
14088
14439
  beginUpload: async (attributes, options) => {
14089
14440
  return rb.execute(
14090
14441
  postAdminExtractionDocumentsBeginUpload,
14091
14442
  {
14092
14443
  body: {
14093
- data: { type: "presigned-url", attributes }
14444
+ data: { type: "extraction-document", attributes }
14094
14445
  }
14095
14446
  },
14096
14447
  options
14097
14448
  );
14098
14449
  },
14099
- /** Find an existing document by hash or begin a new upload. */
14450
+ /**
14451
+ * Finds an existing document by file hash (for deduplication) or begins a
14452
+ * new upload if no match is found.
14453
+ *
14454
+ * @param attributes - Attributes for finding or beginning the upload.
14455
+ * @param options - Optional request options (abort signal, custom headers).
14456
+ * @returns A presigned URL object (or a reference to the existing document).
14457
+ *
14458
+ * @example
14459
+ * ```typescript
14460
+ * const result = await admin.extraction.documents.findOrBeginUpload({
14461
+ * file_hash: 'sha256:abc123...',
14462
+ * filename: 'invoice-2026.pdf',
14463
+ * content_type: 'application/pdf',
14464
+ * });
14465
+ * ```
14466
+ */
14100
14467
  findOrBeginUpload: async (attributes, options) => {
14101
14468
  return rb.execute(
14102
14469
  postAdminExtractionDocumentsFindOrBeginUpload,
14103
14470
  {
14104
14471
  body: {
14105
- data: { type: "presigned-url", attributes }
14472
+ data: { type: "extraction-document", attributes }
14106
14473
  }
14107
14474
  },
14108
14475
  options
14109
14476
  );
14110
14477
  },
14111
- /** Upload a document directly (single-shot). */
14478
+ /**
14479
+ * Uploads a document directly in a single shot. The server handles storage
14480
+ * placement and immediately enqueues the document for processing.
14481
+ *
14482
+ * @param attributes - Upload attributes including filename and optional storage path.
14483
+ * @param options - Optional request options (abort signal, custom headers).
14484
+ * @returns The created extraction document object.
14485
+ *
14486
+ * @example
14487
+ * ```typescript
14488
+ * const doc = await admin.extraction.documents.upload({
14489
+ * filename: 'contract.pdf',
14490
+ * content_type: 'application/pdf',
14491
+ * agent_id: 'agent-uuid',
14492
+ * workspace_id: 'ws-uuid',
14493
+ * });
14494
+ * ```
14495
+ */
14112
14496
  upload: async (attributes, options) => {
14113
14497
  return rb.execute(
14114
14498
  postAdminExtractionDocumentsUpload,
@@ -14120,7 +14504,22 @@ function createExtractionNamespace(rb) {
14120
14504
  options
14121
14505
  );
14122
14506
  },
14123
- /** Bulk reprocess multiple documents. */
14507
+ /**
14508
+ * Reprocesses multiple documents in a single bulk operation.
14509
+ *
14510
+ * @param ids - An array of document UUIDs to reprocess.
14511
+ * @param options - Optional request options (abort signal, custom headers).
14512
+ * @returns An operation success result with the count of enqueued documents.
14513
+ *
14514
+ * @example
14515
+ * ```typescript
14516
+ * const result = await admin.extraction.documents.bulkReprocess([
14517
+ * 'doc-uuid-1',
14518
+ * 'doc-uuid-2',
14519
+ * ]);
14520
+ * console.log(`Enqueued: ${result.enqueued_count}`);
14521
+ * ```
14522
+ */
14124
14523
  bulkReprocess: async (ids, options) => {
14125
14524
  return rb.execute(
14126
14525
  postAdminExtractionDocumentsBulkReprocess,
@@ -14128,30 +14527,67 @@ function createExtractionNamespace(rb) {
14128
14527
  body: {
14129
14528
  data: {
14130
14529
  type: "bulk-reprocess-result",
14131
- attributes: { ids }
14530
+ attributes: { document_ids: ids }
14132
14531
  }
14133
14532
  }
14134
14533
  },
14135
14534
  options
14136
14535
  );
14137
14536
  },
14138
- /** Bulk delete multiple documents. */
14537
+ /**
14538
+ * Permanently deletes multiple documents in a single bulk operation.
14539
+ *
14540
+ * @param ids - An array of document UUIDs to delete.
14541
+ * @param options - Optional request options (abort signal, custom headers).
14542
+ * @returns An operation success result with the count of deleted documents.
14543
+ *
14544
+ * @example
14545
+ * ```typescript
14546
+ * const result = await admin.extraction.documents.bulkDelete([
14547
+ * 'doc-uuid-1',
14548
+ * 'doc-uuid-2',
14549
+ * ]);
14550
+ * console.log(`Deleted: ${result.deleted_count}`);
14551
+ * ```
14552
+ */
14139
14553
  bulkDelete: async (ids, options) => {
14140
14554
  return rb.execute(
14141
14555
  postAdminDocumentsBulkDelete,
14142
14556
  {
14143
14557
  body: {
14144
- data: { type: "bulk-delete", attributes: { ids } }
14558
+ data: { type: "operation-success", attributes: { ids } }
14145
14559
  }
14146
14560
  },
14147
14561
  options
14148
14562
  );
14149
14563
  },
14150
- /** Get platform-wide document statistics. */
14564
+ /**
14565
+ * Retrieves platform-wide document statistics including counts by status.
14566
+ *
14567
+ * @param options - Optional request options (abort signal, custom headers).
14568
+ * @returns Aggregate document statistics.
14569
+ *
14570
+ * @example
14571
+ * ```typescript
14572
+ * const stats = await admin.extraction.documents.stats();
14573
+ * console.log(`Total: ${stats.total}, Failed: ${stats.failed}`);
14574
+ * ```
14575
+ */
14151
14576
  stats: async (options) => {
14152
14577
  return rb.execute(getAdminDocumentsStats, {}, options);
14153
14578
  },
14154
- /** List documents for a specific workspace. */
14579
+ /**
14580
+ * Lists all extraction documents belonging to a specific workspace.
14581
+ *
14582
+ * @param workspaceId - The UUID of the workspace.
14583
+ * @param options - Optional request options (abort signal, custom headers).
14584
+ * @returns An array of extraction documents for the workspace.
14585
+ *
14586
+ * @example
14587
+ * ```typescript
14588
+ * const docs = await admin.extraction.documents.listByWorkspace('ws-uuid');
14589
+ * ```
14590
+ */
14155
14591
  listByWorkspace: async (workspaceId, options) => {
14156
14592
  return rb.execute(
14157
14593
  getAdminExtractionDocumentsWorkspaceByWorkspaceId,
@@ -14159,7 +14595,20 @@ function createExtractionNamespace(rb) {
14159
14595
  options
14160
14596
  );
14161
14597
  },
14162
- /** List documents by status for a workspace. */
14598
+ /**
14599
+ * Lists documents filtered by processing status within a workspace.
14600
+ *
14601
+ * @param workspaceId - The UUID of the workspace.
14602
+ * @param status - The processing status to filter by (e.g. `"completed"`, `"failed"`).
14603
+ * @param options - Optional request options (abort signal, custom headers).
14604
+ * @returns An array of extraction documents matching the status filter.
14605
+ *
14606
+ * @example
14607
+ * ```typescript
14608
+ * const failed = await admin.extraction.documents.listByStatus('ws-uuid', 'failed');
14609
+ * console.log(`${failed.length} failed documents`);
14610
+ * ```
14611
+ */
14163
14612
  listByStatus: async (workspaceId, status, options) => {
14164
14613
  return rb.execute(
14165
14614
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdByStatusByStatus,
@@ -14167,7 +14616,20 @@ function createExtractionNamespace(rb) {
14167
14616
  options
14168
14617
  );
14169
14618
  },
14170
- /** Get the review queue for a workspace. */
14619
+ /**
14620
+ * Returns the review queue for a workspace — documents awaiting human
14621
+ * verification of their extraction results.
14622
+ *
14623
+ * @param workspaceId - The UUID of the workspace.
14624
+ * @param options - Optional request options (abort signal, custom headers).
14625
+ * @returns An array of documents in the review queue.
14626
+ *
14627
+ * @example
14628
+ * ```typescript
14629
+ * const queue = await admin.extraction.documents.reviewQueue('ws-uuid');
14630
+ * console.log(`${queue.length} documents awaiting review`);
14631
+ * ```
14632
+ */
14171
14633
  reviewQueue: async (workspaceId, options) => {
14172
14634
  return rb.execute(
14173
14635
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdReviewQueue,
@@ -14175,7 +14637,18 @@ function createExtractionNamespace(rb) {
14175
14637
  options
14176
14638
  );
14177
14639
  },
14178
- /** List trained documents for a workspace. */
14640
+ /**
14641
+ * Lists documents that have been marked as trained within a workspace.
14642
+ *
14643
+ * @param workspaceId - The UUID of the workspace.
14644
+ * @param options - Optional request options (abort signal, custom headers).
14645
+ * @returns An array of trained extraction documents.
14646
+ *
14647
+ * @example
14648
+ * ```typescript
14649
+ * const trained = await admin.extraction.documents.listTrained('ws-uuid');
14650
+ * ```
14651
+ */
14179
14652
  listTrained: async (workspaceId, options) => {
14180
14653
  return rb.execute(
14181
14654
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdTrained,
@@ -14183,7 +14656,19 @@ function createExtractionNamespace(rb) {
14183
14656
  options
14184
14657
  );
14185
14658
  },
14186
- /** List trashed (soft-deleted) documents for a workspace. */
14659
+ /**
14660
+ * Lists soft-deleted (trashed) documents for a workspace. These can be
14661
+ * restored via the `restore` method.
14662
+ *
14663
+ * @param workspaceId - The UUID of the workspace.
14664
+ * @param options - Optional request options (abort signal, custom headers).
14665
+ * @returns An array of trashed extraction documents.
14666
+ *
14667
+ * @example
14668
+ * ```typescript
14669
+ * const trashed = await admin.extraction.documents.listTrashed('ws-uuid');
14670
+ * ```
14671
+ */
14187
14672
  listTrashed: async (workspaceId, options) => {
14188
14673
  return rb.execute(
14189
14674
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdTrashed,
@@ -14191,7 +14676,19 @@ function createExtractionNamespace(rb) {
14191
14676
  options
14192
14677
  );
14193
14678
  },
14194
- /** List excluded documents for a workspace. */
14679
+ /**
14680
+ * Lists documents that have been excluded from the training dataset
14681
+ * within a workspace.
14682
+ *
14683
+ * @param workspaceId - The UUID of the workspace.
14684
+ * @param options - Optional request options (abort signal, custom headers).
14685
+ * @returns An array of excluded extraction documents.
14686
+ *
14687
+ * @example
14688
+ * ```typescript
14689
+ * const excluded = await admin.extraction.documents.listExcluded('ws-uuid');
14690
+ * ```
14691
+ */
14195
14692
  listExcluded: async (workspaceId, options) => {
14196
14693
  return rb.execute(
14197
14694
  getAdminExtractionDocumentsWorkspaceByWorkspaceIdExcluded,
@@ -14199,7 +14696,20 @@ function createExtractionNamespace(rb) {
14199
14696
  options
14200
14697
  );
14201
14698
  },
14202
- /** Dismiss all trained documents in a workspace. */
14699
+ /**
14700
+ * Dismisses all trained-flagged documents in a workspace in one operation.
14701
+ * Useful for clearing training notifications after a batch review.
14702
+ *
14703
+ * @param workspaceId - The UUID of the workspace.
14704
+ * @param options - Optional request options (abort signal, custom headers).
14705
+ * @returns An operation success result with the dismissed count.
14706
+ *
14707
+ * @example
14708
+ * ```typescript
14709
+ * const result = await admin.extraction.documents.dismissAllTrained('ws-uuid');
14710
+ * console.log(`Dismissed ${result.dismissed_count} documents`);
14711
+ * ```
14712
+ */
14203
14713
  dismissAllTrained: async (workspaceId, options) => {
14204
14714
  return rb.execute(
14205
14715
  postAdminWorkspacesByWorkspaceIdExtractionDocumentsDismissAllTrained,
@@ -14213,7 +14723,17 @@ function createExtractionNamespace(rb) {
14213
14723
  },
14214
14724
  /** Extraction result management — CRUD, history, corrections, regeneration. */
14215
14725
  results: {
14216
- /** List all extraction results. */
14726
+ /**
14727
+ * Lists all extraction results across the platform.
14728
+ *
14729
+ * @param options - Optional request options (abort signal, custom headers).
14730
+ * @returns An array of extraction result objects.
14731
+ *
14732
+ * @example
14733
+ * ```typescript
14734
+ * const results = await admin.extraction.results.list();
14735
+ * ```
14736
+ */
14217
14737
  list: async (options) => {
14218
14738
  return rb.execute(
14219
14739
  getAdminExtractionResults,
@@ -14221,7 +14741,19 @@ function createExtractionNamespace(rb) {
14221
14741
  options
14222
14742
  );
14223
14743
  },
14224
- /** Get an extraction result by ID. */
14744
+ /**
14745
+ * Retrieves a single extraction result by its unique identifier.
14746
+ *
14747
+ * @param id - The UUID of the extraction result.
14748
+ * @param options - Optional request options (abort signal, custom headers).
14749
+ * @returns The matching extraction result object.
14750
+ *
14751
+ * @example
14752
+ * ```typescript
14753
+ * const result = await admin.extraction.results.get('result-uuid');
14754
+ * console.log(result.extracted_data);
14755
+ * ```
14756
+ */
14225
14757
  get: async (id, options) => {
14226
14758
  return rb.execute(
14227
14759
  getAdminExtractionResultsById,
@@ -14229,7 +14761,21 @@ function createExtractionNamespace(rb) {
14229
14761
  options
14230
14762
  );
14231
14763
  },
14232
- /** Update an extraction result. */
14764
+ /**
14765
+ * Updates an extraction result's metadata (e.g. review status).
14766
+ *
14767
+ * @param id - The UUID of the extraction result to update.
14768
+ * @param attributes - The attributes to update.
14769
+ * @param options - Optional request options (abort signal, custom headers).
14770
+ * @returns The updated extraction result object.
14771
+ *
14772
+ * @example
14773
+ * ```typescript
14774
+ * const result = await admin.extraction.results.update('result-uuid', {
14775
+ * review_status: 'approved',
14776
+ * });
14777
+ * ```
14778
+ */
14233
14779
  update: async (id, attributes, options) => {
14234
14780
  return rb.execute(
14235
14781
  patchAdminExtractionResultsById,
@@ -14242,7 +14788,18 @@ function createExtractionNamespace(rb) {
14242
14788
  options
14243
14789
  );
14244
14790
  },
14245
- /** Delete an extraction result. */
14791
+ /**
14792
+ * Permanently deletes an extraction result.
14793
+ *
14794
+ * @param id - The UUID of the extraction result to delete.
14795
+ * @param options - Optional request options (abort signal, custom headers).
14796
+ * @returns `true` when the deletion succeeds.
14797
+ *
14798
+ * @example
14799
+ * ```typescript
14800
+ * await admin.extraction.results.delete('result-uuid');
14801
+ * ```
14802
+ */
14246
14803
  delete: async (id, options) => {
14247
14804
  return rb.executeDelete(
14248
14805
  deleteAdminExtractionResultsById,
@@ -14250,7 +14807,18 @@ function createExtractionNamespace(rb) {
14250
14807
  options
14251
14808
  );
14252
14809
  },
14253
- /** Get extraction results for a specific document. */
14810
+ /**
14811
+ * Retrieves all extraction results for a specific document.
14812
+ *
14813
+ * @param documentId - The UUID of the parent document.
14814
+ * @param options - Optional request options (abort signal, custom headers).
14815
+ * @returns An array of extraction results for the document.
14816
+ *
14817
+ * @example
14818
+ * ```typescript
14819
+ * const results = await admin.extraction.results.byDocument('doc-uuid');
14820
+ * ```
14821
+ */
14254
14822
  byDocument: async (documentId, options) => {
14255
14823
  return rb.execute(
14256
14824
  getAdminExtractionResultsDocumentByDocumentId,
@@ -14258,7 +14826,20 @@ function createExtractionNamespace(rb) {
14258
14826
  options
14259
14827
  );
14260
14828
  },
14261
- /** Get extraction result version history for a document. */
14829
+ /**
14830
+ * Retrieves the version history of extraction results for a document,
14831
+ * showing how results have changed over reprocessing cycles.
14832
+ *
14833
+ * @param documentId - The UUID of the parent document.
14834
+ * @param options - Optional request options (abort signal, custom headers).
14835
+ * @returns An array of historical extraction result versions.
14836
+ *
14837
+ * @example
14838
+ * ```typescript
14839
+ * const history = await admin.extraction.results.history('doc-uuid');
14840
+ * console.log(`${history.length} result versions`);
14841
+ * ```
14842
+ */
14262
14843
  history: async (documentId, options) => {
14263
14844
  return rb.execute(
14264
14845
  getAdminExtractionResultsDocumentByDocumentIdHistory,
@@ -14266,7 +14847,19 @@ function createExtractionNamespace(rb) {
14266
14847
  options
14267
14848
  );
14268
14849
  },
14269
- /** Get partial extraction results for a document (in-progress). */
14850
+ /**
14851
+ * Retrieves partial (in-progress) extraction results for a document that
14852
+ * is still being processed.
14853
+ *
14854
+ * @param documentId - The UUID of the parent document.
14855
+ * @param options - Optional request options (abort signal, custom headers).
14856
+ * @returns An array of partial extraction results available so far.
14857
+ *
14858
+ * @example
14859
+ * ```typescript
14860
+ * const partial = await admin.extraction.results.partial('doc-uuid');
14861
+ * ```
14862
+ */
14270
14863
  partial: async (documentId, options) => {
14271
14864
  return rb.execute(
14272
14865
  getAdminExtractionResultsDocumentByDocumentIdPartial,
@@ -14274,7 +14867,23 @@ function createExtractionNamespace(rb) {
14274
14867
  options
14275
14868
  );
14276
14869
  },
14277
- /** Regenerate an extraction result with optional feedback. */
14870
+ /**
14871
+ * Regenerates an extraction result, optionally incorporating human
14872
+ * feedback or restricting which fields to retry.
14873
+ *
14874
+ * @param id - The UUID of the extraction result to regenerate.
14875
+ * @param attributes - Regeneration parameters (feedback, fields to retry).
14876
+ * @param options - Optional request options (abort signal, custom headers).
14877
+ * @returns The regenerated extraction result object.
14878
+ *
14879
+ * @example
14880
+ * ```typescript
14881
+ * const result = await admin.extraction.results.regenerate('result-uuid', {
14882
+ * feedback: 'The date field was parsed incorrectly.',
14883
+ * fields_to_retry: ['invoice_date', 'due_date'],
14884
+ * });
14885
+ * ```
14886
+ */
14278
14887
  regenerate: async (id, attributes, options) => {
14279
14888
  return rb.execute(
14280
14889
  patchAdminExtractionResultsByIdRegenerate,
@@ -14287,7 +14896,25 @@ function createExtractionNamespace(rb) {
14287
14896
  options
14288
14897
  );
14289
14898
  },
14290
- /** Save manual corrections to an extraction result. */
14899
+ /**
14900
+ * Saves manual corrections to an extraction result. The corrections are
14901
+ * stored alongside the original data and can be used for model training.
14902
+ *
14903
+ * @param id - The UUID of the extraction result to correct.
14904
+ * @param attributes - The corrections to save.
14905
+ * @param options - Optional request options (abort signal, custom headers).
14906
+ * @returns The updated extraction result object with corrections applied.
14907
+ *
14908
+ * @example
14909
+ * ```typescript
14910
+ * const result = await admin.extraction.results.saveCorrections('result-uuid', {
14911
+ * corrections: [
14912
+ * { field: 'invoice_number', value: 'INV-2026-001' },
14913
+ * { field: 'total_amount', value: 1250.00 },
14914
+ * ],
14915
+ * });
14916
+ * ```
14917
+ */
14291
14918
  saveCorrections: async (id, attributes, options) => {
14292
14919
  return rb.execute(
14293
14920
  patchAdminExtractionResultsByIdSaveCorrections,
@@ -14300,7 +14927,18 @@ function createExtractionNamespace(rb) {
14300
14927
  options
14301
14928
  );
14302
14929
  },
14303
- /** List extraction results for a workspace. */
14930
+ /**
14931
+ * Lists all extraction results belonging to a specific workspace.
14932
+ *
14933
+ * @param workspaceId - The UUID of the workspace.
14934
+ * @param options - Optional request options (abort signal, custom headers).
14935
+ * @returns An array of extraction results for the workspace.
14936
+ *
14937
+ * @example
14938
+ * ```typescript
14939
+ * const results = await admin.extraction.results.listByWorkspace('ws-uuid');
14940
+ * ```
14941
+ */
14304
14942
  listByWorkspace: async (workspaceId, options) => {
14305
14943
  return rb.execute(
14306
14944
  getAdminExtractionResultsWorkspaceByWorkspaceId,
@@ -14311,7 +14949,19 @@ function createExtractionNamespace(rb) {
14311
14949
  },
14312
14950
  /** Batch upload management — create batches, get upload URLs. */
14313
14951
  batches: {
14314
- /** Get a batch by ID. */
14952
+ /**
14953
+ * Retrieves a single extraction batch by its unique identifier.
14954
+ *
14955
+ * @param id - The UUID of the batch.
14956
+ * @param options - Optional request options (abort signal, custom headers).
14957
+ * @returns The matching extraction batch object.
14958
+ *
14959
+ * @example
14960
+ * ```typescript
14961
+ * const batch = await admin.extraction.batches.get('batch-uuid');
14962
+ * console.log(`Batch: ${batch.name}, ${batch.document_count} docs`);
14963
+ * ```
14964
+ */
14315
14965
  get: async (id, options) => {
14316
14966
  return rb.execute(
14317
14967
  getAdminExtractionBatchesById,
@@ -14319,7 +14969,18 @@ function createExtractionNamespace(rb) {
14319
14969
  options
14320
14970
  );
14321
14971
  },
14322
- /** Delete a batch. */
14972
+ /**
14973
+ * Permanently deletes an extraction batch.
14974
+ *
14975
+ * @param id - The UUID of the batch to delete.
14976
+ * @param options - Optional request options (abort signal, custom headers).
14977
+ * @returns `true` when the deletion succeeds.
14978
+ *
14979
+ * @example
14980
+ * ```typescript
14981
+ * await admin.extraction.batches.delete('batch-uuid');
14982
+ * ```
14983
+ */
14323
14984
  delete: async (id, options) => {
14324
14985
  return rb.executeDelete(
14325
14986
  deleteAdminExtractionBatchesById,
@@ -14327,7 +14988,22 @@ function createExtractionNamespace(rb) {
14327
14988
  options
14328
14989
  );
14329
14990
  },
14330
- /** Create a new batch. */
14991
+ /**
14992
+ * Creates a new extraction batch for grouping document uploads.
14993
+ *
14994
+ * @param attributes - Batch creation attributes including workspace ID.
14995
+ * @param options - Optional request options (abort signal, custom headers).
14996
+ * @returns The newly created extraction batch object.
14997
+ *
14998
+ * @example
14999
+ * ```typescript
15000
+ * const batch = await admin.extraction.batches.create({
15001
+ * name: 'Q1 Invoices',
15002
+ * workspace_id: 'ws-uuid',
15003
+ * agent_id: 'agent-uuid',
15004
+ * });
15005
+ * ```
15006
+ */
14331
15007
  create: async (attributes, options) => {
14332
15008
  return rb.execute(
14333
15009
  postAdminExtractionBatches,
@@ -14339,7 +15015,18 @@ function createExtractionNamespace(rb) {
14339
15015
  options
14340
15016
  );
14341
15017
  },
14342
- /** List batches for a workspace. */
15018
+ /**
15019
+ * Lists all extraction batches belonging to a specific workspace.
15020
+ *
15021
+ * @param workspaceId - The UUID of the workspace.
15022
+ * @param options - Optional request options (abort signal, custom headers).
15023
+ * @returns An array of extraction batches for the workspace.
15024
+ *
15025
+ * @example
15026
+ * ```typescript
15027
+ * const batches = await admin.extraction.batches.listByWorkspace('ws-uuid');
15028
+ * ```
15029
+ */
14343
15030
  listByWorkspace: async (workspaceId, options) => {
14344
15031
  return rb.execute(
14345
15032
  getAdminExtractionBatchesWorkspaceByWorkspaceId,
@@ -14347,7 +15034,24 @@ function createExtractionNamespace(rb) {
14347
15034
  options
14348
15035
  );
14349
15036
  },
14350
- /** Get presigned upload URLs for a batch. */
15037
+ /**
15038
+ * Retrieves presigned upload URLs for all documents in a batch, enabling
15039
+ * parallel direct-to-storage uploads.
15040
+ *
15041
+ * @param id - The UUID of the batch.
15042
+ * @param options - Optional request options (abort signal, custom headers).
15043
+ * @returns An array of presigned URL objects, one per document slot.
15044
+ *
15045
+ * @example
15046
+ * ```typescript
15047
+ * const urls = await admin.extraction.batches.getUploadUrls('batch-uuid');
15048
+ * // Upload files in parallel to each presigned URL
15049
+ * await Promise.all(urls.map((u, i) => fetch(u.upload_url, {
15050
+ * method: 'PUT',
15051
+ * body: files[i],
15052
+ * })));
15053
+ * ```
15054
+ */
14351
15055
  getUploadUrls: async (id, options) => {
14352
15056
  return rb.execute(
14353
15057
  getAdminExtractionBatchesByIdUploadUrls,
@@ -14358,7 +15062,18 @@ function createExtractionNamespace(rb) {
14358
15062
  },
14359
15063
  /** Export management — create and retrieve data exports. */
14360
15064
  exports: {
14361
- /** List exports for a workspace. */
15065
+ /**
15066
+ * Lists all extraction exports for a workspace.
15067
+ *
15068
+ * @param workspaceId - The UUID of the workspace.
15069
+ * @param options - Optional request options (abort signal, custom headers).
15070
+ * @returns An array of extraction export objects.
15071
+ *
15072
+ * @example
15073
+ * ```typescript
15074
+ * const exports = await admin.extraction.exports.list('ws-uuid');
15075
+ * ```
15076
+ */
14362
15077
  list: async (workspaceId, options) => {
14363
15078
  return rb.execute(
14364
15079
  getAdminWorkspacesByWorkspaceIdExtractionExports,
@@ -14366,7 +15081,23 @@ function createExtractionNamespace(rb) {
14366
15081
  options
14367
15082
  );
14368
15083
  },
14369
- /** Create a new export for a workspace. */
15084
+ /**
15085
+ * Creates a new data export for a workspace in the specified format.
15086
+ *
15087
+ * @param workspaceId - The UUID of the workspace.
15088
+ * @param attributes - Export creation attributes including format.
15089
+ * @param options - Optional request options (abort signal, custom headers).
15090
+ * @returns The newly created extraction export object.
15091
+ *
15092
+ * @example
15093
+ * ```typescript
15094
+ * const exp = await admin.extraction.exports.create('ws-uuid', {
15095
+ * format: 'csv',
15096
+ * agent_id: 'agent-uuid',
15097
+ * });
15098
+ * console.log(`Export ${exp.id} created, status: ${exp.status}`);
15099
+ * ```
15100
+ */
14370
15101
  create: async (workspaceId, attributes, options) => {
14371
15102
  return rb.execute(
14372
15103
  postAdminWorkspacesByWorkspaceIdExtractionExports,
@@ -14379,7 +15110,23 @@ function createExtractionNamespace(rb) {
14379
15110
  options
14380
15111
  );
14381
15112
  },
14382
- /** Get an export by ID. */
15113
+ /**
15114
+ * Retrieves a single extraction export by ID within a workspace.
15115
+ *
15116
+ * @param workspaceId - The UUID of the workspace.
15117
+ * @param id - The UUID of the export to retrieve.
15118
+ * @param options - Optional request options (abort signal, custom headers).
15119
+ * @returns The matching extraction export object, including download URL
15120
+ * when the export is complete.
15121
+ *
15122
+ * @example
15123
+ * ```typescript
15124
+ * const exp = await admin.extraction.exports.get('ws-uuid', 'export-uuid');
15125
+ * if (exp.status === 'completed') {
15126
+ * console.log(`Download: ${exp.download_url}`);
15127
+ * }
15128
+ * ```
15129
+ */
14383
15130
  get: async (workspaceId, id, options) => {
14384
15131
  return rb.execute(
14385
15132
  getAdminWorkspacesByWorkspaceIdExtractionExportsById,
@@ -14390,7 +15137,17 @@ function createExtractionNamespace(rb) {
14390
15137
  },
14391
15138
  /** Workflow management — configurable extraction pipelines. */
14392
15139
  workflows: {
14393
- /** List all extraction workflows. */
15140
+ /**
15141
+ * Lists all extraction workflows across the platform.
15142
+ *
15143
+ * @param options - Optional request options (abort signal, custom headers).
15144
+ * @returns An array of extraction workflow objects.
15145
+ *
15146
+ * @example
15147
+ * ```typescript
15148
+ * const workflows = await admin.extraction.workflows.list();
15149
+ * ```
15150
+ */
14394
15151
  list: async (options) => {
14395
15152
  return rb.execute(
14396
15153
  getAdminExtractionWorkflows,
@@ -14398,7 +15155,21 @@ function createExtractionNamespace(rb) {
14398
15155
  options
14399
15156
  );
14400
15157
  },
14401
- /** Create a new extraction workflow. */
15158
+ /**
15159
+ * Creates a new extraction workflow with the specified configuration.
15160
+ *
15161
+ * @param attributes - Workflow creation attributes including name.
15162
+ * @param options - Optional request options (abort signal, custom headers).
15163
+ * @returns The newly created extraction workflow object.
15164
+ *
15165
+ * @example
15166
+ * ```typescript
15167
+ * const workflow = await admin.extraction.workflows.create({
15168
+ * name: 'Invoice Processing',
15169
+ * workspace_id: 'ws-uuid',
15170
+ * });
15171
+ * ```
15172
+ */
14402
15173
  create: async (attributes, options) => {
14403
15174
  return rb.execute(
14404
15175
  postAdminExtractionWorkflows,
@@ -14410,7 +15181,18 @@ function createExtractionNamespace(rb) {
14410
15181
  options
14411
15182
  );
14412
15183
  },
14413
- /** Get a workflow by ID. */
15184
+ /**
15185
+ * Retrieves a single extraction workflow by its unique identifier.
15186
+ *
15187
+ * @param id - The UUID of the workflow.
15188
+ * @param options - Optional request options (abort signal, custom headers).
15189
+ * @returns The matching extraction workflow object.
15190
+ *
15191
+ * @example
15192
+ * ```typescript
15193
+ * const workflow = await admin.extraction.workflows.get('workflow-uuid');
15194
+ * ```
15195
+ */
14414
15196
  get: async (id, options) => {
14415
15197
  return rb.execute(
14416
15198
  getAdminExtractionWorkflowsById,
@@ -14418,7 +15200,21 @@ function createExtractionNamespace(rb) {
14418
15200
  options
14419
15201
  );
14420
15202
  },
14421
- /** Update a workflow. */
15203
+ /**
15204
+ * Updates an existing extraction workflow's configuration.
15205
+ *
15206
+ * @param id - The UUID of the workflow to update.
15207
+ * @param attributes - The attributes to update.
15208
+ * @param options - Optional request options (abort signal, custom headers).
15209
+ * @returns The updated extraction workflow object.
15210
+ *
15211
+ * @example
15212
+ * ```typescript
15213
+ * const workflow = await admin.extraction.workflows.update('workflow-uuid', {
15214
+ * name: 'Updated Invoice Pipeline',
15215
+ * });
15216
+ * ```
15217
+ */
14422
15218
  update: async (id, attributes, options) => {
14423
15219
  return rb.execute(
14424
15220
  patchAdminExtractionWorkflowsById,
@@ -14431,7 +15227,18 @@ function createExtractionNamespace(rb) {
14431
15227
  options
14432
15228
  );
14433
15229
  },
14434
- /** Delete a workflow. */
15230
+ /**
15231
+ * Permanently deletes an extraction workflow.
15232
+ *
15233
+ * @param id - The UUID of the workflow to delete.
15234
+ * @param options - Optional request options (abort signal, custom headers).
15235
+ * @returns `true` when the deletion succeeds.
15236
+ *
15237
+ * @example
15238
+ * ```typescript
15239
+ * await admin.extraction.workflows.delete('workflow-uuid');
15240
+ * ```
15241
+ */
14435
15242
  delete: async (id, options) => {
14436
15243
  return rb.executeDelete(
14437
15244
  deleteAdminExtractionWorkflowsById,
@@ -14442,7 +15249,18 @@ function createExtractionNamespace(rb) {
14442
15249
  },
14443
15250
  /** Config enum management — dropdown and validation values. */
14444
15251
  configEnums: {
14445
- /** List all config enums. */
15252
+ /**
15253
+ * Lists all config enums used for extraction field validation and
15254
+ * dropdown options.
15255
+ *
15256
+ * @param options - Optional request options (abort signal, custom headers).
15257
+ * @returns An array of config enum objects.
15258
+ *
15259
+ * @example
15260
+ * ```typescript
15261
+ * const enums = await admin.extraction.configEnums.list();
15262
+ * ```
15263
+ */
14446
15264
  list: async (options) => {
14447
15265
  return rb.execute(
14448
15266
  getAdminExtractionConfigEnums,
@@ -14450,7 +15268,23 @@ function createExtractionNamespace(rb) {
14450
15268
  options
14451
15269
  );
14452
15270
  },
14453
- /** Create a new config enum. */
15271
+ /**
15272
+ * Creates a new config enum value for use in extraction field dropdowns
15273
+ * and validation.
15274
+ *
15275
+ * @param attributes - Config enum creation attributes.
15276
+ * @param options - Optional request options (abort signal, custom headers).
15277
+ * @returns The newly created config enum object.
15278
+ *
15279
+ * @example
15280
+ * ```typescript
15281
+ * const enumVal = await admin.extraction.configEnums.create({
15282
+ * type: 'document_category',
15283
+ * value: 'invoice',
15284
+ * label: 'Invoice',
15285
+ * });
15286
+ * ```
15287
+ */
14454
15288
  create: async (attributes, options) => {
14455
15289
  return rb.execute(
14456
15290
  postAdminExtractionConfigEnums,
@@ -14462,7 +15296,18 @@ function createExtractionNamespace(rb) {
14462
15296
  options
14463
15297
  );
14464
15298
  },
14465
- /** Get a config enum by ID. */
15299
+ /**
15300
+ * Retrieves a single config enum by its unique identifier.
15301
+ *
15302
+ * @param id - The UUID of the config enum.
15303
+ * @param options - Optional request options (abort signal, custom headers).
15304
+ * @returns The matching config enum object.
15305
+ *
15306
+ * @example
15307
+ * ```typescript
15308
+ * const enumVal = await admin.extraction.configEnums.get('enum-uuid');
15309
+ * ```
15310
+ */
14466
15311
  get: async (id, options) => {
14467
15312
  return rb.execute(
14468
15313
  getAdminExtractionConfigEnumsById,
@@ -14470,7 +15315,21 @@ function createExtractionNamespace(rb) {
14470
15315
  options
14471
15316
  );
14472
15317
  },
14473
- /** Update a config enum. */
15318
+ /**
15319
+ * Updates an existing config enum's label or other mutable attributes.
15320
+ *
15321
+ * @param id - The UUID of the config enum to update.
15322
+ * @param attributes - The attributes to update.
15323
+ * @param options - Optional request options (abort signal, custom headers).
15324
+ * @returns The updated config enum object.
15325
+ *
15326
+ * @example
15327
+ * ```typescript
15328
+ * const enumVal = await admin.extraction.configEnums.update('enum-uuid', {
15329
+ * label: 'Updated Label',
15330
+ * });
15331
+ * ```
15332
+ */
14474
15333
  update: async (id, attributes, options) => {
14475
15334
  return rb.execute(
14476
15335
  patchAdminExtractionConfigEnumsById,
@@ -14486,132 +15345,530 @@ function createExtractionNamespace(rb) {
14486
15345
  },
14487
15346
  /** Schema discovery — AI-powered field schema detection. */
14488
15347
  schemaDiscoveries: {
14489
- /** Run schema discovery on documents. */
15348
+ /**
15349
+ * Runs schema discovery on documents to automatically detect extraction
15350
+ * field schemas using AI.
15351
+ *
15352
+ * @param attributes - Schema discovery attributes (document or workspace scope).
15353
+ * @param options - Optional request options (abort signal, custom headers).
15354
+ * @returns The created schema discovery object with detected fields.
15355
+ *
15356
+ * @example
15357
+ * ```typescript
15358
+ * const discovery = await admin.extraction.schemaDiscoveries.create({
15359
+ * document_id: 'doc-uuid',
15360
+ * workspace_id: 'ws-uuid',
15361
+ * });
15362
+ * console.log(discovery.suggested_fields);
15363
+ * ```
15364
+ */
15365
+ create: async (attributes, options) => {
15366
+ return rb.execute(
15367
+ postAdminExtractionSchemaDiscoveries,
15368
+ {
15369
+ body: {
15370
+ data: { type: "schema-discovery", attributes }
15371
+ }
15372
+ },
15373
+ options
15374
+ );
15375
+ },
15376
+ /**
15377
+ * Retrieves a schema discovery result by its unique identifier.
15378
+ *
15379
+ * @param id - The UUID of the schema discovery.
15380
+ * @param options - Optional request options (abort signal, custom headers).
15381
+ * @returns The matching schema discovery object.
15382
+ *
15383
+ * @example
15384
+ * ```typescript
15385
+ * const discovery = await admin.extraction.schemaDiscoveries.get('discovery-uuid');
15386
+ * ```
15387
+ */
15388
+ get: async (id, options) => {
15389
+ return rb.execute(
15390
+ getAdminExtractionSchemaDiscoveriesById,
15391
+ { path: { id } },
15392
+ options
15393
+ );
15394
+ },
15395
+ /**
15396
+ * Bootstraps schema discovery for a workspace, analyzing existing
15397
+ * documents to suggest an initial extraction schema.
15398
+ *
15399
+ * @param attributes - Bootstrap attributes (workspace scope).
15400
+ * @param options - Optional request options (abort signal, custom headers).
15401
+ * @returns The bootstrapped schema discovery object.
15402
+ *
15403
+ * @example
15404
+ * ```typescript
15405
+ * const discovery = await admin.extraction.schemaDiscoveries.bootstrap({
15406
+ * workspace_id: 'ws-uuid',
15407
+ * });
15408
+ * ```
15409
+ */
15410
+ bootstrap: async (attributes, options) => {
15411
+ return rb.execute(
15412
+ postAdminExtractionSchemaDiscoveriesBootstrap,
15413
+ {
15414
+ body: {
15415
+ data: { type: "schema-discovery", attributes }
15416
+ }
15417
+ },
15418
+ options
15419
+ );
15420
+ }
15421
+ },
15422
+ /** Field mapping — document-to-schema field alignment. */
15423
+ fieldMappings: {
15424
+ /**
15425
+ * Retrieves the current field mapping for a document within a workspace,
15426
+ * showing how extracted fields align with the schema.
15427
+ *
15428
+ * @param workspaceId - The UUID of the workspace.
15429
+ * @param documentId - The UUID of the document.
15430
+ * @param options - Optional request options (abort signal, custom headers).
15431
+ * @returns The field mapping result for the document.
15432
+ *
15433
+ * @example
15434
+ * ```typescript
15435
+ * const mapping = await admin.extraction.fieldMappings.get('ws-uuid', 'doc-uuid');
15436
+ * console.log(mapping.mappings);
15437
+ * ```
15438
+ */
15439
+ get: async (workspaceId, documentId, options) => {
15440
+ return rb.execute(
15441
+ getAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
15442
+ { path: { workspace_id: workspaceId, document_id: documentId } },
15443
+ options
15444
+ );
15445
+ },
15446
+ /**
15447
+ * Creates or updates the field mapping for a document, confirming how
15448
+ * extracted fields should map to schema fields.
15449
+ *
15450
+ * @param workspaceId - The UUID of the workspace.
15451
+ * @param documentId - The UUID of the document.
15452
+ * @param attributes - The mapping attributes including confirmation and mappings.
15453
+ * @param options - Optional request options (abort signal, custom headers).
15454
+ * @returns The created or updated field mapping result.
15455
+ *
15456
+ * @example
15457
+ * ```typescript
15458
+ * const mapping = await admin.extraction.fieldMappings.create(
15459
+ * 'ws-uuid',
15460
+ * 'doc-uuid',
15461
+ * {
15462
+ * confirmed: true,
15463
+ * mappings: [
15464
+ * { source: 'inv_num', target: 'invoice_number' },
15465
+ * { source: 'amt', target: 'total_amount' },
15466
+ * ],
15467
+ * },
15468
+ * );
15469
+ * ```
15470
+ */
15471
+ create: async (workspaceId, documentId, attributes, options) => {
15472
+ return rb.execute(
15473
+ postAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
15474
+ {
15475
+ path: { workspace_id: workspaceId, document_id: documentId },
15476
+ body: {
15477
+ data: { type: "field-mapping-result", attributes }
15478
+ }
15479
+ },
15480
+ options
15481
+ );
15482
+ }
15483
+ },
15484
+ /** Shadow comparison results — primary vs shadow extractor quality metrics. */
15485
+ shadowComparisons: {
15486
+ /**
15487
+ * Lists all shadow comparison records across the platform.
15488
+ *
15489
+ * @param options - Optional request options (abort signal, custom headers).
15490
+ * @returns An array of shadow comparison objects.
15491
+ *
15492
+ * @example
15493
+ * ```typescript
15494
+ * const comparisons = await admin.extraction.shadowComparisons.list();
15495
+ * ```
15496
+ */
15497
+ list: async (options) => {
15498
+ return rb.execute(
15499
+ getAdminExtractionShadowComparisons,
15500
+ {},
15501
+ options
15502
+ );
15503
+ },
15504
+ /**
15505
+ * Retrieves a single shadow comparison by its unique identifier.
15506
+ *
15507
+ * @param id - The UUID of the shadow comparison.
15508
+ * @param options - Optional request options (abort signal, custom headers).
15509
+ * @returns The matching shadow comparison object.
15510
+ *
15511
+ * @example
15512
+ * ```typescript
15513
+ * const comparison = await admin.extraction.shadowComparisons.get('comparison-uuid');
15514
+ * ```
15515
+ */
15516
+ get: async (id, options) => {
15517
+ return rb.execute(
15518
+ getAdminExtractionShadowComparisonsById,
15519
+ { path: { id } },
15520
+ options
15521
+ );
15522
+ },
15523
+ /**
15524
+ * Creates a new shadow comparison record to compare the output of the
15525
+ * primary extractor against a shadow extractor for quality evaluation.
15526
+ *
15527
+ * @param attributes - Shadow comparison creation attributes.
15528
+ * @param options - Optional request options (abort signal, custom headers).
15529
+ * @returns The newly created shadow comparison object.
15530
+ *
15531
+ * @example
15532
+ * ```typescript
15533
+ * const comparison = await admin.extraction.shadowComparisons.create({
15534
+ * document_id: 'doc-uuid',
15535
+ * workspace_id: 'ws-uuid',
15536
+ * });
15537
+ * ```
15538
+ */
14490
15539
  create: async (attributes, options) => {
14491
15540
  return rb.execute(
14492
- postAdminExtractionSchemaDiscoveries,
15541
+ postAdminExtractionShadowComparisons,
14493
15542
  {
14494
15543
  body: {
14495
- data: { type: "schema-discovery", attributes }
15544
+ data: { type: "shadow-comparison", attributes }
14496
15545
  }
14497
15546
  },
14498
15547
  options
14499
15548
  );
14500
15549
  },
14501
- /** Get a schema discovery result by ID. */
14502
- get: async (id, options) => {
14503
- return rb.execute(
14504
- getAdminExtractionSchemaDiscoveriesById,
15550
+ /**
15551
+ * Permanently deletes a shadow comparison record.
15552
+ *
15553
+ * @param id - The UUID of the shadow comparison to delete.
15554
+ * @param options - Optional request options (abort signal, custom headers).
15555
+ * @returns `true` when the deletion succeeds.
15556
+ *
15557
+ * @example
15558
+ * ```typescript
15559
+ * await admin.extraction.shadowComparisons.delete('comparison-uuid');
15560
+ * ```
15561
+ */
15562
+ delete: async (id, options) => {
15563
+ return rb.executeDelete(
15564
+ deleteAdminExtractionShadowComparisonsById,
14505
15565
  { path: { id } },
14506
15566
  options
14507
15567
  );
14508
15568
  },
14509
- /** Bootstrap schema discovery for a workspace. */
14510
- bootstrap: async (attributes, options) => {
15569
+ /**
15570
+ * Retrieves the aggregated analysis report comparing primary vs shadow
15571
+ * extractor performance across all shadow comparison records.
15572
+ *
15573
+ * @param options - Optional request options (abort signal, custom headers).
15574
+ * @returns An array of shadow comparison analysis results.
15575
+ *
15576
+ * @example
15577
+ * ```typescript
15578
+ * const analysis = await admin.extraction.shadowComparisons.analysis();
15579
+ * ```
15580
+ */
15581
+ analysis: async (options) => {
14511
15582
  return rb.execute(
14512
- postAdminExtractionSchemaDiscoveriesBootstrap,
14513
- {
14514
- body: {
14515
- data: { type: "schema-discovery", attributes }
14516
- }
14517
- },
15583
+ getAdminExtractionShadowComparisonsAnalysis,
15584
+ {},
14518
15585
  options
14519
15586
  );
14520
15587
  }
14521
15588
  },
14522
- /** Field mappingdocument-to-schema field alignment. */
14523
- fieldMappings: {
14524
- /** Get field mapping for a document. */
14525
- get: async (workspaceId, documentId, options) => {
15589
+ /** Content analysis results PII detection, OCR quality, entity extraction. */
15590
+ analyses: {
15591
+ /**
15592
+ * Lists all extraction analysis records across the platform, including
15593
+ * PII detection results and OCR quality metrics.
15594
+ *
15595
+ * @param options - Optional request options (abort signal, custom headers).
15596
+ * @returns An array of extraction analysis objects.
15597
+ *
15598
+ * @example
15599
+ * ```typescript
15600
+ * const analyses = await admin.extraction.analyses.list();
15601
+ * ```
15602
+ */
15603
+ list: async (options) => {
14526
15604
  return rb.execute(
14527
- getAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
14528
- { path: { workspace_id: workspaceId, document_id: documentId } },
15605
+ getAdminExtractionAnalyses,
15606
+ {},
14529
15607
  options
14530
15608
  );
14531
15609
  },
14532
- /** Create or update field mapping for a document. */
14533
- create: async (workspaceId, documentId, attributes, options) => {
15610
+ /**
15611
+ * Retrieves a single extraction analysis by its unique identifier.
15612
+ *
15613
+ * @param id - The UUID of the extraction analysis.
15614
+ * @param options - Optional request options (abort signal, custom headers).
15615
+ * @returns The matching extraction analysis object.
15616
+ *
15617
+ * @example
15618
+ * ```typescript
15619
+ * const analysis = await admin.extraction.analyses.get('analysis-uuid');
15620
+ * console.log(analysis.pii_detected, analysis.ocr_confidence);
15621
+ * ```
15622
+ */
15623
+ get: async (id, options) => {
14534
15624
  return rb.execute(
14535
- postAdminWorkspacesByWorkspaceIdExtractionByDocumentIdMapping,
14536
- {
14537
- path: { workspace_id: workspaceId, document_id: documentId },
14538
- body: {
14539
- data: { type: "field-mapping-result", attributes }
14540
- }
14541
- },
15625
+ getAdminExtractionAnalysesById,
15626
+ { path: { id } },
14542
15627
  options
14543
15628
  );
14544
15629
  }
14545
15630
  },
14546
- /** Shadow comparison results primary vs shadow extractor quality metrics. */
14547
- shadowComparisons: {
14548
- /** List all shadow comparisons. */
15631
+ /** Post-processing hooksconfigurable hooks that execute after extraction. */
15632
+ postProcessingHooks: {
15633
+ /**
15634
+ * Lists all post-processing hooks across the platform.
15635
+ *
15636
+ * @param options - Optional request options (abort signal, custom headers).
15637
+ * @returns An array of post-processing hook objects.
15638
+ *
15639
+ * @example
15640
+ * ```typescript
15641
+ * const hooks = await admin.extraction.postProcessingHooks.list();
15642
+ * ```
15643
+ */
14549
15644
  list: async (options) => {
14550
15645
  return rb.execute(
14551
- getAdminExtractionShadowComparisons,
15646
+ getAdminPostProcessingHooks,
14552
15647
  {},
14553
15648
  options
14554
15649
  );
14555
15650
  },
14556
- /** Get a shadow comparison by ID. */
15651
+ /**
15652
+ * Retrieves a single post-processing hook by its unique identifier.
15653
+ *
15654
+ * @param id - The UUID of the hook.
15655
+ * @param options - Optional request options (abort signal, custom headers).
15656
+ * @returns The matching post-processing hook object.
15657
+ *
15658
+ * @example
15659
+ * ```typescript
15660
+ * const hook = await admin.extraction.postProcessingHooks.get('hook-uuid');
15661
+ * ```
15662
+ */
14557
15663
  get: async (id, options) => {
14558
15664
  return rb.execute(
14559
- getAdminExtractionShadowComparisonsById,
15665
+ getAdminPostProcessingHooksById,
14560
15666
  { path: { id } },
14561
15667
  options
14562
15668
  );
14563
15669
  },
14564
- /** Create a new shadow comparison record. */
15670
+ /**
15671
+ * Creates a new post-processing hook for the extraction pipeline.
15672
+ *
15673
+ * @param attributes - Hook creation attributes including name, trigger, and type.
15674
+ * @param options - Optional request options (abort signal, custom headers).
15675
+ * @returns The newly created post-processing hook object.
15676
+ *
15677
+ * @example
15678
+ * ```typescript
15679
+ * const hook = await admin.extraction.postProcessingHooks.create({
15680
+ * name: 'Notify on extraction',
15681
+ * trigger: 'after_extraction',
15682
+ * type: 'webhook',
15683
+ * config: { url: 'https://example.com/hook' },
15684
+ * workspace_id: 'ws-uuid',
15685
+ * });
15686
+ * ```
15687
+ */
14565
15688
  create: async (attributes, options) => {
14566
15689
  return rb.execute(
14567
- postAdminExtractionShadowComparisons,
15690
+ postAdminPostProcessingHooks,
14568
15691
  {
14569
15692
  body: {
14570
- data: { type: "shadow-comparison", attributes }
15693
+ data: { type: "post-processing-hook", attributes }
15694
+ }
15695
+ },
15696
+ options
15697
+ );
15698
+ },
15699
+ /**
15700
+ * Updates an existing post-processing hook's configuration.
15701
+ *
15702
+ * @param id - The UUID of the hook to update.
15703
+ * @param attributes - The attributes to update.
15704
+ * @param options - Optional request options (abort signal, custom headers).
15705
+ * @returns The updated post-processing hook object.
15706
+ *
15707
+ * @example
15708
+ * ```typescript
15709
+ * const hook = await admin.extraction.postProcessingHooks.update('hook-uuid', {
15710
+ * enabled: false,
15711
+ * });
15712
+ * ```
15713
+ */
15714
+ update: async (id, attributes, options) => {
15715
+ return rb.execute(
15716
+ patchAdminPostProcessingHooksById,
15717
+ {
15718
+ path: { id },
15719
+ body: {
15720
+ data: { id, type: "post-processing-hook", attributes }
14571
15721
  }
14572
15722
  },
14573
15723
  options
14574
15724
  );
14575
15725
  },
14576
- /** Delete a shadow comparison. */
15726
+ /**
15727
+ * Permanently deletes a post-processing hook.
15728
+ *
15729
+ * @param id - The UUID of the hook to delete.
15730
+ * @param options - Optional request options (abort signal, custom headers).
15731
+ * @returns `true` when the deletion succeeds.
15732
+ *
15733
+ * @example
15734
+ * ```typescript
15735
+ * await admin.extraction.postProcessingHooks.delete('hook-uuid');
15736
+ * ```
15737
+ */
14577
15738
  delete: async (id, options) => {
14578
15739
  return rb.executeDelete(
14579
- deleteAdminExtractionShadowComparisonsById,
15740
+ deleteAdminPostProcessingHooksById,
14580
15741
  { path: { id } },
14581
15742
  options
14582
15743
  );
15744
+ }
15745
+ },
15746
+ /** Training analytics — workspace-level extraction training metrics. */
15747
+ trainingAnalytics: {
15748
+ /**
15749
+ * Retrieves training analytics for a specific workspace, including
15750
+ * accuracy trends, correction counts, and low-confidence documents.
15751
+ *
15752
+ * @param workspaceId - The UUID of the workspace.
15753
+ * @param options - Optional request options (abort signal, custom headers).
15754
+ * @returns The training analytics object for the workspace.
15755
+ *
15756
+ * @example
15757
+ * ```typescript
15758
+ * const analytics = await admin.extraction.trainingAnalytics.forWorkspace('ws-uuid');
15759
+ * console.log(analytics.avg_confidence, analytics.total_examples);
15760
+ * ```
15761
+ */
15762
+ forWorkspace: async (workspaceId, options) => {
15763
+ return rb.execute(
15764
+ getAdminWorkspacesByWorkspaceIdTrainingAnalytics,
15765
+ { path: { workspace_id: workspaceId } },
15766
+ options
15767
+ );
14583
15768
  },
14584
- /** Get the analysis report for shadow comparisons. */
14585
- analysis: async (options) => {
15769
+ /**
15770
+ * Retrieves training analytics for multiple workspaces in a single
15771
+ * request (max 50). Pass workspace IDs as a comma-separated string.
15772
+ *
15773
+ * @param workspaceIds - Comma-separated workspace UUIDs.
15774
+ * @param options - Optional request options (abort signal, custom headers).
15775
+ * @returns An array of training analytics objects.
15776
+ *
15777
+ * @example
15778
+ * ```typescript
15779
+ * const batch = await admin.extraction.trainingAnalytics.batch('ws-1,ws-2,ws-3');
15780
+ * ```
15781
+ */
15782
+ batch: async (workspaceIds, options) => {
14586
15783
  return rb.execute(
14587
- getAdminExtractionShadowComparisonsAnalysis,
14588
- {},
15784
+ getAdminWorkspacesAnalyticsBatch,
15785
+ { query: { workspace_ids: workspaceIds } },
14589
15786
  options
14590
15787
  );
14591
15788
  }
14592
15789
  },
14593
- /** Content analysis results PII detection, OCR quality, entity extraction. */
14594
- analyses: {
14595
- /** List all extraction analyses. */
15790
+ /** Extraction agentslist and predict best extraction agents for documents. */
15791
+ extractionAgents: {
15792
+ /**
15793
+ * Lists all available extraction agents (system agents tagged with
15794
+ * "extraction" category).
15795
+ *
15796
+ * @param options - Optional request options (abort signal, custom headers).
15797
+ * @returns An array of extraction agent objects.
15798
+ *
15799
+ * @example
15800
+ * ```typescript
15801
+ * const agents = await admin.extraction.extractionAgents.list();
15802
+ * ```
15803
+ */
14596
15804
  list: async (options) => {
14597
15805
  return rb.execute(
14598
- getAdminExtractionAnalyses,
15806
+ getAdminExtractionAgents,
14599
15807
  {},
14600
15808
  options
14601
15809
  );
14602
15810
  },
14603
- /** Get an extraction analysis by ID. */
15811
+ /**
15812
+ * Retrieves a single extraction agent by its unique identifier.
15813
+ *
15814
+ * @param id - The UUID of the extraction agent.
15815
+ * @param options - Optional request options (abort signal, custom headers).
15816
+ * @returns The matching extraction agent object.
15817
+ *
15818
+ * @example
15819
+ * ```typescript
15820
+ * const agent = await admin.extraction.extractionAgents.get('agent-uuid');
15821
+ * ```
15822
+ */
14604
15823
  get: async (id, options) => {
14605
15824
  return rb.execute(
14606
- getAdminExtractionAnalysesById,
15825
+ getAdminExtractionAgentsById,
14607
15826
  { path: { id } },
14608
15827
  options
14609
15828
  );
15829
+ },
15830
+ /**
15831
+ * Predicts the best extraction agent for a given document based on its
15832
+ * name, description, or file content.
15833
+ *
15834
+ * @param attributes - Prediction input attributes.
15835
+ * @param options - Optional request options (abort signal, custom headers).
15836
+ * @returns A prediction result with recommended agents.
15837
+ *
15838
+ * @example
15839
+ * ```typescript
15840
+ * const prediction = await admin.extraction.extractionAgents.predict({
15841
+ * name: 'invoice.pdf',
15842
+ * description: 'Monthly vendor invoice',
15843
+ * file_content: 'Invoice #12345...',
15844
+ * });
15845
+ * ```
15846
+ */
15847
+ predict: async (attributes, options) => {
15848
+ return rb.execute(
15849
+ postAdminExtractionAgentsPredict,
15850
+ {
15851
+ body: {
15852
+ data: { type: "extraction-agent", attributes }
15853
+ }
15854
+ },
15855
+ options
15856
+ );
14610
15857
  }
14611
15858
  },
14612
15859
  /** Chunk-entity links — bridge between document chunks and knowledge graph entities. */
14613
15860
  chunkEntityLinks: {
14614
- /** List all chunk-entity links. */
15861
+ /**
15862
+ * Lists all chunk-entity links across the platform.
15863
+ *
15864
+ * @param options - Optional request options (abort signal, custom headers).
15865
+ * @returns An array of chunk-entity link objects.
15866
+ *
15867
+ * @example
15868
+ * ```typescript
15869
+ * const links = await admin.extraction.chunkEntityLinks.list();
15870
+ * ```
15871
+ */
14615
15872
  list: async (options) => {
14616
15873
  return rb.execute(
14617
15874
  getAdminExtractionChunkEntityLinks,
@@ -14619,7 +15876,18 @@ function createExtractionNamespace(rb) {
14619
15876
  options
14620
15877
  );
14621
15878
  },
14622
- /** Get a chunk-entity link by ID. */
15879
+ /**
15880
+ * Retrieves a single chunk-entity link by its unique identifier.
15881
+ *
15882
+ * @param id - The UUID of the chunk-entity link.
15883
+ * @param options - Optional request options (abort signal, custom headers).
15884
+ * @returns The matching chunk-entity link object.
15885
+ *
15886
+ * @example
15887
+ * ```typescript
15888
+ * const link = await admin.extraction.chunkEntityLinks.get('link-uuid');
15889
+ * ```
15890
+ */
14623
15891
  get: async (id, options) => {
14624
15892
  return rb.execute(
14625
15893
  getAdminExtractionChunkEntityLinksById,
@@ -14627,7 +15895,18 @@ function createExtractionNamespace(rb) {
14627
15895
  options
14628
15896
  );
14629
15897
  },
14630
- /** List links for a specific document. */
15898
+ /**
15899
+ * Lists all chunk-entity links for a specific document.
15900
+ *
15901
+ * @param documentId - The UUID of the document.
15902
+ * @param options - Optional request options (abort signal, custom headers).
15903
+ * @returns An array of chunk-entity links for the document.
15904
+ *
15905
+ * @example
15906
+ * ```typescript
15907
+ * const links = await admin.extraction.chunkEntityLinks.byDocument('doc-uuid');
15908
+ * ```
15909
+ */
14631
15910
  byDocument: async (documentId, options) => {
14632
15911
  return rb.execute(
14633
15912
  getAdminExtractionChunkEntityLinksDocumentByDocumentId,
@@ -14635,7 +15914,18 @@ function createExtractionNamespace(rb) {
14635
15914
  options
14636
15915
  );
14637
15916
  },
14638
- /** List links for a specific chunk. */
15917
+ /**
15918
+ * Lists all chunk-entity links for a specific document chunk.
15919
+ *
15920
+ * @param documentChunkId - The UUID of the document chunk.
15921
+ * @param options - Optional request options (abort signal, custom headers).
15922
+ * @returns An array of chunk-entity links for the chunk.
15923
+ *
15924
+ * @example
15925
+ * ```typescript
15926
+ * const links = await admin.extraction.chunkEntityLinks.byChunk('chunk-uuid');
15927
+ * ```
15928
+ */
14639
15929
  byChunk: async (documentChunkId, options) => {
14640
15930
  return rb.execute(
14641
15931
  getAdminExtractionChunkEntityLinksChunkByDocumentChunkId,
@@ -14643,7 +15933,18 @@ function createExtractionNamespace(rb) {
14643
15933
  options
14644
15934
  );
14645
15935
  },
14646
- /** List links for a specific entity. */
15936
+ /**
15937
+ * Lists all chunk-entity links for a specific knowledge graph entity.
15938
+ *
15939
+ * @param graphNodeId - The UUID of the graph node (entity).
15940
+ * @param options - Optional request options (abort signal, custom headers).
15941
+ * @returns An array of chunk-entity links for the entity.
15942
+ *
15943
+ * @example
15944
+ * ```typescript
15945
+ * const links = await admin.extraction.chunkEntityLinks.byEntity('node-uuid');
15946
+ * ```
15947
+ */
14647
15948
  byEntity: async (graphNodeId, options) => {
14648
15949
  return rb.execute(
14649
15950
  getAdminExtractionChunkEntityLinksEntityByGraphNodeId,
@@ -21080,6 +22381,72 @@ function createImportsNamespace(rb) {
21080
22381
  };
21081
22382
  }
21082
22383
 
22384
+ // src/namespaces/documents.ts
22385
+ function createDocumentsNamespace(rb) {
22386
+ return {
22387
+ /**
22388
+ * Generate a PDF from HTML content and store it in platform Storage.
22389
+ *
22390
+ * Always pass `store: true` and `workspace_id` to get a JSON response with
22391
+ * a `storage_key`. Without `store: true`, the server returns raw
22392
+ * `application/pdf` binary which cannot be parsed as JSON by this SDK method.
22393
+ *
22394
+ * HTML input is capped at 2MB by the server.
22395
+ *
22396
+ * @param params - PDF generation parameters. Set `store: true` and provide
22397
+ * `workspace_id` for JSON response.
22398
+ * @param options - Optional request options (abort signal, custom headers).
22399
+ * @returns A storage key reference for the generated PDF.
22400
+ *
22401
+ * @example
22402
+ * ```typescript
22403
+ * const { storage_key } = await admin.documents.generatePdf({
22404
+ * html: '<html><body>Report</body></html>',
22405
+ * store: true,
22406
+ * workspace_id: 'ws-123',
22407
+ * });
22408
+ * ```
22409
+ */
22410
+ generatePdf: async (params, options) => {
22411
+ return rb.rawPostDirect(
22412
+ "/isv/documents/pdf",
22413
+ params,
22414
+ options
22415
+ );
22416
+ },
22417
+ /**
22418
+ * Generate a PDF from HTML and email it as an attachment.
22419
+ *
22420
+ * The PDF is generated server-side and delivered via platform SMTP.
22421
+ * Optionally stores the PDF in platform Storage alongside the email delivery.
22422
+ *
22423
+ * If storage fails but the email succeeds, the response includes
22424
+ * `storage_error` with the failure reason (email is still delivered).
22425
+ *
22426
+ * @param params - Email report parameters.
22427
+ * @param options - Optional request options (abort signal, custom headers).
22428
+ * @returns Delivery status, optional storage key, and any storage error.
22429
+ *
22430
+ * @example
22431
+ * ```typescript
22432
+ * const result = await admin.documents.emailReport({
22433
+ * html: '<html><body><h1>Q1 Summary</h1></body></html>',
22434
+ * to: 'finance@company.com',
22435
+ * subject: 'Q1 Financial Summary',
22436
+ * });
22437
+ * console.log(result.sent); // true
22438
+ * ```
22439
+ */
22440
+ emailReport: async (params, options) => {
22441
+ return rb.rawPostDirect(
22442
+ "/isv/documents/pdf/email",
22443
+ params,
22444
+ options
22445
+ );
22446
+ }
22447
+ };
22448
+ }
22449
+
21083
22450
  // src/gpt-admin.ts
21084
22451
  var GptAdmin = class extends BaseClient {
21085
22452
  constructor(config) {
@@ -21096,7 +22463,7 @@ var GptAdmin = class extends BaseClient {
21096
22463
  this.capabilities = createCapabilitiesNamespace(rb);
21097
22464
  this.apiKeys = createApiKeysNamespace(rb);
21098
22465
  this.extraction = createExtractionNamespace(rb);
21099
- this.documents = this.extraction.documents;
22466
+ this.documents = createDocumentsNamespace(rb);
21100
22467
  this.executions = createExecutionsNamespace(rb);
21101
22468
  this.storage = createStorageNamespace(rb);
21102
22469
  this.users = createUsersNamespace(rb);