anchorbrowser 0.16.3 → 1.0.0-dev.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 (43) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js.map +1 -1
  7. package/client.mjs +1 -1
  8. package/client.mjs.map +1 -1
  9. package/package.json +1 -1
  10. package/resources/index.d.mts +1 -1
  11. package/resources/index.d.mts.map +1 -1
  12. package/resources/index.d.ts +1 -1
  13. package/resources/index.d.ts.map +1 -1
  14. package/resources/index.js.map +1 -1
  15. package/resources/index.mjs +1 -1
  16. package/resources/index.mjs.map +1 -1
  17. package/resources/sessions/sessions.d.mts +46 -0
  18. package/resources/sessions/sessions.d.mts.map +1 -1
  19. package/resources/sessions/sessions.d.ts +46 -0
  20. package/resources/sessions/sessions.d.ts.map +1 -1
  21. package/resources/sessions/sessions.js.map +1 -1
  22. package/resources/sessions/sessions.mjs.map +1 -1
  23. package/resources/task.d.mts +0 -731
  24. package/resources/task.d.mts.map +1 -1
  25. package/resources/task.d.ts +0 -731
  26. package/resources/task.d.ts.map +1 -1
  27. package/resources/task.js +0 -69
  28. package/resources/task.js.map +1 -1
  29. package/resources/task.mjs +0 -69
  30. package/resources/task.mjs.map +1 -1
  31. package/src/client.ts +2 -22
  32. package/src/resources/index.ts +1 -11
  33. package/src/resources/sessions/sessions.ts +51 -0
  34. package/src/resources/task.ts +1 -1476
  35. package/src/version.ts +1 -1
  36. package/version.d.mts +1 -1
  37. package/version.d.mts.map +1 -1
  38. package/version.d.ts +1 -1
  39. package/version.d.ts.map +1 -1
  40. package/version.js +1 -1
  41. package/version.js.map +1 -1
  42. package/version.mjs +1 -1
  43. package/version.mjs.map +1 -1
@@ -1,1480 +1,5 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
3
  import { APIResource } from '../core/resource';
4
- import { APIPromise } from '../core/api-promise';
5
- import { RequestOptions } from '../internal/request-options';
6
- import { path } from '../internal/utils/path';
7
4
 
8
- export class Task extends APIResource {
9
- /**
10
- * Creates a new task or updates an existing task with the same name. Tasks are
11
- * reusable code snippets that can be executed in browser sessions. Tasks support
12
- * versioning with draft and published versions.
13
- *
14
- * @example
15
- * ```ts
16
- * const task = await client.task.create({
17
- * language: 'typescript',
18
- * name: 'web-scraper',
19
- * code: 'Y29uc3QgYW5jaG9yID0gcmVxdWlyZSgnYW5jaG9yYnJvd3NlcicpOwoKYXN5bmMgZnVuY3Rpb24gcnVuKCkgewogIGNvbnN0IHNlc3Npb24gPSBhd2FpdCBhbmNob3IuY3JlYXRlU2Vzc2lvbigpOwogIGF3YWl0IHNlc3Npb24uZ29UbygnaHR0cHM6Ly9leGFtcGxlLmNvbScpOwogIGNvbnN0IHRpdGxlID0gYXdhaXQgc2Vzc2lvbi5nZXRUaXRsZSgpOwogIGNvbnNvbGUubG9nKHRpdGxlKTsKICBhd2FpdCBzZXNzaW9uLmNsb3NlKCk7Cn0KcnVuKCk7',
20
- * description:
21
- * 'A task to scrape product information from e-commerce sites',
22
- * });
23
- * ```
24
- */
25
- create(body: TaskCreateParams, options?: RequestOptions): APIPromise<TaskCreateResponse> {
26
- return this._client.post('/v1/task', { body, ...options });
27
- }
28
-
29
- /**
30
- * Retrieves a paginated list of all tasks for the authenticated team. Tasks are
31
- * returned with their latest version information and metadata.
32
- *
33
- * @example
34
- * ```ts
35
- * const tasks = await client.task.list();
36
- * ```
37
- */
38
- list(
39
- query: TaskListParams | null | undefined = {},
40
- options?: RequestOptions,
41
- ): APIPromise<TaskListResponse> {
42
- return this._client.get('/v1/task', { query, ...options });
43
- }
44
-
45
- /**
46
- * Retrieves a single execution result by its ID. This endpoint is useful for
47
- * polling execution status in async mode or retrieving detailed execution
48
- * information.
49
- *
50
- * @example
51
- * ```ts
52
- * const response = await client.task.retrieveExecutionResult(
53
- * '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
54
- * { taskId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
55
- * );
56
- * ```
57
- */
58
- retrieveExecutionResult(
59
- executionID: string,
60
- params: TaskRetrieveExecutionResultParams,
61
- options?: RequestOptions,
62
- ): APIPromise<TaskRetrieveExecutionResultResponse> {
63
- const { taskId } = params;
64
- return this._client.get(path`/v1/task/${taskId}/executions/${executionID}`, options);
65
- }
66
-
67
- /**
68
- * Executes a task in a browser session. The task can be run with a specific
69
- * version or the latest version. Optionally, you can provide an existing session
70
- * ID or let the system create a new one.
71
- *
72
- * @example
73
- * ```ts
74
- * const response = await client.task.run({
75
- * taskId: '550e8400-e29b-41d4-a716-446655440000',
76
- * inputs: {
77
- * ANCHOR_TARGET_URL: 'https://example.com',
78
- * ANCHOR_MAX_PAGES: '10',
79
- * },
80
- * version: '1',
81
- * });
82
- * ```
83
- */
84
- run(body: TaskRunParams, options?: RequestOptions): APIPromise<TaskRunResponse> {
85
- return this._client.post('/v1/task/run', { body, ...options });
86
- }
87
- }
88
-
89
- export interface TaskCreateResponse {
90
- data?: TaskCreateResponse.Data;
91
- }
92
-
93
- export namespace TaskCreateResponse {
94
- export interface Data {
95
- /**
96
- * Unique identifier for the task
97
- */
98
- id: string;
99
-
100
- /**
101
- * Base64 encoded task code
102
- */
103
- code: string;
104
-
105
- /**
106
- * Task creation timestamp
107
- */
108
- createdAt: string;
109
-
110
- /**
111
- * Whether the task is soft deleted
112
- */
113
- deleted: boolean;
114
-
115
- /**
116
- * Programming language for the task
117
- */
118
- language: 'typescript';
119
-
120
- /**
121
- * Latest version identifier (draft, latest, or version number)
122
- */
123
- latestVersion: string;
124
-
125
- /**
126
- * Task name (letters, numbers, hyphens, and underscores only)
127
- */
128
- name: string;
129
-
130
- /**
131
- * Team identifier that owns this task
132
- */
133
- teamId: string;
134
-
135
- /**
136
- * Task last update timestamp
137
- */
138
- updatedAt: string;
139
-
140
- /**
141
- * Browser configuration for task execution
142
- */
143
- browserConfiguration?: Data.BrowserConfiguration;
144
-
145
- /**
146
- * Optional description of the task
147
- */
148
- description?: string;
149
- }
150
-
151
- export namespace Data {
152
- /**
153
- * Browser configuration for task execution
154
- */
155
- export interface BrowserConfiguration {
156
- /**
157
- * The URL to navigate to when the browser session starts. If not provided, the
158
- * browser will load an empty page.
159
- */
160
- initial_url?: string;
161
-
162
- /**
163
- * Configuration for live viewing the browser session.
164
- */
165
- live_view?: BrowserConfiguration.LiveView;
166
-
167
- /**
168
- * Proxy Documentation available at [Proxy Documentation](/advanced/proxy)
169
- */
170
- proxy?: BrowserConfiguration.AnchorProxy | BrowserConfiguration.CustomProxy;
171
-
172
- /**
173
- * Configuration for session recording.
174
- */
175
- recording?: BrowserConfiguration.Recording;
176
-
177
- /**
178
- * Timeout configurations for the browser session.
179
- */
180
- timeout?: BrowserConfiguration.Timeout;
181
- }
182
-
183
- export namespace BrowserConfiguration {
184
- /**
185
- * Configuration for live viewing the browser session.
186
- */
187
- export interface LiveView {
188
- /**
189
- * Enable or disable read-only mode for live viewing. Defaults to `false`.
190
- */
191
- read_only?: boolean;
192
- }
193
-
194
- export interface AnchorProxy {
195
- active: boolean;
196
-
197
- /**
198
- * City name for precise geographic targeting. Supported for anchor_proxy only. Can
199
- * only be used when region is also provided.
200
- */
201
- city?: string;
202
-
203
- /**
204
- * Supported country codes ISO 2 lowercase
205
- */
206
- country_code?:
207
- | 'af'
208
- | 'al'
209
- | 'dz'
210
- | 'ad'
211
- | 'ao'
212
- | 'as'
213
- | 'ag'
214
- | 'ar'
215
- | 'am'
216
- | 'aw'
217
- | 'au'
218
- | 'at'
219
- | 'az'
220
- | 'bs'
221
- | 'bh'
222
- | 'bb'
223
- | 'by'
224
- | 'be'
225
- | 'bz'
226
- | 'bj'
227
- | 'bm'
228
- | 'bo'
229
- | 'ba'
230
- | 'br'
231
- | 'bg'
232
- | 'bf'
233
- | 'cm'
234
- | 'ca'
235
- | 'cv'
236
- | 'td'
237
- | 'cl'
238
- | 'co'
239
- | 'cg'
240
- | 'cr'
241
- | 'ci'
242
- | 'hr'
243
- | 'cu'
244
- | 'cy'
245
- | 'cz'
246
- | 'dk'
247
- | 'dm'
248
- | 'do'
249
- | 'ec'
250
- | 'eg'
251
- | 'sv'
252
- | 'ee'
253
- | 'et'
254
- | 'fo'
255
- | 'fi'
256
- | 'fr'
257
- | 'gf'
258
- | 'pf'
259
- | 'ga'
260
- | 'gm'
261
- | 'ge'
262
- | 'de'
263
- | 'gh'
264
- | 'gi'
265
- | 'gr'
266
- | 'gd'
267
- | 'gp'
268
- | 'gt'
269
- | 'gg'
270
- | 'gn'
271
- | 'gw'
272
- | 'gy'
273
- | 'ht'
274
- | 'hn'
275
- | 'hu'
276
- | 'is'
277
- | 'in'
278
- | 'ir'
279
- | 'iq'
280
- | 'ie'
281
- | 'il'
282
- | 'it'
283
- | 'jm'
284
- | 'jp'
285
- | 'jo'
286
- | 'kz'
287
- | 'kw'
288
- | 'kg'
289
- | 'lv'
290
- | 'lb'
291
- | 'ly'
292
- | 'li'
293
- | 'lt'
294
- | 'lu'
295
- | 'mk'
296
- | 'ml'
297
- | 'mt'
298
- | 'mq'
299
- | 'mr'
300
- | 'mx'
301
- | 'md'
302
- | 'mc'
303
- | 'me'
304
- | 'ma'
305
- | 'nl'
306
- | 'nz'
307
- | 'ni'
308
- | 'ng'
309
- | 'no'
310
- | 'pk'
311
- | 'pa'
312
- | 'py'
313
- | 'pe'
314
- | 'ph'
315
- | 'pl'
316
- | 'pt'
317
- | 'pr'
318
- | 'qa'
319
- | 'ro'
320
- | 'lc'
321
- | 'sm'
322
- | 'sa'
323
- | 'sn'
324
- | 'rs'
325
- | 'sc'
326
- | 'sl'
327
- | 'sk'
328
- | 'si'
329
- | 'so'
330
- | 'za'
331
- | 'kr'
332
- | 'es'
333
- | 'sr'
334
- | 'se'
335
- | 'ch'
336
- | 'sy'
337
- | 'st'
338
- | 'tw'
339
- | 'tj'
340
- | 'tg'
341
- | 'tt'
342
- | 'tn'
343
- | 'tr'
344
- | 'tc'
345
- | 'ua'
346
- | 'ae'
347
- | 'us'
348
- | 'uy'
349
- | 'uz'
350
- | 've'
351
- | 'ye';
352
-
353
- /**
354
- * Region code for more specific geographic targeting. The city parameter can only
355
- * be used when region is also provided.
356
- */
357
- region?: string;
358
-
359
- /**
360
- * Create a session with a proxy to access websites as if you're browsing from a
361
- * computer in that country.
362
- */
363
- type?: 'anchor_proxy';
364
- }
365
-
366
- export interface CustomProxy {
367
- active: boolean;
368
-
369
- /**
370
- * Proxy password
371
- */
372
- password: string;
373
-
374
- /**
375
- * Proxy address in **PROTOCOL://HOST:PORT** format (e.g.,
376
- * https://proxy.example.com:443). See [proxy page](/advanced/proxy#custom-proxy).
377
- */
378
- server: string;
379
-
380
- type: 'custom';
381
-
382
- /**
383
- * Proxy username
384
- */
385
- username: string;
386
- }
387
-
388
- /**
389
- * Configuration for session recording.
390
- */
391
- export interface Recording {
392
- /**
393
- * Enable or disable video recording of the browser session. Defaults to `true`.
394
- */
395
- active?: boolean;
396
- }
397
-
398
- /**
399
- * Timeout configurations for the browser session.
400
- */
401
- export interface Timeout {
402
- /**
403
- * The amount of time (in minutes) the browser session waits for new connections
404
- * after all others are closed before stopping. Defaults to `5`.
405
- */
406
- idle_timeout?: number;
407
-
408
- /**
409
- * Maximum amount of time (in minutes) for the browser to run before terminating.
410
- * Defaults to `20`.
411
- */
412
- max_duration?: number;
413
- }
414
- }
415
- }
416
- }
417
-
418
- export interface TaskListResponse {
419
- data?: TaskListResponse.Data;
420
- }
421
-
422
- export namespace TaskListResponse {
423
- export interface Data {
424
- /**
425
- * Number of tasks per page
426
- */
427
- limit: number;
428
-
429
- /**
430
- * Current page number
431
- */
432
- page: number;
433
-
434
- tasks: Array<Data.Task>;
435
-
436
- /**
437
- * Total number of tasks
438
- */
439
- total: number;
440
- }
441
-
442
- export namespace Data {
443
- export interface Task {
444
- /**
445
- * Unique identifier for the task
446
- */
447
- id: string;
448
-
449
- /**
450
- * Base64 encoded task code
451
- */
452
- code: string;
453
-
454
- /**
455
- * Task creation timestamp
456
- */
457
- createdAt: string;
458
-
459
- /**
460
- * Whether the task is soft deleted
461
- */
462
- deleted: boolean;
463
-
464
- /**
465
- * Programming language for the task
466
- */
467
- language: 'typescript';
468
-
469
- /**
470
- * Latest version identifier (draft, latest, or version number)
471
- */
472
- latestVersion: string;
473
-
474
- /**
475
- * Task name (letters, numbers, hyphens, and underscores only)
476
- */
477
- name: string;
478
-
479
- /**
480
- * Team identifier that owns this task
481
- */
482
- teamId: string;
483
-
484
- /**
485
- * Task last update timestamp
486
- */
487
- updatedAt: string;
488
-
489
- /**
490
- * Browser configuration for task execution
491
- */
492
- browserConfiguration?: Task.BrowserConfiguration;
493
-
494
- /**
495
- * Optional description of the task
496
- */
497
- description?: string;
498
- }
499
-
500
- export namespace Task {
501
- /**
502
- * Browser configuration for task execution
503
- */
504
- export interface BrowserConfiguration {
505
- /**
506
- * The URL to navigate to when the browser session starts. If not provided, the
507
- * browser will load an empty page.
508
- */
509
- initial_url?: string;
510
-
511
- /**
512
- * Configuration for live viewing the browser session.
513
- */
514
- live_view?: BrowserConfiguration.LiveView;
515
-
516
- /**
517
- * Proxy Documentation available at [Proxy Documentation](/advanced/proxy)
518
- */
519
- proxy?: BrowserConfiguration.AnchorProxy | BrowserConfiguration.CustomProxy;
520
-
521
- /**
522
- * Configuration for session recording.
523
- */
524
- recording?: BrowserConfiguration.Recording;
525
-
526
- /**
527
- * Timeout configurations for the browser session.
528
- */
529
- timeout?: BrowserConfiguration.Timeout;
530
- }
531
-
532
- export namespace BrowserConfiguration {
533
- /**
534
- * Configuration for live viewing the browser session.
535
- */
536
- export interface LiveView {
537
- /**
538
- * Enable or disable read-only mode for live viewing. Defaults to `false`.
539
- */
540
- read_only?: boolean;
541
- }
542
-
543
- export interface AnchorProxy {
544
- active: boolean;
545
-
546
- /**
547
- * City name for precise geographic targeting. Supported for anchor_proxy only. Can
548
- * only be used when region is also provided.
549
- */
550
- city?: string;
551
-
552
- /**
553
- * Supported country codes ISO 2 lowercase
554
- */
555
- country_code?:
556
- | 'af'
557
- | 'al'
558
- | 'dz'
559
- | 'ad'
560
- | 'ao'
561
- | 'as'
562
- | 'ag'
563
- | 'ar'
564
- | 'am'
565
- | 'aw'
566
- | 'au'
567
- | 'at'
568
- | 'az'
569
- | 'bs'
570
- | 'bh'
571
- | 'bb'
572
- | 'by'
573
- | 'be'
574
- | 'bz'
575
- | 'bj'
576
- | 'bm'
577
- | 'bo'
578
- | 'ba'
579
- | 'br'
580
- | 'bg'
581
- | 'bf'
582
- | 'cm'
583
- | 'ca'
584
- | 'cv'
585
- | 'td'
586
- | 'cl'
587
- | 'co'
588
- | 'cg'
589
- | 'cr'
590
- | 'ci'
591
- | 'hr'
592
- | 'cu'
593
- | 'cy'
594
- | 'cz'
595
- | 'dk'
596
- | 'dm'
597
- | 'do'
598
- | 'ec'
599
- | 'eg'
600
- | 'sv'
601
- | 'ee'
602
- | 'et'
603
- | 'fo'
604
- | 'fi'
605
- | 'fr'
606
- | 'gf'
607
- | 'pf'
608
- | 'ga'
609
- | 'gm'
610
- | 'ge'
611
- | 'de'
612
- | 'gh'
613
- | 'gi'
614
- | 'gr'
615
- | 'gd'
616
- | 'gp'
617
- | 'gt'
618
- | 'gg'
619
- | 'gn'
620
- | 'gw'
621
- | 'gy'
622
- | 'ht'
623
- | 'hn'
624
- | 'hu'
625
- | 'is'
626
- | 'in'
627
- | 'ir'
628
- | 'iq'
629
- | 'ie'
630
- | 'il'
631
- | 'it'
632
- | 'jm'
633
- | 'jp'
634
- | 'jo'
635
- | 'kz'
636
- | 'kw'
637
- | 'kg'
638
- | 'lv'
639
- | 'lb'
640
- | 'ly'
641
- | 'li'
642
- | 'lt'
643
- | 'lu'
644
- | 'mk'
645
- | 'ml'
646
- | 'mt'
647
- | 'mq'
648
- | 'mr'
649
- | 'mx'
650
- | 'md'
651
- | 'mc'
652
- | 'me'
653
- | 'ma'
654
- | 'nl'
655
- | 'nz'
656
- | 'ni'
657
- | 'ng'
658
- | 'no'
659
- | 'pk'
660
- | 'pa'
661
- | 'py'
662
- | 'pe'
663
- | 'ph'
664
- | 'pl'
665
- | 'pt'
666
- | 'pr'
667
- | 'qa'
668
- | 'ro'
669
- | 'lc'
670
- | 'sm'
671
- | 'sa'
672
- | 'sn'
673
- | 'rs'
674
- | 'sc'
675
- | 'sl'
676
- | 'sk'
677
- | 'si'
678
- | 'so'
679
- | 'za'
680
- | 'kr'
681
- | 'es'
682
- | 'sr'
683
- | 'se'
684
- | 'ch'
685
- | 'sy'
686
- | 'st'
687
- | 'tw'
688
- | 'tj'
689
- | 'tg'
690
- | 'tt'
691
- | 'tn'
692
- | 'tr'
693
- | 'tc'
694
- | 'ua'
695
- | 'ae'
696
- | 'us'
697
- | 'uy'
698
- | 'uz'
699
- | 've'
700
- | 'ye';
701
-
702
- /**
703
- * Region code for more specific geographic targeting. The city parameter can only
704
- * be used when region is also provided.
705
- */
706
- region?: string;
707
-
708
- /**
709
- * Create a session with a proxy to access websites as if you're browsing from a
710
- * computer in that country.
711
- */
712
- type?: 'anchor_proxy';
713
- }
714
-
715
- export interface CustomProxy {
716
- active: boolean;
717
-
718
- /**
719
- * Proxy password
720
- */
721
- password: string;
722
-
723
- /**
724
- * Proxy address in **PROTOCOL://HOST:PORT** format (e.g.,
725
- * https://proxy.example.com:443). See [proxy page](/advanced/proxy#custom-proxy).
726
- */
727
- server: string;
728
-
729
- type: 'custom';
730
-
731
- /**
732
- * Proxy username
733
- */
734
- username: string;
735
- }
736
-
737
- /**
738
- * Configuration for session recording.
739
- */
740
- export interface Recording {
741
- /**
742
- * Enable or disable video recording of the browser session. Defaults to `true`.
743
- */
744
- active?: boolean;
745
- }
746
-
747
- /**
748
- * Timeout configurations for the browser session.
749
- */
750
- export interface Timeout {
751
- /**
752
- * The amount of time (in minutes) the browser session waits for new connections
753
- * after all others are closed before stopping. Defaults to `5`.
754
- */
755
- idle_timeout?: number;
756
-
757
- /**
758
- * Maximum amount of time (in minutes) for the browser to run before terminating.
759
- * Defaults to `20`.
760
- */
761
- max_duration?: number;
762
- }
763
- }
764
- }
765
- }
766
- }
767
-
768
- export interface TaskRetrieveExecutionResultResponse {
769
- data?: TaskRetrieveExecutionResultResponse.Data;
770
- }
771
-
772
- export namespace TaskRetrieveExecutionResultResponse {
773
- export interface Data {
774
- /**
775
- * Unique identifier for the execution result
776
- */
777
- id: string;
778
-
779
- /**
780
- * Execution start time
781
- */
782
- startTime: string;
783
-
784
- /**
785
- * Execution status
786
- */
787
- status: 'success' | 'failure' | 'timeout' | 'cancelled';
788
-
789
- /**
790
- * Task version identifier
791
- */
792
- taskVersionId: string;
793
-
794
- /**
795
- * Version that was executed
796
- */
797
- version: string;
798
-
799
- /**
800
- * Error message if execution failed
801
- */
802
- errorMessage?: string | null;
803
-
804
- /**
805
- * Execution duration in milliseconds
806
- */
807
- executionTime?: number | null;
808
-
809
- /**
810
- * Task execution output
811
- */
812
- output?: string | null;
813
- }
814
- }
815
-
816
- export interface TaskRunResponse {
817
- data?: TaskRunResponse.Data;
818
- }
819
-
820
- export namespace TaskRunResponse {
821
- export interface Data {
822
- /**
823
- * Execution result message
824
- */
825
- message: string;
826
-
827
- /**
828
- * Whether the task executed successfully
829
- */
830
- success: boolean;
831
-
832
- /**
833
- * Task identifier
834
- */
835
- taskId: string;
836
-
837
- /**
838
- * Error message if execution failed
839
- */
840
- error?: string;
841
-
842
- /**
843
- * Execution duration in milliseconds
844
- */
845
- executionTime?: number;
846
-
847
- /**
848
- * Task execution output
849
- */
850
- output?: string;
851
- }
852
- }
853
-
854
- export interface TaskCreateParams {
855
- /**
856
- * Programming language for the task
857
- */
858
- language: 'typescript';
859
-
860
- /**
861
- * Task name (letters, numbers, hyphens, and underscores only)
862
- */
863
- name: string;
864
-
865
- /**
866
- * Browser configuration for task execution
867
- */
868
- browserConfiguration?: TaskCreateParams.BrowserConfiguration;
869
-
870
- /**
871
- * Base64 encoded task code (optional)
872
- */
873
- code?: string;
874
-
875
- /**
876
- * Optional description of the task
877
- */
878
- description?: string;
879
- }
880
-
881
- export namespace TaskCreateParams {
882
- /**
883
- * Browser configuration for task execution
884
- */
885
- export interface BrowserConfiguration {
886
- /**
887
- * The URL to navigate to when the browser session starts. If not provided, the
888
- * browser will load an empty page.
889
- */
890
- initial_url?: string;
891
-
892
- /**
893
- * Configuration for live viewing the browser session.
894
- */
895
- live_view?: BrowserConfiguration.LiveView;
896
-
897
- /**
898
- * Proxy Documentation available at [Proxy Documentation](/advanced/proxy)
899
- */
900
- proxy?: BrowserConfiguration.AnchorProxy | BrowserConfiguration.CustomProxy;
901
-
902
- /**
903
- * Configuration for session recording.
904
- */
905
- recording?: BrowserConfiguration.Recording;
906
-
907
- /**
908
- * Timeout configurations for the browser session.
909
- */
910
- timeout?: BrowserConfiguration.Timeout;
911
- }
912
-
913
- export namespace BrowserConfiguration {
914
- /**
915
- * Configuration for live viewing the browser session.
916
- */
917
- export interface LiveView {
918
- /**
919
- * Enable or disable read-only mode for live viewing. Defaults to `false`.
920
- */
921
- read_only?: boolean;
922
- }
923
-
924
- export interface AnchorProxy {
925
- active: boolean;
926
-
927
- /**
928
- * City name for precise geographic targeting. Supported for anchor_proxy only. Can
929
- * only be used when region is also provided.
930
- */
931
- city?: string;
932
-
933
- /**
934
- * Supported country codes ISO 2 lowercase
935
- */
936
- country_code?:
937
- | 'af'
938
- | 'al'
939
- | 'dz'
940
- | 'ad'
941
- | 'ao'
942
- | 'as'
943
- | 'ag'
944
- | 'ar'
945
- | 'am'
946
- | 'aw'
947
- | 'au'
948
- | 'at'
949
- | 'az'
950
- | 'bs'
951
- | 'bh'
952
- | 'bb'
953
- | 'by'
954
- | 'be'
955
- | 'bz'
956
- | 'bj'
957
- | 'bm'
958
- | 'bo'
959
- | 'ba'
960
- | 'br'
961
- | 'bg'
962
- | 'bf'
963
- | 'cm'
964
- | 'ca'
965
- | 'cv'
966
- | 'td'
967
- | 'cl'
968
- | 'co'
969
- | 'cg'
970
- | 'cr'
971
- | 'ci'
972
- | 'hr'
973
- | 'cu'
974
- | 'cy'
975
- | 'cz'
976
- | 'dk'
977
- | 'dm'
978
- | 'do'
979
- | 'ec'
980
- | 'eg'
981
- | 'sv'
982
- | 'ee'
983
- | 'et'
984
- | 'fo'
985
- | 'fi'
986
- | 'fr'
987
- | 'gf'
988
- | 'pf'
989
- | 'ga'
990
- | 'gm'
991
- | 'ge'
992
- | 'de'
993
- | 'gh'
994
- | 'gi'
995
- | 'gr'
996
- | 'gd'
997
- | 'gp'
998
- | 'gt'
999
- | 'gg'
1000
- | 'gn'
1001
- | 'gw'
1002
- | 'gy'
1003
- | 'ht'
1004
- | 'hn'
1005
- | 'hu'
1006
- | 'is'
1007
- | 'in'
1008
- | 'ir'
1009
- | 'iq'
1010
- | 'ie'
1011
- | 'il'
1012
- | 'it'
1013
- | 'jm'
1014
- | 'jp'
1015
- | 'jo'
1016
- | 'kz'
1017
- | 'kw'
1018
- | 'kg'
1019
- | 'lv'
1020
- | 'lb'
1021
- | 'ly'
1022
- | 'li'
1023
- | 'lt'
1024
- | 'lu'
1025
- | 'mk'
1026
- | 'ml'
1027
- | 'mt'
1028
- | 'mq'
1029
- | 'mr'
1030
- | 'mx'
1031
- | 'md'
1032
- | 'mc'
1033
- | 'me'
1034
- | 'ma'
1035
- | 'nl'
1036
- | 'nz'
1037
- | 'ni'
1038
- | 'ng'
1039
- | 'no'
1040
- | 'pk'
1041
- | 'pa'
1042
- | 'py'
1043
- | 'pe'
1044
- | 'ph'
1045
- | 'pl'
1046
- | 'pt'
1047
- | 'pr'
1048
- | 'qa'
1049
- | 'ro'
1050
- | 'lc'
1051
- | 'sm'
1052
- | 'sa'
1053
- | 'sn'
1054
- | 'rs'
1055
- | 'sc'
1056
- | 'sl'
1057
- | 'sk'
1058
- | 'si'
1059
- | 'so'
1060
- | 'za'
1061
- | 'kr'
1062
- | 'es'
1063
- | 'sr'
1064
- | 'se'
1065
- | 'ch'
1066
- | 'sy'
1067
- | 'st'
1068
- | 'tw'
1069
- | 'tj'
1070
- | 'tg'
1071
- | 'tt'
1072
- | 'tn'
1073
- | 'tr'
1074
- | 'tc'
1075
- | 'ua'
1076
- | 'ae'
1077
- | 'us'
1078
- | 'uy'
1079
- | 'uz'
1080
- | 've'
1081
- | 'ye';
1082
-
1083
- /**
1084
- * Region code for more specific geographic targeting. The city parameter can only
1085
- * be used when region is also provided.
1086
- */
1087
- region?: string;
1088
-
1089
- /**
1090
- * Create a session with a proxy to access websites as if you're browsing from a
1091
- * computer in that country.
1092
- */
1093
- type?: 'anchor_proxy';
1094
- }
1095
-
1096
- export interface CustomProxy {
1097
- active: boolean;
1098
-
1099
- /**
1100
- * Proxy password
1101
- */
1102
- password: string;
1103
-
1104
- /**
1105
- * Proxy address in **PROTOCOL://HOST:PORT** format (e.g.,
1106
- * https://proxy.example.com:443). See [proxy page](/advanced/proxy#custom-proxy).
1107
- */
1108
- server: string;
1109
-
1110
- type: 'custom';
1111
-
1112
- /**
1113
- * Proxy username
1114
- */
1115
- username: string;
1116
- }
1117
-
1118
- /**
1119
- * Configuration for session recording.
1120
- */
1121
- export interface Recording {
1122
- /**
1123
- * Enable or disable video recording of the browser session. Defaults to `true`.
1124
- */
1125
- active?: boolean;
1126
- }
1127
-
1128
- /**
1129
- * Timeout configurations for the browser session.
1130
- */
1131
- export interface Timeout {
1132
- /**
1133
- * The amount of time (in minutes) the browser session waits for new connections
1134
- * after all others are closed before stopping. Defaults to `5`.
1135
- */
1136
- idle_timeout?: number;
1137
-
1138
- /**
1139
- * Maximum amount of time (in minutes) for the browser to run before terminating.
1140
- * Defaults to `20`.
1141
- */
1142
- max_duration?: number;
1143
- }
1144
- }
1145
- }
1146
-
1147
- export interface TaskListParams {
1148
- /**
1149
- * Number of tasks per page
1150
- */
1151
- limit?: string;
1152
-
1153
- /**
1154
- * Page number
1155
- */
1156
- page?: string;
1157
- }
1158
-
1159
- export interface TaskRetrieveExecutionResultParams {
1160
- /**
1161
- * The ID of the task
1162
- */
1163
- taskId: string;
1164
- }
1165
-
1166
- export interface TaskRunParams {
1167
- /**
1168
- * Task identifier
1169
- */
1170
- taskId: string;
1171
-
1172
- /**
1173
- * Whether to run the task asynchronously.
1174
- */
1175
- async?: boolean;
1176
-
1177
- /**
1178
- * Whether to cleanup browser sessions after task execution. Defaults to true.
1179
- */
1180
- cleanupSessions?: boolean;
1181
-
1182
- /**
1183
- * Environment variables for task execution (keys must start with ANCHOR\_)
1184
- */
1185
- inputs?: { [key: string]: string };
1186
-
1187
- /**
1188
- * Override browser configuration for this execution
1189
- */
1190
- overrideBrowserConfiguration?: TaskRunParams.OverrideBrowserConfiguration;
1191
-
1192
- /**
1193
- * Optional existing browser session ID to use for task execution
1194
- */
1195
- sessionId?: string;
1196
-
1197
- /**
1198
- * Version to run (draft, latest, or version number)
1199
- */
1200
- version?: string;
1201
- }
1202
-
1203
- export namespace TaskRunParams {
1204
- /**
1205
- * Override browser configuration for this execution
1206
- */
1207
- export interface OverrideBrowserConfiguration {
1208
- /**
1209
- * The URL to navigate to when the browser session starts. If not provided, the
1210
- * browser will load an empty page.
1211
- */
1212
- initial_url?: string;
1213
-
1214
- /**
1215
- * Configuration for live viewing the browser session.
1216
- */
1217
- live_view?: OverrideBrowserConfiguration.LiveView;
1218
-
1219
- /**
1220
- * Proxy Documentation available at [Proxy Documentation](/advanced/proxy)
1221
- */
1222
- proxy?: OverrideBrowserConfiguration.AnchorProxy | OverrideBrowserConfiguration.CustomProxy;
1223
-
1224
- /**
1225
- * Configuration for session recording.
1226
- */
1227
- recording?: OverrideBrowserConfiguration.Recording;
1228
-
1229
- /**
1230
- * Timeout configurations for the browser session.
1231
- */
1232
- timeout?: OverrideBrowserConfiguration.Timeout;
1233
- }
1234
-
1235
- export namespace OverrideBrowserConfiguration {
1236
- /**
1237
- * Configuration for live viewing the browser session.
1238
- */
1239
- export interface LiveView {
1240
- /**
1241
- * Enable or disable read-only mode for live viewing. Defaults to `false`.
1242
- */
1243
- read_only?: boolean;
1244
- }
1245
-
1246
- export interface AnchorProxy {
1247
- active: boolean;
1248
-
1249
- /**
1250
- * City name for precise geographic targeting. Supported for anchor_proxy only. Can
1251
- * only be used when region is also provided.
1252
- */
1253
- city?: string;
1254
-
1255
- /**
1256
- * Supported country codes ISO 2 lowercase
1257
- */
1258
- country_code?:
1259
- | 'af'
1260
- | 'al'
1261
- | 'dz'
1262
- | 'ad'
1263
- | 'ao'
1264
- | 'as'
1265
- | 'ag'
1266
- | 'ar'
1267
- | 'am'
1268
- | 'aw'
1269
- | 'au'
1270
- | 'at'
1271
- | 'az'
1272
- | 'bs'
1273
- | 'bh'
1274
- | 'bb'
1275
- | 'by'
1276
- | 'be'
1277
- | 'bz'
1278
- | 'bj'
1279
- | 'bm'
1280
- | 'bo'
1281
- | 'ba'
1282
- | 'br'
1283
- | 'bg'
1284
- | 'bf'
1285
- | 'cm'
1286
- | 'ca'
1287
- | 'cv'
1288
- | 'td'
1289
- | 'cl'
1290
- | 'co'
1291
- | 'cg'
1292
- | 'cr'
1293
- | 'ci'
1294
- | 'hr'
1295
- | 'cu'
1296
- | 'cy'
1297
- | 'cz'
1298
- | 'dk'
1299
- | 'dm'
1300
- | 'do'
1301
- | 'ec'
1302
- | 'eg'
1303
- | 'sv'
1304
- | 'ee'
1305
- | 'et'
1306
- | 'fo'
1307
- | 'fi'
1308
- | 'fr'
1309
- | 'gf'
1310
- | 'pf'
1311
- | 'ga'
1312
- | 'gm'
1313
- | 'ge'
1314
- | 'de'
1315
- | 'gh'
1316
- | 'gi'
1317
- | 'gr'
1318
- | 'gd'
1319
- | 'gp'
1320
- | 'gt'
1321
- | 'gg'
1322
- | 'gn'
1323
- | 'gw'
1324
- | 'gy'
1325
- | 'ht'
1326
- | 'hn'
1327
- | 'hu'
1328
- | 'is'
1329
- | 'in'
1330
- | 'ir'
1331
- | 'iq'
1332
- | 'ie'
1333
- | 'il'
1334
- | 'it'
1335
- | 'jm'
1336
- | 'jp'
1337
- | 'jo'
1338
- | 'kz'
1339
- | 'kw'
1340
- | 'kg'
1341
- | 'lv'
1342
- | 'lb'
1343
- | 'ly'
1344
- | 'li'
1345
- | 'lt'
1346
- | 'lu'
1347
- | 'mk'
1348
- | 'ml'
1349
- | 'mt'
1350
- | 'mq'
1351
- | 'mr'
1352
- | 'mx'
1353
- | 'md'
1354
- | 'mc'
1355
- | 'me'
1356
- | 'ma'
1357
- | 'nl'
1358
- | 'nz'
1359
- | 'ni'
1360
- | 'ng'
1361
- | 'no'
1362
- | 'pk'
1363
- | 'pa'
1364
- | 'py'
1365
- | 'pe'
1366
- | 'ph'
1367
- | 'pl'
1368
- | 'pt'
1369
- | 'pr'
1370
- | 'qa'
1371
- | 'ro'
1372
- | 'lc'
1373
- | 'sm'
1374
- | 'sa'
1375
- | 'sn'
1376
- | 'rs'
1377
- | 'sc'
1378
- | 'sl'
1379
- | 'sk'
1380
- | 'si'
1381
- | 'so'
1382
- | 'za'
1383
- | 'kr'
1384
- | 'es'
1385
- | 'sr'
1386
- | 'se'
1387
- | 'ch'
1388
- | 'sy'
1389
- | 'st'
1390
- | 'tw'
1391
- | 'tj'
1392
- | 'tg'
1393
- | 'tt'
1394
- | 'tn'
1395
- | 'tr'
1396
- | 'tc'
1397
- | 'ua'
1398
- | 'ae'
1399
- | 'us'
1400
- | 'uy'
1401
- | 'uz'
1402
- | 've'
1403
- | 'ye';
1404
-
1405
- /**
1406
- * Region code for more specific geographic targeting. The city parameter can only
1407
- * be used when region is also provided.
1408
- */
1409
- region?: string;
1410
-
1411
- /**
1412
- * Create a session with a proxy to access websites as if you're browsing from a
1413
- * computer in that country.
1414
- */
1415
- type?: 'anchor_proxy';
1416
- }
1417
-
1418
- export interface CustomProxy {
1419
- active: boolean;
1420
-
1421
- /**
1422
- * Proxy password
1423
- */
1424
- password: string;
1425
-
1426
- /**
1427
- * Proxy address in **PROTOCOL://HOST:PORT** format (e.g.,
1428
- * https://proxy.example.com:443). See [proxy page](/advanced/proxy#custom-proxy).
1429
- */
1430
- server: string;
1431
-
1432
- type: 'custom';
1433
-
1434
- /**
1435
- * Proxy username
1436
- */
1437
- username: string;
1438
- }
1439
-
1440
- /**
1441
- * Configuration for session recording.
1442
- */
1443
- export interface Recording {
1444
- /**
1445
- * Enable or disable video recording of the browser session. Defaults to `true`.
1446
- */
1447
- active?: boolean;
1448
- }
1449
-
1450
- /**
1451
- * Timeout configurations for the browser session.
1452
- */
1453
- export interface Timeout {
1454
- /**
1455
- * The amount of time (in minutes) the browser session waits for new connections
1456
- * after all others are closed before stopping. Defaults to `5`.
1457
- */
1458
- idle_timeout?: number;
1459
-
1460
- /**
1461
- * Maximum amount of time (in minutes) for the browser to run before terminating.
1462
- * Defaults to `20`.
1463
- */
1464
- max_duration?: number;
1465
- }
1466
- }
1467
- }
1468
-
1469
- export declare namespace Task {
1470
- export {
1471
- type TaskCreateResponse as TaskCreateResponse,
1472
- type TaskListResponse as TaskListResponse,
1473
- type TaskRetrieveExecutionResultResponse as TaskRetrieveExecutionResultResponse,
1474
- type TaskRunResponse as TaskRunResponse,
1475
- type TaskCreateParams as TaskCreateParams,
1476
- type TaskListParams as TaskListParams,
1477
- type TaskRetrieveExecutionResultParams as TaskRetrieveExecutionResultParams,
1478
- type TaskRunParams as TaskRunParams,
1479
- };
1480
- }
5
+ export class Task extends APIResource {}