extend-ai 1.8.0 → 1.9.0
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/BaseClient.js +2 -2
- package/api/resources/batchRuns/client/Client.d.ts +3 -2
- package/api/resources/batchRuns/client/Client.js +3 -2
- package/api/resources/parseRuns/client/Client.d.ts +77 -0
- package/api/resources/parseRuns/client/Client.js +189 -0
- package/api/resources/parseRuns/client/requests/ParseRunsCreateBatchRequest.d.ts +35 -0
- package/api/resources/parseRuns/client/requests/ParseRunsCreateBatchRequest.js +3 -0
- package/api/resources/parseRuns/client/requests/ParseRunsListRequest.d.ts +27 -0
- package/api/resources/parseRuns/client/requests/ParseRunsListRequest.js +3 -0
- package/api/resources/parseRuns/client/requests/index.d.ts +2 -0
- package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItem.d.ts +6 -0
- package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItem.js +3 -0
- package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItemFile.d.ts +5 -0
- package/api/resources/parseRuns/types/ParseRunsCreateBatchRequestInputsItemFile.js +3 -0
- package/api/resources/parseRuns/types/ParseRunsListRequestStatus.d.ts +7 -0
- package/api/resources/parseRuns/types/ParseRunsListRequestStatus.js +10 -0
- package/api/resources/parseRuns/types/ParseRunsListResponse.d.ts +6 -0
- package/api/resources/parseRuns/types/ParseRunsListResponse.js +3 -0
- package/api/resources/parseRuns/types/index.d.ts +4 -0
- package/api/resources/parseRuns/types/index.js +4 -0
- package/api/types/BatchParseRunCompletedWebhookEvent.d.ts +6 -0
- package/api/types/BatchParseRunCompletedWebhookEvent.js +3 -0
- package/api/types/BatchParseRunFailedWebhookEvent.d.ts +6 -0
- package/api/types/BatchParseRunFailedWebhookEvent.js +3 -0
- package/api/types/BatchRun.d.ts +1 -1
- package/api/types/ParseRun.d.ts +10 -1
- package/api/types/ParseRunStatusEnum.d.ts +2 -0
- package/api/types/ParseRunStatusEnum.js +2 -0
- package/api/types/WebhookEndpointEventType.d.ts +2 -0
- package/api/types/WebhookEndpointEventType.js +2 -0
- package/api/types/WebhookEvent.d.ts +7 -1
- package/api/types/index.d.ts +2 -0
- package/api/types/index.js +2 -0
- package/package.json +1 -1
- package/reference.md +166 -2
- package/version.d.ts +1 -1
- package/version.js +1 -1
package/BaseClient.js
CHANGED
|
@@ -44,8 +44,8 @@ function normalizeClientOptions(options) {
|
|
|
44
44
|
const headers = (0, headers_1.mergeHeaders)({
|
|
45
45
|
"X-Fern-Language": "JavaScript",
|
|
46
46
|
"X-Fern-SDK-Name": "extend-ai",
|
|
47
|
-
"X-Fern-SDK-Version": "1.
|
|
48
|
-
"User-Agent": "extend-ai/1.
|
|
47
|
+
"X-Fern-SDK-Version": "1.9.0",
|
|
48
|
+
"User-Agent": "extend-ai/1.9.0",
|
|
49
49
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
50
50
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
51
51
|
"x-extend-api-version": (_a = options === null || options === void 0 ? void 0 : options.extendApiVersion) !== null && _a !== void 0 ? _a : "2026-02-09",
|
|
@@ -13,7 +13,7 @@ export declare class BatchRunsClient {
|
|
|
13
13
|
/**
|
|
14
14
|
* Retrieve the status of a batch run by its ID. The `status` field reflects the aggregate state of the batch.
|
|
15
15
|
*
|
|
16
|
-
* This is a unified endpoint that works for batches created via any of the batch submission endpoints (`POST /extract_runs/batch`, `POST /classify_runs/batch`, `POST /split_runs/batch`).
|
|
16
|
+
* This is a unified endpoint that works for batches created via any of the batch submission endpoints (`POST /parse_runs/batch`, `POST /extract_runs/batch`, `POST /classify_runs/batch`, `POST /split_runs/batch`).
|
|
17
17
|
*
|
|
18
18
|
* | Status | Meaning |
|
|
19
19
|
* |---|---|
|
|
@@ -23,7 +23,8 @@ export declare class BatchRunsClient {
|
|
|
23
23
|
* | `FAILED` | The batch encountered a fatal error |
|
|
24
24
|
* | `CANCELLED` | The batch was cancelled |
|
|
25
25
|
*
|
|
26
|
-
* To retrieve individual run results, use the List endpoint for the relevant
|
|
26
|
+
* To retrieve individual run results, use the List endpoint for the relevant type filtered by `batchId`:
|
|
27
|
+
* - `GET /parse_runs?batchId={id}`
|
|
27
28
|
* - `GET /extract_runs?batchId={id}`
|
|
28
29
|
* - `GET /classify_runs?batchId={id}`
|
|
29
30
|
* - `GET /split_runs?batchId={id}`
|
|
@@ -58,7 +58,7 @@ class BatchRunsClient {
|
|
|
58
58
|
/**
|
|
59
59
|
* Retrieve the status of a batch run by its ID. The `status` field reflects the aggregate state of the batch.
|
|
60
60
|
*
|
|
61
|
-
* This is a unified endpoint that works for batches created via any of the batch submission endpoints (`POST /extract_runs/batch`, `POST /classify_runs/batch`, `POST /split_runs/batch`).
|
|
61
|
+
* This is a unified endpoint that works for batches created via any of the batch submission endpoints (`POST /parse_runs/batch`, `POST /extract_runs/batch`, `POST /classify_runs/batch`, `POST /split_runs/batch`).
|
|
62
62
|
*
|
|
63
63
|
* | Status | Meaning |
|
|
64
64
|
* |---|---|
|
|
@@ -68,7 +68,8 @@ class BatchRunsClient {
|
|
|
68
68
|
* | `FAILED` | The batch encountered a fatal error |
|
|
69
69
|
* | `CANCELLED` | The batch was cancelled |
|
|
70
70
|
*
|
|
71
|
-
* To retrieve individual run results, use the List endpoint for the relevant
|
|
71
|
+
* To retrieve individual run results, use the List endpoint for the relevant type filtered by `batchId`:
|
|
72
|
+
* - `GET /parse_runs?batchId={id}`
|
|
72
73
|
* - `GET /extract_runs?batchId={id}`
|
|
73
74
|
* - `GET /classify_runs?batchId={id}`
|
|
74
75
|
* - `GET /split_runs?batchId={id}`
|
|
@@ -10,6 +10,30 @@ export declare namespace ParseRunsClient {
|
|
|
10
10
|
export declare class ParseRunsClient {
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<ParseRunsClient.Options>;
|
|
12
12
|
constructor(options: ParseRunsClient.Options);
|
|
13
|
+
/**
|
|
14
|
+
* List parse runs, with optional filters for status, batch ID, and file name.
|
|
15
|
+
*
|
|
16
|
+
* Returns a paginated list of parse runs. Use `GET /parse_runs/{id}` to retrieve the full result including output for a specific run.
|
|
17
|
+
*
|
|
18
|
+
* @param {Extend.ParseRunsListRequest} request
|
|
19
|
+
* @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
20
|
+
*
|
|
21
|
+
* @throws {@link Extend.BadRequestError}
|
|
22
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
23
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
24
|
+
* @throws {@link Extend.ForbiddenError}
|
|
25
|
+
* @throws {@link Extend.NotFoundError}
|
|
26
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
27
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
28
|
+
* @throws {@link Extend.InternalServerError}
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* await client.parseRuns.list({
|
|
32
|
+
* nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
33
|
+
* })
|
|
34
|
+
*/
|
|
35
|
+
list(request?: Extend.ParseRunsListRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ParseRunsListResponse>;
|
|
36
|
+
private __list;
|
|
13
37
|
/**
|
|
14
38
|
* Parse files to get cleaned, chunked target content (e.g. markdown).
|
|
15
39
|
*
|
|
@@ -89,4 +113,57 @@ export declare class ParseRunsClient {
|
|
|
89
113
|
*/
|
|
90
114
|
delete(id: string, request?: Extend.ParseRunsDeleteRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.ParseRunsDeleteResponse>;
|
|
91
115
|
private __delete;
|
|
116
|
+
/**
|
|
117
|
+
* Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
|
|
118
|
+
*
|
|
119
|
+
* Unlike the single [Parse File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/parse/create-parse-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
|
|
120
|
+
*
|
|
121
|
+
* **Monitoring results:**
|
|
122
|
+
* - **Webhooks (recommended):** Subscribe to `batch_parse_run.processed` and `batch_parse_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /parse_runs?batchId={id}`.
|
|
123
|
+
* - **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /parse_runs?batchId={id}` to retrieve individual run results.
|
|
124
|
+
*
|
|
125
|
+
* **Notes:**
|
|
126
|
+
* - `inputs` must contain between 1 and 1,000 items.
|
|
127
|
+
* - File input supports URLs, Extend file IDs, and raw text strings.
|
|
128
|
+
*
|
|
129
|
+
* @param {Extend.ParseRunsCreateBatchRequest} request
|
|
130
|
+
* @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
131
|
+
*
|
|
132
|
+
* @throws {@link Extend.BadRequestError}
|
|
133
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
134
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
135
|
+
* @throws {@link Extend.ForbiddenError}
|
|
136
|
+
* @throws {@link Extend.NotFoundError}
|
|
137
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
138
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
139
|
+
* @throws {@link Extend.InternalServerError}
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* await client.parseRuns.createBatch({
|
|
143
|
+
* inputs: [{
|
|
144
|
+
* file: {
|
|
145
|
+
* url: "https://example.com/document1.pdf"
|
|
146
|
+
* },
|
|
147
|
+
* metadata: {
|
|
148
|
+
* "customerId": "cust_abc123"
|
|
149
|
+
* }
|
|
150
|
+
* }, {
|
|
151
|
+
* file: {
|
|
152
|
+
* url: "https://example.com/document2.pdf"
|
|
153
|
+
* },
|
|
154
|
+
* metadata: {
|
|
155
|
+
* "customerId": "cust_def456"
|
|
156
|
+
* }
|
|
157
|
+
* }, {
|
|
158
|
+
* file: {
|
|
159
|
+
* text: "This is some raw text to parse."
|
|
160
|
+
* },
|
|
161
|
+
* metadata: {
|
|
162
|
+
* "source": "manual-entry"
|
|
163
|
+
* }
|
|
164
|
+
* }]
|
|
165
|
+
* })
|
|
166
|
+
*/
|
|
167
|
+
createBatch(request: Extend.ParseRunsCreateBatchRequest, requestOptions?: ParseRunsClient.RequestOptions): core.HttpResponsePromise<Extend.BatchRun>;
|
|
168
|
+
private __createBatch;
|
|
92
169
|
}
|
|
@@ -55,6 +55,90 @@ class ParseRunsClient {
|
|
|
55
55
|
constructor(options) {
|
|
56
56
|
this._options = (0, BaseClient_1.normalizeClientOptionsWithAuth)(options);
|
|
57
57
|
}
|
|
58
|
+
/**
|
|
59
|
+
* List parse runs, with optional filters for status, batch ID, and file name.
|
|
60
|
+
*
|
|
61
|
+
* Returns a paginated list of parse runs. Use `GET /parse_runs/{id}` to retrieve the full result including output for a specific run.
|
|
62
|
+
*
|
|
63
|
+
* @param {Extend.ParseRunsListRequest} request
|
|
64
|
+
* @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
65
|
+
*
|
|
66
|
+
* @throws {@link Extend.BadRequestError}
|
|
67
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
68
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
69
|
+
* @throws {@link Extend.ForbiddenError}
|
|
70
|
+
* @throws {@link Extend.NotFoundError}
|
|
71
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
72
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
73
|
+
* @throws {@link Extend.InternalServerError}
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* await client.parseRuns.list({
|
|
77
|
+
* nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
78
|
+
* })
|
|
79
|
+
*/
|
|
80
|
+
list(request = {}, requestOptions) {
|
|
81
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
82
|
+
}
|
|
83
|
+
__list() {
|
|
84
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
85
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
86
|
+
const { status, batchId, fileNameContains, nextPageToken, maxPageSize, "x-extend-workspace-id": extendWorkspaceId, } = request;
|
|
87
|
+
const _queryParams = {
|
|
88
|
+
status: status != null ? status : undefined,
|
|
89
|
+
batchId,
|
|
90
|
+
fileNameContains,
|
|
91
|
+
nextPageToken,
|
|
92
|
+
maxPageSize,
|
|
93
|
+
};
|
|
94
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
95
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({
|
|
96
|
+
"x-extend-workspace-id": extendWorkspaceId,
|
|
97
|
+
"x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09",
|
|
98
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
99
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
100
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, "parse_runs"),
|
|
101
|
+
method: "GET",
|
|
102
|
+
headers: _headers,
|
|
103
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
104
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
105
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
106
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
107
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
108
|
+
logging: this._options.logging,
|
|
109
|
+
});
|
|
110
|
+
if (_response.ok) {
|
|
111
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
112
|
+
}
|
|
113
|
+
if (_response.error.reason === "status-code") {
|
|
114
|
+
switch (_response.error.statusCode) {
|
|
115
|
+
case 400:
|
|
116
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
117
|
+
case 401:
|
|
118
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
119
|
+
case 402:
|
|
120
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
121
|
+
case 403:
|
|
122
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
123
|
+
case 404:
|
|
124
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
125
|
+
case 422:
|
|
126
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
127
|
+
case 429:
|
|
128
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
129
|
+
case 500:
|
|
130
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
131
|
+
default:
|
|
132
|
+
throw new errors.ExtendError({
|
|
133
|
+
statusCode: _response.error.statusCode,
|
|
134
|
+
body: _response.error.body,
|
|
135
|
+
rawResponse: _response.rawResponse,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/parse_runs");
|
|
140
|
+
});
|
|
141
|
+
}
|
|
58
142
|
/**
|
|
59
143
|
* Parse files to get cleaned, chunked target content (e.g. markdown).
|
|
60
144
|
*
|
|
@@ -295,5 +379,110 @@ class ParseRunsClient {
|
|
|
295
379
|
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/parse_runs/{id}");
|
|
296
380
|
});
|
|
297
381
|
}
|
|
382
|
+
/**
|
|
383
|
+
* Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
|
|
384
|
+
*
|
|
385
|
+
* Unlike the single [Parse File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/parse/create-parse-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
|
|
386
|
+
*
|
|
387
|
+
* **Monitoring results:**
|
|
388
|
+
* - **Webhooks (recommended):** Subscribe to `batch_parse_run.processed` and `batch_parse_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /parse_runs?batchId={id}`.
|
|
389
|
+
* - **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /parse_runs?batchId={id}` to retrieve individual run results.
|
|
390
|
+
*
|
|
391
|
+
* **Notes:**
|
|
392
|
+
* - `inputs` must contain between 1 and 1,000 items.
|
|
393
|
+
* - File input supports URLs, Extend file IDs, and raw text strings.
|
|
394
|
+
*
|
|
395
|
+
* @param {Extend.ParseRunsCreateBatchRequest} request
|
|
396
|
+
* @param {ParseRunsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
397
|
+
*
|
|
398
|
+
* @throws {@link Extend.BadRequestError}
|
|
399
|
+
* @throws {@link Extend.UnauthorizedError}
|
|
400
|
+
* @throws {@link Extend.PaymentRequiredError}
|
|
401
|
+
* @throws {@link Extend.ForbiddenError}
|
|
402
|
+
* @throws {@link Extend.NotFoundError}
|
|
403
|
+
* @throws {@link Extend.UnprocessableEntityError}
|
|
404
|
+
* @throws {@link Extend.TooManyRequestsError}
|
|
405
|
+
* @throws {@link Extend.InternalServerError}
|
|
406
|
+
*
|
|
407
|
+
* @example
|
|
408
|
+
* await client.parseRuns.createBatch({
|
|
409
|
+
* inputs: [{
|
|
410
|
+
* file: {
|
|
411
|
+
* url: "https://example.com/document1.pdf"
|
|
412
|
+
* },
|
|
413
|
+
* metadata: {
|
|
414
|
+
* "customerId": "cust_abc123"
|
|
415
|
+
* }
|
|
416
|
+
* }, {
|
|
417
|
+
* file: {
|
|
418
|
+
* url: "https://example.com/document2.pdf"
|
|
419
|
+
* },
|
|
420
|
+
* metadata: {
|
|
421
|
+
* "customerId": "cust_def456"
|
|
422
|
+
* }
|
|
423
|
+
* }, {
|
|
424
|
+
* file: {
|
|
425
|
+
* text: "This is some raw text to parse."
|
|
426
|
+
* },
|
|
427
|
+
* metadata: {
|
|
428
|
+
* "source": "manual-entry"
|
|
429
|
+
* }
|
|
430
|
+
* }]
|
|
431
|
+
* })
|
|
432
|
+
*/
|
|
433
|
+
createBatch(request, requestOptions) {
|
|
434
|
+
return core.HttpResponsePromise.fromPromise(this.__createBatch(request, requestOptions));
|
|
435
|
+
}
|
|
436
|
+
__createBatch(request, requestOptions) {
|
|
437
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
438
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
439
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
440
|
+
const _headers = (0, headers_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_1.mergeOnlyDefinedHeaders)({ "x-extend-api-version": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.extendApiVersion) !== null && _b !== void 0 ? _b : "2026-02-09" }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
441
|
+
const _response = yield ((_c = this._options.fetcher) !== null && _c !== void 0 ? _c : core.fetcher)({
|
|
442
|
+
url: core.url.join((_e = (_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment))) !== null && _e !== void 0 ? _e : environments.ExtendEnvironment.Production, "parse_runs/batch"),
|
|
443
|
+
method: "POST",
|
|
444
|
+
headers: _headers,
|
|
445
|
+
contentType: "application/json",
|
|
446
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
447
|
+
requestType: "json",
|
|
448
|
+
body: request,
|
|
449
|
+
timeoutMs: ((_h = (_f = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _f !== void 0 ? _f : (_g = this._options) === null || _g === void 0 ? void 0 : _g.timeoutInSeconds) !== null && _h !== void 0 ? _h : 300) * 1000,
|
|
450
|
+
maxRetries: (_j = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _j !== void 0 ? _j : (_k = this._options) === null || _k === void 0 ? void 0 : _k.maxRetries,
|
|
451
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
452
|
+
fetchFn: (_l = this._options) === null || _l === void 0 ? void 0 : _l.fetch,
|
|
453
|
+
logging: this._options.logging,
|
|
454
|
+
});
|
|
455
|
+
if (_response.ok) {
|
|
456
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
457
|
+
}
|
|
458
|
+
if (_response.error.reason === "status-code") {
|
|
459
|
+
switch (_response.error.statusCode) {
|
|
460
|
+
case 400:
|
|
461
|
+
throw new Extend.BadRequestError(_response.error.body, _response.rawResponse);
|
|
462
|
+
case 401:
|
|
463
|
+
throw new Extend.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
464
|
+
case 402:
|
|
465
|
+
throw new Extend.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
466
|
+
case 403:
|
|
467
|
+
throw new Extend.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
468
|
+
case 404:
|
|
469
|
+
throw new Extend.NotFoundError(_response.error.body, _response.rawResponse);
|
|
470
|
+
case 422:
|
|
471
|
+
throw new Extend.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
472
|
+
case 429:
|
|
473
|
+
throw new Extend.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
474
|
+
case 500:
|
|
475
|
+
throw new Extend.InternalServerError(_response.error.body, _response.rawResponse);
|
|
476
|
+
default:
|
|
477
|
+
throw new errors.ExtendError({
|
|
478
|
+
statusCode: _response.error.statusCode,
|
|
479
|
+
body: _response.error.body,
|
|
480
|
+
rawResponse: _response.rawResponse,
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
return (0, handleNonStatusCodeError_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/parse_runs/batch");
|
|
485
|
+
});
|
|
486
|
+
}
|
|
298
487
|
}
|
|
299
488
|
exports.ParseRunsClient = ParseRunsClient;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type * as Extend from "../../../../index";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* inputs: [{
|
|
6
|
+
* file: {
|
|
7
|
+
* url: "https://example.com/document1.pdf"
|
|
8
|
+
* },
|
|
9
|
+
* metadata: {
|
|
10
|
+
* "customerId": "cust_abc123"
|
|
11
|
+
* }
|
|
12
|
+
* }, {
|
|
13
|
+
* file: {
|
|
14
|
+
* url: "https://example.com/document2.pdf"
|
|
15
|
+
* },
|
|
16
|
+
* metadata: {
|
|
17
|
+
* "customerId": "cust_def456"
|
|
18
|
+
* }
|
|
19
|
+
* }, {
|
|
20
|
+
* file: {
|
|
21
|
+
* text: "This is some raw text to parse."
|
|
22
|
+
* },
|
|
23
|
+
* metadata: {
|
|
24
|
+
* "source": "manual-entry"
|
|
25
|
+
* }
|
|
26
|
+
* }]
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export interface ParseRunsCreateBatchRequest {
|
|
30
|
+
/** An array of inputs to parse. Each item produces one parse run. Must contain between 1 and 1,000 items. */
|
|
31
|
+
inputs: Extend.ParseRunsCreateBatchRequestInputsItem[];
|
|
32
|
+
/** Optional parsing configuration applied to every run in this batch. If omitted, default parse settings are used. */
|
|
33
|
+
config?: Extend.ParseConfig;
|
|
34
|
+
priority?: Extend.RunPriority;
|
|
35
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type * as Extend from "../../../../index";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
6
|
+
* }
|
|
7
|
+
*/
|
|
8
|
+
export interface ParseRunsListRequest {
|
|
9
|
+
/** Filter parse runs by status. */
|
|
10
|
+
status?: Extend.ParseRunsListRequestStatus;
|
|
11
|
+
/**
|
|
12
|
+
* Filter parse runs by the batch they belong to. Use this after submitting a batch via `POST /parse_runs/batch` to retrieve individual run results.
|
|
13
|
+
*
|
|
14
|
+
* Example: `"bpar_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
15
|
+
*/
|
|
16
|
+
batchId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Filters runs by the name of the file. Only returns runs where the file name contains this string.
|
|
19
|
+
*
|
|
20
|
+
* Example: `"invoice"`
|
|
21
|
+
*/
|
|
22
|
+
fileNameContains?: string;
|
|
23
|
+
nextPageToken?: Extend.NextPageToken;
|
|
24
|
+
maxPageSize?: Extend.MaxPageSize;
|
|
25
|
+
/** The workspace ID to target. **Required** when using an organization-scoped API key; optional for workspace-scoped keys (the key is already tied to a workspace). See [Authentication](https://docs.extend.ai/2026-02-09/developers/authentication) for details on API key scopes. */
|
|
26
|
+
"x-extend-workspace-id"?: string;
|
|
27
|
+
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
export type { ParseRunsCreateBatchRequest } from "./ParseRunsCreateBatchRequest";
|
|
1
2
|
export type { ParseRunsCreateRequest } from "./ParseRunsCreateRequest";
|
|
2
3
|
export type { ParseRunsDeleteRequest } from "./ParseRunsDeleteRequest";
|
|
4
|
+
export type { ParseRunsListRequest } from "./ParseRunsListRequest";
|
|
3
5
|
export type { ParseRunsRetrieveRequest } from "./ParseRunsRetrieveRequest";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type * as Extend from "../../../index";
|
|
2
|
+
export interface ParseRunsCreateBatchRequestInputsItem {
|
|
3
|
+
/** The file to parse. Can be a URL, an Extend file ID, or raw text. */
|
|
4
|
+
file: Extend.ParseRunsCreateBatchRequestInputsItemFile;
|
|
5
|
+
metadata?: Extend.RunMetadata;
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ParseRunsListRequestStatus: {
|
|
2
|
+
readonly Pending: "PENDING";
|
|
3
|
+
readonly Processing: "PROCESSING";
|
|
4
|
+
readonly Processed: "PROCESSED";
|
|
5
|
+
readonly Failed: "FAILED";
|
|
6
|
+
};
|
|
7
|
+
export type ParseRunsListRequestStatus = (typeof ParseRunsListRequestStatus)[keyof typeof ParseRunsListRequestStatus] | string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ParseRunsListRequestStatus = void 0;
|
|
5
|
+
exports.ParseRunsListRequestStatus = {
|
|
6
|
+
Pending: "PENDING",
|
|
7
|
+
Processing: "PROCESSING",
|
|
8
|
+
Processed: "PROCESSED",
|
|
9
|
+
Failed: "FAILED",
|
|
10
|
+
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export * from "./ParseRunsCreateBatchRequestInputsItem";
|
|
2
|
+
export * from "./ParseRunsCreateBatchRequestInputsItemFile";
|
|
1
3
|
export * from "./ParseRunsCreateRequestFile";
|
|
2
4
|
export * from "./ParseRunsDeleteResponse";
|
|
5
|
+
export * from "./ParseRunsListRequestStatus";
|
|
6
|
+
export * from "./ParseRunsListResponse";
|
|
3
7
|
export * from "./ParseRunsRetrieveRequestResponseType";
|
|
@@ -14,6 +14,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./ParseRunsCreateBatchRequestInputsItem"), exports);
|
|
18
|
+
__exportStar(require("./ParseRunsCreateBatchRequestInputsItemFile"), exports);
|
|
17
19
|
__exportStar(require("./ParseRunsCreateRequestFile"), exports);
|
|
18
20
|
__exportStar(require("./ParseRunsDeleteResponse"), exports);
|
|
21
|
+
__exportStar(require("./ParseRunsListRequestStatus"), exports);
|
|
22
|
+
__exportStar(require("./ParseRunsListResponse"), exports);
|
|
19
23
|
__exportStar(require("./ParseRunsRetrieveRequestResponseType"), exports);
|
package/api/types/BatchRun.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type * as Extend from "../index";
|
|
2
2
|
/**
|
|
3
|
-
* A batch run represents a batch of files submitted for processing via one of the batch endpoints (`POST /extract_runs/batch`, `POST /classify_runs/batch`, or `POST /split_runs/batch`). Use `GET /batch_runs/{id}` to poll the status.
|
|
3
|
+
* A batch run represents a batch of files submitted for processing via one of the batch endpoints (`POST /parse_runs/batch`, `POST /extract_runs/batch`, `POST /classify_runs/batch`, or `POST /split_runs/batch`). Use `GET /batch_runs/{id}` to poll the status.
|
|
4
4
|
*
|
|
5
5
|
* **Note:** This object is not used for workflow batch runs. See `POST /workflow_runs/batch` for workflow batching.
|
|
6
6
|
*/
|
package/api/types/ParseRun.d.ts
CHANGED
|
@@ -11,10 +11,19 @@ export interface ParseRun {
|
|
|
11
11
|
* Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
12
12
|
*/
|
|
13
13
|
id: string;
|
|
14
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* The ID of the batch this run belongs to, if created via `POST /parse_runs/batch`.
|
|
16
|
+
*
|
|
17
|
+
* **Availability:** Present when the run was submitted as part of a batch.
|
|
18
|
+
*
|
|
19
|
+
* Example: `"bpar_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
20
|
+
*/
|
|
21
|
+
batchId?: string | null;
|
|
22
|
+
/** The file that was parsed. This file can be used as a parameter for other Extend endpoints, such as `POST /workflow_runs`. May be `null` for batch parse runs where file ingestion failed. */
|
|
15
23
|
file: Extend.FileSummary;
|
|
16
24
|
/**
|
|
17
25
|
* The status of the parse run:
|
|
26
|
+
* * `"PENDING"` - The run has been created and is waiting to be processed. Only applies to runs created via `POST /parse_runs/batch`.
|
|
18
27
|
* * `"PROCESSING"` - The file is still being processed
|
|
19
28
|
* * `"PROCESSED"` - The file was successfully processed
|
|
20
29
|
* * `"FAILED"` - The processing failed (see `failureReason` for details)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The status of the parse run:
|
|
3
|
+
* * `"PENDING"` - The run has been created and is waiting to be processed. Only applies to runs created via `POST /parse_runs/batch`.
|
|
3
4
|
* * `"PROCESSING"` - The file is still being processed
|
|
4
5
|
* * `"PROCESSED"` - The file was successfully processed
|
|
5
6
|
* * `"FAILED"` - The processing failed (see `failureReason` for details)
|
|
6
7
|
*/
|
|
7
8
|
export declare const ParseRunStatusEnum: {
|
|
9
|
+
readonly Pending: "PENDING";
|
|
8
10
|
readonly Processing: "PROCESSING";
|
|
9
11
|
readonly Processed: "PROCESSED";
|
|
10
12
|
readonly Failed: "FAILED";
|
|
@@ -4,11 +4,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.ParseRunStatusEnum = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* The status of the parse run:
|
|
7
|
+
* * `"PENDING"` - The run has been created and is waiting to be processed. Only applies to runs created via `POST /parse_runs/batch`.
|
|
7
8
|
* * `"PROCESSING"` - The file is still being processed
|
|
8
9
|
* * `"PROCESSED"` - The file was successfully processed
|
|
9
10
|
* * `"FAILED"` - The processing failed (see `failureReason` for details)
|
|
10
11
|
*/
|
|
11
12
|
exports.ParseRunStatusEnum = {
|
|
13
|
+
Pending: "PENDING",
|
|
12
14
|
Processing: "PROCESSING",
|
|
13
15
|
Processed: "PROCESSED",
|
|
14
16
|
Failed: "FAILED",
|
|
@@ -12,6 +12,8 @@ export declare const WebhookEndpointEventType: {
|
|
|
12
12
|
readonly SplitRunFailed: "split_run.failed";
|
|
13
13
|
readonly BatchProcessorRunProcessed: "batch_processor_run.processed";
|
|
14
14
|
readonly BatchProcessorRunFailed: "batch_processor_run.failed";
|
|
15
|
+
readonly BatchParseRunProcessed: "batch_parse_run.processed";
|
|
16
|
+
readonly BatchParseRunFailed: "batch_parse_run.failed";
|
|
15
17
|
readonly ExtractorCreated: "extractor.created";
|
|
16
18
|
readonly ExtractorUpdated: "extractor.updated";
|
|
17
19
|
readonly ExtractorDeleted: "extractor.deleted";
|
|
@@ -16,6 +16,8 @@ exports.WebhookEndpointEventType = {
|
|
|
16
16
|
SplitRunFailed: "split_run.failed",
|
|
17
17
|
BatchProcessorRunProcessed: "batch_processor_run.processed",
|
|
18
18
|
BatchProcessorRunFailed: "batch_processor_run.failed",
|
|
19
|
+
BatchParseRunProcessed: "batch_parse_run.processed",
|
|
20
|
+
BatchParseRunFailed: "batch_parse_run.failed",
|
|
19
21
|
ExtractorCreated: "extractor.created",
|
|
20
22
|
ExtractorUpdated: "extractor.updated",
|
|
21
23
|
ExtractorDeleted: "extractor.deleted",
|
|
@@ -19,7 +19,7 @@ import type * as Extend from "../index";
|
|
|
19
19
|
* }
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
export type WebhookEvent = Extend.WebhookEvent.WorkflowRunCompleted | Extend.WebhookEvent.WorkflowRunFailed | Extend.WebhookEvent.WorkflowRunNeedsReview | Extend.WebhookEvent.WorkflowRunRejected | Extend.WebhookEvent.WorkflowRunCancelled | Extend.WebhookEvent.WorkflowRunStepRunProcessed | Extend.WebhookEvent.ExtractRunProcessed | Extend.WebhookEvent.ExtractRunFailed | Extend.WebhookEvent.ClassifyRunProcessed | Extend.WebhookEvent.ClassifyRunFailed | Extend.WebhookEvent.SplitRunProcessed | Extend.WebhookEvent.SplitRunFailed | Extend.WebhookEvent.BatchProcessorRunProcessed | Extend.WebhookEvent.BatchProcessorRunFailed | Extend.WebhookEvent.ParseRunProcessed | Extend.WebhookEvent.ParseRunFailed | Extend.WebhookEvent.EditRunProcessed | Extend.WebhookEvent.EditRunFailed | Extend.WebhookEvent.WorkflowCreated | Extend.WebhookEvent.WorkflowDeployed | Extend.WebhookEvent.WorkflowDeleted | Extend.WebhookEvent.ExtractorCreated | Extend.WebhookEvent.ExtractorUpdated | Extend.WebhookEvent.ExtractorDeleted | Extend.WebhookEvent.ExtractorDraftUpdated | Extend.WebhookEvent.ExtractorVersionPublished | Extend.WebhookEvent.ClassifierCreated | Extend.WebhookEvent.ClassifierUpdated | Extend.WebhookEvent.ClassifierDeleted | Extend.WebhookEvent.ClassifierDraftUpdated | Extend.WebhookEvent.ClassifierVersionPublished | Extend.WebhookEvent.SplitterCreated | Extend.WebhookEvent.SplitterUpdated | Extend.WebhookEvent.SplitterDeleted | Extend.WebhookEvent.SplitterDraftUpdated | Extend.WebhookEvent.SplitterVersionPublished;
|
|
22
|
+
export type WebhookEvent = Extend.WebhookEvent.WorkflowRunCompleted | Extend.WebhookEvent.WorkflowRunFailed | Extend.WebhookEvent.WorkflowRunNeedsReview | Extend.WebhookEvent.WorkflowRunRejected | Extend.WebhookEvent.WorkflowRunCancelled | Extend.WebhookEvent.WorkflowRunStepRunProcessed | Extend.WebhookEvent.ExtractRunProcessed | Extend.WebhookEvent.ExtractRunFailed | Extend.WebhookEvent.ClassifyRunProcessed | Extend.WebhookEvent.ClassifyRunFailed | Extend.WebhookEvent.SplitRunProcessed | Extend.WebhookEvent.SplitRunFailed | Extend.WebhookEvent.BatchProcessorRunProcessed | Extend.WebhookEvent.BatchProcessorRunFailed | Extend.WebhookEvent.BatchParseRunProcessed | Extend.WebhookEvent.BatchParseRunFailed | Extend.WebhookEvent.ParseRunProcessed | Extend.WebhookEvent.ParseRunFailed | Extend.WebhookEvent.EditRunProcessed | Extend.WebhookEvent.EditRunFailed | Extend.WebhookEvent.WorkflowCreated | Extend.WebhookEvent.WorkflowDeployed | Extend.WebhookEvent.WorkflowDeleted | Extend.WebhookEvent.ExtractorCreated | Extend.WebhookEvent.ExtractorUpdated | Extend.WebhookEvent.ExtractorDeleted | Extend.WebhookEvent.ExtractorDraftUpdated | Extend.WebhookEvent.ExtractorVersionPublished | Extend.WebhookEvent.ClassifierCreated | Extend.WebhookEvent.ClassifierUpdated | Extend.WebhookEvent.ClassifierDeleted | Extend.WebhookEvent.ClassifierDraftUpdated | Extend.WebhookEvent.ClassifierVersionPublished | Extend.WebhookEvent.SplitterCreated | Extend.WebhookEvent.SplitterUpdated | Extend.WebhookEvent.SplitterDeleted | Extend.WebhookEvent.SplitterDraftUpdated | Extend.WebhookEvent.SplitterVersionPublished;
|
|
23
23
|
export declare namespace WebhookEvent {
|
|
24
24
|
interface WorkflowRunCompleted extends Extend.WorkflowRunCompletedWebhookEvent {
|
|
25
25
|
eventType: "workflow_run.completed";
|
|
@@ -63,6 +63,12 @@ export declare namespace WebhookEvent {
|
|
|
63
63
|
interface BatchProcessorRunFailed extends Extend.BatchProcessorRunFailedWebhookEvent {
|
|
64
64
|
eventType: "batch_processor_run.failed";
|
|
65
65
|
}
|
|
66
|
+
interface BatchParseRunProcessed extends Extend.BatchParseRunCompletedWebhookEvent {
|
|
67
|
+
eventType: "batch_parse_run.processed";
|
|
68
|
+
}
|
|
69
|
+
interface BatchParseRunFailed extends Extend.BatchParseRunFailedWebhookEvent {
|
|
70
|
+
eventType: "batch_parse_run.failed";
|
|
71
|
+
}
|
|
66
72
|
interface ParseRunProcessed extends Extend.ParseRunProcessedWebhookEvent {
|
|
67
73
|
eventType: "parse_run.processed";
|
|
68
74
|
}
|
package/api/types/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from "./ApiVersionEnum";
|
|
|
3
3
|
export * from "./ArrayStrategy";
|
|
4
4
|
export * from "./ArrayStrategyType";
|
|
5
5
|
export * from "./BarcodeDetails";
|
|
6
|
+
export * from "./BatchParseRunCompletedWebhookEvent";
|
|
7
|
+
export * from "./BatchParseRunFailedWebhookEvent";
|
|
6
8
|
export * from "./BatchProcessorRunCompletedWebhookEvent";
|
|
7
9
|
export * from "./BatchProcessorRunFailedWebhookEvent";
|
|
8
10
|
export * from "./BatchRun";
|
package/api/types/index.js
CHANGED
|
@@ -19,6 +19,8 @@ __exportStar(require("./ApiVersionEnum"), exports);
|
|
|
19
19
|
__exportStar(require("./ArrayStrategy"), exports);
|
|
20
20
|
__exportStar(require("./ArrayStrategyType"), exports);
|
|
21
21
|
__exportStar(require("./BarcodeDetails"), exports);
|
|
22
|
+
__exportStar(require("./BatchParseRunCompletedWebhookEvent"), exports);
|
|
23
|
+
__exportStar(require("./BatchParseRunFailedWebhookEvent"), exports);
|
|
22
24
|
__exportStar(require("./BatchProcessorRunCompletedWebhookEvent"), exports);
|
|
23
25
|
__exportStar(require("./BatchProcessorRunFailedWebhookEvent"), exports);
|
|
24
26
|
__exportStar(require("./BatchRun"), exports);
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -720,6 +720,73 @@ await client.files.upload(createReadStream("path/to/file"), {});
|
|
|
720
720
|
</details>
|
|
721
721
|
|
|
722
722
|
## ParseRuns
|
|
723
|
+
<details><summary><code>client.parseRuns.<a href="/src/api/resources/parseRuns/client/Client.ts">list</a>({ ...params }) -> Extend.ParseRunsListResponse</code></summary>
|
|
724
|
+
<dl>
|
|
725
|
+
<dd>
|
|
726
|
+
|
|
727
|
+
#### 📝 Description
|
|
728
|
+
|
|
729
|
+
<dl>
|
|
730
|
+
<dd>
|
|
731
|
+
|
|
732
|
+
<dl>
|
|
733
|
+
<dd>
|
|
734
|
+
|
|
735
|
+
List parse runs, with optional filters for status, batch ID, and file name.
|
|
736
|
+
|
|
737
|
+
Returns a paginated list of parse runs. Use `GET /parse_runs/{id}` to retrieve the full result including output for a specific run.
|
|
738
|
+
</dd>
|
|
739
|
+
</dl>
|
|
740
|
+
</dd>
|
|
741
|
+
</dl>
|
|
742
|
+
|
|
743
|
+
#### 🔌 Usage
|
|
744
|
+
|
|
745
|
+
<dl>
|
|
746
|
+
<dd>
|
|
747
|
+
|
|
748
|
+
<dl>
|
|
749
|
+
<dd>
|
|
750
|
+
|
|
751
|
+
```typescript
|
|
752
|
+
await client.parseRuns.list({
|
|
753
|
+
nextPageToken: "xK9mLPqRtN3vS8wF5hB2cQ==:zWvUxYjM4nKpL7aDgE9HbTcR2mAyX3/Q+CNkfBSw1dZ="
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
```
|
|
757
|
+
</dd>
|
|
758
|
+
</dl>
|
|
759
|
+
</dd>
|
|
760
|
+
</dl>
|
|
761
|
+
|
|
762
|
+
#### ⚙️ Parameters
|
|
763
|
+
|
|
764
|
+
<dl>
|
|
765
|
+
<dd>
|
|
766
|
+
|
|
767
|
+
<dl>
|
|
768
|
+
<dd>
|
|
769
|
+
|
|
770
|
+
**request:** `Extend.ParseRunsListRequest`
|
|
771
|
+
|
|
772
|
+
</dd>
|
|
773
|
+
</dl>
|
|
774
|
+
|
|
775
|
+
<dl>
|
|
776
|
+
<dd>
|
|
777
|
+
|
|
778
|
+
**requestOptions:** `ParseRunsClient.RequestOptions`
|
|
779
|
+
|
|
780
|
+
</dd>
|
|
781
|
+
</dl>
|
|
782
|
+
</dd>
|
|
783
|
+
</dl>
|
|
784
|
+
|
|
785
|
+
|
|
786
|
+
</dd>
|
|
787
|
+
</dl>
|
|
788
|
+
</details>
|
|
789
|
+
|
|
723
790
|
<details><summary><code>client.parseRuns.<a href="/src/api/resources/parseRuns/client/Client.ts">create</a>({ ...params }) -> Extend.ParseRun</code></summary>
|
|
724
791
|
<dl>
|
|
725
792
|
<dd>
|
|
@@ -942,6 +1009,102 @@ Example: `"pr_xK9mLPqRtN3vS8wF5hB2cQ"`
|
|
|
942
1009
|
</dl>
|
|
943
1010
|
|
|
944
1011
|
|
|
1012
|
+
</dd>
|
|
1013
|
+
</dl>
|
|
1014
|
+
</details>
|
|
1015
|
+
|
|
1016
|
+
<details><summary><code>client.parseRuns.<a href="/src/api/resources/parseRuns/client/Client.ts">createBatch</a>({ ...params }) -> Extend.BatchRun</code></summary>
|
|
1017
|
+
<dl>
|
|
1018
|
+
<dd>
|
|
1019
|
+
|
|
1020
|
+
#### 📝 Description
|
|
1021
|
+
|
|
1022
|
+
<dl>
|
|
1023
|
+
<dd>
|
|
1024
|
+
|
|
1025
|
+
<dl>
|
|
1026
|
+
<dd>
|
|
1027
|
+
|
|
1028
|
+
Submit up to **1,000 files** for parsing in a single request. Each file is processed as an independent parse run using the same configuration.
|
|
1029
|
+
|
|
1030
|
+
Unlike the single [Parse File (Async)](https://docs.extend.ai/2026-02-09/developers/api-reference/endpoints/parse/create-parse-run) endpoint, this batch endpoint accepts an `inputs` array and immediately returns a `BatchRun` object containing a batch `id` and a `PENDING` status. The individual runs are then queued and processed asynchronously.
|
|
1031
|
+
|
|
1032
|
+
**Monitoring results:**
|
|
1033
|
+
- **Webhooks (recommended):** Subscribe to `batch_parse_run.processed` and `batch_parse_run.failed` events. The webhook payload indicates the batch has finished — fetch individual run results using `GET /parse_runs?batchId={id}`.
|
|
1034
|
+
- **Polling:** Call `GET /batch_runs/{id}` to check the overall batch status, and use `GET /parse_runs?batchId={id}` to retrieve individual run results.
|
|
1035
|
+
|
|
1036
|
+
**Notes:**
|
|
1037
|
+
- `inputs` must contain between 1 and 1,000 items.
|
|
1038
|
+
- File input supports URLs, Extend file IDs, and raw text strings.
|
|
1039
|
+
</dd>
|
|
1040
|
+
</dl>
|
|
1041
|
+
</dd>
|
|
1042
|
+
</dl>
|
|
1043
|
+
|
|
1044
|
+
#### 🔌 Usage
|
|
1045
|
+
|
|
1046
|
+
<dl>
|
|
1047
|
+
<dd>
|
|
1048
|
+
|
|
1049
|
+
<dl>
|
|
1050
|
+
<dd>
|
|
1051
|
+
|
|
1052
|
+
```typescript
|
|
1053
|
+
await client.parseRuns.createBatch({
|
|
1054
|
+
inputs: [{
|
|
1055
|
+
file: {
|
|
1056
|
+
url: "https://example.com/document1.pdf"
|
|
1057
|
+
},
|
|
1058
|
+
metadata: {
|
|
1059
|
+
"customerId": "cust_abc123"
|
|
1060
|
+
}
|
|
1061
|
+
}, {
|
|
1062
|
+
file: {
|
|
1063
|
+
url: "https://example.com/document2.pdf"
|
|
1064
|
+
},
|
|
1065
|
+
metadata: {
|
|
1066
|
+
"customerId": "cust_def456"
|
|
1067
|
+
}
|
|
1068
|
+
}, {
|
|
1069
|
+
file: {
|
|
1070
|
+
text: "This is some raw text to parse."
|
|
1071
|
+
},
|
|
1072
|
+
metadata: {
|
|
1073
|
+
"source": "manual-entry"
|
|
1074
|
+
}
|
|
1075
|
+
}]
|
|
1076
|
+
});
|
|
1077
|
+
|
|
1078
|
+
```
|
|
1079
|
+
</dd>
|
|
1080
|
+
</dl>
|
|
1081
|
+
</dd>
|
|
1082
|
+
</dl>
|
|
1083
|
+
|
|
1084
|
+
#### ⚙️ Parameters
|
|
1085
|
+
|
|
1086
|
+
<dl>
|
|
1087
|
+
<dd>
|
|
1088
|
+
|
|
1089
|
+
<dl>
|
|
1090
|
+
<dd>
|
|
1091
|
+
|
|
1092
|
+
**request:** `Extend.ParseRunsCreateBatchRequest`
|
|
1093
|
+
|
|
1094
|
+
</dd>
|
|
1095
|
+
</dl>
|
|
1096
|
+
|
|
1097
|
+
<dl>
|
|
1098
|
+
<dd>
|
|
1099
|
+
|
|
1100
|
+
**requestOptions:** `ParseRunsClient.RequestOptions`
|
|
1101
|
+
|
|
1102
|
+
</dd>
|
|
1103
|
+
</dl>
|
|
1104
|
+
</dd>
|
|
1105
|
+
</dl>
|
|
1106
|
+
|
|
1107
|
+
|
|
945
1108
|
</dd>
|
|
946
1109
|
</dl>
|
|
947
1110
|
</details>
|
|
@@ -6269,7 +6432,7 @@ Example: `"bpr_Xj8mK2pL9nR4vT7qY5wZ"`
|
|
|
6269
6432
|
|
|
6270
6433
|
Retrieve the status of a batch run by its ID. The `status` field reflects the aggregate state of the batch.
|
|
6271
6434
|
|
|
6272
|
-
This is a unified endpoint that works for batches created via any of the batch submission endpoints (`POST /extract_runs/batch`, `POST /classify_runs/batch`, `POST /split_runs/batch`).
|
|
6435
|
+
This is a unified endpoint that works for batches created via any of the batch submission endpoints (`POST /parse_runs/batch`, `POST /extract_runs/batch`, `POST /classify_runs/batch`, `POST /split_runs/batch`).
|
|
6273
6436
|
|
|
6274
6437
|
| Status | Meaning |
|
|
6275
6438
|
|---|---|
|
|
@@ -6279,7 +6442,8 @@ This is a unified endpoint that works for batches created via any of the batch s
|
|
|
6279
6442
|
| `FAILED` | The batch encountered a fatal error |
|
|
6280
6443
|
| `CANCELLED` | The batch was cancelled |
|
|
6281
6444
|
|
|
6282
|
-
To retrieve individual run results, use the List endpoint for the relevant
|
|
6445
|
+
To retrieve individual run results, use the List endpoint for the relevant type filtered by `batchId`:
|
|
6446
|
+
- `GET /parse_runs?batchId={id}`
|
|
6283
6447
|
- `GET /extract_runs?batchId={id}`
|
|
6284
6448
|
- `GET /classify_runs?batchId={id}`
|
|
6285
6449
|
- `GET /split_runs?batchId={id}`
|
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.
|
|
1
|
+
export declare const SDK_VERSION = "1.9.0";
|
package/version.js
CHANGED