@nimble-way/nimble-js 0.19.0 → 1.0.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.
Files changed (255) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +10 -10
  3. package/client.d.mts +10 -39
  4. package/client.d.mts.map +1 -1
  5. package/client.d.ts +10 -39
  6. package/client.d.ts.map +1 -1
  7. package/client.js +8 -43
  8. package/client.js.map +1 -1
  9. package/client.mjs +8 -43
  10. package/client.mjs.map +1 -1
  11. package/package.json +1 -1
  12. package/resources/agents/agents.d.mts +811 -0
  13. package/resources/agents/agents.d.mts.map +1 -0
  14. package/resources/agents/agents.d.ts +811 -0
  15. package/resources/agents/agents.d.ts.map +1 -0
  16. package/resources/agents/agents.js +67 -0
  17. package/resources/agents/agents.js.map +1 -0
  18. package/resources/agents/agents.mjs +62 -0
  19. package/resources/agents/agents.mjs.map +1 -0
  20. package/resources/agents/index.d.mts +4 -0
  21. package/resources/agents/index.d.mts.map +1 -0
  22. package/resources/agents/index.d.ts +4 -0
  23. package/resources/agents/index.d.ts.map +1 -0
  24. package/resources/{task-agent → agents}/index.js +3 -3
  25. package/resources/agents/index.js.map +1 -0
  26. package/resources/{task-agent → agents}/index.mjs +1 -1
  27. package/resources/agents/index.mjs.map +1 -0
  28. package/resources/{task-agent → agents}/runs.d.mts +413 -128
  29. package/resources/agents/runs.d.mts.map +1 -0
  30. package/resources/{task-agent → agents}/runs.d.ts +413 -128
  31. package/resources/agents/runs.d.ts.map +1 -0
  32. package/resources/agents/runs.js +63 -0
  33. package/resources/agents/runs.js.map +1 -0
  34. package/resources/agents/runs.mjs +59 -0
  35. package/resources/agents/runs.mjs.map +1 -0
  36. package/resources/agents/templates.d.mts +258 -0
  37. package/resources/agents/templates.d.mts.map +1 -0
  38. package/resources/agents/templates.d.ts +258 -0
  39. package/resources/agents/templates.d.ts.map +1 -0
  40. package/resources/{task-agent → agents}/templates.js +5 -4
  41. package/resources/agents/templates.js.map +1 -0
  42. package/resources/agents/templates.mjs +19 -0
  43. package/resources/agents/templates.mjs.map +1 -0
  44. package/resources/agents.d.mts +2 -0
  45. package/resources/agents.d.mts.map +1 -0
  46. package/resources/agents.d.ts +2 -0
  47. package/resources/agents.d.ts.map +1 -0
  48. package/resources/{task-agent.js → agents.js} +2 -2
  49. package/resources/agents.js.map +1 -0
  50. package/resources/{task-agent.mjs → agents.mjs} +2 -2
  51. package/resources/agents.mjs.map +1 -0
  52. package/resources/batches.js +3 -3
  53. package/resources/batches.mjs +3 -3
  54. package/resources/crawl.js +4 -4
  55. package/resources/crawl.mjs +4 -4
  56. package/resources/domain-knowledge.js +1 -1
  57. package/resources/domain-knowledge.mjs +1 -1
  58. package/resources/extract/extract.d.mts +1243 -0
  59. package/resources/extract/extract.d.mts.map +1 -0
  60. package/resources/extract/extract.d.ts +1243 -0
  61. package/resources/extract/extract.d.ts.map +1 -0
  62. package/resources/extract/extract.js +52 -0
  63. package/resources/extract/extract.js.map +1 -0
  64. package/resources/extract/extract.mjs +47 -0
  65. package/resources/extract/extract.mjs.map +1 -0
  66. package/resources/extract/index.d.mts +3 -0
  67. package/resources/extract/index.d.mts.map +1 -0
  68. package/resources/extract/index.d.ts +3 -0
  69. package/resources/extract/index.d.ts.map +1 -0
  70. package/resources/extract/index.js +9 -0
  71. package/resources/extract/index.js.map +1 -0
  72. package/resources/extract/index.mjs +4 -0
  73. package/resources/extract/index.mjs.map +1 -0
  74. package/resources/extract/templates/generations.d.mts +364 -0
  75. package/resources/extract/templates/generations.d.mts.map +1 -0
  76. package/resources/extract/templates/generations.d.ts +364 -0
  77. package/resources/extract/templates/generations.d.ts.map +1 -0
  78. package/resources/extract/templates/generations.js +39 -0
  79. package/resources/extract/templates/generations.js.map +1 -0
  80. package/resources/extract/templates/generations.mjs +35 -0
  81. package/resources/extract/templates/generations.mjs.map +1 -0
  82. package/resources/extract/templates/index.d.mts +4 -0
  83. package/resources/extract/templates/index.d.mts.map +1 -0
  84. package/resources/extract/templates/index.d.ts +4 -0
  85. package/resources/extract/templates/index.d.ts.map +1 -0
  86. package/resources/extract/templates/index.js +11 -0
  87. package/resources/extract/templates/index.js.map +1 -0
  88. package/resources/extract/templates/index.mjs +5 -0
  89. package/resources/extract/templates/index.mjs.map +1 -0
  90. package/resources/{agent.d.ts → extract/templates/templates.d.mts} +475 -263
  91. package/resources/extract/templates/templates.d.mts.map +1 -0
  92. package/resources/{agent.d.mts → extract/templates/templates.d.ts} +475 -263
  93. package/resources/extract/templates/templates.d.ts.map +1 -0
  94. package/resources/extract/templates/templates.js +120 -0
  95. package/resources/extract/templates/templates.js.map +1 -0
  96. package/resources/extract/templates/templates.mjs +115 -0
  97. package/resources/extract/templates/templates.mjs.map +1 -0
  98. package/resources/extract/templates/versions.d.mts +226 -0
  99. package/resources/extract/templates/versions.d.mts.map +1 -0
  100. package/resources/extract/templates/versions.d.ts +226 -0
  101. package/resources/extract/templates/versions.d.ts.map +1 -0
  102. package/resources/extract/templates/versions.js +42 -0
  103. package/resources/extract/templates/versions.js.map +1 -0
  104. package/resources/extract/templates/versions.mjs +38 -0
  105. package/resources/extract/templates/versions.mjs.map +1 -0
  106. package/resources/extract/templates.d.mts +2 -0
  107. package/resources/extract/templates.d.mts.map +1 -0
  108. package/resources/extract/templates.d.ts +2 -0
  109. package/resources/extract/templates.d.ts.map +1 -0
  110. package/resources/extract/templates.js +6 -0
  111. package/resources/extract/templates.js.map +1 -0
  112. package/resources/extract/templates.mjs +3 -0
  113. package/resources/extract/templates.mjs.map +1 -0
  114. package/resources/extract.d.mts +2 -0
  115. package/resources/extract.d.mts.map +1 -0
  116. package/resources/extract.d.ts +2 -0
  117. package/resources/extract.d.ts.map +1 -0
  118. package/resources/extract.js +6 -0
  119. package/resources/extract.js.map +1 -0
  120. package/resources/extract.mjs +3 -0
  121. package/resources/extract.mjs.map +1 -0
  122. package/resources/fast-serp.js +1 -1
  123. package/resources/fast-serp.mjs +1 -1
  124. package/resources/index.d.mts +4 -4
  125. package/resources/index.d.mts.map +1 -1
  126. package/resources/index.d.ts +4 -4
  127. package/resources/index.d.ts.map +1 -1
  128. package/resources/index.js +5 -5
  129. package/resources/index.js.map +1 -1
  130. package/resources/index.mjs +2 -2
  131. package/resources/index.mjs.map +1 -1
  132. package/resources/jobs/index.d.mts +2 -2
  133. package/resources/jobs/index.d.mts.map +1 -1
  134. package/resources/jobs/index.d.ts +2 -2
  135. package/resources/jobs/index.d.ts.map +1 -1
  136. package/resources/jobs/index.js.map +1 -1
  137. package/resources/jobs/index.mjs.map +1 -1
  138. package/resources/jobs/jobs.d.mts +34 -90
  139. package/resources/jobs/jobs.d.mts.map +1 -1
  140. package/resources/jobs/jobs.d.ts +34 -90
  141. package/resources/jobs/jobs.d.ts.map +1 -1
  142. package/resources/jobs/jobs.js +10 -16
  143. package/resources/jobs/jobs.js.map +1 -1
  144. package/resources/jobs/jobs.mjs +11 -17
  145. package/resources/jobs/jobs.mjs.map +1 -1
  146. package/resources/jobs/runs/artifacts.d.mts +7 -17
  147. package/resources/jobs/runs/artifacts.d.mts.map +1 -1
  148. package/resources/jobs/runs/artifacts.d.ts +7 -17
  149. package/resources/jobs/runs/artifacts.d.ts.map +1 -1
  150. package/resources/jobs/runs/artifacts.js +8 -8
  151. package/resources/jobs/runs/artifacts.mjs +8 -8
  152. package/resources/jobs/runs/index.d.mts +1 -1
  153. package/resources/jobs/runs/index.d.mts.map +1 -1
  154. package/resources/jobs/runs/index.d.ts +1 -1
  155. package/resources/jobs/runs/index.d.ts.map +1 -1
  156. package/resources/jobs/runs/index.js.map +1 -1
  157. package/resources/jobs/runs/index.mjs.map +1 -1
  158. package/resources/jobs/runs/runs.d.mts +59 -21
  159. package/resources/jobs/runs/runs.d.mts.map +1 -1
  160. package/resources/jobs/runs/runs.d.ts +59 -21
  161. package/resources/jobs/runs/runs.d.ts.map +1 -1
  162. package/resources/jobs/runs/runs.js +12 -6
  163. package/resources/jobs/runs/runs.js.map +1 -1
  164. package/resources/jobs/runs/runs.mjs +12 -6
  165. package/resources/jobs/runs/runs.mjs.map +1 -1
  166. package/resources/media.js +2 -2
  167. package/resources/media.mjs +2 -2
  168. package/resources/serp.js +3 -3
  169. package/resources/serp.mjs +3 -3
  170. package/resources/tasks.js +3 -3
  171. package/resources/tasks.mjs +3 -3
  172. package/resources/top-level.d.mts +1 -1208
  173. package/resources/top-level.d.mts.map +1 -1
  174. package/resources/top-level.d.ts +1 -1208
  175. package/resources/top-level.d.ts.map +1 -1
  176. package/src/client.ts +41 -123
  177. package/src/resources/agents/agents.ts +1039 -0
  178. package/src/resources/agents/index.ts +30 -0
  179. package/src/resources/{task-agent → agents}/runs.ts +450 -154
  180. package/src/resources/agents/templates.ts +324 -0
  181. package/src/resources/{task-agent.ts → agents.ts} +1 -1
  182. package/src/resources/batches.ts +3 -3
  183. package/src/resources/crawl.ts +4 -4
  184. package/src/resources/domain-knowledge.ts +1 -1
  185. package/src/resources/extract/extract.ts +5182 -0
  186. package/src/resources/extract/index.ts +25 -0
  187. package/src/resources/extract/templates/generations.ts +435 -0
  188. package/src/resources/extract/templates/index.ts +29 -0
  189. package/src/resources/extract/templates/templates.ts +1176 -0
  190. package/src/resources/extract/templates/versions.ts +284 -0
  191. package/src/resources/extract/templates.ts +3 -0
  192. package/src/resources/extract.ts +3 -0
  193. package/src/resources/fast-serp.ts +1 -1
  194. package/src/resources/index.ts +16 -36
  195. package/src/resources/jobs/index.ts +1 -1
  196. package/src/resources/jobs/jobs.ts +49 -112
  197. package/src/resources/jobs/runs/artifacts.ts +11 -21
  198. package/src/resources/jobs/runs/index.ts +1 -0
  199. package/src/resources/jobs/runs/runs.ts +74 -24
  200. package/src/resources/media.ts +2 -2
  201. package/src/resources/serp.ts +3 -3
  202. package/src/resources/tasks.ts +3 -3
  203. package/src/resources/top-level.ts +88 -5192
  204. package/src/version.ts +1 -1
  205. package/version.d.mts +1 -1
  206. package/version.d.mts.map +1 -1
  207. package/version.d.ts +1 -1
  208. package/version.d.ts.map +1 -1
  209. package/version.js +1 -1
  210. package/version.js.map +1 -1
  211. package/version.mjs +1 -1
  212. package/version.mjs.map +1 -1
  213. package/resources/agent.d.mts.map +0 -1
  214. package/resources/agent.d.ts.map +0 -1
  215. package/resources/agent.js +0 -101
  216. package/resources/agent.js.map +0 -1
  217. package/resources/agent.mjs +0 -97
  218. package/resources/agent.mjs.map +0 -1
  219. package/resources/task-agent/index.d.mts +0 -4
  220. package/resources/task-agent/index.d.mts.map +0 -1
  221. package/resources/task-agent/index.d.ts +0 -4
  222. package/resources/task-agent/index.d.ts.map +0 -1
  223. package/resources/task-agent/index.js.map +0 -1
  224. package/resources/task-agent/index.mjs.map +0 -1
  225. package/resources/task-agent/runs.d.mts.map +0 -1
  226. package/resources/task-agent/runs.d.ts.map +0 -1
  227. package/resources/task-agent/runs.js +0 -65
  228. package/resources/task-agent/runs.js.map +0 -1
  229. package/resources/task-agent/runs.mjs +0 -61
  230. package/resources/task-agent/runs.mjs.map +0 -1
  231. package/resources/task-agent/task-agent.d.mts +0 -481
  232. package/resources/task-agent/task-agent.d.mts.map +0 -1
  233. package/resources/task-agent/task-agent.d.ts +0 -481
  234. package/resources/task-agent/task-agent.d.ts.map +0 -1
  235. package/resources/task-agent/task-agent.js +0 -68
  236. package/resources/task-agent/task-agent.js.map +0 -1
  237. package/resources/task-agent/task-agent.mjs +0 -63
  238. package/resources/task-agent/task-agent.mjs.map +0 -1
  239. package/resources/task-agent/templates.d.mts +0 -107
  240. package/resources/task-agent/templates.d.mts.map +0 -1
  241. package/resources/task-agent/templates.d.ts +0 -107
  242. package/resources/task-agent/templates.d.ts.map +0 -1
  243. package/resources/task-agent/templates.js.map +0 -1
  244. package/resources/task-agent/templates.mjs +0 -18
  245. package/resources/task-agent/templates.mjs.map +0 -1
  246. package/resources/task-agent.d.mts +0 -2
  247. package/resources/task-agent.d.mts.map +0 -1
  248. package/resources/task-agent.d.ts +0 -2
  249. package/resources/task-agent.d.ts.map +0 -1
  250. package/resources/task-agent.js.map +0 -1
  251. package/resources/task-agent.mjs.map +0 -1
  252. package/src/resources/agent.ts +0 -952
  253. package/src/resources/task-agent/index.ts +0 -32
  254. package/src/resources/task-agent/task-agent.ts +0 -746
  255. package/src/resources/task-agent/templates.ts +0 -172
@@ -0,0 +1,1176 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import * as GenerationsAPI from './generations';
5
+ import {
6
+ GenerationCreateParams,
7
+ GenerationCreateResponse,
8
+ GenerationGetResponse,
9
+ Generations,
10
+ } from './generations';
11
+ import * as VersionsAPI from './versions';
12
+ import {
13
+ VersionGetParams,
14
+ VersionGetResponse,
15
+ VersionListParams,
16
+ VersionListResponse,
17
+ Versions,
18
+ } from './versions';
19
+ import { APIPromise } from '../../../core/api-promise';
20
+ import { buildHeaders } from '../../../internal/headers';
21
+ import { RequestOptions } from '../../../internal/request-options';
22
+ import { path } from '../../../internal/utils/path';
23
+
24
+ export class Templates extends APIResource {
25
+ generations: GenerationsAPI.Generations = new GenerationsAPI.Generations(this._client);
26
+ versions: VersionsAPI.Versions = new VersionsAPI.Versions(this._client);
27
+
28
+ /**
29
+ * Patch Extract Template Public V2
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * const template = await client.extract.templates.update(
34
+ * 'extract_template_name',
35
+ * { body: [{ op: 'add', path: 'path' }] },
36
+ * );
37
+ * ```
38
+ */
39
+ update(
40
+ extractTemplateName: string,
41
+ params: TemplateUpdateParams,
42
+ options?: RequestOptions,
43
+ ): APIPromise<TemplateUpdateResponse> {
44
+ const { body } = params;
45
+ return this._client.patch(path`/v2/extract/templates/${extractTemplateName}`, { body: body, ...options });
46
+ }
47
+
48
+ /**
49
+ * List Extract Templates Public V2
50
+ *
51
+ * @example
52
+ * ```ts
53
+ * const templates = await client.extract.templates.list();
54
+ * ```
55
+ */
56
+ list(
57
+ query: TemplateListParams | null | undefined = {},
58
+ options?: RequestOptions,
59
+ ): APIPromise<TemplateListResponse> {
60
+ return this._client.get('/v2/extract/templates', { query, ...options });
61
+ }
62
+
63
+ /**
64
+ * Delete Extract Template Public V2
65
+ *
66
+ * @example
67
+ * ```ts
68
+ * await client.extract.templates.delete(
69
+ * 'extract_template_name',
70
+ * );
71
+ * ```
72
+ */
73
+ delete(extractTemplateName: string, options?: RequestOptions): APIPromise<void> {
74
+ return this._client.delete(path`/v2/extract/templates/${extractTemplateName}`, {
75
+ ...options,
76
+ headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
77
+ });
78
+ }
79
+
80
+ /**
81
+ * Execute Extraction Template Async Endpoint
82
+ *
83
+ * @example
84
+ * ```ts
85
+ * const response = await client.extract.templates.async({
86
+ * params: { foo: 'bar' },
87
+ * template: 'template',
88
+ * });
89
+ * ```
90
+ */
91
+ async(body: TemplateAsyncParams, options?: RequestOptions): APIPromise<TemplateAsyncResponse> {
92
+ return this._client.post('/v2/extract/templates/async', { body, ...options });
93
+ }
94
+
95
+ /**
96
+ * Execute Extraction Template Batch Endpoint
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const response = await client.extract.templates.batch({
101
+ * inputs: [{}],
102
+ * shared_inputs: { template: 'template' },
103
+ * });
104
+ * ```
105
+ */
106
+ batch(body: TemplateBatchParams, options?: RequestOptions): APIPromise<TemplateBatchResponse> {
107
+ return this._client.post('/v2/extract/templates/batch', { body, ...options });
108
+ }
109
+
110
+ /**
111
+ * Get Extract Template Public V2
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * const template = await client.extract.templates.get(
116
+ * 'extract_template_name',
117
+ * );
118
+ * ```
119
+ */
120
+ get(extractTemplateName: string, options?: RequestOptions): APIPromise<TemplateGetResponse> {
121
+ return this._client.get(path`/v2/extract/templates/${extractTemplateName}`, options);
122
+ }
123
+
124
+ /**
125
+ * Execute Extraction Template Realtime Endpoint
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * const response = await client.extract.templates.run({
130
+ * params: { foo: 'bar' },
131
+ * template: 'template',
132
+ * });
133
+ * ```
134
+ */
135
+ run(body: TemplateRunParams, options?: RequestOptions): APIPromise<TemplateRunResponse> {
136
+ return this._client.post('/v2/extract/templates/run', { body, ...options });
137
+ }
138
+ }
139
+
140
+ export interface TemplateUpdateResponse {
141
+ /**
142
+ * Unique extract template identifier.
143
+ */
144
+ id: string;
145
+
146
+ /**
147
+ * When the extract template was created.
148
+ */
149
+ created_at: string;
150
+
151
+ /**
152
+ * Stable extract template name.
153
+ */
154
+ name: string;
155
+
156
+ /**
157
+ * When the extract template was last updated.
158
+ */
159
+ updated_at: string;
160
+
161
+ /**
162
+ * Published version details, when available.
163
+ */
164
+ published_version?: TemplateUpdateResponse.PublishedVersion | null;
165
+
166
+ /**
167
+ * Identifier of the published version.
168
+ */
169
+ published_version_id?: string | null;
170
+ }
171
+
172
+ export namespace TemplateUpdateResponse {
173
+ /**
174
+ * Published version details, when available.
175
+ */
176
+ export interface PublishedVersion {
177
+ /**
178
+ * Unique extract template version identifier.
179
+ */
180
+ id: string;
181
+
182
+ /**
183
+ * When the version was created.
184
+ */
185
+ created_at: string;
186
+
187
+ /**
188
+ * JSON schema describing accepted input parameters.
189
+ */
190
+ input_schema: { [key: string]: unknown };
191
+
192
+ /**
193
+ * Metadata associated with this version.
194
+ */
195
+ metadata: PublishedVersion.Metadata;
196
+
197
+ /**
198
+ * Extract template name this version belongs to.
199
+ */
200
+ name: string;
201
+
202
+ /**
203
+ * JSON schema describing extracted output.
204
+ */
205
+ output_schema: { [key: string]: unknown };
206
+
207
+ /**
208
+ * Monotonic version number for the extract template.
209
+ */
210
+ version_number: number;
211
+
212
+ /**
213
+ * Sample input and output pairs for the version.
214
+ */
215
+ samples?: Array<PublishedVersion.Sample> | null;
216
+ }
217
+
218
+ export namespace PublishedVersion {
219
+ /**
220
+ * Metadata associated with this version.
221
+ */
222
+ export interface Metadata {
223
+ /**
224
+ * Data source associated with the version.
225
+ */
226
+ data_source?: string | null;
227
+
228
+ /**
229
+ * Version description shown to users.
230
+ */
231
+ description?: string | null;
232
+
233
+ /**
234
+ * Human-friendly version display name.
235
+ */
236
+ display_name?: string | null;
237
+
238
+ /**
239
+ * Domain associated with the version.
240
+ */
241
+ domain?: string | null;
242
+
243
+ /**
244
+ * Entity type produced by the version.
245
+ */
246
+ entity_type?: string | null;
247
+
248
+ /**
249
+ * Tags associated with the version.
250
+ */
251
+ tags?: Array<string>;
252
+
253
+ /**
254
+ * Business vertical associated with the version.
255
+ */
256
+ vertical?: string | null;
257
+ }
258
+
259
+ export interface Sample {
260
+ /**
261
+ * Sample input parameters for the version.
262
+ */
263
+ input?: unknown;
264
+
265
+ /**
266
+ * Sample output produced by the version.
267
+ */
268
+ output?: unknown;
269
+ }
270
+ }
271
+ }
272
+
273
+ export interface TemplateListResponse {
274
+ /**
275
+ * Items returned in this page.
276
+ */
277
+ items: Array<TemplateListResponse.Item>;
278
+
279
+ /**
280
+ * Maximum number of items returned.
281
+ */
282
+ limit: number;
283
+
284
+ /**
285
+ * Number of items skipped before this page.
286
+ */
287
+ offset: number;
288
+
289
+ /**
290
+ * Total number of items matching the query.
291
+ */
292
+ total: number;
293
+ }
294
+
295
+ export namespace TemplateListResponse {
296
+ export interface Item {
297
+ /**
298
+ * Unique extract template identifier.
299
+ */
300
+ id: string;
301
+
302
+ /**
303
+ * When the extract template was created.
304
+ */
305
+ created_at: string;
306
+
307
+ /**
308
+ * Stable extract template name.
309
+ */
310
+ name: string;
311
+
312
+ /**
313
+ * When the extract template was last updated.
314
+ */
315
+ updated_at: string;
316
+
317
+ /**
318
+ * Published version details, when available.
319
+ */
320
+ published_version?: Item.PublishedVersion | null;
321
+
322
+ /**
323
+ * Identifier of the published version.
324
+ */
325
+ published_version_id?: string | null;
326
+ }
327
+
328
+ export namespace Item {
329
+ /**
330
+ * Published version details, when available.
331
+ */
332
+ export interface PublishedVersion {
333
+ /**
334
+ * Unique extract template version identifier.
335
+ */
336
+ id: string;
337
+
338
+ /**
339
+ * When the version was created.
340
+ */
341
+ created_at: string;
342
+
343
+ /**
344
+ * JSON schema describing accepted input parameters.
345
+ */
346
+ input_schema: { [key: string]: unknown };
347
+
348
+ /**
349
+ * Metadata associated with this version.
350
+ */
351
+ metadata: PublishedVersion.Metadata;
352
+
353
+ /**
354
+ * Extract template name this version belongs to.
355
+ */
356
+ name: string;
357
+
358
+ /**
359
+ * JSON schema describing extracted output.
360
+ */
361
+ output_schema: { [key: string]: unknown };
362
+
363
+ /**
364
+ * Monotonic version number for the extract template.
365
+ */
366
+ version_number: number;
367
+
368
+ /**
369
+ * Sample input and output pairs for the version.
370
+ */
371
+ samples?: Array<PublishedVersion.Sample> | null;
372
+ }
373
+
374
+ export namespace PublishedVersion {
375
+ /**
376
+ * Metadata associated with this version.
377
+ */
378
+ export interface Metadata {
379
+ /**
380
+ * Data source associated with the version.
381
+ */
382
+ data_source?: string | null;
383
+
384
+ /**
385
+ * Version description shown to users.
386
+ */
387
+ description?: string | null;
388
+
389
+ /**
390
+ * Human-friendly version display name.
391
+ */
392
+ display_name?: string | null;
393
+
394
+ /**
395
+ * Domain associated with the version.
396
+ */
397
+ domain?: string | null;
398
+
399
+ /**
400
+ * Entity type produced by the version.
401
+ */
402
+ entity_type?: string | null;
403
+
404
+ /**
405
+ * Tags associated with the version.
406
+ */
407
+ tags?: Array<string>;
408
+
409
+ /**
410
+ * Business vertical associated with the version.
411
+ */
412
+ vertical?: string | null;
413
+ }
414
+
415
+ export interface Sample {
416
+ /**
417
+ * Sample input parameters for the version.
418
+ */
419
+ input?: unknown;
420
+
421
+ /**
422
+ * Sample output produced by the version.
423
+ */
424
+ output?: unknown;
425
+ }
426
+ }
427
+ }
428
+ }
429
+
430
+ export interface TemplateAsyncResponse {
431
+ status: 'success';
432
+
433
+ task: { [key: string]: unknown };
434
+ }
435
+
436
+ /**
437
+ * Response when a batch of extract tasks is created successfully.
438
+ */
439
+ export interface TemplateBatchResponse {
440
+ /**
441
+ * Unique identifier for the batch.
442
+ */
443
+ batch_id: string;
444
+
445
+ /**
446
+ * Number of tasks in the batch.
447
+ */
448
+ batch_size: number;
449
+
450
+ /**
451
+ * List of created tasks.
452
+ */
453
+ tasks: Array<TemplateBatchResponse.Task>;
454
+ }
455
+
456
+ export namespace TemplateBatchResponse {
457
+ export interface Task {
458
+ /**
459
+ * Unique task identifier.
460
+ */
461
+ id: string;
462
+
463
+ _query: unknown;
464
+
465
+ /**
466
+ * Timestamp when the task was created.
467
+ */
468
+ created_at: string;
469
+
470
+ /**
471
+ * Original input data for the task.
472
+ */
473
+ input: unknown;
474
+
475
+ /**
476
+ * Current state of the task.
477
+ */
478
+ state: 'pending' | 'queued' | 'in_progress' | 'success' | 'error';
479
+
480
+ /**
481
+ * URL for checking the task status.
482
+ */
483
+ status_url: string;
484
+
485
+ /**
486
+ * Account name that owns the task.
487
+ */
488
+ account_name?: string;
489
+
490
+ api_type?: 'web' | 'serp' | 'ecommerce' | 'social' | 'media' | 'agent' | 'extract' | 'fast-serp' | 'labs';
491
+
492
+ /**
493
+ * Batch ID if this task is part of a batch.
494
+ */
495
+ batch_id?: string | null;
496
+
497
+ /**
498
+ * URL for downloading the task results.
499
+ */
500
+ download_url?: string | null;
501
+
502
+ /**
503
+ * Error message if the task failed.
504
+ */
505
+ error?: string | null;
506
+
507
+ /**
508
+ * Classification of the error type.
509
+ */
510
+ error_type?: string | null;
511
+
512
+ /**
513
+ * Timestamp when the task was last modified.
514
+ */
515
+ modified_at?: string;
516
+
517
+ /**
518
+ * Storage location of the output data.
519
+ */
520
+ output_url?: string | null;
521
+
522
+ /**
523
+ * Queue name the task was submitted to.
524
+ */
525
+ queue?: string;
526
+
527
+ /**
528
+ * HTTP status code from the task execution.
529
+ */
530
+ status_code?: number;
531
+ }
532
+ }
533
+
534
+ export interface TemplateGetResponse {
535
+ /**
536
+ * Unique extract template identifier.
537
+ */
538
+ id: string;
539
+
540
+ /**
541
+ * When the extract template was created.
542
+ */
543
+ created_at: string;
544
+
545
+ /**
546
+ * Stable extract template name.
547
+ */
548
+ name: string;
549
+
550
+ /**
551
+ * When the extract template was last updated.
552
+ */
553
+ updated_at: string;
554
+
555
+ /**
556
+ * Published version details, when available.
557
+ */
558
+ published_version?: TemplateGetResponse.PublishedVersion | null;
559
+
560
+ /**
561
+ * Identifier of the published version.
562
+ */
563
+ published_version_id?: string | null;
564
+ }
565
+
566
+ export namespace TemplateGetResponse {
567
+ /**
568
+ * Published version details, when available.
569
+ */
570
+ export interface PublishedVersion {
571
+ /**
572
+ * Unique extract template version identifier.
573
+ */
574
+ id: string;
575
+
576
+ /**
577
+ * When the version was created.
578
+ */
579
+ created_at: string;
580
+
581
+ /**
582
+ * JSON schema describing accepted input parameters.
583
+ */
584
+ input_schema: { [key: string]: unknown };
585
+
586
+ /**
587
+ * Metadata associated with this version.
588
+ */
589
+ metadata: PublishedVersion.Metadata;
590
+
591
+ /**
592
+ * Extract template name this version belongs to.
593
+ */
594
+ name: string;
595
+
596
+ /**
597
+ * JSON schema describing extracted output.
598
+ */
599
+ output_schema: { [key: string]: unknown };
600
+
601
+ /**
602
+ * Monotonic version number for the extract template.
603
+ */
604
+ version_number: number;
605
+
606
+ /**
607
+ * Sample input and output pairs for the version.
608
+ */
609
+ samples?: Array<PublishedVersion.Sample> | null;
610
+ }
611
+
612
+ export namespace PublishedVersion {
613
+ /**
614
+ * Metadata associated with this version.
615
+ */
616
+ export interface Metadata {
617
+ /**
618
+ * Data source associated with the version.
619
+ */
620
+ data_source?: string | null;
621
+
622
+ /**
623
+ * Version description shown to users.
624
+ */
625
+ description?: string | null;
626
+
627
+ /**
628
+ * Human-friendly version display name.
629
+ */
630
+ display_name?: string | null;
631
+
632
+ /**
633
+ * Domain associated with the version.
634
+ */
635
+ domain?: string | null;
636
+
637
+ /**
638
+ * Entity type produced by the version.
639
+ */
640
+ entity_type?: string | null;
641
+
642
+ /**
643
+ * Tags associated with the version.
644
+ */
645
+ tags?: Array<string>;
646
+
647
+ /**
648
+ * Business vertical associated with the version.
649
+ */
650
+ vertical?: string | null;
651
+ }
652
+
653
+ export interface Sample {
654
+ /**
655
+ * Sample input parameters for the version.
656
+ */
657
+ input?: unknown;
658
+
659
+ /**
660
+ * Sample output produced by the version.
661
+ */
662
+ output?: unknown;
663
+ }
664
+ }
665
+ }
666
+
667
+ export interface TemplateRunResponse {
668
+ data: TemplateRunResponse.Data;
669
+
670
+ metadata: TemplateRunResponse.Metadata;
671
+
672
+ /**
673
+ * The status of the task.
674
+ */
675
+ status: 'success' | 'skipped' | 'fatal' | 'error' | 'postponed' | 'ignored' | 'rejected' | 'blocked';
676
+
677
+ /**
678
+ * Unique identifier for the task.
679
+ */
680
+ task_id: string;
681
+
682
+ /**
683
+ * The final URL.
684
+ */
685
+ url: string;
686
+
687
+ debug?: TemplateRunResponse.Debug;
688
+
689
+ /**
690
+ * Pagination information if applicable.
691
+ */
692
+ pagination?: TemplateRunResponse.NextPageParams | Array<TemplateRunResponse.UnionMember1>;
693
+
694
+ /**
695
+ * The HTTP status code of the task.
696
+ */
697
+ status_code?: number;
698
+
699
+ /**
700
+ * List of warnings generated during the task.
701
+ */
702
+ warnings?: Array<string>;
703
+ }
704
+
705
+ export namespace TemplateRunResponse {
706
+ export interface Data {
707
+ /**
708
+ * Browser actions execution results. Present only when browser_actions were
709
+ * specified in the request.
710
+ */
711
+ browser_actions?: Data.BrowserActions;
712
+
713
+ /**
714
+ * The cookies collected from browser actions during the task.
715
+ */
716
+ cookies?: Array<unknown>;
717
+
718
+ /**
719
+ * The evaluation results from browser actions during the task.
720
+ */
721
+ eval?: Array<unknown>;
722
+
723
+ /**
724
+ * The http requests from browser actions made during the task.
725
+ */
726
+ fetch?: Array<unknown>;
727
+
728
+ /**
729
+ * The headers received during the task.
730
+ */
731
+ headers?: { [key: string]: string };
732
+
733
+ /**
734
+ * The HTML content of the page.
735
+ */
736
+ html?: string;
737
+
738
+ /**
739
+ * List of all unique URLs found on the page.
740
+ */
741
+ links?: Array<string>;
742
+
743
+ /**
744
+ * The Markdown version of the HTML content.
745
+ */
746
+ markdown?: string;
747
+
748
+ /**
749
+ * The network capture data collected during the task.
750
+ */
751
+ network_capture?: Array<Data.NetworkCapture>;
752
+
753
+ /**
754
+ * Individual HTML content of each pagination page, before merging.
755
+ */
756
+ pages_html?: Array<string>;
757
+
758
+ /**
759
+ * The parsing results extracted from the HTML & network content.
760
+ */
761
+ parsing?: Data.ParsingSuccessResult | Data.ParsingErrorResult | { [key: string]: unknown };
762
+
763
+ /**
764
+ * The list of redirects that occurred during the task.
765
+ */
766
+ redirects?: Array<Data.Redirect>;
767
+
768
+ /**
769
+ * Screenshots taken during the task, from browser actions, or the screenshot
770
+ * format.
771
+ */
772
+ screenshots?: Array<unknown>;
773
+ }
774
+
775
+ export namespace Data {
776
+ /**
777
+ * Browser actions execution results. Present only when browser_actions were
778
+ * specified in the request.
779
+ */
780
+ export interface BrowserActions {
781
+ results: Array<BrowserActions.Result>;
782
+
783
+ success: boolean;
784
+
785
+ total_duration: number;
786
+ }
787
+
788
+ export namespace BrowserActions {
789
+ export interface Result {
790
+ duration: number;
791
+
792
+ name:
793
+ | 'goto'
794
+ | 'wait'
795
+ | 'wait_for_element'
796
+ | 'wait_for_navigation'
797
+ | 'click'
798
+ | 'fill'
799
+ | 'press'
800
+ | 'scroll'
801
+ | 'auto_scroll'
802
+ | 'screenshot'
803
+ | 'get_cookies'
804
+ | 'eval'
805
+ | 'fetch';
806
+
807
+ status: 'no-run' | 'in-progress' | 'done' | 'error' | 'skipped';
808
+
809
+ error?: string;
810
+
811
+ result?: unknown;
812
+ }
813
+ }
814
+
815
+ export interface NetworkCapture {
816
+ filter: NetworkCapture.Filter;
817
+
818
+ results: Array<NetworkCapture.Result>;
819
+
820
+ errorMessage?: string;
821
+ }
822
+
823
+ export namespace NetworkCapture {
824
+ export interface Filter {
825
+ validation: boolean;
826
+
827
+ wait_for_requests_count: number;
828
+
829
+ method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
830
+
831
+ /**
832
+ * Resource type for network capture filtering
833
+ */
834
+ resource_type?:
835
+ | 'document'
836
+ | 'stylesheet'
837
+ | 'image'
838
+ | 'media'
839
+ | 'font'
840
+ | 'script'
841
+ | 'texttrack'
842
+ | 'xhr'
843
+ | 'fetch'
844
+ | 'prefetch'
845
+ | 'eventsource'
846
+ | 'websocket'
847
+ | 'manifest'
848
+ | 'signedexchange'
849
+ | 'ping'
850
+ | 'cspviolationreport'
851
+ | 'preflight'
852
+ | 'other'
853
+ | 'fedcm'
854
+ | Array<
855
+ | 'document'
856
+ | 'stylesheet'
857
+ | 'image'
858
+ | 'media'
859
+ | 'font'
860
+ | 'script'
861
+ | 'texttrack'
862
+ | 'xhr'
863
+ | 'fetch'
864
+ | 'prefetch'
865
+ | 'eventsource'
866
+ | 'websocket'
867
+ | 'manifest'
868
+ | 'signedexchange'
869
+ | 'ping'
870
+ | 'cspviolationreport'
871
+ | 'preflight'
872
+ | 'other'
873
+ | 'fedcm'
874
+ >;
875
+
876
+ status_code?: number | Array<number>;
877
+
878
+ url?: Filter.URL;
879
+
880
+ wait_for_requests_count_timeout?: number;
881
+ }
882
+
883
+ export namespace Filter {
884
+ export interface URL {
885
+ type: 'exact' | 'contains';
886
+
887
+ value: string;
888
+ }
889
+ }
890
+
891
+ export interface Result {
892
+ request: Result.Request;
893
+
894
+ response: Result.Response;
895
+ }
896
+
897
+ export namespace Result {
898
+ export interface Request {
899
+ headers: { [key: string]: string };
900
+
901
+ method: string;
902
+
903
+ /**
904
+ * Resource type for network capture filtering
905
+ */
906
+ resource_type:
907
+ | 'document'
908
+ | 'stylesheet'
909
+ | 'image'
910
+ | 'media'
911
+ | 'font'
912
+ | 'script'
913
+ | 'texttrack'
914
+ | 'xhr'
915
+ | 'fetch'
916
+ | 'prefetch'
917
+ | 'eventsource'
918
+ | 'websocket'
919
+ | 'manifest'
920
+ | 'signedexchange'
921
+ | 'ping'
922
+ | 'cspviolationreport'
923
+ | 'preflight'
924
+ | 'other'
925
+ | 'fedcm';
926
+
927
+ url: string;
928
+
929
+ body?: string;
930
+ }
931
+
932
+ export interface Response {
933
+ body: string;
934
+
935
+ headers: { [key: string]: string };
936
+
937
+ serialization: 'none' | 'base64';
938
+
939
+ status: number;
940
+
941
+ status_text: string;
942
+ }
943
+ }
944
+ }
945
+
946
+ export interface ParsingSuccessResult {
947
+ entities: { [key: string]: unknown };
948
+
949
+ status: 'success';
950
+ }
951
+
952
+ export interface ParsingErrorResult {
953
+ error: string;
954
+
955
+ status: 'error';
956
+ }
957
+
958
+ export interface Redirect {
959
+ status_code: number;
960
+
961
+ url: string;
962
+ }
963
+ }
964
+
965
+ export interface Metadata {
966
+ /**
967
+ * The name of the agent used for the query.
968
+ */
969
+ agent?: string;
970
+
971
+ /**
972
+ * The driver used for the task.
973
+ */
974
+ driver?: string;
975
+
976
+ /**
977
+ * The localization identifier for the query.
978
+ */
979
+ localization_id?: string;
980
+
981
+ /**
982
+ * The duration in milliseconds of the query processing.
983
+ */
984
+ query_duration?: number;
985
+
986
+ /**
987
+ * The time when the query was received.
988
+ */
989
+ query_time?: string;
990
+
991
+ /**
992
+ * Additional response parameters.
993
+ */
994
+ response_parameters?: unknown;
995
+
996
+ /**
997
+ * A tag associated with the query.
998
+ */
999
+ tag?: string;
1000
+ }
1001
+
1002
+ export interface Debug {
1003
+ /**
1004
+ * Performance metrics collected during the task.
1005
+ */
1006
+ performance_metrics?: { [key: string]: number };
1007
+
1008
+ /**
1009
+ * Total bytes used by the proxy during the task.
1010
+ */
1011
+ proxy_total_bytes_usage?: number;
1012
+
1013
+ /**
1014
+ * The transformed output after applying any transformations.
1015
+ */
1016
+ transformed_output?: unknown;
1017
+
1018
+ /**
1019
+ * The userbrowser instance using during the task.
1020
+ */
1021
+ userbrowser?: unknown;
1022
+ }
1023
+
1024
+ export interface NextPageParams {
1025
+ next_page_params: { [key: string]: unknown };
1026
+ }
1027
+
1028
+ export interface UnionMember1 {
1029
+ next_page_params: { [key: string]: unknown };
1030
+ }
1031
+ }
1032
+
1033
+ export interface TemplateUpdateParams {
1034
+ /**
1035
+ * A JSON Patch document per RFC 6902 — a JSON array of patch operations.
1036
+ */
1037
+ body: Array<TemplateUpdateParams.Body>;
1038
+ }
1039
+
1040
+ export namespace TemplateUpdateParams {
1041
+ /**
1042
+ * A single JSON Patch operation per RFC 6902.
1043
+ */
1044
+ export interface Body {
1045
+ op: 'add' | 'remove' | 'replace' | 'move' | 'copy' | 'test';
1046
+
1047
+ path: string;
1048
+
1049
+ from?: string | null;
1050
+
1051
+ value?: unknown;
1052
+ }
1053
+ }
1054
+
1055
+ export interface TemplateListParams {
1056
+ limit?: number;
1057
+
1058
+ offset?: number;
1059
+ }
1060
+
1061
+ export interface TemplateAsyncParams {
1062
+ params: { [key: string]: unknown };
1063
+
1064
+ template: string;
1065
+
1066
+ /**
1067
+ * URL to call back when async operation completes
1068
+ */
1069
+ callback_url?: string;
1070
+
1071
+ /**
1072
+ * Response formats to include. All disabled by default.
1073
+ */
1074
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
1075
+
1076
+ localization?: boolean;
1077
+
1078
+ /**
1079
+ * Whether to compress stored data
1080
+ */
1081
+ storage_compress?: boolean;
1082
+
1083
+ /**
1084
+ * Custom name for the stored object
1085
+ */
1086
+ storage_object_name?: string;
1087
+
1088
+ /**
1089
+ * Type of storage to use for results
1090
+ */
1091
+ storage_type?: string;
1092
+
1093
+ /**
1094
+ * URL for storage location
1095
+ */
1096
+ storage_url?: string;
1097
+ }
1098
+
1099
+ export interface TemplateBatchParams {
1100
+ inputs: Array<TemplateBatchParams.Input>;
1101
+
1102
+ shared_inputs: TemplateBatchParams.SharedInputs;
1103
+ }
1104
+
1105
+ export namespace TemplateBatchParams {
1106
+ export interface Input {
1107
+ /**
1108
+ * Response formats to include. All disabled by default.
1109
+ */
1110
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
1111
+
1112
+ localization?: boolean;
1113
+
1114
+ params?: { [key: string]: unknown };
1115
+ }
1116
+
1117
+ export interface SharedInputs {
1118
+ template: string;
1119
+
1120
+ /**
1121
+ * Response formats to include. All disabled by default.
1122
+ */
1123
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
1124
+
1125
+ localization?: boolean;
1126
+
1127
+ params?: { [key: string]: unknown };
1128
+ }
1129
+ }
1130
+
1131
+ export interface TemplateRunParams {
1132
+ params: { [key: string]: unknown };
1133
+
1134
+ template: string;
1135
+
1136
+ /**
1137
+ * Response formats to include. All disabled by default.
1138
+ */
1139
+ formats?: Array<'html' | 'markdown' | 'screenshot' | 'headers' | 'links'>;
1140
+
1141
+ localization?: boolean;
1142
+ }
1143
+
1144
+ Templates.Generations = Generations;
1145
+ Templates.Versions = Versions;
1146
+
1147
+ export declare namespace Templates {
1148
+ export {
1149
+ type TemplateUpdateResponse as TemplateUpdateResponse,
1150
+ type TemplateListResponse as TemplateListResponse,
1151
+ type TemplateAsyncResponse as TemplateAsyncResponse,
1152
+ type TemplateBatchResponse as TemplateBatchResponse,
1153
+ type TemplateGetResponse as TemplateGetResponse,
1154
+ type TemplateRunResponse as TemplateRunResponse,
1155
+ type TemplateUpdateParams as TemplateUpdateParams,
1156
+ type TemplateListParams as TemplateListParams,
1157
+ type TemplateAsyncParams as TemplateAsyncParams,
1158
+ type TemplateBatchParams as TemplateBatchParams,
1159
+ type TemplateRunParams as TemplateRunParams,
1160
+ };
1161
+
1162
+ export {
1163
+ Generations as Generations,
1164
+ type GenerationCreateResponse as GenerationCreateResponse,
1165
+ type GenerationGetResponse as GenerationGetResponse,
1166
+ type GenerationCreateParams as GenerationCreateParams,
1167
+ };
1168
+
1169
+ export {
1170
+ Versions as Versions,
1171
+ type VersionListResponse as VersionListResponse,
1172
+ type VersionGetResponse as VersionGetResponse,
1173
+ type VersionListParams as VersionListParams,
1174
+ type VersionGetParams as VersionGetParams,
1175
+ };
1176
+ }