anchorbrowser 0.1.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.
Files changed (100) hide show
  1. anchorbrowser/__init__.py +100 -0
  2. anchorbrowser/_base_client.py +1995 -0
  3. anchorbrowser/_client.py +440 -0
  4. anchorbrowser/_compat.py +219 -0
  5. anchorbrowser/_constants.py +14 -0
  6. anchorbrowser/_exceptions.py +108 -0
  7. anchorbrowser/_files.py +123 -0
  8. anchorbrowser/_models.py +829 -0
  9. anchorbrowser/_qs.py +150 -0
  10. anchorbrowser/_resource.py +43 -0
  11. anchorbrowser/_response.py +832 -0
  12. anchorbrowser/_streaming.py +333 -0
  13. anchorbrowser/_types.py +219 -0
  14. anchorbrowser/_utils/__init__.py +57 -0
  15. anchorbrowser/_utils/_logs.py +25 -0
  16. anchorbrowser/_utils/_proxy.py +65 -0
  17. anchorbrowser/_utils/_reflection.py +42 -0
  18. anchorbrowser/_utils/_resources_proxy.py +24 -0
  19. anchorbrowser/_utils/_streams.py +12 -0
  20. anchorbrowser/_utils/_sync.py +86 -0
  21. anchorbrowser/_utils/_transform.py +447 -0
  22. anchorbrowser/_utils/_typing.py +151 -0
  23. anchorbrowser/_utils/_utils.py +422 -0
  24. anchorbrowser/_version.py +4 -0
  25. anchorbrowser/lib/.keep +4 -0
  26. anchorbrowser/lib/agent.py +69 -0
  27. anchorbrowser/lib/browser.py +186 -0
  28. anchorbrowser/py.typed +0 -0
  29. anchorbrowser/resources/__init__.py +61 -0
  30. anchorbrowser/resources/agent.py +305 -0
  31. anchorbrowser/resources/browser.py +152 -0
  32. anchorbrowser/resources/extensions.py +412 -0
  33. anchorbrowser/resources/profiles.py +553 -0
  34. anchorbrowser/resources/sessions/__init__.py +89 -0
  35. anchorbrowser/resources/sessions/all.py +192 -0
  36. anchorbrowser/resources/sessions/clipboard.py +252 -0
  37. anchorbrowser/resources/sessions/keyboard.py +298 -0
  38. anchorbrowser/resources/sessions/mouse.py +651 -0
  39. anchorbrowser/resources/sessions/recordings/__init__.py +33 -0
  40. anchorbrowser/resources/sessions/recordings/primary.py +176 -0
  41. anchorbrowser/resources/sessions/recordings/recordings.py +357 -0
  42. anchorbrowser/resources/sessions/sessions.py +1122 -0
  43. anchorbrowser/resources/tools.py +529 -0
  44. anchorbrowser/types/__init__.py +32 -0
  45. anchorbrowser/types/extension_delete_response.py +12 -0
  46. anchorbrowser/types/extension_list_response.py +31 -0
  47. anchorbrowser/types/extension_manifest.py +28 -0
  48. anchorbrowser/types/extension_retrieve_response.py +27 -0
  49. anchorbrowser/types/extension_upload_params.py +17 -0
  50. anchorbrowser/types/extension_upload_response.py +31 -0
  51. anchorbrowser/types/profile_create_params.py +31 -0
  52. anchorbrowser/types/profile_list_response.py +43 -0
  53. anchorbrowser/types/profile_retrieve_response.py +36 -0
  54. anchorbrowser/types/profile_update_params.py +27 -0
  55. anchorbrowser/types/session_copy_response.py +12 -0
  56. anchorbrowser/types/session_create_params.py +196 -0
  57. anchorbrowser/types/session_create_response.py +22 -0
  58. anchorbrowser/types/session_drag_and_drop_params.py +26 -0
  59. anchorbrowser/types/session_drag_and_drop_response.py +11 -0
  60. anchorbrowser/types/session_goto_params.py +12 -0
  61. anchorbrowser/types/session_goto_response.py +11 -0
  62. anchorbrowser/types/session_paste_params.py +12 -0
  63. anchorbrowser/types/session_paste_response.py +11 -0
  64. anchorbrowser/types/session_retrieve_downloads_response.py +51 -0
  65. anchorbrowser/types/session_scroll_params.py +26 -0
  66. anchorbrowser/types/session_scroll_response.py +11 -0
  67. anchorbrowser/types/sessions/__init__.py +25 -0
  68. anchorbrowser/types/sessions/all_status_response.py +30 -0
  69. anchorbrowser/types/sessions/clipboard_get_response.py +16 -0
  70. anchorbrowser/types/sessions/clipboard_set_params.py +12 -0
  71. anchorbrowser/types/sessions/clipboard_set_response.py +11 -0
  72. anchorbrowser/types/sessions/keyboard_shortcut_params.py +18 -0
  73. anchorbrowser/types/sessions/keyboard_shortcut_response.py +11 -0
  74. anchorbrowser/types/sessions/keyboard_type_params.py +15 -0
  75. anchorbrowser/types/sessions/keyboard_type_response.py +11 -0
  76. anchorbrowser/types/sessions/mouse_click_params.py +18 -0
  77. anchorbrowser/types/sessions/mouse_click_response.py +11 -0
  78. anchorbrowser/types/sessions/mouse_double_click_params.py +18 -0
  79. anchorbrowser/types/sessions/mouse_double_click_response.py +11 -0
  80. anchorbrowser/types/sessions/mouse_down_params.py +18 -0
  81. anchorbrowser/types/sessions/mouse_down_response.py +11 -0
  82. anchorbrowser/types/sessions/mouse_move_params.py +15 -0
  83. anchorbrowser/types/sessions/mouse_move_response.py +11 -0
  84. anchorbrowser/types/sessions/mouse_up_params.py +18 -0
  85. anchorbrowser/types/sessions/mouse_up_response.py +11 -0
  86. anchorbrowser/types/sessions/recording_list_response.py +46 -0
  87. anchorbrowser/types/sessions/recording_pause_response.py +12 -0
  88. anchorbrowser/types/sessions/recording_resume_response.py +12 -0
  89. anchorbrowser/types/sessions/recordings/__init__.py +3 -0
  90. anchorbrowser/types/shared/__init__.py +3 -0
  91. anchorbrowser/types/shared/success_response.py +15 -0
  92. anchorbrowser/types/tool_fetch_webpage_params.py +26 -0
  93. anchorbrowser/types/tool_fetch_webpage_response.py +7 -0
  94. anchorbrowser/types/tool_perform_web_task_params.py +30 -0
  95. anchorbrowser/types/tool_perform_web_task_response.py +16 -0
  96. anchorbrowser/types/tool_screenshot_webpage_params.py +48 -0
  97. anchorbrowser-0.1.0.dist-info/METADATA +449 -0
  98. anchorbrowser-0.1.0.dist-info/RECORD +100 -0
  99. anchorbrowser-0.1.0.dist-info/WHEEL +4 -0
  100. anchorbrowser-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,651 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing_extensions import Literal
6
+
7
+ import httpx
8
+
9
+ from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
10
+ from ..._utils import maybe_transform, async_maybe_transform
11
+ from ..._compat import cached_property
12
+ from ..._resource import SyncAPIResource, AsyncAPIResource
13
+ from ..._response import (
14
+ to_raw_response_wrapper,
15
+ to_streamed_response_wrapper,
16
+ async_to_raw_response_wrapper,
17
+ async_to_streamed_response_wrapper,
18
+ )
19
+ from ..._base_client import make_request_options
20
+ from ...types.sessions import (
21
+ mouse_up_params,
22
+ mouse_down_params,
23
+ mouse_move_params,
24
+ mouse_click_params,
25
+ mouse_double_click_params,
26
+ )
27
+ from ...types.sessions.mouse_up_response import MouseUpResponse
28
+ from ...types.sessions.mouse_down_response import MouseDownResponse
29
+ from ...types.sessions.mouse_move_response import MouseMoveResponse
30
+ from ...types.sessions.mouse_click_response import MouseClickResponse
31
+ from ...types.sessions.mouse_double_click_response import MouseDoubleClickResponse
32
+
33
+ __all__ = ["MouseResource", "AsyncMouseResource"]
34
+
35
+
36
+ class MouseResource(SyncAPIResource):
37
+ @cached_property
38
+ def with_raw_response(self) -> MouseResourceWithRawResponse:
39
+ """
40
+ This property can be used as a prefix for any HTTP method call to return
41
+ the raw response object instead of the parsed content.
42
+
43
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
44
+ """
45
+ return MouseResourceWithRawResponse(self)
46
+
47
+ @cached_property
48
+ def with_streaming_response(self) -> MouseResourceWithStreamingResponse:
49
+ """
50
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
51
+
52
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
53
+ """
54
+ return MouseResourceWithStreamingResponse(self)
55
+
56
+ def click(
57
+ self,
58
+ session_id: str,
59
+ *,
60
+ x: int,
61
+ y: int,
62
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
63
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
64
+ # The extra values given here take precedence over values defined on the client or passed to this method.
65
+ extra_headers: Headers | None = None,
66
+ extra_query: Query | None = None,
67
+ extra_body: Body | None = None,
68
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
69
+ ) -> MouseClickResponse:
70
+ """
71
+ Performs a mouse click at the specified coordinates
72
+
73
+ Args:
74
+ x: X coordinate
75
+
76
+ y: Y coordinate
77
+
78
+ button: Mouse button to use
79
+
80
+ extra_headers: Send extra headers
81
+
82
+ extra_query: Add additional query parameters to the request
83
+
84
+ extra_body: Add additional JSON properties to the request
85
+
86
+ timeout: Override the client-level default timeout for this request, in seconds
87
+ """
88
+ if not session_id:
89
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
90
+ return self._post(
91
+ f"/v1/sessions/{session_id}/mouse/click",
92
+ body=maybe_transform(
93
+ {
94
+ "x": x,
95
+ "y": y,
96
+ "button": button,
97
+ },
98
+ mouse_click_params.MouseClickParams,
99
+ ),
100
+ options=make_request_options(
101
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
102
+ ),
103
+ cast_to=MouseClickResponse,
104
+ )
105
+
106
+ def double_click(
107
+ self,
108
+ session_id: str,
109
+ *,
110
+ x: int,
111
+ y: int,
112
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
113
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
114
+ # The extra values given here take precedence over values defined on the client or passed to this method.
115
+ extra_headers: Headers | None = None,
116
+ extra_query: Query | None = None,
117
+ extra_body: Body | None = None,
118
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
119
+ ) -> MouseDoubleClickResponse:
120
+ """
121
+ Performs a double click at the specified coordinates
122
+
123
+ Args:
124
+ x: X coordinate
125
+
126
+ y: Y coordinate
127
+
128
+ button: Mouse button to use
129
+
130
+ extra_headers: Send extra headers
131
+
132
+ extra_query: Add additional query parameters to the request
133
+
134
+ extra_body: Add additional JSON properties to the request
135
+
136
+ timeout: Override the client-level default timeout for this request, in seconds
137
+ """
138
+ if not session_id:
139
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
140
+ return self._post(
141
+ f"/v1/sessions/{session_id}/mouse/doubleClick",
142
+ body=maybe_transform(
143
+ {
144
+ "x": x,
145
+ "y": y,
146
+ "button": button,
147
+ },
148
+ mouse_double_click_params.MouseDoubleClickParams,
149
+ ),
150
+ options=make_request_options(
151
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
152
+ ),
153
+ cast_to=MouseDoubleClickResponse,
154
+ )
155
+
156
+ def down(
157
+ self,
158
+ session_id: str,
159
+ *,
160
+ x: int,
161
+ y: int,
162
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
163
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
164
+ # The extra values given here take precedence over values defined on the client or passed to this method.
165
+ extra_headers: Headers | None = None,
166
+ extra_query: Query | None = None,
167
+ extra_body: Body | None = None,
168
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
169
+ ) -> MouseDownResponse:
170
+ """
171
+ Performs a mouse button down action at the specified coordinates
172
+
173
+ Args:
174
+ x: X coordinate
175
+
176
+ y: Y coordinate
177
+
178
+ button: Mouse button to use
179
+
180
+ extra_headers: Send extra headers
181
+
182
+ extra_query: Add additional query parameters to the request
183
+
184
+ extra_body: Add additional JSON properties to the request
185
+
186
+ timeout: Override the client-level default timeout for this request, in seconds
187
+ """
188
+ if not session_id:
189
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
190
+ return self._post(
191
+ f"/v1/sessions/{session_id}/mouse/down",
192
+ body=maybe_transform(
193
+ {
194
+ "x": x,
195
+ "y": y,
196
+ "button": button,
197
+ },
198
+ mouse_down_params.MouseDownParams,
199
+ ),
200
+ options=make_request_options(
201
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
202
+ ),
203
+ cast_to=MouseDownResponse,
204
+ )
205
+
206
+ def move(
207
+ self,
208
+ session_id: str,
209
+ *,
210
+ x: int,
211
+ y: int,
212
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
213
+ # The extra values given here take precedence over values defined on the client or passed to this method.
214
+ extra_headers: Headers | None = None,
215
+ extra_query: Query | None = None,
216
+ extra_body: Body | None = None,
217
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
218
+ ) -> MouseMoveResponse:
219
+ """
220
+ Moves the mouse cursor to the specified coordinates
221
+
222
+ Args:
223
+ x: X coordinate
224
+
225
+ y: Y coordinate
226
+
227
+ extra_headers: Send extra headers
228
+
229
+ extra_query: Add additional query parameters to the request
230
+
231
+ extra_body: Add additional JSON properties to the request
232
+
233
+ timeout: Override the client-level default timeout for this request, in seconds
234
+ """
235
+ if not session_id:
236
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
237
+ return self._post(
238
+ f"/v1/sessions/{session_id}/mouse/move",
239
+ body=maybe_transform(
240
+ {
241
+ "x": x,
242
+ "y": y,
243
+ },
244
+ mouse_move_params.MouseMoveParams,
245
+ ),
246
+ options=make_request_options(
247
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
248
+ ),
249
+ cast_to=MouseMoveResponse,
250
+ )
251
+
252
+ def up(
253
+ self,
254
+ session_id: str,
255
+ *,
256
+ x: int,
257
+ y: int,
258
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
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
+ ) -> MouseUpResponse:
266
+ """
267
+ Performs a mouse button up action at the specified coordinates
268
+
269
+ Args:
270
+ x: X coordinate
271
+
272
+ y: Y coordinate
273
+
274
+ button: Mouse button to use
275
+
276
+ extra_headers: Send extra headers
277
+
278
+ extra_query: Add additional query parameters to the request
279
+
280
+ extra_body: Add additional JSON properties to the request
281
+
282
+ timeout: Override the client-level default timeout for this request, in seconds
283
+ """
284
+ if not session_id:
285
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
286
+ return self._post(
287
+ f"/v1/sessions/{session_id}/mouse/up",
288
+ body=maybe_transform(
289
+ {
290
+ "x": x,
291
+ "y": y,
292
+ "button": button,
293
+ },
294
+ mouse_up_params.MouseUpParams,
295
+ ),
296
+ options=make_request_options(
297
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
298
+ ),
299
+ cast_to=MouseUpResponse,
300
+ )
301
+
302
+
303
+ class AsyncMouseResource(AsyncAPIResource):
304
+ @cached_property
305
+ def with_raw_response(self) -> AsyncMouseResourceWithRawResponse:
306
+ """
307
+ This property can be used as a prefix for any HTTP method call to return
308
+ the raw response object instead of the parsed content.
309
+
310
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
311
+ """
312
+ return AsyncMouseResourceWithRawResponse(self)
313
+
314
+ @cached_property
315
+ def with_streaming_response(self) -> AsyncMouseResourceWithStreamingResponse:
316
+ """
317
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
318
+
319
+ For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
320
+ """
321
+ return AsyncMouseResourceWithStreamingResponse(self)
322
+
323
+ async def click(
324
+ self,
325
+ session_id: str,
326
+ *,
327
+ x: int,
328
+ y: int,
329
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
330
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
331
+ # The extra values given here take precedence over values defined on the client or passed to this method.
332
+ extra_headers: Headers | None = None,
333
+ extra_query: Query | None = None,
334
+ extra_body: Body | None = None,
335
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
336
+ ) -> MouseClickResponse:
337
+ """
338
+ Performs a mouse click at the specified coordinates
339
+
340
+ Args:
341
+ x: X coordinate
342
+
343
+ y: Y coordinate
344
+
345
+ button: Mouse button to use
346
+
347
+ extra_headers: Send extra headers
348
+
349
+ extra_query: Add additional query parameters to the request
350
+
351
+ extra_body: Add additional JSON properties to the request
352
+
353
+ timeout: Override the client-level default timeout for this request, in seconds
354
+ """
355
+ if not session_id:
356
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
357
+ return await self._post(
358
+ f"/v1/sessions/{session_id}/mouse/click",
359
+ body=await async_maybe_transform(
360
+ {
361
+ "x": x,
362
+ "y": y,
363
+ "button": button,
364
+ },
365
+ mouse_click_params.MouseClickParams,
366
+ ),
367
+ options=make_request_options(
368
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
369
+ ),
370
+ cast_to=MouseClickResponse,
371
+ )
372
+
373
+ async def double_click(
374
+ self,
375
+ session_id: str,
376
+ *,
377
+ x: int,
378
+ y: int,
379
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
380
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
381
+ # The extra values given here take precedence over values defined on the client or passed to this method.
382
+ extra_headers: Headers | None = None,
383
+ extra_query: Query | None = None,
384
+ extra_body: Body | None = None,
385
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
386
+ ) -> MouseDoubleClickResponse:
387
+ """
388
+ Performs a double click at the specified coordinates
389
+
390
+ Args:
391
+ x: X coordinate
392
+
393
+ y: Y coordinate
394
+
395
+ button: Mouse button to use
396
+
397
+ extra_headers: Send extra headers
398
+
399
+ extra_query: Add additional query parameters to the request
400
+
401
+ extra_body: Add additional JSON properties to the request
402
+
403
+ timeout: Override the client-level default timeout for this request, in seconds
404
+ """
405
+ if not session_id:
406
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
407
+ return await self._post(
408
+ f"/v1/sessions/{session_id}/mouse/doubleClick",
409
+ body=await async_maybe_transform(
410
+ {
411
+ "x": x,
412
+ "y": y,
413
+ "button": button,
414
+ },
415
+ mouse_double_click_params.MouseDoubleClickParams,
416
+ ),
417
+ options=make_request_options(
418
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
419
+ ),
420
+ cast_to=MouseDoubleClickResponse,
421
+ )
422
+
423
+ async def down(
424
+ self,
425
+ session_id: str,
426
+ *,
427
+ x: int,
428
+ y: int,
429
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
430
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
431
+ # The extra values given here take precedence over values defined on the client or passed to this method.
432
+ extra_headers: Headers | None = None,
433
+ extra_query: Query | None = None,
434
+ extra_body: Body | None = None,
435
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
436
+ ) -> MouseDownResponse:
437
+ """
438
+ Performs a mouse button down action at the specified coordinates
439
+
440
+ Args:
441
+ x: X coordinate
442
+
443
+ y: Y coordinate
444
+
445
+ button: Mouse button to use
446
+
447
+ extra_headers: Send extra headers
448
+
449
+ extra_query: Add additional query parameters to the request
450
+
451
+ extra_body: Add additional JSON properties to the request
452
+
453
+ timeout: Override the client-level default timeout for this request, in seconds
454
+ """
455
+ if not session_id:
456
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
457
+ return await self._post(
458
+ f"/v1/sessions/{session_id}/mouse/down",
459
+ body=await async_maybe_transform(
460
+ {
461
+ "x": x,
462
+ "y": y,
463
+ "button": button,
464
+ },
465
+ mouse_down_params.MouseDownParams,
466
+ ),
467
+ options=make_request_options(
468
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
469
+ ),
470
+ cast_to=MouseDownResponse,
471
+ )
472
+
473
+ async def move(
474
+ self,
475
+ session_id: str,
476
+ *,
477
+ x: int,
478
+ y: int,
479
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
480
+ # The extra values given here take precedence over values defined on the client or passed to this method.
481
+ extra_headers: Headers | None = None,
482
+ extra_query: Query | None = None,
483
+ extra_body: Body | None = None,
484
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
485
+ ) -> MouseMoveResponse:
486
+ """
487
+ Moves the mouse cursor to the specified coordinates
488
+
489
+ Args:
490
+ x: X coordinate
491
+
492
+ y: Y coordinate
493
+
494
+ extra_headers: Send extra headers
495
+
496
+ extra_query: Add additional query parameters to the request
497
+
498
+ extra_body: Add additional JSON properties to the request
499
+
500
+ timeout: Override the client-level default timeout for this request, in seconds
501
+ """
502
+ if not session_id:
503
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
504
+ return await self._post(
505
+ f"/v1/sessions/{session_id}/mouse/move",
506
+ body=await async_maybe_transform(
507
+ {
508
+ "x": x,
509
+ "y": y,
510
+ },
511
+ mouse_move_params.MouseMoveParams,
512
+ ),
513
+ options=make_request_options(
514
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
515
+ ),
516
+ cast_to=MouseMoveResponse,
517
+ )
518
+
519
+ async def up(
520
+ self,
521
+ session_id: str,
522
+ *,
523
+ x: int,
524
+ y: int,
525
+ button: Literal["left", "middle", "right"] | NotGiven = NOT_GIVEN,
526
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
527
+ # The extra values given here take precedence over values defined on the client or passed to this method.
528
+ extra_headers: Headers | None = None,
529
+ extra_query: Query | None = None,
530
+ extra_body: Body | None = None,
531
+ timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
532
+ ) -> MouseUpResponse:
533
+ """
534
+ Performs a mouse button up action at the specified coordinates
535
+
536
+ Args:
537
+ x: X coordinate
538
+
539
+ y: Y coordinate
540
+
541
+ button: Mouse button to use
542
+
543
+ extra_headers: Send extra headers
544
+
545
+ extra_query: Add additional query parameters to the request
546
+
547
+ extra_body: Add additional JSON properties to the request
548
+
549
+ timeout: Override the client-level default timeout for this request, in seconds
550
+ """
551
+ if not session_id:
552
+ raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
553
+ return await self._post(
554
+ f"/v1/sessions/{session_id}/mouse/up",
555
+ body=await async_maybe_transform(
556
+ {
557
+ "x": x,
558
+ "y": y,
559
+ "button": button,
560
+ },
561
+ mouse_up_params.MouseUpParams,
562
+ ),
563
+ options=make_request_options(
564
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
565
+ ),
566
+ cast_to=MouseUpResponse,
567
+ )
568
+
569
+
570
+ class MouseResourceWithRawResponse:
571
+ def __init__(self, mouse: MouseResource) -> None:
572
+ self._mouse = mouse
573
+
574
+ self.click = to_raw_response_wrapper(
575
+ mouse.click,
576
+ )
577
+ self.double_click = to_raw_response_wrapper(
578
+ mouse.double_click,
579
+ )
580
+ self.down = to_raw_response_wrapper(
581
+ mouse.down,
582
+ )
583
+ self.move = to_raw_response_wrapper(
584
+ mouse.move,
585
+ )
586
+ self.up = to_raw_response_wrapper(
587
+ mouse.up,
588
+ )
589
+
590
+
591
+ class AsyncMouseResourceWithRawResponse:
592
+ def __init__(self, mouse: AsyncMouseResource) -> None:
593
+ self._mouse = mouse
594
+
595
+ self.click = async_to_raw_response_wrapper(
596
+ mouse.click,
597
+ )
598
+ self.double_click = async_to_raw_response_wrapper(
599
+ mouse.double_click,
600
+ )
601
+ self.down = async_to_raw_response_wrapper(
602
+ mouse.down,
603
+ )
604
+ self.move = async_to_raw_response_wrapper(
605
+ mouse.move,
606
+ )
607
+ self.up = async_to_raw_response_wrapper(
608
+ mouse.up,
609
+ )
610
+
611
+
612
+ class MouseResourceWithStreamingResponse:
613
+ def __init__(self, mouse: MouseResource) -> None:
614
+ self._mouse = mouse
615
+
616
+ self.click = to_streamed_response_wrapper(
617
+ mouse.click,
618
+ )
619
+ self.double_click = to_streamed_response_wrapper(
620
+ mouse.double_click,
621
+ )
622
+ self.down = to_streamed_response_wrapper(
623
+ mouse.down,
624
+ )
625
+ self.move = to_streamed_response_wrapper(
626
+ mouse.move,
627
+ )
628
+ self.up = to_streamed_response_wrapper(
629
+ mouse.up,
630
+ )
631
+
632
+
633
+ class AsyncMouseResourceWithStreamingResponse:
634
+ def __init__(self, mouse: AsyncMouseResource) -> None:
635
+ self._mouse = mouse
636
+
637
+ self.click = async_to_streamed_response_wrapper(
638
+ mouse.click,
639
+ )
640
+ self.double_click = async_to_streamed_response_wrapper(
641
+ mouse.double_click,
642
+ )
643
+ self.down = async_to_streamed_response_wrapper(
644
+ mouse.down,
645
+ )
646
+ self.move = async_to_streamed_response_wrapper(
647
+ mouse.move,
648
+ )
649
+ self.up = async_to_streamed_response_wrapper(
650
+ mouse.up,
651
+ )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .primary import (
4
+ PrimaryResource,
5
+ AsyncPrimaryResource,
6
+ PrimaryResourceWithRawResponse,
7
+ AsyncPrimaryResourceWithRawResponse,
8
+ PrimaryResourceWithStreamingResponse,
9
+ AsyncPrimaryResourceWithStreamingResponse,
10
+ )
11
+ from .recordings import (
12
+ RecordingsResource,
13
+ AsyncRecordingsResource,
14
+ RecordingsResourceWithRawResponse,
15
+ AsyncRecordingsResourceWithRawResponse,
16
+ RecordingsResourceWithStreamingResponse,
17
+ AsyncRecordingsResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "PrimaryResource",
22
+ "AsyncPrimaryResource",
23
+ "PrimaryResourceWithRawResponse",
24
+ "AsyncPrimaryResourceWithRawResponse",
25
+ "PrimaryResourceWithStreamingResponse",
26
+ "AsyncPrimaryResourceWithStreamingResponse",
27
+ "RecordingsResource",
28
+ "AsyncRecordingsResource",
29
+ "RecordingsResourceWithRawResponse",
30
+ "AsyncRecordingsResourceWithRawResponse",
31
+ "RecordingsResourceWithStreamingResponse",
32
+ "AsyncRecordingsResourceWithStreamingResponse",
33
+ ]