tzafon 2.3.0__py3-none-any.whl

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.

Potentially problematic release.


This version of tzafon might be problematic. Click here for more details.

Files changed (55) hide show
  1. tzafon/__init__.py +102 -0
  2. tzafon/_base_client.py +1995 -0
  3. tzafon/_client.py +403 -0
  4. tzafon/_compat.py +219 -0
  5. tzafon/_constants.py +14 -0
  6. tzafon/_exceptions.py +108 -0
  7. tzafon/_files.py +123 -0
  8. tzafon/_models.py +835 -0
  9. tzafon/_qs.py +150 -0
  10. tzafon/_resource.py +43 -0
  11. tzafon/_response.py +830 -0
  12. tzafon/_streaming.py +331 -0
  13. tzafon/_types.py +260 -0
  14. tzafon/_utils/__init__.py +64 -0
  15. tzafon/_utils/_compat.py +45 -0
  16. tzafon/_utils/_datetime_parse.py +136 -0
  17. tzafon/_utils/_logs.py +25 -0
  18. tzafon/_utils/_proxy.py +65 -0
  19. tzafon/_utils/_reflection.py +42 -0
  20. tzafon/_utils/_resources_proxy.py +24 -0
  21. tzafon/_utils/_streams.py +12 -0
  22. tzafon/_utils/_sync.py +86 -0
  23. tzafon/_utils/_transform.py +457 -0
  24. tzafon/_utils/_typing.py +156 -0
  25. tzafon/_utils/_utils.py +421 -0
  26. tzafon/_version.py +4 -0
  27. tzafon/lib/.keep +4 -0
  28. tzafon/py.typed +0 -0
  29. tzafon/resources/__init__.py +19 -0
  30. tzafon/resources/computers.py +2051 -0
  31. tzafon/types/__init__.py +24 -0
  32. tzafon/types/action_result.py +19 -0
  33. tzafon/types/computer_capture_screenshot_params.py +11 -0
  34. tzafon/types/computer_click_params.py +13 -0
  35. tzafon/types/computer_create_params.py +36 -0
  36. tzafon/types/computer_debug_params.py +15 -0
  37. tzafon/types/computer_double_click_params.py +13 -0
  38. tzafon/types/computer_drag_params.py +17 -0
  39. tzafon/types/computer_execute_action_params.py +72 -0
  40. tzafon/types/computer_execute_batch_params.py +73 -0
  41. tzafon/types/computer_execute_batch_response.py +8 -0
  42. tzafon/types/computer_get_html_params.py +11 -0
  43. tzafon/types/computer_keep_alive_response.py +8 -0
  44. tzafon/types/computer_list_response.py +10 -0
  45. tzafon/types/computer_navigate_params.py +11 -0
  46. tzafon/types/computer_press_hotkey_params.py +13 -0
  47. tzafon/types/computer_response.py +19 -0
  48. tzafon/types/computer_right_click_params.py +13 -0
  49. tzafon/types/computer_scroll_viewport_params.py +17 -0
  50. tzafon/types/computer_set_viewport_params.py +15 -0
  51. tzafon/types/computer_type_text_params.py +11 -0
  52. tzafon-2.3.0.dist-info/METADATA +429 -0
  53. tzafon-2.3.0.dist-info/RECORD +55 -0
  54. tzafon-2.3.0.dist-info/WHEEL +4 -0
  55. tzafon-2.3.0.dist-info/licenses/LICENSE +7 -0
@@ -0,0 +1,2051 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Iterable
6
+
7
+ import httpx
8
+
9
+ from ..types import (
10
+ computer_drag_params,
11
+ computer_click_params,
12
+ computer_debug_params,
13
+ computer_create_params,
14
+ computer_get_html_params,
15
+ computer_navigate_params,
16
+ computer_type_text_params,
17
+ computer_right_click_params,
18
+ computer_double_click_params,
19
+ computer_press_hotkey_params,
20
+ computer_set_viewport_params,
21
+ computer_execute_batch_params,
22
+ computer_execute_action_params,
23
+ computer_scroll_viewport_params,
24
+ computer_capture_screenshot_params,
25
+ )
26
+ from .._types import Body, Omit, Query, Headers, NoneType, NotGiven, SequenceNotStr, omit, not_given
27
+ from .._utils import maybe_transform, async_maybe_transform
28
+ from .._compat import cached_property
29
+ from .._resource import SyncAPIResource, AsyncAPIResource
30
+ from .._response import (
31
+ to_raw_response_wrapper,
32
+ to_streamed_response_wrapper,
33
+ async_to_raw_response_wrapper,
34
+ async_to_streamed_response_wrapper,
35
+ )
36
+ from .._base_client import make_request_options
37
+ from ..types.action_result import ActionResult
38
+ from ..types.computer_response import ComputerResponse
39
+ from ..types.computer_list_response import ComputerListResponse
40
+ from ..types.computer_keep_alive_response import ComputerKeepAliveResponse
41
+ from ..types.computer_execute_batch_response import ComputerExecuteBatchResponse
42
+
43
+ __all__ = ["ComputersResource", "AsyncComputersResource"]
44
+
45
+
46
+ class ComputersResource(SyncAPIResource):
47
+ @cached_property
48
+ def with_raw_response(self) -> ComputersResourceWithRawResponse:
49
+ """
50
+ This property can be used as a prefix for any HTTP method call to return
51
+ the raw response object instead of the parsed content.
52
+
53
+ For more information, see https://www.github.com/tzafon/computer-python#accessing-raw-response-data-eg-headers
54
+ """
55
+ return ComputersResourceWithRawResponse(self)
56
+
57
+ @cached_property
58
+ def with_streaming_response(self) -> ComputersResourceWithStreamingResponse:
59
+ """
60
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
61
+
62
+ For more information, see https://www.github.com/tzafon/computer-python#with_streaming_response
63
+ """
64
+ return ComputersResourceWithStreamingResponse(self)
65
+
66
+ def create(
67
+ self,
68
+ *,
69
+ auto_kill: bool | Omit = omit,
70
+ context_id: str | Omit = omit,
71
+ display: computer_create_params.Display | Omit = omit,
72
+ kind: str | Omit = omit,
73
+ stealth: object | Omit = omit,
74
+ timeout_seconds: int | Omit = omit,
75
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
76
+ # The extra values given here take precedence over values defined on the client or passed to this method.
77
+ extra_headers: Headers | None = None,
78
+ extra_query: Query | None = None,
79
+ extra_body: Body | None = None,
80
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
81
+ ) -> ComputerResponse:
82
+ """
83
+ Create a new browser or desktop automation session with configurable timeout.
84
+ Returns endpoints for executing actions, streaming events, and viewing
85
+ screencast.
86
+
87
+ Args:
88
+ auto_kill: If true (default), kill session after inactivity. If false, only kill on
89
+ explicit stop or max_lifetime
90
+
91
+ display: TODO: implement
92
+
93
+ kind: "browser"|"desktop"|"code" etc
94
+
95
+ stealth: TODO: implement
96
+
97
+ extra_headers: Send extra headers
98
+
99
+ extra_query: Add additional query parameters to the request
100
+
101
+ extra_body: Add additional JSON properties to the request
102
+
103
+ timeout: Override the client-level default timeout for this request, in seconds
104
+ """
105
+ return self._post(
106
+ "/computers",
107
+ body=maybe_transform(
108
+ {
109
+ "auto_kill": auto_kill,
110
+ "context_id": context_id,
111
+ "display": display,
112
+ "kind": kind,
113
+ "stealth": stealth,
114
+ "timeout_seconds": timeout_seconds,
115
+ },
116
+ computer_create_params.ComputerCreateParams,
117
+ ),
118
+ options=make_request_options(
119
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
120
+ ),
121
+ cast_to=ComputerResponse,
122
+ )
123
+
124
+ def retrieve(
125
+ self,
126
+ id: str,
127
+ *,
128
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
129
+ # The extra values given here take precedence over values defined on the client or passed to this method.
130
+ extra_headers: Headers | None = None,
131
+ extra_query: Query | None = None,
132
+ extra_body: Body | None = None,
133
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
134
+ ) -> ComputerResponse:
135
+ """
136
+ Get the current status and metadata of a computer instance
137
+
138
+ Args:
139
+ extra_headers: Send extra headers
140
+
141
+ extra_query: Add additional query parameters to the request
142
+
143
+ extra_body: Add additional JSON properties to the request
144
+
145
+ timeout: Override the client-level default timeout for this request, in seconds
146
+ """
147
+ if not id:
148
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
149
+ return self._get(
150
+ f"/computers/{id}",
151
+ options=make_request_options(
152
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
153
+ ),
154
+ cast_to=ComputerResponse,
155
+ )
156
+
157
+ def list(
158
+ self,
159
+ *,
160
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
161
+ # The extra values given here take precedence over values defined on the client or passed to this method.
162
+ extra_headers: Headers | None = None,
163
+ extra_query: Query | None = None,
164
+ extra_body: Body | None = None,
165
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
166
+ ) -> ComputerListResponse:
167
+ """List all active computers for the user's organization"""
168
+ return self._get(
169
+ "/computers",
170
+ options=make_request_options(
171
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
172
+ ),
173
+ cast_to=ComputerListResponse,
174
+ )
175
+
176
+ def capture_screenshot(
177
+ self,
178
+ id: str,
179
+ *,
180
+ base64: bool | Omit = omit,
181
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
182
+ # The extra values given here take precedence over values defined on the client or passed to this method.
183
+ extra_headers: Headers | None = None,
184
+ extra_query: Query | None = None,
185
+ extra_body: Body | None = None,
186
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
187
+ ) -> ActionResult:
188
+ """
189
+ Take a screenshot of the current browser viewport, optionally as base64
190
+
191
+ Args:
192
+ extra_headers: Send extra headers
193
+
194
+ extra_query: Add additional query parameters to the request
195
+
196
+ extra_body: Add additional JSON properties to the request
197
+
198
+ timeout: Override the client-level default timeout for this request, in seconds
199
+ """
200
+ if not id:
201
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
202
+ return self._post(
203
+ f"/computers/{id}/screenshot",
204
+ body=maybe_transform(
205
+ {"base64": base64}, computer_capture_screenshot_params.ComputerCaptureScreenshotParams
206
+ ),
207
+ options=make_request_options(
208
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
209
+ ),
210
+ cast_to=ActionResult,
211
+ )
212
+
213
+ def click(
214
+ self,
215
+ id: str,
216
+ *,
217
+ x: float | Omit = omit,
218
+ y: float | Omit = omit,
219
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
220
+ # The extra values given here take precedence over values defined on the client or passed to this method.
221
+ extra_headers: Headers | None = None,
222
+ extra_query: Query | None = None,
223
+ extra_body: Body | None = None,
224
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
225
+ ) -> ActionResult:
226
+ """
227
+ Perform a left mouse click at the specified x,y coordinates
228
+
229
+ Args:
230
+ extra_headers: Send extra headers
231
+
232
+ extra_query: Add additional query parameters to the request
233
+
234
+ extra_body: Add additional JSON properties to the request
235
+
236
+ timeout: Override the client-level default timeout for this request, in seconds
237
+ """
238
+ if not id:
239
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
240
+ return self._post(
241
+ f"/computers/{id}/click",
242
+ body=maybe_transform(
243
+ {
244
+ "x": x,
245
+ "y": y,
246
+ },
247
+ computer_click_params.ComputerClickParams,
248
+ ),
249
+ options=make_request_options(
250
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
251
+ ),
252
+ cast_to=ActionResult,
253
+ )
254
+
255
+ def connect_websocket(
256
+ self,
257
+ id: str,
258
+ *,
259
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
260
+ # The extra values given here take precedence over values defined on the client or passed to this method.
261
+ extra_headers: Headers | None = None,
262
+ extra_query: Query | None = None,
263
+ extra_body: Body | None = None,
264
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
265
+ ) -> None:
266
+ """
267
+ Establish WebSocket for real-time bidirectional communication
268
+
269
+ Args:
270
+ extra_headers: Send extra headers
271
+
272
+ extra_query: Add additional query parameters to the request
273
+
274
+ extra_body: Add additional JSON properties to the request
275
+
276
+ timeout: Override the client-level default timeout for this request, in seconds
277
+ """
278
+ if not id:
279
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
280
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
281
+ return self._get(
282
+ f"/computers/{id}/ws",
283
+ options=make_request_options(
284
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
285
+ ),
286
+ cast_to=NoneType,
287
+ )
288
+
289
+ def debug(
290
+ self,
291
+ id: str,
292
+ *,
293
+ command: str | Omit = omit,
294
+ max_output_length: int | Omit = omit,
295
+ timeout_seconds: int | Omit = omit,
296
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
297
+ # The extra values given here take precedence over values defined on the client or passed to this method.
298
+ extra_headers: Headers | None = None,
299
+ extra_query: Query | None = None,
300
+ extra_body: Body | None = None,
301
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
302
+ ) -> ActionResult:
303
+ """
304
+ Execute a shell command with optional timeout and output length limits
305
+
306
+ Args:
307
+ extra_headers: Send extra headers
308
+
309
+ extra_query: Add additional query parameters to the request
310
+
311
+ extra_body: Add additional JSON properties to the request
312
+
313
+ timeout: Override the client-level default timeout for this request, in seconds
314
+ """
315
+ if not id:
316
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
317
+ return self._post(
318
+ f"/computers/{id}/debug",
319
+ body=maybe_transform(
320
+ {
321
+ "command": command,
322
+ "max_output_length": max_output_length,
323
+ "timeout_seconds": timeout_seconds,
324
+ },
325
+ computer_debug_params.ComputerDebugParams,
326
+ ),
327
+ options=make_request_options(
328
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
329
+ ),
330
+ cast_to=ActionResult,
331
+ )
332
+
333
+ def double_click(
334
+ self,
335
+ id: str,
336
+ *,
337
+ x: float | Omit = omit,
338
+ y: float | Omit = omit,
339
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
340
+ # The extra values given here take precedence over values defined on the client or passed to this method.
341
+ extra_headers: Headers | None = None,
342
+ extra_query: Query | None = None,
343
+ extra_body: Body | None = None,
344
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
345
+ ) -> ActionResult:
346
+ """
347
+ Perform a double mouse click at the specified x,y coordinates
348
+
349
+ Args:
350
+ extra_headers: Send extra headers
351
+
352
+ extra_query: Add additional query parameters to the request
353
+
354
+ extra_body: Add additional JSON properties to the request
355
+
356
+ timeout: Override the client-level default timeout for this request, in seconds
357
+ """
358
+ if not id:
359
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
360
+ return self._post(
361
+ f"/computers/{id}/double-click",
362
+ body=maybe_transform(
363
+ {
364
+ "x": x,
365
+ "y": y,
366
+ },
367
+ computer_double_click_params.ComputerDoubleClickParams,
368
+ ),
369
+ options=make_request_options(
370
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
371
+ ),
372
+ cast_to=ActionResult,
373
+ )
374
+
375
+ def drag(
376
+ self,
377
+ id: str,
378
+ *,
379
+ x1: float | Omit = omit,
380
+ x2: float | Omit = omit,
381
+ y1: float | Omit = omit,
382
+ y2: float | Omit = omit,
383
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
384
+ # The extra values given here take precedence over values defined on the client or passed to this method.
385
+ extra_headers: Headers | None = None,
386
+ extra_query: Query | None = None,
387
+ extra_body: Body | None = None,
388
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
389
+ ) -> ActionResult:
390
+ """
391
+ Perform a click-and-drag action from (x1,y1) to (x2,y2)
392
+
393
+ Args:
394
+ extra_headers: Send extra headers
395
+
396
+ extra_query: Add additional query parameters to the request
397
+
398
+ extra_body: Add additional JSON properties to the request
399
+
400
+ timeout: Override the client-level default timeout for this request, in seconds
401
+ """
402
+ if not id:
403
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
404
+ return self._post(
405
+ f"/computers/{id}/drag",
406
+ body=maybe_transform(
407
+ {
408
+ "x1": x1,
409
+ "x2": x2,
410
+ "y1": y1,
411
+ "y2": y2,
412
+ },
413
+ computer_drag_params.ComputerDragParams,
414
+ ),
415
+ options=make_request_options(
416
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
417
+ ),
418
+ cast_to=ActionResult,
419
+ )
420
+
421
+ def execute_action(
422
+ self,
423
+ id: str,
424
+ *,
425
+ action: computer_execute_action_params.Action | Omit = omit,
426
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
427
+ # The extra values given here take precedence over values defined on the client or passed to this method.
428
+ extra_headers: Headers | None = None,
429
+ extra_query: Query | None = None,
430
+ extra_body: Body | None = None,
431
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
432
+ ) -> ActionResult:
433
+ """
434
+ Execute a single action such as screenshot, click, type, navigate, scroll,
435
+ debug, set_viewport, get_html_content or other computer use actions
436
+
437
+ Args:
438
+ extra_headers: Send extra headers
439
+
440
+ extra_query: Add additional query parameters to the request
441
+
442
+ extra_body: Add additional JSON properties to the request
443
+
444
+ timeout: Override the client-level default timeout for this request, in seconds
445
+ """
446
+ if not id:
447
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
448
+ return self._post(
449
+ f"/computers/{id}/execute",
450
+ body=maybe_transform({"action": action}, computer_execute_action_params.ComputerExecuteActionParams),
451
+ options=make_request_options(
452
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
453
+ ),
454
+ cast_to=ActionResult,
455
+ )
456
+
457
+ def execute_batch(
458
+ self,
459
+ id: str,
460
+ *,
461
+ actions: Iterable[computer_execute_batch_params.Action] | Omit = omit,
462
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
463
+ # The extra values given here take precedence over values defined on the client or passed to this method.
464
+ extra_headers: Headers | None = None,
465
+ extra_query: Query | None = None,
466
+ extra_body: Body | None = None,
467
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
468
+ ) -> ComputerExecuteBatchResponse:
469
+ """
470
+ Execute a batch of actions in sequence, stopping on first error
471
+
472
+ Args:
473
+ extra_headers: Send extra headers
474
+
475
+ extra_query: Add additional query parameters to the request
476
+
477
+ extra_body: Add additional JSON properties to the request
478
+
479
+ timeout: Override the client-level default timeout for this request, in seconds
480
+ """
481
+ if not id:
482
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
483
+ return self._post(
484
+ f"/computers/{id}/batch",
485
+ body=maybe_transform({"actions": actions}, computer_execute_batch_params.ComputerExecuteBatchParams),
486
+ options=make_request_options(
487
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
488
+ ),
489
+ cast_to=ComputerExecuteBatchResponse,
490
+ )
491
+
492
+ def get_html(
493
+ self,
494
+ id: str,
495
+ *,
496
+ auto_detect_encoding: bool | Omit = omit,
497
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
498
+ # The extra values given here take precedence over values defined on the client or passed to this method.
499
+ extra_headers: Headers | None = None,
500
+ extra_query: Query | None = None,
501
+ extra_body: Body | None = None,
502
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
503
+ ) -> ActionResult:
504
+ """
505
+ Get the HTML content of the current browser page
506
+
507
+ Args:
508
+ extra_headers: Send extra headers
509
+
510
+ extra_query: Add additional query parameters to the request
511
+
512
+ extra_body: Add additional JSON properties to the request
513
+
514
+ timeout: Override the client-level default timeout for this request, in seconds
515
+ """
516
+ if not id:
517
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
518
+ return self._post(
519
+ f"/computers/{id}/html",
520
+ body=maybe_transform(
521
+ {"auto_detect_encoding": auto_detect_encoding}, computer_get_html_params.ComputerGetHTMLParams
522
+ ),
523
+ options=make_request_options(
524
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
525
+ ),
526
+ cast_to=ActionResult,
527
+ )
528
+
529
+ def keep_alive(
530
+ self,
531
+ id: str,
532
+ *,
533
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
534
+ # The extra values given here take precedence over values defined on the client or passed to this method.
535
+ extra_headers: Headers | None = None,
536
+ extra_query: Query | None = None,
537
+ extra_body: Body | None = None,
538
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
539
+ ) -> ComputerKeepAliveResponse:
540
+ """
541
+ Extend the timeout for a computer session and verify it is still running
542
+
543
+ Args:
544
+ extra_headers: Send extra headers
545
+
546
+ extra_query: Add additional query parameters to the request
547
+
548
+ extra_body: Add additional JSON properties to the request
549
+
550
+ timeout: Override the client-level default timeout for this request, in seconds
551
+ """
552
+ if not id:
553
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
554
+ return self._post(
555
+ f"/computers/{id}/keepalive",
556
+ options=make_request_options(
557
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
558
+ ),
559
+ cast_to=ComputerKeepAliveResponse,
560
+ )
561
+
562
+ def navigate(
563
+ self,
564
+ id: str,
565
+ *,
566
+ url: str | Omit = omit,
567
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
568
+ # The extra values given here take precedence over values defined on the client or passed to this method.
569
+ extra_headers: Headers | None = None,
570
+ extra_query: Query | None = None,
571
+ extra_body: Body | None = None,
572
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
573
+ ) -> ActionResult:
574
+ """
575
+ Navigate the browser to a specified URL
576
+
577
+ Args:
578
+ extra_headers: Send extra headers
579
+
580
+ extra_query: Add additional query parameters to the request
581
+
582
+ extra_body: Add additional JSON properties to the request
583
+
584
+ timeout: Override the client-level default timeout for this request, in seconds
585
+ """
586
+ if not id:
587
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
588
+ return self._post(
589
+ f"/computers/{id}/navigate",
590
+ body=maybe_transform({"url": url}, computer_navigate_params.ComputerNavigateParams),
591
+ options=make_request_options(
592
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
593
+ ),
594
+ cast_to=ActionResult,
595
+ )
596
+
597
+ def press_hotkey(
598
+ self,
599
+ id: str,
600
+ *,
601
+ keys: SequenceNotStr[str] | Omit = omit,
602
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
603
+ # The extra values given here take precedence over values defined on the client or passed to this method.
604
+ extra_headers: Headers | None = None,
605
+ extra_query: Query | None = None,
606
+ extra_body: Body | None = None,
607
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
608
+ ) -> ActionResult:
609
+ """
610
+ Press a combination of keys (e.g., ["Control", "c"] for copy)
611
+
612
+ Args:
613
+ extra_headers: Send extra headers
614
+
615
+ extra_query: Add additional query parameters to the request
616
+
617
+ extra_body: Add additional JSON properties to the request
618
+
619
+ timeout: Override the client-level default timeout for this request, in seconds
620
+ """
621
+ if not id:
622
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
623
+ return self._post(
624
+ f"/computers/{id}/hotkey",
625
+ body=maybe_transform({"keys": keys}, computer_press_hotkey_params.ComputerPressHotkeyParams),
626
+ options=make_request_options(
627
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
628
+ ),
629
+ cast_to=ActionResult,
630
+ )
631
+
632
+ def right_click(
633
+ self,
634
+ id: str,
635
+ *,
636
+ x: float | Omit = omit,
637
+ y: float | Omit = omit,
638
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
639
+ # The extra values given here take precedence over values defined on the client or passed to this method.
640
+ extra_headers: Headers | None = None,
641
+ extra_query: Query | None = None,
642
+ extra_body: Body | None = None,
643
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
644
+ ) -> ActionResult:
645
+ """
646
+ Perform a right mouse click at the specified x,y coordinates
647
+
648
+ Args:
649
+ extra_headers: Send extra headers
650
+
651
+ extra_query: Add additional query parameters to the request
652
+
653
+ extra_body: Add additional JSON properties to the request
654
+
655
+ timeout: Override the client-level default timeout for this request, in seconds
656
+ """
657
+ if not id:
658
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
659
+ return self._post(
660
+ f"/computers/{id}/right-click",
661
+ body=maybe_transform(
662
+ {
663
+ "x": x,
664
+ "y": y,
665
+ },
666
+ computer_right_click_params.ComputerRightClickParams,
667
+ ),
668
+ options=make_request_options(
669
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
670
+ ),
671
+ cast_to=ActionResult,
672
+ )
673
+
674
+ def scroll_viewport(
675
+ self,
676
+ id: str,
677
+ *,
678
+ dx: float | Omit = omit,
679
+ dy: float | Omit = omit,
680
+ x: float | Omit = omit,
681
+ y: float | Omit = omit,
682
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
683
+ # The extra values given here take precedence over values defined on the client or passed to this method.
684
+ extra_headers: Headers | None = None,
685
+ extra_query: Query | None = None,
686
+ extra_body: Body | None = None,
687
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
688
+ ) -> ActionResult:
689
+ """
690
+ Scroll the browser viewport by the specified delta
691
+
692
+ Args:
693
+ extra_headers: Send extra headers
694
+
695
+ extra_query: Add additional query parameters to the request
696
+
697
+ extra_body: Add additional JSON properties to the request
698
+
699
+ timeout: Override the client-level default timeout for this request, in seconds
700
+ """
701
+ if not id:
702
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
703
+ return self._post(
704
+ f"/computers/{id}/scroll",
705
+ body=maybe_transform(
706
+ {
707
+ "dx": dx,
708
+ "dy": dy,
709
+ "x": x,
710
+ "y": y,
711
+ },
712
+ computer_scroll_viewport_params.ComputerScrollViewportParams,
713
+ ),
714
+ options=make_request_options(
715
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
716
+ ),
717
+ cast_to=ActionResult,
718
+ )
719
+
720
+ def set_viewport(
721
+ self,
722
+ id: str,
723
+ *,
724
+ height: int | Omit = omit,
725
+ scale_factor: float | Omit = omit,
726
+ width: int | Omit = omit,
727
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
728
+ # The extra values given here take precedence over values defined on the client or passed to this method.
729
+ extra_headers: Headers | None = None,
730
+ extra_query: Query | None = None,
731
+ extra_body: Body | None = None,
732
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
733
+ ) -> ActionResult:
734
+ """
735
+ Change the browser viewport dimensions and scale factor
736
+
737
+ Args:
738
+ extra_headers: Send extra headers
739
+
740
+ extra_query: Add additional query parameters to the request
741
+
742
+ extra_body: Add additional JSON properties to the request
743
+
744
+ timeout: Override the client-level default timeout for this request, in seconds
745
+ """
746
+ if not id:
747
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
748
+ return self._post(
749
+ f"/computers/{id}/viewport",
750
+ body=maybe_transform(
751
+ {
752
+ "height": height,
753
+ "scale_factor": scale_factor,
754
+ "width": width,
755
+ },
756
+ computer_set_viewport_params.ComputerSetViewportParams,
757
+ ),
758
+ options=make_request_options(
759
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
760
+ ),
761
+ cast_to=ActionResult,
762
+ )
763
+
764
+ def stream_events(
765
+ self,
766
+ id: str,
767
+ *,
768
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
769
+ # The extra values given here take precedence over values defined on the client or passed to this method.
770
+ extra_headers: Headers | None = None,
771
+ extra_query: Query | None = None,
772
+ extra_body: Body | None = None,
773
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
774
+ ) -> None:
775
+ """
776
+ Stream real-time events using Server-Sent Events (SSE)
777
+
778
+ Args:
779
+ extra_headers: Send extra headers
780
+
781
+ extra_query: Add additional query parameters to the request
782
+
783
+ extra_body: Add additional JSON properties to the request
784
+
785
+ timeout: Override the client-level default timeout for this request, in seconds
786
+ """
787
+ if not id:
788
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
789
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
790
+ return self._get(
791
+ f"/computers/{id}/events",
792
+ options=make_request_options(
793
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
794
+ ),
795
+ cast_to=NoneType,
796
+ )
797
+
798
+ def stream_screencast(
799
+ self,
800
+ id: str,
801
+ *,
802
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
803
+ # The extra values given here take precedence over values defined on the client or passed to this method.
804
+ extra_headers: Headers | None = None,
805
+ extra_query: Query | None = None,
806
+ extra_body: Body | None = None,
807
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
808
+ ) -> None:
809
+ """
810
+ Stream only screencast frames (base64 JPEG images) using Server-Sent Events
811
+ (SSE) for live browser viewing
812
+
813
+ Args:
814
+ extra_headers: Send extra headers
815
+
816
+ extra_query: Add additional query parameters to the request
817
+
818
+ extra_body: Add additional JSON properties to the request
819
+
820
+ timeout: Override the client-level default timeout for this request, in seconds
821
+ """
822
+ if not id:
823
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
824
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
825
+ return self._get(
826
+ f"/computers/{id}/screencast",
827
+ options=make_request_options(
828
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
829
+ ),
830
+ cast_to=NoneType,
831
+ )
832
+
833
+ def terminate(
834
+ self,
835
+ id: str,
836
+ *,
837
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
838
+ # The extra values given here take precedence over values defined on the client or passed to this method.
839
+ extra_headers: Headers | None = None,
840
+ extra_query: Query | None = None,
841
+ extra_body: Body | None = None,
842
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
843
+ ) -> None:
844
+ """
845
+ Terminate and clean up a computer instance, stopping the session and recording
846
+ metrics
847
+
848
+ Args:
849
+ extra_headers: Send extra headers
850
+
851
+ extra_query: Add additional query parameters to the request
852
+
853
+ extra_body: Add additional JSON properties to the request
854
+
855
+ timeout: Override the client-level default timeout for this request, in seconds
856
+ """
857
+ if not id:
858
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
859
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
860
+ return self._delete(
861
+ f"/computers/{id}",
862
+ options=make_request_options(
863
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
864
+ ),
865
+ cast_to=NoneType,
866
+ )
867
+
868
+ def type_text(
869
+ self,
870
+ id: str,
871
+ *,
872
+ text: str | Omit = omit,
873
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
874
+ # The extra values given here take precedence over values defined on the client or passed to this method.
875
+ extra_headers: Headers | None = None,
876
+ extra_query: Query | None = None,
877
+ extra_body: Body | None = None,
878
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
879
+ ) -> ActionResult:
880
+ """
881
+ Type text into the currently focused element in the browser
882
+
883
+ Args:
884
+ extra_headers: Send extra headers
885
+
886
+ extra_query: Add additional query parameters to the request
887
+
888
+ extra_body: Add additional JSON properties to the request
889
+
890
+ timeout: Override the client-level default timeout for this request, in seconds
891
+ """
892
+ if not id:
893
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
894
+ return self._post(
895
+ f"/computers/{id}/type",
896
+ body=maybe_transform({"text": text}, computer_type_text_params.ComputerTypeTextParams),
897
+ options=make_request_options(
898
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
899
+ ),
900
+ cast_to=ActionResult,
901
+ )
902
+
903
+
904
+ class AsyncComputersResource(AsyncAPIResource):
905
+ @cached_property
906
+ def with_raw_response(self) -> AsyncComputersResourceWithRawResponse:
907
+ """
908
+ This property can be used as a prefix for any HTTP method call to return
909
+ the raw response object instead of the parsed content.
910
+
911
+ For more information, see https://www.github.com/tzafon/computer-python#accessing-raw-response-data-eg-headers
912
+ """
913
+ return AsyncComputersResourceWithRawResponse(self)
914
+
915
+ @cached_property
916
+ def with_streaming_response(self) -> AsyncComputersResourceWithStreamingResponse:
917
+ """
918
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
919
+
920
+ For more information, see https://www.github.com/tzafon/computer-python#with_streaming_response
921
+ """
922
+ return AsyncComputersResourceWithStreamingResponse(self)
923
+
924
+ async def create(
925
+ self,
926
+ *,
927
+ auto_kill: bool | Omit = omit,
928
+ context_id: str | Omit = omit,
929
+ display: computer_create_params.Display | Omit = omit,
930
+ kind: str | Omit = omit,
931
+ stealth: object | Omit = omit,
932
+ timeout_seconds: int | Omit = omit,
933
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
934
+ # The extra values given here take precedence over values defined on the client or passed to this method.
935
+ extra_headers: Headers | None = None,
936
+ extra_query: Query | None = None,
937
+ extra_body: Body | None = None,
938
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
939
+ ) -> ComputerResponse:
940
+ """
941
+ Create a new browser or desktop automation session with configurable timeout.
942
+ Returns endpoints for executing actions, streaming events, and viewing
943
+ screencast.
944
+
945
+ Args:
946
+ auto_kill: If true (default), kill session after inactivity. If false, only kill on
947
+ explicit stop or max_lifetime
948
+
949
+ display: TODO: implement
950
+
951
+ kind: "browser"|"desktop"|"code" etc
952
+
953
+ stealth: TODO: implement
954
+
955
+ extra_headers: Send extra headers
956
+
957
+ extra_query: Add additional query parameters to the request
958
+
959
+ extra_body: Add additional JSON properties to the request
960
+
961
+ timeout: Override the client-level default timeout for this request, in seconds
962
+ """
963
+ return await self._post(
964
+ "/computers",
965
+ body=await async_maybe_transform(
966
+ {
967
+ "auto_kill": auto_kill,
968
+ "context_id": context_id,
969
+ "display": display,
970
+ "kind": kind,
971
+ "stealth": stealth,
972
+ "timeout_seconds": timeout_seconds,
973
+ },
974
+ computer_create_params.ComputerCreateParams,
975
+ ),
976
+ options=make_request_options(
977
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
978
+ ),
979
+ cast_to=ComputerResponse,
980
+ )
981
+
982
+ async def retrieve(
983
+ self,
984
+ id: str,
985
+ *,
986
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
987
+ # The extra values given here take precedence over values defined on the client or passed to this method.
988
+ extra_headers: Headers | None = None,
989
+ extra_query: Query | None = None,
990
+ extra_body: Body | None = None,
991
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
992
+ ) -> ComputerResponse:
993
+ """
994
+ Get the current status and metadata of a computer instance
995
+
996
+ Args:
997
+ extra_headers: Send extra headers
998
+
999
+ extra_query: Add additional query parameters to the request
1000
+
1001
+ extra_body: Add additional JSON properties to the request
1002
+
1003
+ timeout: Override the client-level default timeout for this request, in seconds
1004
+ """
1005
+ if not id:
1006
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1007
+ return await self._get(
1008
+ f"/computers/{id}",
1009
+ options=make_request_options(
1010
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1011
+ ),
1012
+ cast_to=ComputerResponse,
1013
+ )
1014
+
1015
+ async def list(
1016
+ self,
1017
+ *,
1018
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1019
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1020
+ extra_headers: Headers | None = None,
1021
+ extra_query: Query | None = None,
1022
+ extra_body: Body | None = None,
1023
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1024
+ ) -> ComputerListResponse:
1025
+ """List all active computers for the user's organization"""
1026
+ return await self._get(
1027
+ "/computers",
1028
+ options=make_request_options(
1029
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1030
+ ),
1031
+ cast_to=ComputerListResponse,
1032
+ )
1033
+
1034
+ async def capture_screenshot(
1035
+ self,
1036
+ id: str,
1037
+ *,
1038
+ base64: bool | Omit = omit,
1039
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1040
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1041
+ extra_headers: Headers | None = None,
1042
+ extra_query: Query | None = None,
1043
+ extra_body: Body | None = None,
1044
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1045
+ ) -> ActionResult:
1046
+ """
1047
+ Take a screenshot of the current browser viewport, optionally as base64
1048
+
1049
+ Args:
1050
+ extra_headers: Send extra headers
1051
+
1052
+ extra_query: Add additional query parameters to the request
1053
+
1054
+ extra_body: Add additional JSON properties to the request
1055
+
1056
+ timeout: Override the client-level default timeout for this request, in seconds
1057
+ """
1058
+ if not id:
1059
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1060
+ return await self._post(
1061
+ f"/computers/{id}/screenshot",
1062
+ body=await async_maybe_transform(
1063
+ {"base64": base64}, computer_capture_screenshot_params.ComputerCaptureScreenshotParams
1064
+ ),
1065
+ options=make_request_options(
1066
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1067
+ ),
1068
+ cast_to=ActionResult,
1069
+ )
1070
+
1071
+ async def click(
1072
+ self,
1073
+ id: str,
1074
+ *,
1075
+ x: float | Omit = omit,
1076
+ y: float | Omit = omit,
1077
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1078
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1079
+ extra_headers: Headers | None = None,
1080
+ extra_query: Query | None = None,
1081
+ extra_body: Body | None = None,
1082
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1083
+ ) -> ActionResult:
1084
+ """
1085
+ Perform a left mouse click at the specified x,y coordinates
1086
+
1087
+ Args:
1088
+ extra_headers: Send extra headers
1089
+
1090
+ extra_query: Add additional query parameters to the request
1091
+
1092
+ extra_body: Add additional JSON properties to the request
1093
+
1094
+ timeout: Override the client-level default timeout for this request, in seconds
1095
+ """
1096
+ if not id:
1097
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1098
+ return await self._post(
1099
+ f"/computers/{id}/click",
1100
+ body=await async_maybe_transform(
1101
+ {
1102
+ "x": x,
1103
+ "y": y,
1104
+ },
1105
+ computer_click_params.ComputerClickParams,
1106
+ ),
1107
+ options=make_request_options(
1108
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1109
+ ),
1110
+ cast_to=ActionResult,
1111
+ )
1112
+
1113
+ async def connect_websocket(
1114
+ self,
1115
+ id: str,
1116
+ *,
1117
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1118
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1119
+ extra_headers: Headers | None = None,
1120
+ extra_query: Query | None = None,
1121
+ extra_body: Body | None = None,
1122
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1123
+ ) -> None:
1124
+ """
1125
+ Establish WebSocket for real-time bidirectional communication
1126
+
1127
+ Args:
1128
+ extra_headers: Send extra headers
1129
+
1130
+ extra_query: Add additional query parameters to the request
1131
+
1132
+ extra_body: Add additional JSON properties to the request
1133
+
1134
+ timeout: Override the client-level default timeout for this request, in seconds
1135
+ """
1136
+ if not id:
1137
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1138
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1139
+ return await self._get(
1140
+ f"/computers/{id}/ws",
1141
+ options=make_request_options(
1142
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1143
+ ),
1144
+ cast_to=NoneType,
1145
+ )
1146
+
1147
+ async def debug(
1148
+ self,
1149
+ id: str,
1150
+ *,
1151
+ command: str | Omit = omit,
1152
+ max_output_length: int | Omit = omit,
1153
+ timeout_seconds: int | Omit = omit,
1154
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1155
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1156
+ extra_headers: Headers | None = None,
1157
+ extra_query: Query | None = None,
1158
+ extra_body: Body | None = None,
1159
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1160
+ ) -> ActionResult:
1161
+ """
1162
+ Execute a shell command with optional timeout and output length limits
1163
+
1164
+ Args:
1165
+ extra_headers: Send extra headers
1166
+
1167
+ extra_query: Add additional query parameters to the request
1168
+
1169
+ extra_body: Add additional JSON properties to the request
1170
+
1171
+ timeout: Override the client-level default timeout for this request, in seconds
1172
+ """
1173
+ if not id:
1174
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1175
+ return await self._post(
1176
+ f"/computers/{id}/debug",
1177
+ body=await async_maybe_transform(
1178
+ {
1179
+ "command": command,
1180
+ "max_output_length": max_output_length,
1181
+ "timeout_seconds": timeout_seconds,
1182
+ },
1183
+ computer_debug_params.ComputerDebugParams,
1184
+ ),
1185
+ options=make_request_options(
1186
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1187
+ ),
1188
+ cast_to=ActionResult,
1189
+ )
1190
+
1191
+ async def double_click(
1192
+ self,
1193
+ id: str,
1194
+ *,
1195
+ x: float | Omit = omit,
1196
+ y: float | Omit = omit,
1197
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1198
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1199
+ extra_headers: Headers | None = None,
1200
+ extra_query: Query | None = None,
1201
+ extra_body: Body | None = None,
1202
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1203
+ ) -> ActionResult:
1204
+ """
1205
+ Perform a double mouse click at the specified x,y coordinates
1206
+
1207
+ Args:
1208
+ extra_headers: Send extra headers
1209
+
1210
+ extra_query: Add additional query parameters to the request
1211
+
1212
+ extra_body: Add additional JSON properties to the request
1213
+
1214
+ timeout: Override the client-level default timeout for this request, in seconds
1215
+ """
1216
+ if not id:
1217
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1218
+ return await self._post(
1219
+ f"/computers/{id}/double-click",
1220
+ body=await async_maybe_transform(
1221
+ {
1222
+ "x": x,
1223
+ "y": y,
1224
+ },
1225
+ computer_double_click_params.ComputerDoubleClickParams,
1226
+ ),
1227
+ options=make_request_options(
1228
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1229
+ ),
1230
+ cast_to=ActionResult,
1231
+ )
1232
+
1233
+ async def drag(
1234
+ self,
1235
+ id: str,
1236
+ *,
1237
+ x1: float | Omit = omit,
1238
+ x2: float | Omit = omit,
1239
+ y1: float | Omit = omit,
1240
+ y2: float | Omit = omit,
1241
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1242
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1243
+ extra_headers: Headers | None = None,
1244
+ extra_query: Query | None = None,
1245
+ extra_body: Body | None = None,
1246
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1247
+ ) -> ActionResult:
1248
+ """
1249
+ Perform a click-and-drag action from (x1,y1) to (x2,y2)
1250
+
1251
+ Args:
1252
+ extra_headers: Send extra headers
1253
+
1254
+ extra_query: Add additional query parameters to the request
1255
+
1256
+ extra_body: Add additional JSON properties to the request
1257
+
1258
+ timeout: Override the client-level default timeout for this request, in seconds
1259
+ """
1260
+ if not id:
1261
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1262
+ return await self._post(
1263
+ f"/computers/{id}/drag",
1264
+ body=await async_maybe_transform(
1265
+ {
1266
+ "x1": x1,
1267
+ "x2": x2,
1268
+ "y1": y1,
1269
+ "y2": y2,
1270
+ },
1271
+ computer_drag_params.ComputerDragParams,
1272
+ ),
1273
+ options=make_request_options(
1274
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1275
+ ),
1276
+ cast_to=ActionResult,
1277
+ )
1278
+
1279
+ async def execute_action(
1280
+ self,
1281
+ id: str,
1282
+ *,
1283
+ action: computer_execute_action_params.Action | Omit = omit,
1284
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1285
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1286
+ extra_headers: Headers | None = None,
1287
+ extra_query: Query | None = None,
1288
+ extra_body: Body | None = None,
1289
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1290
+ ) -> ActionResult:
1291
+ """
1292
+ Execute a single action such as screenshot, click, type, navigate, scroll,
1293
+ debug, set_viewport, get_html_content or other computer use actions
1294
+
1295
+ Args:
1296
+ extra_headers: Send extra headers
1297
+
1298
+ extra_query: Add additional query parameters to the request
1299
+
1300
+ extra_body: Add additional JSON properties to the request
1301
+
1302
+ timeout: Override the client-level default timeout for this request, in seconds
1303
+ """
1304
+ if not id:
1305
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1306
+ return await self._post(
1307
+ f"/computers/{id}/execute",
1308
+ body=await async_maybe_transform(
1309
+ {"action": action}, computer_execute_action_params.ComputerExecuteActionParams
1310
+ ),
1311
+ options=make_request_options(
1312
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1313
+ ),
1314
+ cast_to=ActionResult,
1315
+ )
1316
+
1317
+ async def execute_batch(
1318
+ self,
1319
+ id: str,
1320
+ *,
1321
+ actions: Iterable[computer_execute_batch_params.Action] | Omit = omit,
1322
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1323
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1324
+ extra_headers: Headers | None = None,
1325
+ extra_query: Query | None = None,
1326
+ extra_body: Body | None = None,
1327
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1328
+ ) -> ComputerExecuteBatchResponse:
1329
+ """
1330
+ Execute a batch of actions in sequence, stopping on first error
1331
+
1332
+ Args:
1333
+ extra_headers: Send extra headers
1334
+
1335
+ extra_query: Add additional query parameters to the request
1336
+
1337
+ extra_body: Add additional JSON properties to the request
1338
+
1339
+ timeout: Override the client-level default timeout for this request, in seconds
1340
+ """
1341
+ if not id:
1342
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1343
+ return await self._post(
1344
+ f"/computers/{id}/batch",
1345
+ body=await async_maybe_transform(
1346
+ {"actions": actions}, computer_execute_batch_params.ComputerExecuteBatchParams
1347
+ ),
1348
+ options=make_request_options(
1349
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1350
+ ),
1351
+ cast_to=ComputerExecuteBatchResponse,
1352
+ )
1353
+
1354
+ async def get_html(
1355
+ self,
1356
+ id: str,
1357
+ *,
1358
+ auto_detect_encoding: bool | Omit = omit,
1359
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1360
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1361
+ extra_headers: Headers | None = None,
1362
+ extra_query: Query | None = None,
1363
+ extra_body: Body | None = None,
1364
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1365
+ ) -> ActionResult:
1366
+ """
1367
+ Get the HTML content of the current browser page
1368
+
1369
+ Args:
1370
+ extra_headers: Send extra headers
1371
+
1372
+ extra_query: Add additional query parameters to the request
1373
+
1374
+ extra_body: Add additional JSON properties to the request
1375
+
1376
+ timeout: Override the client-level default timeout for this request, in seconds
1377
+ """
1378
+ if not id:
1379
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1380
+ return await self._post(
1381
+ f"/computers/{id}/html",
1382
+ body=await async_maybe_transform(
1383
+ {"auto_detect_encoding": auto_detect_encoding}, computer_get_html_params.ComputerGetHTMLParams
1384
+ ),
1385
+ options=make_request_options(
1386
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1387
+ ),
1388
+ cast_to=ActionResult,
1389
+ )
1390
+
1391
+ async def keep_alive(
1392
+ self,
1393
+ id: str,
1394
+ *,
1395
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1396
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1397
+ extra_headers: Headers | None = None,
1398
+ extra_query: Query | None = None,
1399
+ extra_body: Body | None = None,
1400
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1401
+ ) -> ComputerKeepAliveResponse:
1402
+ """
1403
+ Extend the timeout for a computer session and verify it is still running
1404
+
1405
+ Args:
1406
+ extra_headers: Send extra headers
1407
+
1408
+ extra_query: Add additional query parameters to the request
1409
+
1410
+ extra_body: Add additional JSON properties to the request
1411
+
1412
+ timeout: Override the client-level default timeout for this request, in seconds
1413
+ """
1414
+ if not id:
1415
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1416
+ return await self._post(
1417
+ f"/computers/{id}/keepalive",
1418
+ options=make_request_options(
1419
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1420
+ ),
1421
+ cast_to=ComputerKeepAliveResponse,
1422
+ )
1423
+
1424
+ async def navigate(
1425
+ self,
1426
+ id: str,
1427
+ *,
1428
+ url: str | Omit = omit,
1429
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1430
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1431
+ extra_headers: Headers | None = None,
1432
+ extra_query: Query | None = None,
1433
+ extra_body: Body | None = None,
1434
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1435
+ ) -> ActionResult:
1436
+ """
1437
+ Navigate the browser to a specified URL
1438
+
1439
+ Args:
1440
+ extra_headers: Send extra headers
1441
+
1442
+ extra_query: Add additional query parameters to the request
1443
+
1444
+ extra_body: Add additional JSON properties to the request
1445
+
1446
+ timeout: Override the client-level default timeout for this request, in seconds
1447
+ """
1448
+ if not id:
1449
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1450
+ return await self._post(
1451
+ f"/computers/{id}/navigate",
1452
+ body=await async_maybe_transform({"url": url}, computer_navigate_params.ComputerNavigateParams),
1453
+ options=make_request_options(
1454
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1455
+ ),
1456
+ cast_to=ActionResult,
1457
+ )
1458
+
1459
+ async def press_hotkey(
1460
+ self,
1461
+ id: str,
1462
+ *,
1463
+ keys: SequenceNotStr[str] | Omit = omit,
1464
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1465
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1466
+ extra_headers: Headers | None = None,
1467
+ extra_query: Query | None = None,
1468
+ extra_body: Body | None = None,
1469
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1470
+ ) -> ActionResult:
1471
+ """
1472
+ Press a combination of keys (e.g., ["Control", "c"] for copy)
1473
+
1474
+ Args:
1475
+ extra_headers: Send extra headers
1476
+
1477
+ extra_query: Add additional query parameters to the request
1478
+
1479
+ extra_body: Add additional JSON properties to the request
1480
+
1481
+ timeout: Override the client-level default timeout for this request, in seconds
1482
+ """
1483
+ if not id:
1484
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1485
+ return await self._post(
1486
+ f"/computers/{id}/hotkey",
1487
+ body=await async_maybe_transform({"keys": keys}, computer_press_hotkey_params.ComputerPressHotkeyParams),
1488
+ options=make_request_options(
1489
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1490
+ ),
1491
+ cast_to=ActionResult,
1492
+ )
1493
+
1494
+ async def right_click(
1495
+ self,
1496
+ id: str,
1497
+ *,
1498
+ x: float | Omit = omit,
1499
+ y: float | Omit = omit,
1500
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1501
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1502
+ extra_headers: Headers | None = None,
1503
+ extra_query: Query | None = None,
1504
+ extra_body: Body | None = None,
1505
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1506
+ ) -> ActionResult:
1507
+ """
1508
+ Perform a right mouse click at the specified x,y coordinates
1509
+
1510
+ Args:
1511
+ extra_headers: Send extra headers
1512
+
1513
+ extra_query: Add additional query parameters to the request
1514
+
1515
+ extra_body: Add additional JSON properties to the request
1516
+
1517
+ timeout: Override the client-level default timeout for this request, in seconds
1518
+ """
1519
+ if not id:
1520
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1521
+ return await self._post(
1522
+ f"/computers/{id}/right-click",
1523
+ body=await async_maybe_transform(
1524
+ {
1525
+ "x": x,
1526
+ "y": y,
1527
+ },
1528
+ computer_right_click_params.ComputerRightClickParams,
1529
+ ),
1530
+ options=make_request_options(
1531
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1532
+ ),
1533
+ cast_to=ActionResult,
1534
+ )
1535
+
1536
+ async def scroll_viewport(
1537
+ self,
1538
+ id: str,
1539
+ *,
1540
+ dx: float | Omit = omit,
1541
+ dy: float | Omit = omit,
1542
+ x: float | Omit = omit,
1543
+ y: float | Omit = omit,
1544
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1545
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1546
+ extra_headers: Headers | None = None,
1547
+ extra_query: Query | None = None,
1548
+ extra_body: Body | None = None,
1549
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1550
+ ) -> ActionResult:
1551
+ """
1552
+ Scroll the browser viewport by the specified delta
1553
+
1554
+ Args:
1555
+ extra_headers: Send extra headers
1556
+
1557
+ extra_query: Add additional query parameters to the request
1558
+
1559
+ extra_body: Add additional JSON properties to the request
1560
+
1561
+ timeout: Override the client-level default timeout for this request, in seconds
1562
+ """
1563
+ if not id:
1564
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1565
+ return await self._post(
1566
+ f"/computers/{id}/scroll",
1567
+ body=await async_maybe_transform(
1568
+ {
1569
+ "dx": dx,
1570
+ "dy": dy,
1571
+ "x": x,
1572
+ "y": y,
1573
+ },
1574
+ computer_scroll_viewport_params.ComputerScrollViewportParams,
1575
+ ),
1576
+ options=make_request_options(
1577
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1578
+ ),
1579
+ cast_to=ActionResult,
1580
+ )
1581
+
1582
+ async def set_viewport(
1583
+ self,
1584
+ id: str,
1585
+ *,
1586
+ height: int | Omit = omit,
1587
+ scale_factor: float | Omit = omit,
1588
+ width: int | Omit = omit,
1589
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1590
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1591
+ extra_headers: Headers | None = None,
1592
+ extra_query: Query | None = None,
1593
+ extra_body: Body | None = None,
1594
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1595
+ ) -> ActionResult:
1596
+ """
1597
+ Change the browser viewport dimensions and scale factor
1598
+
1599
+ Args:
1600
+ extra_headers: Send extra headers
1601
+
1602
+ extra_query: Add additional query parameters to the request
1603
+
1604
+ extra_body: Add additional JSON properties to the request
1605
+
1606
+ timeout: Override the client-level default timeout for this request, in seconds
1607
+ """
1608
+ if not id:
1609
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1610
+ return await self._post(
1611
+ f"/computers/{id}/viewport",
1612
+ body=await async_maybe_transform(
1613
+ {
1614
+ "height": height,
1615
+ "scale_factor": scale_factor,
1616
+ "width": width,
1617
+ },
1618
+ computer_set_viewport_params.ComputerSetViewportParams,
1619
+ ),
1620
+ options=make_request_options(
1621
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1622
+ ),
1623
+ cast_to=ActionResult,
1624
+ )
1625
+
1626
+ async def stream_events(
1627
+ self,
1628
+ id: str,
1629
+ *,
1630
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1631
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1632
+ extra_headers: Headers | None = None,
1633
+ extra_query: Query | None = None,
1634
+ extra_body: Body | None = None,
1635
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1636
+ ) -> None:
1637
+ """
1638
+ Stream real-time events using Server-Sent Events (SSE)
1639
+
1640
+ Args:
1641
+ extra_headers: Send extra headers
1642
+
1643
+ extra_query: Add additional query parameters to the request
1644
+
1645
+ extra_body: Add additional JSON properties to the request
1646
+
1647
+ timeout: Override the client-level default timeout for this request, in seconds
1648
+ """
1649
+ if not id:
1650
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1651
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1652
+ return await self._get(
1653
+ f"/computers/{id}/events",
1654
+ options=make_request_options(
1655
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1656
+ ),
1657
+ cast_to=NoneType,
1658
+ )
1659
+
1660
+ async def stream_screencast(
1661
+ self,
1662
+ id: str,
1663
+ *,
1664
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1665
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1666
+ extra_headers: Headers | None = None,
1667
+ extra_query: Query | None = None,
1668
+ extra_body: Body | None = None,
1669
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1670
+ ) -> None:
1671
+ """
1672
+ Stream only screencast frames (base64 JPEG images) using Server-Sent Events
1673
+ (SSE) for live browser viewing
1674
+
1675
+ Args:
1676
+ extra_headers: Send extra headers
1677
+
1678
+ extra_query: Add additional query parameters to the request
1679
+
1680
+ extra_body: Add additional JSON properties to the request
1681
+
1682
+ timeout: Override the client-level default timeout for this request, in seconds
1683
+ """
1684
+ if not id:
1685
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1686
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1687
+ return await self._get(
1688
+ f"/computers/{id}/screencast",
1689
+ options=make_request_options(
1690
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1691
+ ),
1692
+ cast_to=NoneType,
1693
+ )
1694
+
1695
+ async def terminate(
1696
+ self,
1697
+ id: str,
1698
+ *,
1699
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1700
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1701
+ extra_headers: Headers | None = None,
1702
+ extra_query: Query | None = None,
1703
+ extra_body: Body | None = None,
1704
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1705
+ ) -> None:
1706
+ """
1707
+ Terminate and clean up a computer instance, stopping the session and recording
1708
+ metrics
1709
+
1710
+ Args:
1711
+ extra_headers: Send extra headers
1712
+
1713
+ extra_query: Add additional query parameters to the request
1714
+
1715
+ extra_body: Add additional JSON properties to the request
1716
+
1717
+ timeout: Override the client-level default timeout for this request, in seconds
1718
+ """
1719
+ if not id:
1720
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1721
+ extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1722
+ return await self._delete(
1723
+ f"/computers/{id}",
1724
+ options=make_request_options(
1725
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1726
+ ),
1727
+ cast_to=NoneType,
1728
+ )
1729
+
1730
+ async def type_text(
1731
+ self,
1732
+ id: str,
1733
+ *,
1734
+ text: str | Omit = omit,
1735
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1736
+ # The extra values given here take precedence over values defined on the client or passed to this method.
1737
+ extra_headers: Headers | None = None,
1738
+ extra_query: Query | None = None,
1739
+ extra_body: Body | None = None,
1740
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
1741
+ ) -> ActionResult:
1742
+ """
1743
+ Type text into the currently focused element in the browser
1744
+
1745
+ Args:
1746
+ extra_headers: Send extra headers
1747
+
1748
+ extra_query: Add additional query parameters to the request
1749
+
1750
+ extra_body: Add additional JSON properties to the request
1751
+
1752
+ timeout: Override the client-level default timeout for this request, in seconds
1753
+ """
1754
+ if not id:
1755
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1756
+ return await self._post(
1757
+ f"/computers/{id}/type",
1758
+ body=await async_maybe_transform({"text": text}, computer_type_text_params.ComputerTypeTextParams),
1759
+ options=make_request_options(
1760
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1761
+ ),
1762
+ cast_to=ActionResult,
1763
+ )
1764
+
1765
+
1766
+ class ComputersResourceWithRawResponse:
1767
+ def __init__(self, computers: ComputersResource) -> None:
1768
+ self._computers = computers
1769
+
1770
+ self.create = to_raw_response_wrapper(
1771
+ computers.create,
1772
+ )
1773
+ self.retrieve = to_raw_response_wrapper(
1774
+ computers.retrieve,
1775
+ )
1776
+ self.list = to_raw_response_wrapper(
1777
+ computers.list,
1778
+ )
1779
+ self.capture_screenshot = to_raw_response_wrapper(
1780
+ computers.capture_screenshot,
1781
+ )
1782
+ self.click = to_raw_response_wrapper(
1783
+ computers.click,
1784
+ )
1785
+ self.connect_websocket = to_raw_response_wrapper(
1786
+ computers.connect_websocket,
1787
+ )
1788
+ self.debug = to_raw_response_wrapper(
1789
+ computers.debug,
1790
+ )
1791
+ self.double_click = to_raw_response_wrapper(
1792
+ computers.double_click,
1793
+ )
1794
+ self.drag = to_raw_response_wrapper(
1795
+ computers.drag,
1796
+ )
1797
+ self.execute_action = to_raw_response_wrapper(
1798
+ computers.execute_action,
1799
+ )
1800
+ self.execute_batch = to_raw_response_wrapper(
1801
+ computers.execute_batch,
1802
+ )
1803
+ self.get_html = to_raw_response_wrapper(
1804
+ computers.get_html,
1805
+ )
1806
+ self.keep_alive = to_raw_response_wrapper(
1807
+ computers.keep_alive,
1808
+ )
1809
+ self.navigate = to_raw_response_wrapper(
1810
+ computers.navigate,
1811
+ )
1812
+ self.press_hotkey = to_raw_response_wrapper(
1813
+ computers.press_hotkey,
1814
+ )
1815
+ self.right_click = to_raw_response_wrapper(
1816
+ computers.right_click,
1817
+ )
1818
+ self.scroll_viewport = to_raw_response_wrapper(
1819
+ computers.scroll_viewport,
1820
+ )
1821
+ self.set_viewport = to_raw_response_wrapper(
1822
+ computers.set_viewport,
1823
+ )
1824
+ self.stream_events = to_raw_response_wrapper(
1825
+ computers.stream_events,
1826
+ )
1827
+ self.stream_screencast = to_raw_response_wrapper(
1828
+ computers.stream_screencast,
1829
+ )
1830
+ self.terminate = to_raw_response_wrapper(
1831
+ computers.terminate,
1832
+ )
1833
+ self.type_text = to_raw_response_wrapper(
1834
+ computers.type_text,
1835
+ )
1836
+
1837
+
1838
+ class AsyncComputersResourceWithRawResponse:
1839
+ def __init__(self, computers: AsyncComputersResource) -> None:
1840
+ self._computers = computers
1841
+
1842
+ self.create = async_to_raw_response_wrapper(
1843
+ computers.create,
1844
+ )
1845
+ self.retrieve = async_to_raw_response_wrapper(
1846
+ computers.retrieve,
1847
+ )
1848
+ self.list = async_to_raw_response_wrapper(
1849
+ computers.list,
1850
+ )
1851
+ self.capture_screenshot = async_to_raw_response_wrapper(
1852
+ computers.capture_screenshot,
1853
+ )
1854
+ self.click = async_to_raw_response_wrapper(
1855
+ computers.click,
1856
+ )
1857
+ self.connect_websocket = async_to_raw_response_wrapper(
1858
+ computers.connect_websocket,
1859
+ )
1860
+ self.debug = async_to_raw_response_wrapper(
1861
+ computers.debug,
1862
+ )
1863
+ self.double_click = async_to_raw_response_wrapper(
1864
+ computers.double_click,
1865
+ )
1866
+ self.drag = async_to_raw_response_wrapper(
1867
+ computers.drag,
1868
+ )
1869
+ self.execute_action = async_to_raw_response_wrapper(
1870
+ computers.execute_action,
1871
+ )
1872
+ self.execute_batch = async_to_raw_response_wrapper(
1873
+ computers.execute_batch,
1874
+ )
1875
+ self.get_html = async_to_raw_response_wrapper(
1876
+ computers.get_html,
1877
+ )
1878
+ self.keep_alive = async_to_raw_response_wrapper(
1879
+ computers.keep_alive,
1880
+ )
1881
+ self.navigate = async_to_raw_response_wrapper(
1882
+ computers.navigate,
1883
+ )
1884
+ self.press_hotkey = async_to_raw_response_wrapper(
1885
+ computers.press_hotkey,
1886
+ )
1887
+ self.right_click = async_to_raw_response_wrapper(
1888
+ computers.right_click,
1889
+ )
1890
+ self.scroll_viewport = async_to_raw_response_wrapper(
1891
+ computers.scroll_viewport,
1892
+ )
1893
+ self.set_viewport = async_to_raw_response_wrapper(
1894
+ computers.set_viewport,
1895
+ )
1896
+ self.stream_events = async_to_raw_response_wrapper(
1897
+ computers.stream_events,
1898
+ )
1899
+ self.stream_screencast = async_to_raw_response_wrapper(
1900
+ computers.stream_screencast,
1901
+ )
1902
+ self.terminate = async_to_raw_response_wrapper(
1903
+ computers.terminate,
1904
+ )
1905
+ self.type_text = async_to_raw_response_wrapper(
1906
+ computers.type_text,
1907
+ )
1908
+
1909
+
1910
+ class ComputersResourceWithStreamingResponse:
1911
+ def __init__(self, computers: ComputersResource) -> None:
1912
+ self._computers = computers
1913
+
1914
+ self.create = to_streamed_response_wrapper(
1915
+ computers.create,
1916
+ )
1917
+ self.retrieve = to_streamed_response_wrapper(
1918
+ computers.retrieve,
1919
+ )
1920
+ self.list = to_streamed_response_wrapper(
1921
+ computers.list,
1922
+ )
1923
+ self.capture_screenshot = to_streamed_response_wrapper(
1924
+ computers.capture_screenshot,
1925
+ )
1926
+ self.click = to_streamed_response_wrapper(
1927
+ computers.click,
1928
+ )
1929
+ self.connect_websocket = to_streamed_response_wrapper(
1930
+ computers.connect_websocket,
1931
+ )
1932
+ self.debug = to_streamed_response_wrapper(
1933
+ computers.debug,
1934
+ )
1935
+ self.double_click = to_streamed_response_wrapper(
1936
+ computers.double_click,
1937
+ )
1938
+ self.drag = to_streamed_response_wrapper(
1939
+ computers.drag,
1940
+ )
1941
+ self.execute_action = to_streamed_response_wrapper(
1942
+ computers.execute_action,
1943
+ )
1944
+ self.execute_batch = to_streamed_response_wrapper(
1945
+ computers.execute_batch,
1946
+ )
1947
+ self.get_html = to_streamed_response_wrapper(
1948
+ computers.get_html,
1949
+ )
1950
+ self.keep_alive = to_streamed_response_wrapper(
1951
+ computers.keep_alive,
1952
+ )
1953
+ self.navigate = to_streamed_response_wrapper(
1954
+ computers.navigate,
1955
+ )
1956
+ self.press_hotkey = to_streamed_response_wrapper(
1957
+ computers.press_hotkey,
1958
+ )
1959
+ self.right_click = to_streamed_response_wrapper(
1960
+ computers.right_click,
1961
+ )
1962
+ self.scroll_viewport = to_streamed_response_wrapper(
1963
+ computers.scroll_viewport,
1964
+ )
1965
+ self.set_viewport = to_streamed_response_wrapper(
1966
+ computers.set_viewport,
1967
+ )
1968
+ self.stream_events = to_streamed_response_wrapper(
1969
+ computers.stream_events,
1970
+ )
1971
+ self.stream_screencast = to_streamed_response_wrapper(
1972
+ computers.stream_screencast,
1973
+ )
1974
+ self.terminate = to_streamed_response_wrapper(
1975
+ computers.terminate,
1976
+ )
1977
+ self.type_text = to_streamed_response_wrapper(
1978
+ computers.type_text,
1979
+ )
1980
+
1981
+
1982
+ class AsyncComputersResourceWithStreamingResponse:
1983
+ def __init__(self, computers: AsyncComputersResource) -> None:
1984
+ self._computers = computers
1985
+
1986
+ self.create = async_to_streamed_response_wrapper(
1987
+ computers.create,
1988
+ )
1989
+ self.retrieve = async_to_streamed_response_wrapper(
1990
+ computers.retrieve,
1991
+ )
1992
+ self.list = async_to_streamed_response_wrapper(
1993
+ computers.list,
1994
+ )
1995
+ self.capture_screenshot = async_to_streamed_response_wrapper(
1996
+ computers.capture_screenshot,
1997
+ )
1998
+ self.click = async_to_streamed_response_wrapper(
1999
+ computers.click,
2000
+ )
2001
+ self.connect_websocket = async_to_streamed_response_wrapper(
2002
+ computers.connect_websocket,
2003
+ )
2004
+ self.debug = async_to_streamed_response_wrapper(
2005
+ computers.debug,
2006
+ )
2007
+ self.double_click = async_to_streamed_response_wrapper(
2008
+ computers.double_click,
2009
+ )
2010
+ self.drag = async_to_streamed_response_wrapper(
2011
+ computers.drag,
2012
+ )
2013
+ self.execute_action = async_to_streamed_response_wrapper(
2014
+ computers.execute_action,
2015
+ )
2016
+ self.execute_batch = async_to_streamed_response_wrapper(
2017
+ computers.execute_batch,
2018
+ )
2019
+ self.get_html = async_to_streamed_response_wrapper(
2020
+ computers.get_html,
2021
+ )
2022
+ self.keep_alive = async_to_streamed_response_wrapper(
2023
+ computers.keep_alive,
2024
+ )
2025
+ self.navigate = async_to_streamed_response_wrapper(
2026
+ computers.navigate,
2027
+ )
2028
+ self.press_hotkey = async_to_streamed_response_wrapper(
2029
+ computers.press_hotkey,
2030
+ )
2031
+ self.right_click = async_to_streamed_response_wrapper(
2032
+ computers.right_click,
2033
+ )
2034
+ self.scroll_viewport = async_to_streamed_response_wrapper(
2035
+ computers.scroll_viewport,
2036
+ )
2037
+ self.set_viewport = async_to_streamed_response_wrapper(
2038
+ computers.set_viewport,
2039
+ )
2040
+ self.stream_events = async_to_streamed_response_wrapper(
2041
+ computers.stream_events,
2042
+ )
2043
+ self.stream_screencast = async_to_streamed_response_wrapper(
2044
+ computers.stream_screencast,
2045
+ )
2046
+ self.terminate = async_to_streamed_response_wrapper(
2047
+ computers.terminate,
2048
+ )
2049
+ self.type_text = async_to_streamed_response_wrapper(
2050
+ computers.type_text,
2051
+ )