@nimble-way/nimble-js 0.13.0 → 0.16.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 (267) hide show
  1. package/CHANGELOG.md +52 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +17 -2
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +17 -2
  11. package/client.d.ts.map +1 -1
  12. package/client.js +24 -1
  13. package/client.js.map +1 -1
  14. package/client.mjs +24 -1
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/resource.d.mts.map +1 -1
  21. package/core/resource.d.ts.map +1 -1
  22. package/core/uploads.d.mts.map +1 -1
  23. package/core/uploads.d.ts.map +1 -1
  24. package/core/uploads.mjs.map +1 -1
  25. package/error.d.mts +1 -0
  26. package/error.d.mts.map +1 -1
  27. package/error.d.ts +1 -0
  28. package/error.d.ts.map +1 -1
  29. package/error.mjs +1 -0
  30. package/error.mjs.map +1 -1
  31. package/index.d.mts.map +1 -1
  32. package/index.d.ts.map +1 -1
  33. package/index.mjs.map +1 -1
  34. package/internal/detect-platform.mjs.map +1 -1
  35. package/internal/headers.mjs.map +1 -1
  36. package/internal/parse.d.mts.map +1 -1
  37. package/internal/parse.d.ts.map +1 -1
  38. package/internal/parse.mjs.map +1 -1
  39. package/internal/request-options.d.mts.map +1 -1
  40. package/internal/request-options.d.ts.map +1 -1
  41. package/internal/shims.d.mts +6 -0
  42. package/internal/shims.d.mts.map +1 -1
  43. package/internal/shims.d.ts +6 -0
  44. package/internal/shims.d.ts.map +1 -1
  45. package/internal/to-file.d.mts.map +1 -1
  46. package/internal/to-file.d.ts.map +1 -1
  47. package/internal/to-file.mjs.map +1 -1
  48. package/internal/tslib.js +22 -22
  49. package/internal/types.d.mts +4 -4
  50. package/internal/types.d.mts.map +1 -1
  51. package/internal/types.d.ts +4 -4
  52. package/internal/types.d.ts.map +1 -1
  53. package/internal/uploads.d.mts.map +1 -1
  54. package/internal/uploads.d.ts.map +1 -1
  55. package/internal/uploads.mjs.map +1 -1
  56. package/internal/utils/base64.mjs.map +1 -1
  57. package/internal/utils/log.d.mts.map +1 -1
  58. package/internal/utils/log.d.ts.map +1 -1
  59. package/internal/utils/log.js +2 -0
  60. package/internal/utils/log.js.map +1 -1
  61. package/internal/utils/log.mjs +2 -0
  62. package/internal/utils/log.mjs.map +1 -1
  63. package/internal/utils/path.mjs.map +1 -1
  64. package/internal/utils/query.mjs.map +1 -1
  65. package/internal/utils/values.mjs.map +1 -1
  66. package/internal/utils.d.mts.map +1 -1
  67. package/internal/utils.d.ts.map +1 -1
  68. package/internal/utils.mjs.map +1 -1
  69. package/package.json +1 -1
  70. package/resource.d.mts +1 -0
  71. package/resource.d.mts.map +1 -1
  72. package/resource.d.ts +1 -0
  73. package/resource.d.ts.map +1 -1
  74. package/resource.mjs +1 -0
  75. package/resource.mjs.map +1 -1
  76. package/resources/agent.d.mts +33 -26
  77. package/resources/agent.d.mts.map +1 -1
  78. package/resources/agent.d.ts +33 -26
  79. package/resources/agent.d.ts.map +1 -1
  80. package/resources/agent.js +0 -8
  81. package/resources/agent.js.map +1 -1
  82. package/resources/agent.mjs +0 -8
  83. package/resources/agent.mjs.map +1 -1
  84. package/resources/batches.d.mts +1 -1
  85. package/resources/batches.d.mts.map +1 -1
  86. package/resources/batches.d.ts +1 -1
  87. package/resources/batches.d.ts.map +1 -1
  88. package/resources/batches.mjs.map +1 -1
  89. package/resources/crawl.d.mts +5 -1
  90. package/resources/crawl.d.mts.map +1 -1
  91. package/resources/crawl.d.ts +5 -1
  92. package/resources/crawl.d.ts.map +1 -1
  93. package/resources/crawl.mjs.map +1 -1
  94. package/resources/domain-knowledge.d.mts +50 -0
  95. package/resources/domain-knowledge.d.mts.map +1 -0
  96. package/resources/domain-knowledge.d.ts +50 -0
  97. package/resources/domain-knowledge.d.ts.map +1 -0
  98. package/resources/domain-knowledge.js +16 -0
  99. package/resources/domain-knowledge.js.map +1 -0
  100. package/resources/domain-knowledge.mjs +12 -0
  101. package/resources/domain-knowledge.mjs.map +1 -0
  102. package/resources/index.d.mts +6 -1
  103. package/resources/index.d.mts.map +1 -1
  104. package/resources/index.d.ts +6 -1
  105. package/resources/index.d.ts.map +1 -1
  106. package/resources/index.js +11 -1
  107. package/resources/index.js.map +1 -1
  108. package/resources/index.mjs +5 -0
  109. package/resources/index.mjs.map +1 -1
  110. package/resources/jobs/index.d.mts +3 -0
  111. package/resources/jobs/index.d.mts.map +1 -0
  112. package/resources/jobs/index.d.ts +3 -0
  113. package/resources/jobs/index.d.ts.map +1 -0
  114. package/resources/jobs/index.js +9 -0
  115. package/resources/jobs/index.js.map +1 -0
  116. package/resources/jobs/index.mjs +4 -0
  117. package/resources/jobs/index.mjs.map +1 -0
  118. package/resources/jobs/jobs.d.mts +248 -0
  119. package/resources/jobs/jobs.d.mts.map +1 -0
  120. package/resources/jobs/jobs.d.ts +248 -0
  121. package/resources/jobs/jobs.d.ts.map +1 -0
  122. package/resources/jobs/jobs.js +58 -0
  123. package/resources/jobs/jobs.js.map +1 -0
  124. package/resources/jobs/jobs.mjs +53 -0
  125. package/resources/jobs/jobs.mjs.map +1 -0
  126. package/resources/jobs/runs/artifacts.d.mts +62 -0
  127. package/resources/jobs/runs/artifacts.d.mts.map +1 -0
  128. package/resources/jobs/runs/artifacts.d.ts +62 -0
  129. package/resources/jobs/runs/artifacts.d.ts.map +1 -0
  130. package/resources/jobs/runs/artifacts.js +37 -0
  131. package/resources/jobs/runs/artifacts.js.map +1 -0
  132. package/resources/jobs/runs/artifacts.mjs +33 -0
  133. package/resources/jobs/runs/artifacts.mjs.map +1 -0
  134. package/resources/jobs/runs/index.d.mts +3 -0
  135. package/resources/jobs/runs/index.d.mts.map +1 -0
  136. package/resources/jobs/runs/index.d.ts +3 -0
  137. package/resources/jobs/runs/index.d.ts.map +1 -0
  138. package/resources/jobs/runs/index.js +9 -0
  139. package/resources/jobs/runs/index.js.map +1 -0
  140. package/resources/jobs/runs/index.mjs +4 -0
  141. package/resources/jobs/runs/index.mjs.map +1 -0
  142. package/resources/jobs/runs/runs.d.mts +95 -0
  143. package/resources/jobs/runs/runs.d.mts.map +1 -0
  144. package/resources/jobs/runs/runs.d.ts +95 -0
  145. package/resources/jobs/runs/runs.d.ts.map +1 -0
  146. package/resources/jobs/runs/runs.js +36 -0
  147. package/resources/jobs/runs/runs.js.map +1 -0
  148. package/resources/jobs/runs/runs.mjs +31 -0
  149. package/resources/jobs/runs/runs.mjs.map +1 -0
  150. package/resources/jobs/runs.d.mts +2 -0
  151. package/resources/jobs/runs.d.mts.map +1 -0
  152. package/resources/jobs/runs.d.ts +2 -0
  153. package/resources/jobs/runs.d.ts.map +1 -0
  154. package/resources/jobs/runs.js +6 -0
  155. package/resources/jobs/runs.js.map +1 -0
  156. package/resources/jobs/runs.mjs +3 -0
  157. package/resources/jobs/runs.mjs.map +1 -0
  158. package/resources/jobs.d.mts +2 -0
  159. package/resources/jobs.d.mts.map +1 -0
  160. package/resources/jobs.d.ts +2 -0
  161. package/resources/jobs.d.ts.map +1 -0
  162. package/resources/jobs.js +6 -0
  163. package/resources/jobs.js.map +1 -0
  164. package/resources/jobs.mjs +3 -0
  165. package/resources/jobs.mjs.map +1 -0
  166. package/resources/media.d.mts +390 -0
  167. package/resources/media.d.mts.map +1 -0
  168. package/resources/media.d.ts +390 -0
  169. package/resources/media.d.ts.map +1 -0
  170. package/resources/media.js +35 -0
  171. package/resources/media.js.map +1 -0
  172. package/resources/media.mjs +31 -0
  173. package/resources/media.mjs.map +1 -0
  174. package/resources/serp.d.mts +714 -0
  175. package/resources/serp.d.mts.map +1 -0
  176. package/resources/serp.d.ts +714 -0
  177. package/resources/serp.d.ts.map +1 -0
  178. package/resources/serp.js +48 -0
  179. package/resources/serp.js.map +1 -0
  180. package/resources/serp.mjs +44 -0
  181. package/resources/serp.mjs.map +1 -0
  182. package/resources/task-agent/index.d.mts +4 -0
  183. package/resources/task-agent/index.d.mts.map +1 -0
  184. package/resources/task-agent/index.d.ts +4 -0
  185. package/resources/task-agent/index.d.ts.map +1 -0
  186. package/resources/task-agent/index.js +11 -0
  187. package/resources/task-agent/index.js.map +1 -0
  188. package/resources/task-agent/index.mjs +5 -0
  189. package/resources/task-agent/index.mjs.map +1 -0
  190. package/resources/task-agent/runs.d.mts +277 -0
  191. package/resources/task-agent/runs.d.mts.map +1 -0
  192. package/resources/task-agent/runs.d.ts +277 -0
  193. package/resources/task-agent/runs.d.ts.map +1 -0
  194. package/resources/task-agent/runs.js +50 -0
  195. package/resources/task-agent/runs.js.map +1 -0
  196. package/resources/task-agent/runs.mjs +46 -0
  197. package/resources/task-agent/runs.mjs.map +1 -0
  198. package/resources/task-agent/task-agent.d.mts +383 -0
  199. package/resources/task-agent/task-agent.d.mts.map +1 -0
  200. package/resources/task-agent/task-agent.d.ts +383 -0
  201. package/resources/task-agent/task-agent.d.ts.map +1 -0
  202. package/resources/task-agent/task-agent.js +70 -0
  203. package/resources/task-agent/task-agent.js.map +1 -0
  204. package/resources/task-agent/task-agent.mjs +65 -0
  205. package/resources/task-agent/task-agent.mjs.map +1 -0
  206. package/resources/task-agent/templates.d.mts +98 -0
  207. package/resources/task-agent/templates.d.mts.map +1 -0
  208. package/resources/task-agent/templates.d.ts +98 -0
  209. package/resources/task-agent/templates.d.ts.map +1 -0
  210. package/resources/task-agent/templates.js +22 -0
  211. package/resources/task-agent/templates.js.map +1 -0
  212. package/resources/task-agent/templates.mjs +18 -0
  213. package/resources/task-agent/templates.mjs.map +1 -0
  214. package/resources/task-agent.d.mts +2 -0
  215. package/resources/task-agent.d.mts.map +1 -0
  216. package/resources/task-agent.d.ts +2 -0
  217. package/resources/task-agent.d.ts.map +1 -0
  218. package/resources/task-agent.js +6 -0
  219. package/resources/task-agent.js.map +1 -0
  220. package/resources/task-agent.mjs +3 -0
  221. package/resources/task-agent.mjs.map +1 -0
  222. package/resources/tasks.d.mts +2 -2
  223. package/resources/tasks.d.mts.map +1 -1
  224. package/resources/tasks.d.ts +2 -2
  225. package/resources/tasks.d.ts.map +1 -1
  226. package/resources/tasks.mjs.map +1 -1
  227. package/resources/top-level.d.mts +32 -8
  228. package/resources/top-level.d.mts.map +1 -1
  229. package/resources/top-level.d.ts +32 -8
  230. package/resources/top-level.d.ts.map +1 -1
  231. package/resources.d.mts.map +1 -1
  232. package/resources.d.ts.map +1 -1
  233. package/resources.mjs.map +1 -1
  234. package/src/client.ts +112 -5
  235. package/src/internal/utils/log.ts +2 -0
  236. package/src/resources/agent.ts +21 -38
  237. package/src/resources/batches.ts +1 -1
  238. package/src/resources/crawl.ts +6 -1
  239. package/src/resources/domain-knowledge.ts +69 -0
  240. package/src/resources/index.ts +44 -2
  241. package/src/resources/jobs/index.ts +20 -0
  242. package/src/resources/jobs/jobs.ts +413 -0
  243. package/src/resources/jobs/runs/artifacts.ts +115 -0
  244. package/src/resources/jobs/runs/index.ts +19 -0
  245. package/src/resources/jobs/runs/runs.ts +177 -0
  246. package/src/resources/jobs/runs.ts +3 -0
  247. package/src/resources/jobs.ts +3 -0
  248. package/src/resources/media.ts +570 -0
  249. package/src/resources/serp.ts +1001 -0
  250. package/src/resources/task-agent/index.ts +32 -0
  251. package/src/resources/task-agent/runs.ts +416 -0
  252. package/src/resources/task-agent/task-agent.ts +652 -0
  253. package/src/resources/task-agent/templates.ts +163 -0
  254. package/src/resources/task-agent.ts +3 -0
  255. package/src/resources/tasks.ts +2 -2
  256. package/src/resources/top-level.ts +35 -8
  257. package/src/version.ts +1 -1
  258. package/uploads.d.mts +1 -0
  259. package/uploads.d.mts.map +1 -1
  260. package/uploads.d.ts +1 -0
  261. package/uploads.d.ts.map +1 -1
  262. package/uploads.mjs +1 -0
  263. package/uploads.mjs.map +1 -1
  264. package/version.d.mts +1 -1
  265. package/version.d.ts +1 -1
  266. package/version.js +1 -1
  267. package/version.mjs +1 -1
@@ -0,0 +1,1001 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class Serp extends APIResource {
8
+ /**
9
+ * SERP
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * const response = await client.serp.run({
14
+ * search_engine: 'google_search',
15
+ * });
16
+ * ```
17
+ */
18
+ run(body: SerpRunParams, options?: RequestOptions): APIPromise<SerpRunResponse> {
19
+ return this._client.post('/v1/serp', { body, ...options });
20
+ }
21
+
22
+ /**
23
+ * SERP Async Endpoint
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const response = await client.serp.runAsync({
28
+ * search_engine: 'google_search',
29
+ * });
30
+ * ```
31
+ */
32
+ runAsync(body: SerpRunAsyncParams, options?: RequestOptions): APIPromise<SerpRunAsyncResponse> {
33
+ return this._client.post('/v1/serp/async', { body, ...options });
34
+ }
35
+
36
+ /**
37
+ * SERP Batch Endpoint
38
+ *
39
+ * @example
40
+ * ```ts
41
+ * const response = await client.serp.runBatch({
42
+ * inputs: [{}],
43
+ * });
44
+ * ```
45
+ */
46
+ runBatch(body: SerpRunBatchParams, options?: RequestOptions): APIPromise<SerpRunBatchResponse> {
47
+ return this._client.post('/v1/serp/batch', { body, ...options });
48
+ }
49
+ }
50
+
51
+ export interface SerpRunResponse {
52
+ data: SerpRunResponse.Data;
53
+
54
+ metadata: SerpRunResponse.Metadata;
55
+
56
+ /**
57
+ * The status of the task.
58
+ */
59
+ status: 'success' | 'skipped' | 'fatal' | 'error' | 'postponed' | 'ignored' | 'rejected' | 'blocked';
60
+
61
+ /**
62
+ * Unique identifier for the task.
63
+ */
64
+ task_id: string;
65
+
66
+ /**
67
+ * The final URL.
68
+ */
69
+ url: string;
70
+
71
+ debug?: SerpRunResponse.Debug;
72
+
73
+ /**
74
+ * Pagination information if applicable.
75
+ */
76
+ pagination?: SerpRunResponse.NextPageParams | Array<SerpRunResponse.UnionMember1>;
77
+
78
+ /**
79
+ * The HTTP status code of the task.
80
+ */
81
+ status_code?: number;
82
+
83
+ /**
84
+ * List of warnings generated during the task.
85
+ */
86
+ warnings?: Array<string>;
87
+ }
88
+
89
+ export namespace SerpRunResponse {
90
+ export interface Data {
91
+ /**
92
+ * Browser actions execution results. Present only when browser_actions were
93
+ * specified in the request.
94
+ */
95
+ browser_actions?: Data.BrowserActions;
96
+
97
+ /**
98
+ * The cookies collected from browser actions during the task.
99
+ */
100
+ cookies?: Array<unknown>;
101
+
102
+ /**
103
+ * The evaluation results from browser actions during the task.
104
+ */
105
+ eval?: Array<unknown>;
106
+
107
+ /**
108
+ * The http requests from browser actions made during the task.
109
+ */
110
+ fetch?: Array<unknown>;
111
+
112
+ /**
113
+ * The headers received during the task.
114
+ */
115
+ headers?: { [key: string]: string };
116
+
117
+ /**
118
+ * The HTML content of the page.
119
+ */
120
+ html?: string;
121
+
122
+ /**
123
+ * List of all unique URLs found on the page.
124
+ */
125
+ links?: Array<string>;
126
+
127
+ /**
128
+ * The Markdown version of the HTML content.
129
+ */
130
+ markdown?: string;
131
+
132
+ /**
133
+ * The network capture data collected during the task.
134
+ */
135
+ network_capture?: Array<Data.NetworkCapture>;
136
+
137
+ /**
138
+ * Individual HTML content of each pagination page, before merging.
139
+ */
140
+ pages_html?: Array<string>;
141
+
142
+ /**
143
+ * The parsing results extracted from the HTML & network content.
144
+ */
145
+ parsing?: Data.ParsingSuccessResult | Data.ParsingErrorResult | { [key: string]: unknown };
146
+
147
+ /**
148
+ * The list of redirects that occurred during the task.
149
+ */
150
+ redirects?: Array<Data.Redirect>;
151
+
152
+ /**
153
+ * Screenshots taken during the task, from browser actions, or the screenshot
154
+ * format.
155
+ */
156
+ screenshots?: Array<unknown>;
157
+ }
158
+
159
+ export namespace Data {
160
+ /**
161
+ * Browser actions execution results. Present only when browser_actions were
162
+ * specified in the request.
163
+ */
164
+ export interface BrowserActions {
165
+ results: Array<BrowserActions.Result>;
166
+
167
+ success: boolean;
168
+
169
+ total_duration: number;
170
+ }
171
+
172
+ export namespace BrowserActions {
173
+ export interface Result {
174
+ duration: number;
175
+
176
+ name:
177
+ | 'goto'
178
+ | 'wait'
179
+ | 'wait_for_element'
180
+ | 'wait_for_navigation'
181
+ | 'click'
182
+ | 'fill'
183
+ | 'press'
184
+ | 'scroll'
185
+ | 'auto_scroll'
186
+ | 'screenshot'
187
+ | 'get_cookies'
188
+ | 'eval'
189
+ | 'fetch';
190
+
191
+ status: 'no-run' | 'in-progress' | 'done' | 'error' | 'skipped';
192
+
193
+ error?: string;
194
+
195
+ result?: unknown;
196
+ }
197
+ }
198
+
199
+ export interface NetworkCapture {
200
+ filter: NetworkCapture.Filter;
201
+
202
+ results: Array<NetworkCapture.Result>;
203
+
204
+ errorMessage?: string;
205
+ }
206
+
207
+ export namespace NetworkCapture {
208
+ export interface Filter {
209
+ validation: boolean;
210
+
211
+ wait_for_requests_count: number;
212
+
213
+ method?: 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH';
214
+
215
+ /**
216
+ * Resource type for network capture filtering
217
+ */
218
+ resource_type?:
219
+ | 'document'
220
+ | 'stylesheet'
221
+ | 'image'
222
+ | 'media'
223
+ | 'font'
224
+ | 'script'
225
+ | 'texttrack'
226
+ | 'xhr'
227
+ | 'fetch'
228
+ | 'prefetch'
229
+ | 'eventsource'
230
+ | 'websocket'
231
+ | 'manifest'
232
+ | 'signedexchange'
233
+ | 'ping'
234
+ | 'cspviolationreport'
235
+ | 'preflight'
236
+ | 'other'
237
+ | 'fedcm'
238
+ | Array<
239
+ | 'document'
240
+ | 'stylesheet'
241
+ | 'image'
242
+ | 'media'
243
+ | 'font'
244
+ | 'script'
245
+ | 'texttrack'
246
+ | 'xhr'
247
+ | 'fetch'
248
+ | 'prefetch'
249
+ | 'eventsource'
250
+ | 'websocket'
251
+ | 'manifest'
252
+ | 'signedexchange'
253
+ | 'ping'
254
+ | 'cspviolationreport'
255
+ | 'preflight'
256
+ | 'other'
257
+ | 'fedcm'
258
+ >;
259
+
260
+ status_code?: number | Array<number>;
261
+
262
+ url?: Filter.URL;
263
+
264
+ wait_for_requests_count_timeout?: number;
265
+ }
266
+
267
+ export namespace Filter {
268
+ export interface URL {
269
+ type: 'exact' | 'contains';
270
+
271
+ value: string;
272
+ }
273
+ }
274
+
275
+ export interface Result {
276
+ request: Result.Request;
277
+
278
+ response: Result.Response;
279
+ }
280
+
281
+ export namespace Result {
282
+ export interface Request {
283
+ headers: { [key: string]: string };
284
+
285
+ method: string;
286
+
287
+ /**
288
+ * Resource type for network capture filtering
289
+ */
290
+ resource_type:
291
+ | 'document'
292
+ | 'stylesheet'
293
+ | 'image'
294
+ | 'media'
295
+ | 'font'
296
+ | 'script'
297
+ | 'texttrack'
298
+ | 'xhr'
299
+ | 'fetch'
300
+ | 'prefetch'
301
+ | 'eventsource'
302
+ | 'websocket'
303
+ | 'manifest'
304
+ | 'signedexchange'
305
+ | 'ping'
306
+ | 'cspviolationreport'
307
+ | 'preflight'
308
+ | 'other'
309
+ | 'fedcm';
310
+
311
+ url: string;
312
+
313
+ body?: string;
314
+ }
315
+
316
+ export interface Response {
317
+ body: string;
318
+
319
+ headers: { [key: string]: string };
320
+
321
+ serialization: 'none' | 'base64';
322
+
323
+ status: number;
324
+
325
+ status_text: string;
326
+ }
327
+ }
328
+ }
329
+
330
+ export interface ParsingSuccessResult {
331
+ entities: { [key: string]: unknown };
332
+
333
+ status: 'success';
334
+ }
335
+
336
+ export interface ParsingErrorResult {
337
+ error: string;
338
+
339
+ status: 'error';
340
+ }
341
+
342
+ export interface Redirect {
343
+ status_code: number;
344
+
345
+ url: string;
346
+ }
347
+ }
348
+
349
+ export interface Metadata {
350
+ /**
351
+ * The name of the agent used for the query.
352
+ */
353
+ agent?: string;
354
+
355
+ /**
356
+ * The driver used for the task.
357
+ */
358
+ driver?: string;
359
+
360
+ /**
361
+ * The localization identifier for the query.
362
+ */
363
+ localization_id?: string;
364
+
365
+ /**
366
+ * The duration in milliseconds of the query processing.
367
+ */
368
+ query_duration?: number;
369
+
370
+ /**
371
+ * The time when the query was received.
372
+ */
373
+ query_time?: string;
374
+
375
+ /**
376
+ * Additional response parameters.
377
+ */
378
+ response_parameters?: unknown;
379
+
380
+ /**
381
+ * A tag associated with the query.
382
+ */
383
+ tag?: string;
384
+ }
385
+
386
+ export interface Debug {
387
+ /**
388
+ * Performance metrics collected during the task.
389
+ */
390
+ performance_metrics?: { [key: string]: number };
391
+
392
+ /**
393
+ * Total bytes used by the proxy during the task.
394
+ */
395
+ proxy_total_bytes_usage?: number;
396
+
397
+ /**
398
+ * The transformed output after applying any transformations.
399
+ */
400
+ transformed_output?: unknown;
401
+
402
+ /**
403
+ * The userbrowser instance using during the task.
404
+ */
405
+ userbrowser?: unknown;
406
+ }
407
+
408
+ export interface NextPageParams {
409
+ next_page_params: { [key: string]: unknown };
410
+ }
411
+
412
+ export interface UnionMember1 {
413
+ next_page_params: { [key: string]: unknown };
414
+ }
415
+ }
416
+
417
+ /**
418
+ * Response when an async SERP task is created successfully.
419
+ */
420
+ export interface SerpRunAsyncResponse {
421
+ /**
422
+ * Status indicating the async SERP task was created successfully.
423
+ */
424
+ status: 'success';
425
+
426
+ /**
427
+ * The created async task details.
428
+ */
429
+ task: SerpRunAsyncResponse.Task;
430
+ }
431
+
432
+ export namespace SerpRunAsyncResponse {
433
+ /**
434
+ * The created async task details.
435
+ */
436
+ export interface Task {
437
+ /**
438
+ * Unique task identifier.
439
+ */
440
+ id: string;
441
+
442
+ _query: unknown;
443
+
444
+ /**
445
+ * Timestamp when the task was created.
446
+ */
447
+ created_at: string;
448
+
449
+ /**
450
+ * Original input data for the task.
451
+ */
452
+ input: unknown;
453
+
454
+ /**
455
+ * Current state of the task.
456
+ */
457
+ state: 'pending' | 'success' | 'error';
458
+
459
+ /**
460
+ * URL for checking the task status.
461
+ */
462
+ status_url: string;
463
+
464
+ /**
465
+ * Account name that owns the task.
466
+ */
467
+ account_name?: string;
468
+
469
+ api_type?: 'web' | 'serp' | 'ecommerce' | 'social' | 'media' | 'agent' | 'extract' | 'fast-serp';
470
+
471
+ /**
472
+ * Batch ID if this task is part of a batch.
473
+ */
474
+ batch_id?: string;
475
+
476
+ /**
477
+ * URL for downloading the task results.
478
+ */
479
+ download_url?: string;
480
+
481
+ /**
482
+ * Error message if the task failed.
483
+ */
484
+ error?: string;
485
+
486
+ /**
487
+ * Classification of the error type.
488
+ */
489
+ error_type?: string;
490
+
491
+ /**
492
+ * Timestamp when the task was last modified.
493
+ */
494
+ modified_at?: string;
495
+
496
+ /**
497
+ * Storage location of the output data.
498
+ */
499
+ output_url?: string;
500
+
501
+ /**
502
+ * HTTP status code from the task execution.
503
+ */
504
+ status_code?: number;
505
+ }
506
+ }
507
+
508
+ /**
509
+ * Response when a batch of SERP tasks is created successfully.
510
+ */
511
+ export interface SerpRunBatchResponse {
512
+ /**
513
+ * Unique identifier for the batch.
514
+ */
515
+ batch_id: string;
516
+
517
+ /**
518
+ * Number of tasks in the batch.
519
+ */
520
+ batch_size: number;
521
+
522
+ /**
523
+ * List of created tasks.
524
+ */
525
+ tasks: Array<SerpRunBatchResponse.Task>;
526
+ }
527
+
528
+ export namespace SerpRunBatchResponse {
529
+ export interface Task {
530
+ /**
531
+ * Unique task identifier.
532
+ */
533
+ id: string;
534
+
535
+ _query: unknown;
536
+
537
+ /**
538
+ * Timestamp when the task was created.
539
+ */
540
+ created_at: string;
541
+
542
+ /**
543
+ * Original input data for the task.
544
+ */
545
+ input: unknown;
546
+
547
+ /**
548
+ * Current state of the task.
549
+ */
550
+ state: 'pending' | 'success' | 'error';
551
+
552
+ /**
553
+ * URL for checking the task status.
554
+ */
555
+ status_url: string;
556
+
557
+ /**
558
+ * Account name that owns the task.
559
+ */
560
+ account_name?: string;
561
+
562
+ api_type?: 'web' | 'serp' | 'ecommerce' | 'social' | 'media' | 'agent' | 'extract' | 'fast-serp';
563
+
564
+ /**
565
+ * Batch ID if this task is part of a batch.
566
+ */
567
+ batch_id?: string;
568
+
569
+ /**
570
+ * URL for downloading the task results.
571
+ */
572
+ download_url?: string;
573
+
574
+ /**
575
+ * Error message if the task failed.
576
+ */
577
+ error?: string;
578
+
579
+ /**
580
+ * Classification of the error type.
581
+ */
582
+ error_type?: string;
583
+
584
+ /**
585
+ * Timestamp when the task was last modified.
586
+ */
587
+ modified_at?: string;
588
+
589
+ /**
590
+ * Storage location of the output data.
591
+ */
592
+ output_url?: string;
593
+
594
+ /**
595
+ * HTTP status code from the task execution.
596
+ */
597
+ status_code?: number;
598
+ }
599
+ }
600
+
601
+ export interface SerpRunParams {
602
+ /**
603
+ * The search engine to query.
604
+ */
605
+ search_engine:
606
+ | 'google_search'
607
+ | 'google_sge'
608
+ | 'google_aio'
609
+ | 'google_maps_search'
610
+ | 'google_maps_reviews'
611
+ | 'google_maps_place'
612
+ | 'google_news'
613
+ | 'google_images'
614
+ | 'bing_search'
615
+ | 'yandex_search';
616
+
617
+ /**
618
+ * ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
619
+ * GB).
620
+ */
621
+ country?: string;
622
+
623
+ /**
624
+ * Device type used for the search request.
625
+ */
626
+ device?: 'desktop' | 'mobile';
627
+
628
+ /**
629
+ * Top-level domain for the search engine (e.g. "com", "co.uk", "de").
630
+ */
631
+ domain?: string;
632
+
633
+ /**
634
+ * Locale used for the search request.
635
+ */
636
+ locale?: string;
637
+
638
+ /**
639
+ * Geo-location for the search (canonical Google location name).
640
+ */
641
+ location?: string;
642
+
643
+ /**
644
+ * Number of results to return (1–100).
645
+ */
646
+ num_results?: number;
647
+
648
+ /**
649
+ * The result page number for pagination.
650
+ */
651
+ page?: number;
652
+
653
+ /**
654
+ * When true, the SERP response is parsed into structured JSON.
655
+ */
656
+ parse?: boolean;
657
+
658
+ /**
659
+ * The search keyword or phrase to query.
660
+ */
661
+ query?: string;
662
+
663
+ /**
664
+ * Whether to render the page in a browser before extracting.
665
+ */
666
+ render?: boolean;
667
+
668
+ /**
669
+ * When true, disables Google result filtering (filter=0) so omitted/duplicate and
670
+ * highly similar pages are also returned. Applies to Google search engines.
671
+ */
672
+ show_hidden_results?: boolean;
673
+ }
674
+
675
+ export interface SerpRunAsyncParams {
676
+ /**
677
+ * The search engine to query.
678
+ */
679
+ search_engine:
680
+ | 'google_search'
681
+ | 'google_sge'
682
+ | 'google_aio'
683
+ | 'google_maps_search'
684
+ | 'google_maps_reviews'
685
+ | 'google_maps_place'
686
+ | 'google_news'
687
+ | 'google_images'
688
+ | 'bing_search'
689
+ | 'yandex_search';
690
+
691
+ /**
692
+ * URL to call back when async operation completes
693
+ */
694
+ callback_url?: string;
695
+
696
+ /**
697
+ * ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
698
+ * GB).
699
+ */
700
+ country?: string;
701
+
702
+ /**
703
+ * Device type used for the search request.
704
+ */
705
+ device?: 'desktop' | 'mobile';
706
+
707
+ /**
708
+ * Top-level domain for the search engine (e.g. "com", "co.uk", "de").
709
+ */
710
+ domain?: string;
711
+
712
+ /**
713
+ * Locale used for the search request.
714
+ */
715
+ locale?: string;
716
+
717
+ /**
718
+ * Geo-location for the search (canonical Google location name).
719
+ */
720
+ location?: string;
721
+
722
+ /**
723
+ * Number of results to return (1–100).
724
+ */
725
+ num_results?: number;
726
+
727
+ /**
728
+ * The result page number for pagination.
729
+ */
730
+ page?: number;
731
+
732
+ /**
733
+ * When true, the SERP response is parsed into structured JSON.
734
+ */
735
+ parse?: boolean;
736
+
737
+ /**
738
+ * The search keyword or phrase to query.
739
+ */
740
+ query?: string;
741
+
742
+ /**
743
+ * Whether to render the page in a browser before extracting.
744
+ */
745
+ render?: boolean;
746
+
747
+ /**
748
+ * When true, disables Google result filtering (filter=0) so omitted/duplicate and
749
+ * highly similar pages are also returned. Applies to Google search engines.
750
+ */
751
+ show_hidden_results?: boolean;
752
+
753
+ /**
754
+ * Whether to compress stored data
755
+ */
756
+ storage_compress?: boolean;
757
+
758
+ /**
759
+ * Custom name for the stored object
760
+ */
761
+ storage_object_name?: string;
762
+
763
+ /**
764
+ * Type of storage to use for results
765
+ */
766
+ storage_type?: string;
767
+
768
+ /**
769
+ * URL for storage location
770
+ */
771
+ storage_url?: string;
772
+ }
773
+
774
+ export interface SerpRunBatchParams {
775
+ /**
776
+ * Array of SERP requests. Each object can include search parameters and
777
+ * async/storage settings.
778
+ */
779
+ inputs: Array<SerpRunBatchParams.Input>;
780
+
781
+ /**
782
+ * Shared parameters applied to the entire batch. Can include search parameters and
783
+ * async/storage settings.
784
+ */
785
+ shared_inputs?: SerpRunBatchParams.SharedInputs;
786
+ }
787
+
788
+ export namespace SerpRunBatchParams {
789
+ export interface Input {
790
+ /**
791
+ * URL to call back when async operation completes
792
+ */
793
+ callback_url?: string;
794
+
795
+ /**
796
+ * ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
797
+ * GB).
798
+ */
799
+ country?: string;
800
+
801
+ /**
802
+ * Device type used for the search request.
803
+ */
804
+ device?: 'desktop' | 'mobile';
805
+
806
+ /**
807
+ * Top-level domain for the search engine (e.g. "com", "co.uk", "de").
808
+ */
809
+ domain?: string;
810
+
811
+ /**
812
+ * Locale used for the search request.
813
+ */
814
+ locale?: string;
815
+
816
+ /**
817
+ * Geo-location for the search (canonical Google location name).
818
+ */
819
+ location?: string;
820
+
821
+ /**
822
+ * Number of results to return (1–100).
823
+ */
824
+ num_results?: number;
825
+
826
+ /**
827
+ * The result page number for pagination.
828
+ */
829
+ page?: number;
830
+
831
+ /**
832
+ * When true, the SERP response is parsed into structured JSON.
833
+ */
834
+ parse?: boolean;
835
+
836
+ /**
837
+ * The search keyword or phrase to query.
838
+ */
839
+ query?: string;
840
+
841
+ /**
842
+ * Whether to render the page in a browser before extracting.
843
+ */
844
+ render?: boolean;
845
+
846
+ /**
847
+ * The search engine to query.
848
+ */
849
+ search_engine?:
850
+ | 'google_search'
851
+ | 'google_sge'
852
+ | 'google_aio'
853
+ | 'google_maps_search'
854
+ | 'google_maps_reviews'
855
+ | 'google_maps_place'
856
+ | 'google_news'
857
+ | 'google_images'
858
+ | 'bing_search'
859
+ | 'yandex_search';
860
+
861
+ /**
862
+ * When true, disables Google result filtering (filter=0) so omitted/duplicate and
863
+ * highly similar pages are also returned. Applies to Google search engines.
864
+ */
865
+ show_hidden_results?: boolean;
866
+
867
+ /**
868
+ * Whether to compress stored data
869
+ */
870
+ storage_compress?: boolean;
871
+
872
+ /**
873
+ * Custom name for the stored object
874
+ */
875
+ storage_object_name?: string;
876
+
877
+ /**
878
+ * Type of storage to use for results
879
+ */
880
+ storage_type?: string;
881
+
882
+ /**
883
+ * URL for storage location
884
+ */
885
+ storage_url?: string;
886
+ }
887
+
888
+ /**
889
+ * Shared parameters applied to the entire batch. Can include search parameters and
890
+ * async/storage settings.
891
+ */
892
+ export interface SharedInputs {
893
+ /**
894
+ * URL to call back when async operation completes
895
+ */
896
+ callback_url?: string;
897
+
898
+ /**
899
+ * ISO Alpha-2 country code used to access the target search engine (e.g. US, DE,
900
+ * GB).
901
+ */
902
+ country?: string;
903
+
904
+ /**
905
+ * Device type used for the search request.
906
+ */
907
+ device?: 'desktop' | 'mobile';
908
+
909
+ /**
910
+ * Top-level domain for the search engine (e.g. "com", "co.uk", "de").
911
+ */
912
+ domain?: string;
913
+
914
+ /**
915
+ * Locale used for the search request.
916
+ */
917
+ locale?: string;
918
+
919
+ /**
920
+ * Geo-location for the search (canonical Google location name).
921
+ */
922
+ location?: string;
923
+
924
+ /**
925
+ * Number of results to return (1–100).
926
+ */
927
+ num_results?: number;
928
+
929
+ /**
930
+ * The result page number for pagination.
931
+ */
932
+ page?: number;
933
+
934
+ /**
935
+ * When true, the SERP response is parsed into structured JSON.
936
+ */
937
+ parse?: boolean;
938
+
939
+ /**
940
+ * The search keyword or phrase to query.
941
+ */
942
+ query?: string;
943
+
944
+ /**
945
+ * Whether to render the page in a browser before extracting.
946
+ */
947
+ render?: boolean;
948
+
949
+ /**
950
+ * The search engine to query.
951
+ */
952
+ search_engine?:
953
+ | 'google_search'
954
+ | 'google_sge'
955
+ | 'google_aio'
956
+ | 'google_maps_search'
957
+ | 'google_maps_reviews'
958
+ | 'google_maps_place'
959
+ | 'google_news'
960
+ | 'google_images'
961
+ | 'bing_search'
962
+ | 'yandex_search';
963
+
964
+ /**
965
+ * When true, disables Google result filtering (filter=0) so omitted/duplicate and
966
+ * highly similar pages are also returned. Applies to Google search engines.
967
+ */
968
+ show_hidden_results?: boolean;
969
+
970
+ /**
971
+ * Whether to compress stored data
972
+ */
973
+ storage_compress?: boolean;
974
+
975
+ /**
976
+ * Custom name for the stored object
977
+ */
978
+ storage_object_name?: string;
979
+
980
+ /**
981
+ * Type of storage to use for results
982
+ */
983
+ storage_type?: string;
984
+
985
+ /**
986
+ * URL for storage location
987
+ */
988
+ storage_url?: string;
989
+ }
990
+ }
991
+
992
+ export declare namespace Serp {
993
+ export {
994
+ type SerpRunResponse as SerpRunResponse,
995
+ type SerpRunAsyncResponse as SerpRunAsyncResponse,
996
+ type SerpRunBatchResponse as SerpRunBatchResponse,
997
+ type SerpRunParams as SerpRunParams,
998
+ type SerpRunAsyncParams as SerpRunAsyncParams,
999
+ type SerpRunBatchParams as SerpRunBatchParams,
1000
+ };
1001
+ }