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.
- anchorbrowser/__init__.py +100 -0
- anchorbrowser/_base_client.py +1995 -0
- anchorbrowser/_client.py +440 -0
- anchorbrowser/_compat.py +219 -0
- anchorbrowser/_constants.py +14 -0
- anchorbrowser/_exceptions.py +108 -0
- anchorbrowser/_files.py +123 -0
- anchorbrowser/_models.py +829 -0
- anchorbrowser/_qs.py +150 -0
- anchorbrowser/_resource.py +43 -0
- anchorbrowser/_response.py +832 -0
- anchorbrowser/_streaming.py +333 -0
- anchorbrowser/_types.py +219 -0
- anchorbrowser/_utils/__init__.py +57 -0
- anchorbrowser/_utils/_logs.py +25 -0
- anchorbrowser/_utils/_proxy.py +65 -0
- anchorbrowser/_utils/_reflection.py +42 -0
- anchorbrowser/_utils/_resources_proxy.py +24 -0
- anchorbrowser/_utils/_streams.py +12 -0
- anchorbrowser/_utils/_sync.py +86 -0
- anchorbrowser/_utils/_transform.py +447 -0
- anchorbrowser/_utils/_typing.py +151 -0
- anchorbrowser/_utils/_utils.py +422 -0
- anchorbrowser/_version.py +4 -0
- anchorbrowser/lib/.keep +4 -0
- anchorbrowser/lib/agent.py +69 -0
- anchorbrowser/lib/browser.py +186 -0
- anchorbrowser/py.typed +0 -0
- anchorbrowser/resources/__init__.py +61 -0
- anchorbrowser/resources/agent.py +305 -0
- anchorbrowser/resources/browser.py +152 -0
- anchorbrowser/resources/extensions.py +412 -0
- anchorbrowser/resources/profiles.py +553 -0
- anchorbrowser/resources/sessions/__init__.py +89 -0
- anchorbrowser/resources/sessions/all.py +192 -0
- anchorbrowser/resources/sessions/clipboard.py +252 -0
- anchorbrowser/resources/sessions/keyboard.py +298 -0
- anchorbrowser/resources/sessions/mouse.py +651 -0
- anchorbrowser/resources/sessions/recordings/__init__.py +33 -0
- anchorbrowser/resources/sessions/recordings/primary.py +176 -0
- anchorbrowser/resources/sessions/recordings/recordings.py +357 -0
- anchorbrowser/resources/sessions/sessions.py +1122 -0
- anchorbrowser/resources/tools.py +529 -0
- anchorbrowser/types/__init__.py +32 -0
- anchorbrowser/types/extension_delete_response.py +12 -0
- anchorbrowser/types/extension_list_response.py +31 -0
- anchorbrowser/types/extension_manifest.py +28 -0
- anchorbrowser/types/extension_retrieve_response.py +27 -0
- anchorbrowser/types/extension_upload_params.py +17 -0
- anchorbrowser/types/extension_upload_response.py +31 -0
- anchorbrowser/types/profile_create_params.py +31 -0
- anchorbrowser/types/profile_list_response.py +43 -0
- anchorbrowser/types/profile_retrieve_response.py +36 -0
- anchorbrowser/types/profile_update_params.py +27 -0
- anchorbrowser/types/session_copy_response.py +12 -0
- anchorbrowser/types/session_create_params.py +196 -0
- anchorbrowser/types/session_create_response.py +22 -0
- anchorbrowser/types/session_drag_and_drop_params.py +26 -0
- anchorbrowser/types/session_drag_and_drop_response.py +11 -0
- anchorbrowser/types/session_goto_params.py +12 -0
- anchorbrowser/types/session_goto_response.py +11 -0
- anchorbrowser/types/session_paste_params.py +12 -0
- anchorbrowser/types/session_paste_response.py +11 -0
- anchorbrowser/types/session_retrieve_downloads_response.py +51 -0
- anchorbrowser/types/session_scroll_params.py +26 -0
- anchorbrowser/types/session_scroll_response.py +11 -0
- anchorbrowser/types/sessions/__init__.py +25 -0
- anchorbrowser/types/sessions/all_status_response.py +30 -0
- anchorbrowser/types/sessions/clipboard_get_response.py +16 -0
- anchorbrowser/types/sessions/clipboard_set_params.py +12 -0
- anchorbrowser/types/sessions/clipboard_set_response.py +11 -0
- anchorbrowser/types/sessions/keyboard_shortcut_params.py +18 -0
- anchorbrowser/types/sessions/keyboard_shortcut_response.py +11 -0
- anchorbrowser/types/sessions/keyboard_type_params.py +15 -0
- anchorbrowser/types/sessions/keyboard_type_response.py +11 -0
- anchorbrowser/types/sessions/mouse_click_params.py +18 -0
- anchorbrowser/types/sessions/mouse_click_response.py +11 -0
- anchorbrowser/types/sessions/mouse_double_click_params.py +18 -0
- anchorbrowser/types/sessions/mouse_double_click_response.py +11 -0
- anchorbrowser/types/sessions/mouse_down_params.py +18 -0
- anchorbrowser/types/sessions/mouse_down_response.py +11 -0
- anchorbrowser/types/sessions/mouse_move_params.py +15 -0
- anchorbrowser/types/sessions/mouse_move_response.py +11 -0
- anchorbrowser/types/sessions/mouse_up_params.py +18 -0
- anchorbrowser/types/sessions/mouse_up_response.py +11 -0
- anchorbrowser/types/sessions/recording_list_response.py +46 -0
- anchorbrowser/types/sessions/recording_pause_response.py +12 -0
- anchorbrowser/types/sessions/recording_resume_response.py +12 -0
- anchorbrowser/types/sessions/recordings/__init__.py +3 -0
- anchorbrowser/types/shared/__init__.py +3 -0
- anchorbrowser/types/shared/success_response.py +15 -0
- anchorbrowser/types/tool_fetch_webpage_params.py +26 -0
- anchorbrowser/types/tool_fetch_webpage_response.py +7 -0
- anchorbrowser/types/tool_perform_web_task_params.py +30 -0
- anchorbrowser/types/tool_perform_web_task_response.py +16 -0
- anchorbrowser/types/tool_screenshot_webpage_params.py +48 -0
- anchorbrowser-0.1.0.dist-info/METADATA +449 -0
- anchorbrowser-0.1.0.dist-info/RECORD +100 -0
- anchorbrowser-0.1.0.dist-info/WHEEL +4 -0
- anchorbrowser-0.1.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
8
|
+
from ..._compat import cached_property
|
|
9
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
10
|
+
from ..._response import (
|
|
11
|
+
to_raw_response_wrapper,
|
|
12
|
+
to_streamed_response_wrapper,
|
|
13
|
+
async_to_raw_response_wrapper,
|
|
14
|
+
async_to_streamed_response_wrapper,
|
|
15
|
+
)
|
|
16
|
+
from ..._base_client import make_request_options
|
|
17
|
+
from ...types.shared.success_response import SuccessResponse
|
|
18
|
+
from ...types.sessions.all_status_response import AllStatusResponse
|
|
19
|
+
|
|
20
|
+
__all__ = ["AllResource", "AsyncAllResource"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class AllResource(SyncAPIResource):
|
|
24
|
+
@cached_property
|
|
25
|
+
def with_raw_response(self) -> AllResourceWithRawResponse:
|
|
26
|
+
"""
|
|
27
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
28
|
+
the raw response object instead of the parsed content.
|
|
29
|
+
|
|
30
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
31
|
+
"""
|
|
32
|
+
return AllResourceWithRawResponse(self)
|
|
33
|
+
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_streaming_response(self) -> AllResourceWithStreamingResponse:
|
|
36
|
+
"""
|
|
37
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
38
|
+
|
|
39
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
40
|
+
"""
|
|
41
|
+
return AllResourceWithStreamingResponse(self)
|
|
42
|
+
|
|
43
|
+
def delete(
|
|
44
|
+
self,
|
|
45
|
+
*,
|
|
46
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
47
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
48
|
+
extra_headers: Headers | None = None,
|
|
49
|
+
extra_query: Query | None = None,
|
|
50
|
+
extra_body: Body | None = None,
|
|
51
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
52
|
+
) -> SuccessResponse:
|
|
53
|
+
"""Terminates all active browser sessions associated with the provided API key."""
|
|
54
|
+
return self._delete(
|
|
55
|
+
"/v1/sessions/all",
|
|
56
|
+
options=make_request_options(
|
|
57
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
58
|
+
),
|
|
59
|
+
cast_to=SuccessResponse,
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def status(
|
|
63
|
+
self,
|
|
64
|
+
*,
|
|
65
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
66
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
67
|
+
extra_headers: Headers | None = None,
|
|
68
|
+
extra_query: Query | None = None,
|
|
69
|
+
extra_body: Body | None = None,
|
|
70
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
71
|
+
) -> AllStatusResponse:
|
|
72
|
+
"""
|
|
73
|
+
Retrieves status information for all browser sessions associated with the API
|
|
74
|
+
key.
|
|
75
|
+
"""
|
|
76
|
+
return self._get(
|
|
77
|
+
"/v1/sessions/all/status",
|
|
78
|
+
options=make_request_options(
|
|
79
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
80
|
+
),
|
|
81
|
+
cast_to=AllStatusResponse,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
class AsyncAllResource(AsyncAPIResource):
|
|
86
|
+
@cached_property
|
|
87
|
+
def with_raw_response(self) -> AsyncAllResourceWithRawResponse:
|
|
88
|
+
"""
|
|
89
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
90
|
+
the raw response object instead of the parsed content.
|
|
91
|
+
|
|
92
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
93
|
+
"""
|
|
94
|
+
return AsyncAllResourceWithRawResponse(self)
|
|
95
|
+
|
|
96
|
+
@cached_property
|
|
97
|
+
def with_streaming_response(self) -> AsyncAllResourceWithStreamingResponse:
|
|
98
|
+
"""
|
|
99
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
100
|
+
|
|
101
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
102
|
+
"""
|
|
103
|
+
return AsyncAllResourceWithStreamingResponse(self)
|
|
104
|
+
|
|
105
|
+
async def delete(
|
|
106
|
+
self,
|
|
107
|
+
*,
|
|
108
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
109
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
110
|
+
extra_headers: Headers | None = None,
|
|
111
|
+
extra_query: Query | None = None,
|
|
112
|
+
extra_body: Body | None = None,
|
|
113
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
114
|
+
) -> SuccessResponse:
|
|
115
|
+
"""Terminates all active browser sessions associated with the provided API key."""
|
|
116
|
+
return await self._delete(
|
|
117
|
+
"/v1/sessions/all",
|
|
118
|
+
options=make_request_options(
|
|
119
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
120
|
+
),
|
|
121
|
+
cast_to=SuccessResponse,
|
|
122
|
+
)
|
|
123
|
+
|
|
124
|
+
async def status(
|
|
125
|
+
self,
|
|
126
|
+
*,
|
|
127
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
128
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
129
|
+
extra_headers: Headers | None = None,
|
|
130
|
+
extra_query: Query | None = None,
|
|
131
|
+
extra_body: Body | None = None,
|
|
132
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
133
|
+
) -> AllStatusResponse:
|
|
134
|
+
"""
|
|
135
|
+
Retrieves status information for all browser sessions associated with the API
|
|
136
|
+
key.
|
|
137
|
+
"""
|
|
138
|
+
return await self._get(
|
|
139
|
+
"/v1/sessions/all/status",
|
|
140
|
+
options=make_request_options(
|
|
141
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
142
|
+
),
|
|
143
|
+
cast_to=AllStatusResponse,
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
class AllResourceWithRawResponse:
|
|
148
|
+
def __init__(self, all: AllResource) -> None:
|
|
149
|
+
self._all = all
|
|
150
|
+
|
|
151
|
+
self.delete = to_raw_response_wrapper(
|
|
152
|
+
all.delete,
|
|
153
|
+
)
|
|
154
|
+
self.status = to_raw_response_wrapper(
|
|
155
|
+
all.status,
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class AsyncAllResourceWithRawResponse:
|
|
160
|
+
def __init__(self, all: AsyncAllResource) -> None:
|
|
161
|
+
self._all = all
|
|
162
|
+
|
|
163
|
+
self.delete = async_to_raw_response_wrapper(
|
|
164
|
+
all.delete,
|
|
165
|
+
)
|
|
166
|
+
self.status = async_to_raw_response_wrapper(
|
|
167
|
+
all.status,
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class AllResourceWithStreamingResponse:
|
|
172
|
+
def __init__(self, all: AllResource) -> None:
|
|
173
|
+
self._all = all
|
|
174
|
+
|
|
175
|
+
self.delete = to_streamed_response_wrapper(
|
|
176
|
+
all.delete,
|
|
177
|
+
)
|
|
178
|
+
self.status = to_streamed_response_wrapper(
|
|
179
|
+
all.status,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
class AsyncAllResourceWithStreamingResponse:
|
|
184
|
+
def __init__(self, all: AsyncAllResource) -> None:
|
|
185
|
+
self._all = all
|
|
186
|
+
|
|
187
|
+
self.delete = async_to_streamed_response_wrapper(
|
|
188
|
+
all.delete,
|
|
189
|
+
)
|
|
190
|
+
self.status = async_to_streamed_response_wrapper(
|
|
191
|
+
all.status,
|
|
192
|
+
)
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven
|
|
8
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
9
|
+
from ..._compat import cached_property
|
|
10
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
11
|
+
from ..._response import (
|
|
12
|
+
to_raw_response_wrapper,
|
|
13
|
+
to_streamed_response_wrapper,
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
)
|
|
17
|
+
from ..._base_client import make_request_options
|
|
18
|
+
from ...types.sessions import clipboard_set_params
|
|
19
|
+
from ...types.sessions.clipboard_get_response import ClipboardGetResponse
|
|
20
|
+
from ...types.sessions.clipboard_set_response import ClipboardSetResponse
|
|
21
|
+
|
|
22
|
+
__all__ = ["ClipboardResource", "AsyncClipboardResource"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ClipboardResource(SyncAPIResource):
|
|
26
|
+
@cached_property
|
|
27
|
+
def with_raw_response(self) -> ClipboardResourceWithRawResponse:
|
|
28
|
+
"""
|
|
29
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
30
|
+
the raw response object instead of the parsed content.
|
|
31
|
+
|
|
32
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
33
|
+
"""
|
|
34
|
+
return ClipboardResourceWithRawResponse(self)
|
|
35
|
+
|
|
36
|
+
@cached_property
|
|
37
|
+
def with_streaming_response(self) -> ClipboardResourceWithStreamingResponse:
|
|
38
|
+
"""
|
|
39
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
40
|
+
|
|
41
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
42
|
+
"""
|
|
43
|
+
return ClipboardResourceWithStreamingResponse(self)
|
|
44
|
+
|
|
45
|
+
def get(
|
|
46
|
+
self,
|
|
47
|
+
session_id: str,
|
|
48
|
+
*,
|
|
49
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
50
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
51
|
+
extra_headers: Headers | None = None,
|
|
52
|
+
extra_query: Query | None = None,
|
|
53
|
+
extra_body: Body | None = None,
|
|
54
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
55
|
+
) -> ClipboardGetResponse:
|
|
56
|
+
"""
|
|
57
|
+
Retrieves the current content of the clipboard
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
extra_headers: Send extra headers
|
|
61
|
+
|
|
62
|
+
extra_query: Add additional query parameters to the request
|
|
63
|
+
|
|
64
|
+
extra_body: Add additional JSON properties to the request
|
|
65
|
+
|
|
66
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
67
|
+
"""
|
|
68
|
+
if not session_id:
|
|
69
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
70
|
+
return self._get(
|
|
71
|
+
f"/v1/sessions/{session_id}/clipboard",
|
|
72
|
+
options=make_request_options(
|
|
73
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
74
|
+
),
|
|
75
|
+
cast_to=ClipboardGetResponse,
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
def set(
|
|
79
|
+
self,
|
|
80
|
+
session_id: str,
|
|
81
|
+
*,
|
|
82
|
+
text: str,
|
|
83
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
84
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
85
|
+
extra_headers: Headers | None = None,
|
|
86
|
+
extra_query: Query | None = None,
|
|
87
|
+
extra_body: Body | None = None,
|
|
88
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
89
|
+
) -> ClipboardSetResponse:
|
|
90
|
+
"""
|
|
91
|
+
Sets the content of the clipboard
|
|
92
|
+
|
|
93
|
+
Args:
|
|
94
|
+
text: Text to set in the clipboard
|
|
95
|
+
|
|
96
|
+
extra_headers: Send extra headers
|
|
97
|
+
|
|
98
|
+
extra_query: Add additional query parameters to the request
|
|
99
|
+
|
|
100
|
+
extra_body: Add additional JSON properties to the request
|
|
101
|
+
|
|
102
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
103
|
+
"""
|
|
104
|
+
if not session_id:
|
|
105
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
106
|
+
return self._post(
|
|
107
|
+
f"/v1/sessions/{session_id}/clipboard",
|
|
108
|
+
body=maybe_transform({"text": text}, clipboard_set_params.ClipboardSetParams),
|
|
109
|
+
options=make_request_options(
|
|
110
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
111
|
+
),
|
|
112
|
+
cast_to=ClipboardSetResponse,
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class AsyncClipboardResource(AsyncAPIResource):
|
|
117
|
+
@cached_property
|
|
118
|
+
def with_raw_response(self) -> AsyncClipboardResourceWithRawResponse:
|
|
119
|
+
"""
|
|
120
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
121
|
+
the raw response object instead of the parsed content.
|
|
122
|
+
|
|
123
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
124
|
+
"""
|
|
125
|
+
return AsyncClipboardResourceWithRawResponse(self)
|
|
126
|
+
|
|
127
|
+
@cached_property
|
|
128
|
+
def with_streaming_response(self) -> AsyncClipboardResourceWithStreamingResponse:
|
|
129
|
+
"""
|
|
130
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
131
|
+
|
|
132
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
133
|
+
"""
|
|
134
|
+
return AsyncClipboardResourceWithStreamingResponse(self)
|
|
135
|
+
|
|
136
|
+
async def get(
|
|
137
|
+
self,
|
|
138
|
+
session_id: str,
|
|
139
|
+
*,
|
|
140
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
141
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
142
|
+
extra_headers: Headers | None = None,
|
|
143
|
+
extra_query: Query | None = None,
|
|
144
|
+
extra_body: Body | None = None,
|
|
145
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
146
|
+
) -> ClipboardGetResponse:
|
|
147
|
+
"""
|
|
148
|
+
Retrieves the current content of the clipboard
|
|
149
|
+
|
|
150
|
+
Args:
|
|
151
|
+
extra_headers: Send extra headers
|
|
152
|
+
|
|
153
|
+
extra_query: Add additional query parameters to the request
|
|
154
|
+
|
|
155
|
+
extra_body: Add additional JSON properties to the request
|
|
156
|
+
|
|
157
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
158
|
+
"""
|
|
159
|
+
if not session_id:
|
|
160
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
161
|
+
return await self._get(
|
|
162
|
+
f"/v1/sessions/{session_id}/clipboard",
|
|
163
|
+
options=make_request_options(
|
|
164
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
165
|
+
),
|
|
166
|
+
cast_to=ClipboardGetResponse,
|
|
167
|
+
)
|
|
168
|
+
|
|
169
|
+
async def set(
|
|
170
|
+
self,
|
|
171
|
+
session_id: str,
|
|
172
|
+
*,
|
|
173
|
+
text: str,
|
|
174
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
175
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
176
|
+
extra_headers: Headers | None = None,
|
|
177
|
+
extra_query: Query | None = None,
|
|
178
|
+
extra_body: Body | None = None,
|
|
179
|
+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
|
|
180
|
+
) -> ClipboardSetResponse:
|
|
181
|
+
"""
|
|
182
|
+
Sets the content of the clipboard
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
text: Text to set in the clipboard
|
|
186
|
+
|
|
187
|
+
extra_headers: Send extra headers
|
|
188
|
+
|
|
189
|
+
extra_query: Add additional query parameters to the request
|
|
190
|
+
|
|
191
|
+
extra_body: Add additional JSON properties to the request
|
|
192
|
+
|
|
193
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
194
|
+
"""
|
|
195
|
+
if not session_id:
|
|
196
|
+
raise ValueError(f"Expected a non-empty value for `session_id` but received {session_id!r}")
|
|
197
|
+
return await self._post(
|
|
198
|
+
f"/v1/sessions/{session_id}/clipboard",
|
|
199
|
+
body=await async_maybe_transform({"text": text}, clipboard_set_params.ClipboardSetParams),
|
|
200
|
+
options=make_request_options(
|
|
201
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
202
|
+
),
|
|
203
|
+
cast_to=ClipboardSetResponse,
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
class ClipboardResourceWithRawResponse:
|
|
208
|
+
def __init__(self, clipboard: ClipboardResource) -> None:
|
|
209
|
+
self._clipboard = clipboard
|
|
210
|
+
|
|
211
|
+
self.get = to_raw_response_wrapper(
|
|
212
|
+
clipboard.get,
|
|
213
|
+
)
|
|
214
|
+
self.set = to_raw_response_wrapper(
|
|
215
|
+
clipboard.set,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class AsyncClipboardResourceWithRawResponse:
|
|
220
|
+
def __init__(self, clipboard: AsyncClipboardResource) -> None:
|
|
221
|
+
self._clipboard = clipboard
|
|
222
|
+
|
|
223
|
+
self.get = async_to_raw_response_wrapper(
|
|
224
|
+
clipboard.get,
|
|
225
|
+
)
|
|
226
|
+
self.set = async_to_raw_response_wrapper(
|
|
227
|
+
clipboard.set,
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
class ClipboardResourceWithStreamingResponse:
|
|
232
|
+
def __init__(self, clipboard: ClipboardResource) -> None:
|
|
233
|
+
self._clipboard = clipboard
|
|
234
|
+
|
|
235
|
+
self.get = to_streamed_response_wrapper(
|
|
236
|
+
clipboard.get,
|
|
237
|
+
)
|
|
238
|
+
self.set = to_streamed_response_wrapper(
|
|
239
|
+
clipboard.set,
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
class AsyncClipboardResourceWithStreamingResponse:
|
|
244
|
+
def __init__(self, clipboard: AsyncClipboardResource) -> None:
|
|
245
|
+
self._clipboard = clipboard
|
|
246
|
+
|
|
247
|
+
self.get = async_to_streamed_response_wrapper(
|
|
248
|
+
clipboard.get,
|
|
249
|
+
)
|
|
250
|
+
self.set = async_to_streamed_response_wrapper(
|
|
251
|
+
clipboard.set,
|
|
252
|
+
)
|