unstructured-transform-client 0.18.18

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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +210 -0
  3. package/dist/_generated/apis/ExtractApi.d.ts +43 -0
  4. package/dist/_generated/apis/ExtractApi.js +70 -0
  5. package/dist/_generated/apis/JobsApi.d.ts +117 -0
  6. package/dist/_generated/apis/JobsApi.js +211 -0
  7. package/dist/_generated/apis/ParseApi.d.ts +79 -0
  8. package/dist/_generated/apis/ParseApi.js +111 -0
  9. package/dist/_generated/apis/UploadApi.d.ts +78 -0
  10. package/dist/_generated/apis/UploadApi.js +172 -0
  11. package/dist/_generated/apis/index.d.ts +4 -0
  12. package/dist/_generated/apis/index.js +6 -0
  13. package/dist/_generated/index.d.ts +3 -0
  14. package/dist/_generated/index.js +5 -0
  15. package/dist/_generated/models/Citation.d.ts +31 -0
  16. package/dist/_generated/models/Citation.js +44 -0
  17. package/dist/_generated/models/DocumentMetadata.d.ts +30 -0
  18. package/dist/_generated/models/DocumentMetadata.js +43 -0
  19. package/dist/_generated/models/Element.d.ts +43 -0
  20. package/dist/_generated/models/Element.js +56 -0
  21. package/dist/_generated/models/ElementMetadata.d.ts +40 -0
  22. package/dist/_generated/models/ElementMetadata.js +51 -0
  23. package/dist/_generated/models/ErrorCode.d.ts +46 -0
  24. package/dist/_generated/models/ErrorCode.js +64 -0
  25. package/dist/_generated/models/ExtractRequest.d.ts +40 -0
  26. package/dist/_generated/models/ExtractRequest.js +49 -0
  27. package/dist/_generated/models/ExtractionResult.d.ts +37 -0
  28. package/dist/_generated/models/ExtractionResult.js +47 -0
  29. package/dist/_generated/models/FieldMetadata.d.ts +31 -0
  30. package/dist/_generated/models/FieldMetadata.js +42 -0
  31. package/dist/_generated/models/JobAccepted.d.ts +67 -0
  32. package/dist/_generated/models/JobAccepted.js +73 -0
  33. package/dist/_generated/models/JobOperation.d.ts +25 -0
  34. package/dist/_generated/models/JobOperation.js +43 -0
  35. package/dist/_generated/models/JobPage.d.ts +35 -0
  36. package/dist/_generated/models/JobPage.js +48 -0
  37. package/dist/_generated/models/JobResult.d.ts +61 -0
  38. package/dist/_generated/models/JobResult.js +64 -0
  39. package/dist/_generated/models/JobResultState.d.ts +26 -0
  40. package/dist/_generated/models/JobResultState.js +44 -0
  41. package/dist/_generated/models/JobStatus.d.ts +29 -0
  42. package/dist/_generated/models/JobStatus.js +47 -0
  43. package/dist/_generated/models/JobSummary.d.ts +74 -0
  44. package/dist/_generated/models/JobSummary.js +86 -0
  45. package/dist/_generated/models/Locator.d.ts +45 -0
  46. package/dist/_generated/models/Locator.js +57 -0
  47. package/dist/_generated/models/ModelError.d.ts +35 -0
  48. package/dist/_generated/models/ModelError.js +48 -0
  49. package/dist/_generated/models/OutputFormat.d.ts +25 -0
  50. package/dist/_generated/models/OutputFormat.js +43 -0
  51. package/dist/_generated/models/ParseResult.d.ts +87 -0
  52. package/dist/_generated/models/ParseResult.js +98 -0
  53. package/dist/_generated/models/SourceFile.d.ts +42 -0
  54. package/dist/_generated/models/SourceFile.js +56 -0
  55. package/dist/_generated/models/TransformStatus.d.ts +26 -0
  56. package/dist/_generated/models/TransformStatus.js +44 -0
  57. package/dist/_generated/models/TransformWarning.d.ts +34 -0
  58. package/dist/_generated/models/TransformWarning.js +47 -0
  59. package/dist/_generated/models/UploadResult.d.ts +38 -0
  60. package/dist/_generated/models/UploadResult.js +52 -0
  61. package/dist/_generated/models/index.d.ts +23 -0
  62. package/dist/_generated/models/index.js +25 -0
  63. package/dist/_generated/runtime.d.ts +196 -0
  64. package/dist/_generated/runtime.js +398 -0
  65. package/dist/client.d.ts +145 -0
  66. package/dist/client.js +259 -0
  67. package/dist/files.d.ts +32 -0
  68. package/dist/files.js +46 -0
  69. package/dist/hostHeaders.d.ts +36 -0
  70. package/dist/hostHeaders.js +133 -0
  71. package/dist/index.d.ts +26 -0
  72. package/dist/index.js +35 -0
  73. package/dist/multipart.d.ts +50 -0
  74. package/dist/multipart.js +65 -0
  75. package/dist/outcome.d.ts +45 -0
  76. package/dist/outcome.js +40 -0
  77. package/dist/retry.d.ts +16 -0
  78. package/dist/retry.js +181 -0
  79. package/dist/sse.d.ts +50 -0
  80. package/dist/sse.js +140 -0
  81. package/dist/version.d.ts +10 -0
  82. package/dist/version.js +10 -0
  83. package/package.json +41 -0
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime.js';
13
+ import { type OutputFormat } from '../models/OutputFormat.js';
14
+ import { type ParseResult } from '../models/ParseResult.js';
15
+ export interface ParseRunRequest {
16
+ /**
17
+ * Wait up to this many seconds for a completed parse.
18
+ */
19
+ prefer?: string;
20
+ /**
21
+ * Optional list of projection fields to include in elements output. Allowed values are 'coordinates' and 'table_html'. Only valid when output='elements'.
22
+ */
23
+ include?: Array<string>;
24
+ /**
25
+ * The document to parse. Required if file_id is not provided.
26
+ */
27
+ input?: Blob;
28
+ /**
29
+ * The ID of a previously uploaded file. Required if input is not provided.
30
+ */
31
+ fileId?: string;
32
+ /**
33
+ * The original filename to attach to the job when parsing a previously uploaded file.
34
+ */
35
+ filename?: string;
36
+ /**
37
+ *
38
+ */
39
+ output?: OutputFormat;
40
+ /**
41
+ * Optional JSON Schema, as a JSON string, describing fields to extract. Its presence switches parse-only to parse-then-extract.
42
+ */
43
+ schema?: string;
44
+ /**
45
+ * Optional free-text guidance that shapes how extracted fields are filled when schema is supplied. Limited to 1,048,576 bytes when encoded as UTF-8.
46
+ */
47
+ prompt?: string;
48
+ /**
49
+ * Optional customer-facing outcome profile. Omit it to use the current deployment default, balanced, or select one explicitly.
50
+ */
51
+ profile?: ParseRunProfileEnum;
52
+ }
53
+ /**
54
+ *
55
+ */
56
+ export declare class ParseApi extends runtime.BaseAPI {
57
+ /**
58
+ * Creates request options for parseRun without sending the request
59
+ */
60
+ parseRunRequestOpts(requestParameters: ParseRunRequest): Promise<runtime.RequestOpts>;
61
+ /**
62
+ * Give us a document, get the parsed document back. For progress while a document processes, send Prefer wait=0, then open the 202\'s Location URL with Accept text/event-stream. Supplying schema adds an extraction step to the same job, so the document is parsed once. profile is optional; omitting it defaults to balanced. input is limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
63
+ * Parse a document
64
+ */
65
+ parseRunRaw(requestParameters: ParseRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ParseResult>>;
66
+ /**
67
+ * Give us a document, get the parsed document back. For progress while a document processes, send Prefer wait=0, then open the 202\'s Location URL with Accept text/event-stream. Supplying schema adds an extraction step to the same job, so the document is parsed once. profile is optional; omitting it defaults to balanced. input is limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
68
+ * Parse a document
69
+ */
70
+ parseRun(requestParameters?: ParseRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ParseResult>;
71
+ }
72
+ /**
73
+ * @export
74
+ */
75
+ export declare const ParseRunProfileEnum: {
76
+ readonly Balanced: "balanced";
77
+ readonly Best: "best";
78
+ };
79
+ export type ParseRunProfileEnum = typeof ParseRunProfileEnum[keyof typeof ParseRunProfileEnum];
@@ -0,0 +1,111 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Unstructured Transform API
5
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ import * as runtime from '../runtime.js';
15
+ import { ParseResultFromJSON, } from '../models/ParseResult.js';
16
+ /**
17
+ *
18
+ */
19
+ export class ParseApi extends runtime.BaseAPI {
20
+ /**
21
+ * Creates request options for parseRun without sending the request
22
+ */
23
+ async parseRunRequestOpts(requestParameters) {
24
+ const queryParameters = {};
25
+ if (requestParameters['include'] != null) {
26
+ queryParameters['include'] = requestParameters['include'];
27
+ }
28
+ const headerParameters = {};
29
+ if (requestParameters['prefer'] != null) {
30
+ headerParameters['Prefer'] = String(requestParameters['prefer']);
31
+ }
32
+ if (this.configuration && this.configuration.apiKey) {
33
+ headerParameters["unstructured-api-key"] = await this.configuration.apiKey("unstructured-api-key"); // ApiKeyAuth authentication
34
+ }
35
+ if (this.configuration && this.configuration.accessToken) {
36
+ const token = this.configuration.accessToken;
37
+ const tokenString = await token("BearerAuth", []);
38
+ if (tokenString) {
39
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
40
+ }
41
+ }
42
+ const consumes = [
43
+ { contentType: 'multipart/form-data' },
44
+ ];
45
+ // @ts-ignore: canConsumeForm may be unused
46
+ const canConsumeForm = runtime.canConsumeForm(consumes);
47
+ let formParams;
48
+ let useForm = false;
49
+ // use FormData to transmit files using content-type "multipart/form-data"
50
+ useForm = canConsumeForm;
51
+ if (useForm) {
52
+ formParams = new FormData();
53
+ }
54
+ else {
55
+ formParams = new URLSearchParams();
56
+ }
57
+ if (requestParameters['input'] != null) {
58
+ formParams.append('input', requestParameters['input']);
59
+ }
60
+ if (requestParameters['fileId'] != null) {
61
+ formParams.append('file_id', requestParameters['fileId']);
62
+ }
63
+ if (requestParameters['filename'] != null) {
64
+ formParams.append('filename', requestParameters['filename']);
65
+ }
66
+ if (requestParameters['output'] != null) {
67
+ formParams.append('output', requestParameters['output']);
68
+ }
69
+ if (requestParameters['schema'] != null) {
70
+ formParams.append('schema', requestParameters['schema']);
71
+ }
72
+ if (requestParameters['prompt'] != null) {
73
+ formParams.append('prompt', requestParameters['prompt']);
74
+ }
75
+ if (requestParameters['profile'] != null) {
76
+ formParams.append('profile', requestParameters['profile']);
77
+ }
78
+ let urlPath = `/api/v2/parse`;
79
+ return {
80
+ path: urlPath,
81
+ method: 'POST',
82
+ headers: headerParameters,
83
+ query: queryParameters,
84
+ body: formParams,
85
+ };
86
+ }
87
+ /**
88
+ * Give us a document, get the parsed document back. For progress while a document processes, send Prefer wait=0, then open the 202\'s Location URL with Accept text/event-stream. Supplying schema adds an extraction step to the same job, so the document is parsed once. profile is optional; omitting it defaults to balanced. input is limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
89
+ * Parse a document
90
+ */
91
+ async parseRunRaw(requestParameters, initOverrides) {
92
+ const requestOptions = await this.parseRunRequestOpts(requestParameters);
93
+ const response = await this.request(requestOptions, initOverrides);
94
+ return new runtime.JSONApiResponse(response, (jsonValue) => ParseResultFromJSON(jsonValue));
95
+ }
96
+ /**
97
+ * Give us a document, get the parsed document back. For progress while a document processes, send Prefer wait=0, then open the 202\'s Location URL with Accept text/event-stream. Supplying schema adds an extraction step to the same job, so the document is parsed once. profile is optional; omitting it defaults to balanced. input is limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
98
+ * Parse a document
99
+ */
100
+ async parseRun(requestParameters = {}, initOverrides) {
101
+ const response = await this.parseRunRaw(requestParameters, initOverrides);
102
+ return await response.value();
103
+ }
104
+ }
105
+ /**
106
+ * @export
107
+ */
108
+ export const ParseRunProfileEnum = {
109
+ Balanced: 'balanced',
110
+ Best: 'best',
111
+ };
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime.js';
13
+ import { type UploadResult } from '../models/UploadResult.js';
14
+ export interface UploadDeleteRequest {
15
+ /**
16
+ * The ID of the uploaded file.
17
+ */
18
+ fileId: string;
19
+ }
20
+ export interface UploadGetRequest {
21
+ /**
22
+ * The ID of the uploaded file.
23
+ */
24
+ fileId: string;
25
+ }
26
+ export interface UploadRunRequest {
27
+ /**
28
+ * The document to upload.
29
+ */
30
+ file: Blob;
31
+ }
32
+ /**
33
+ *
34
+ */
35
+ export declare class UploadApi extends runtime.BaseAPI {
36
+ /**
37
+ * Creates request options for uploadDelete without sending the request
38
+ */
39
+ uploadDeleteRequestOpts(requestParameters: UploadDeleteRequest): Promise<runtime.RequestOpts>;
40
+ /**
41
+ * Delete a file from scratch storage before it expires. Idempotent: a file id that is already deleted or was never valid also returns 204. Deleting a source file does not delete jobs or results that reference it. If a queued job has not consumed the source yet, deleting the file may cause that job to fail.
42
+ * Delete an uploaded file
43
+ */
44
+ uploadDeleteRaw(requestParameters: UploadDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
45
+ /**
46
+ * Delete a file from scratch storage before it expires. Idempotent: a file id that is already deleted or was never valid also returns 204. Deleting a source file does not delete jobs or results that reference it. If a queued job has not consumed the source yet, deleting the file may cause that job to fail.
47
+ * Delete an uploaded file
48
+ */
49
+ uploadDelete(requestParameters: UploadDeleteRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
50
+ /**
51
+ * Creates request options for uploadGet without sending the request
52
+ */
53
+ uploadGetRequestOpts(requestParameters: UploadGetRequest): Promise<runtime.RequestOpts>;
54
+ /**
55
+ * Retrieve a file previously uploaded to scratch storage.
56
+ * Get an uploaded file
57
+ */
58
+ uploadGetRaw(requestParameters: UploadGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Blob>>;
59
+ /**
60
+ * Retrieve a file previously uploaded to scratch storage.
61
+ * Get an uploaded file
62
+ */
63
+ uploadGet(requestParameters: UploadGetRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Blob>;
64
+ /**
65
+ * Creates request options for uploadRun without sending the request
66
+ */
67
+ uploadRunRequestOpts(requestParameters: UploadRunRequest): Promise<runtime.RequestOpts>;
68
+ /**
69
+ * Upload a file to 24-hour scratch storage for subsequent parse/extract operations. Direct raw Parse and raw-document Extract inputs are materialized through this same storage with the same expiry and deletion behavior. Limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
70
+ * Upload a file
71
+ */
72
+ uploadRunRaw(requestParameters: UploadRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<UploadResult>>;
73
+ /**
74
+ * Upload a file to 24-hour scratch storage for subsequent parse/extract operations. Direct raw Parse and raw-document Extract inputs are materialized through this same storage with the same expiry and deletion behavior. Limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
75
+ * Upload a file
76
+ */
77
+ uploadRun(requestParameters: UploadRunRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<UploadResult>;
78
+ }
@@ -0,0 +1,172 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Unstructured Transform API
5
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ import * as runtime from '../runtime.js';
15
+ import { UploadResultFromJSON, } from '../models/UploadResult.js';
16
+ /**
17
+ *
18
+ */
19
+ export class UploadApi extends runtime.BaseAPI {
20
+ /**
21
+ * Creates request options for uploadDelete without sending the request
22
+ */
23
+ async uploadDeleteRequestOpts(requestParameters) {
24
+ if (requestParameters['fileId'] == null) {
25
+ throw new runtime.RequiredError('fileId', 'Required parameter "fileId" was null or undefined when calling uploadDelete().');
26
+ }
27
+ const queryParameters = {};
28
+ const headerParameters = {};
29
+ if (this.configuration && this.configuration.apiKey) {
30
+ headerParameters["unstructured-api-key"] = await this.configuration.apiKey("unstructured-api-key"); // ApiKeyAuth authentication
31
+ }
32
+ if (this.configuration && this.configuration.accessToken) {
33
+ const token = this.configuration.accessToken;
34
+ const tokenString = await token("BearerAuth", []);
35
+ if (tokenString) {
36
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
37
+ }
38
+ }
39
+ let urlPath = `/api/v2/upload/{fileId}`;
40
+ urlPath = urlPath.replace('{fileId}', encodeURIComponent(String(requestParameters['fileId'])));
41
+ return {
42
+ path: urlPath,
43
+ method: 'DELETE',
44
+ headers: headerParameters,
45
+ query: queryParameters,
46
+ };
47
+ }
48
+ /**
49
+ * Delete a file from scratch storage before it expires. Idempotent: a file id that is already deleted or was never valid also returns 204. Deleting a source file does not delete jobs or results that reference it. If a queued job has not consumed the source yet, deleting the file may cause that job to fail.
50
+ * Delete an uploaded file
51
+ */
52
+ async uploadDeleteRaw(requestParameters, initOverrides) {
53
+ const requestOptions = await this.uploadDeleteRequestOpts(requestParameters);
54
+ const response = await this.request(requestOptions, initOverrides);
55
+ return new runtime.VoidApiResponse(response);
56
+ }
57
+ /**
58
+ * Delete a file from scratch storage before it expires. Idempotent: a file id that is already deleted or was never valid also returns 204. Deleting a source file does not delete jobs or results that reference it. If a queued job has not consumed the source yet, deleting the file may cause that job to fail.
59
+ * Delete an uploaded file
60
+ */
61
+ async uploadDelete(requestParameters, initOverrides) {
62
+ await this.uploadDeleteRaw(requestParameters, initOverrides);
63
+ }
64
+ /**
65
+ * Creates request options for uploadGet without sending the request
66
+ */
67
+ async uploadGetRequestOpts(requestParameters) {
68
+ if (requestParameters['fileId'] == null) {
69
+ throw new runtime.RequiredError('fileId', 'Required parameter "fileId" was null or undefined when calling uploadGet().');
70
+ }
71
+ const queryParameters = {};
72
+ const headerParameters = {};
73
+ if (this.configuration && this.configuration.apiKey) {
74
+ headerParameters["unstructured-api-key"] = await this.configuration.apiKey("unstructured-api-key"); // ApiKeyAuth authentication
75
+ }
76
+ if (this.configuration && this.configuration.accessToken) {
77
+ const token = this.configuration.accessToken;
78
+ const tokenString = await token("BearerAuth", []);
79
+ if (tokenString) {
80
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
81
+ }
82
+ }
83
+ let urlPath = `/api/v2/upload/{fileId}`;
84
+ urlPath = urlPath.replace('{fileId}', encodeURIComponent(String(requestParameters['fileId'])));
85
+ return {
86
+ path: urlPath,
87
+ method: 'GET',
88
+ headers: headerParameters,
89
+ query: queryParameters,
90
+ };
91
+ }
92
+ /**
93
+ * Retrieve a file previously uploaded to scratch storage.
94
+ * Get an uploaded file
95
+ */
96
+ async uploadGetRaw(requestParameters, initOverrides) {
97
+ const requestOptions = await this.uploadGetRequestOpts(requestParameters);
98
+ const response = await this.request(requestOptions, initOverrides);
99
+ return new runtime.BlobApiResponse(response);
100
+ }
101
+ /**
102
+ * Retrieve a file previously uploaded to scratch storage.
103
+ * Get an uploaded file
104
+ */
105
+ async uploadGet(requestParameters, initOverrides) {
106
+ const response = await this.uploadGetRaw(requestParameters, initOverrides);
107
+ return await response.value();
108
+ }
109
+ /**
110
+ * Creates request options for uploadRun without sending the request
111
+ */
112
+ async uploadRunRequestOpts(requestParameters) {
113
+ if (requestParameters['file'] == null) {
114
+ throw new runtime.RequiredError('file', 'Required parameter "file" was null or undefined when calling uploadRun().');
115
+ }
116
+ const queryParameters = {};
117
+ const headerParameters = {};
118
+ if (this.configuration && this.configuration.apiKey) {
119
+ headerParameters["unstructured-api-key"] = await this.configuration.apiKey("unstructured-api-key"); // ApiKeyAuth authentication
120
+ }
121
+ if (this.configuration && this.configuration.accessToken) {
122
+ const token = this.configuration.accessToken;
123
+ const tokenString = await token("BearerAuth", []);
124
+ if (tokenString) {
125
+ headerParameters["Authorization"] = `Bearer ${tokenString}`;
126
+ }
127
+ }
128
+ const consumes = [
129
+ { contentType: 'multipart/form-data' },
130
+ ];
131
+ // @ts-ignore: canConsumeForm may be unused
132
+ const canConsumeForm = runtime.canConsumeForm(consumes);
133
+ let formParams;
134
+ let useForm = false;
135
+ // use FormData to transmit files using content-type "multipart/form-data"
136
+ useForm = canConsumeForm;
137
+ if (useForm) {
138
+ formParams = new FormData();
139
+ }
140
+ else {
141
+ formParams = new URLSearchParams();
142
+ }
143
+ if (requestParameters['file'] != null) {
144
+ formParams.append('file', requestParameters['file']);
145
+ }
146
+ let urlPath = `/api/v2/upload`;
147
+ return {
148
+ path: urlPath,
149
+ method: 'POST',
150
+ headers: headerParameters,
151
+ query: queryParameters,
152
+ body: formParams,
153
+ };
154
+ }
155
+ /**
156
+ * Upload a file to 24-hour scratch storage for subsequent parse/extract operations. Direct raw Parse and raw-document Extract inputs are materialized through this same storage with the same expiry and deletion behavior. Limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
157
+ * Upload a file
158
+ */
159
+ async uploadRunRaw(requestParameters, initOverrides) {
160
+ const requestOptions = await this.uploadRunRequestOpts(requestParameters);
161
+ const response = await this.request(requestOptions, initOverrides);
162
+ return new runtime.JSONApiResponse(response, (jsonValue) => UploadResultFromJSON(jsonValue));
163
+ }
164
+ /**
165
+ * Upload a file to 24-hour scratch storage for subsequent parse/extract operations. Direct raw Parse and raw-document Extract inputs are materialized through this same storage with the same expiry and deletion behavior. Limited to 50 MB and to the supported extensions: bmp, docx, heic, jpeg, jpg, pdf, png, pptx, tiff.
166
+ * Upload a file
167
+ */
168
+ async uploadRun(requestParameters, initOverrides) {
169
+ const response = await this.uploadRunRaw(requestParameters, initOverrides);
170
+ return await response.value();
171
+ }
172
+ }
@@ -0,0 +1,4 @@
1
+ export * from './ExtractApi.js';
2
+ export * from './JobsApi.js';
3
+ export * from './ParseApi.js';
4
+ export * from './UploadApi.js';
@@ -0,0 +1,6 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export * from './ExtractApi.js';
4
+ export * from './JobsApi.js';
5
+ export * from './ParseApi.js';
6
+ export * from './UploadApi.js';
@@ -0,0 +1,3 @@
1
+ export * from './runtime.js';
2
+ export * from './apis/index.js';
3
+ export * from './models/index.js';
@@ -0,0 +1,5 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export * from './runtime.js';
4
+ export * from './apis/index.js';
5
+ export * from './models/index.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { Locator } from './Locator.js';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface Citation
17
+ */
18
+ export interface Citation {
19
+ /**
20
+ *
21
+ */
22
+ locators: Array<Locator>;
23
+ }
24
+ /**
25
+ * Check if a given object implements the Citation interface.
26
+ */
27
+ export declare function instanceOfCitation(value: object): value is Citation;
28
+ export declare function CitationFromJSON(json: any): Citation;
29
+ export declare function CitationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Citation;
30
+ export declare function CitationToJSON(json: any): Citation;
31
+ export declare function CitationToJSONTyped(value?: Citation | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,44 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Unstructured Transform API
5
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ import { LocatorFromJSON, LocatorToJSON, } from './Locator.js';
15
+ /**
16
+ * Check if a given object implements the Citation interface.
17
+ */
18
+ export function instanceOfCitation(value) {
19
+ if (!('locators' in value) || value['locators'] === undefined)
20
+ return false;
21
+ return true;
22
+ }
23
+ export function CitationFromJSON(json) {
24
+ return CitationFromJSONTyped(json, false);
25
+ }
26
+ export function CitationFromJSONTyped(json, ignoreDiscriminator) {
27
+ if (json == null) {
28
+ return json;
29
+ }
30
+ return {
31
+ 'locators': (json['locators'].map(LocatorFromJSON)),
32
+ };
33
+ }
34
+ export function CitationToJSON(json) {
35
+ return CitationToJSONTyped(json, false);
36
+ }
37
+ export function CitationToJSONTyped(value, ignoreDiscriminator = false) {
38
+ if (value == null) {
39
+ return value;
40
+ }
41
+ return {
42
+ 'locators': (value['locators'].map(LocatorToJSON)),
43
+ };
44
+ }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ /**
13
+ * Public document-level metadata.
14
+ * @export
15
+ * @interface DocumentMetadata
16
+ */
17
+ export interface DocumentMetadata {
18
+ /**
19
+ * Page count, when known.
20
+ */
21
+ pageCount: number | null;
22
+ }
23
+ /**
24
+ * Check if a given object implements the DocumentMetadata interface.
25
+ */
26
+ export declare function instanceOfDocumentMetadata(value: object): value is DocumentMetadata;
27
+ export declare function DocumentMetadataFromJSON(json: any): DocumentMetadata;
28
+ export declare function DocumentMetadataFromJSONTyped(json: any, ignoreDiscriminator: boolean): DocumentMetadata;
29
+ export declare function DocumentMetadataToJSON(json: any): DocumentMetadata;
30
+ export declare function DocumentMetadataToJSONTyped(value?: DocumentMetadata | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,43 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Unstructured Transform API
5
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ *
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * Check if a given object implements the DocumentMetadata interface.
16
+ */
17
+ export function instanceOfDocumentMetadata(value) {
18
+ if ((!('pageCount' in value) && !('page_count' in value)) || (value['pageCount'] === undefined && value['page_count'] === undefined))
19
+ return false;
20
+ return true;
21
+ }
22
+ export function DocumentMetadataFromJSON(json) {
23
+ return DocumentMetadataFromJSONTyped(json, false);
24
+ }
25
+ export function DocumentMetadataFromJSONTyped(json, ignoreDiscriminator) {
26
+ if (json == null) {
27
+ return json;
28
+ }
29
+ return {
30
+ 'pageCount': json['page_count'],
31
+ };
32
+ }
33
+ export function DocumentMetadataToJSON(json) {
34
+ return DocumentMetadataToJSONTyped(json, false);
35
+ }
36
+ export function DocumentMetadataToJSONTyped(value, ignoreDiscriminator = false) {
37
+ if (value == null) {
38
+ return value;
39
+ }
40
+ return {
41
+ 'page_count': value['pageCount'],
42
+ };
43
+ }
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Unstructured Transform API
3
+ * One document in, the parsed document back. A single call takes a document and returns structured output — no job graph, no strategy selection, no model provider setup, and no polling loop. An optional schema switches the request from parse-only to parse-then-extract.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import type { ElementMetadata } from './ElementMetadata.js';
13
+ /**
14
+ * A public document element.
15
+ * @export
16
+ * @interface Element
17
+ */
18
+ export interface Element {
19
+ /**
20
+ * Stable element identifier for this parse result.
21
+ */
22
+ elementId: string;
23
+ /**
24
+ * Public element type.
25
+ */
26
+ type: string;
27
+ /**
28
+ * Element text when present.
29
+ */
30
+ text: string | null;
31
+ /**
32
+ *
33
+ */
34
+ metadata: ElementMetadata;
35
+ }
36
+ /**
37
+ * Check if a given object implements the Element interface.
38
+ */
39
+ export declare function instanceOfElement(value: object): value is Element;
40
+ export declare function ElementFromJSON(json: any): Element;
41
+ export declare function ElementFromJSONTyped(json: any, ignoreDiscriminator: boolean): Element;
42
+ export declare function ElementToJSON(json: any): Element;
43
+ export declare function ElementToJSONTyped(value?: Element | null, ignoreDiscriminator?: boolean): any;