anchorbrowser 0.1.0a2__py3-none-any.whl → 0.1.1__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 +3 -1
- anchorbrowser/_base_client.py +16 -13
- anchorbrowser/_client.py +21 -9
- anchorbrowser/_compat.py +48 -48
- anchorbrowser/_files.py +4 -4
- anchorbrowser/_models.py +51 -45
- anchorbrowser/_qs.py +7 -7
- anchorbrowser/_types.py +53 -12
- anchorbrowser/_utils/__init__.py +9 -2
- anchorbrowser/_utils/_compat.py +45 -0
- anchorbrowser/_utils/_datetime_parse.py +136 -0
- anchorbrowser/_utils/_transform.py +13 -3
- anchorbrowser/_utils/_typing.py +6 -1
- anchorbrowser/_utils/_utils.py +4 -5
- anchorbrowser/_version.py +1 -1
- anchorbrowser/lib/browser.py +1 -1
- anchorbrowser/resources/__init__.py +14 -0
- anchorbrowser/resources/events.py +270 -0
- anchorbrowser/resources/extensions.py +9 -9
- anchorbrowser/resources/profiles.py +31 -43
- anchorbrowser/resources/sessions/all.py +5 -5
- anchorbrowser/resources/sessions/clipboard.py +5 -5
- anchorbrowser/resources/sessions/keyboard.py +11 -13
- anchorbrowser/resources/sessions/mouse.py +19 -19
- anchorbrowser/resources/sessions/recordings/primary.py +3 -3
- anchorbrowser/resources/sessions/recordings/recordings.py +7 -7
- anchorbrowser/resources/sessions/sessions.py +307 -30
- anchorbrowser/resources/tools.py +107 -37
- anchorbrowser/types/__init__.py +7 -0
- anchorbrowser/types/event_signal_params.py +13 -0
- anchorbrowser/types/event_wait_for_params.py +14 -0
- anchorbrowser/types/event_wait_for_response.py +12 -0
- anchorbrowser/types/extension_manifest.py +6 -1
- anchorbrowser/types/profile_create_params.py +3 -6
- anchorbrowser/types/profile_list_response.py +0 -3
- anchorbrowser/types/profile_retrieve_response.py +0 -3
- anchorbrowser/types/profile_update_params.py +0 -6
- anchorbrowser/types/session_create_params.py +262 -26
- anchorbrowser/types/session_list_pages_response.py +25 -0
- anchorbrowser/types/session_retrieve_response.py +46 -0
- anchorbrowser/types/session_scroll_params.py +3 -0
- anchorbrowser/types/session_upload_file_params.py +14 -0
- anchorbrowser/types/session_upload_file_response.py +17 -0
- anchorbrowser/types/sessions/keyboard_shortcut_params.py +2 -2
- anchorbrowser/types/sessions/recording_list_response.py +4 -8
- anchorbrowser/types/tool_fetch_webpage_params.py +15 -0
- anchorbrowser/types/tool_perform_web_task_params.py +17 -1
- anchorbrowser/types/tool_perform_web_task_response.py +3 -3
- {anchorbrowser-0.1.0a2.dist-info → anchorbrowser-0.1.1.dist-info}/METADATA +8 -9
- {anchorbrowser-0.1.0a2.dist-info → anchorbrowser-0.1.1.dist-info}/RECORD +52 -42
- {anchorbrowser-0.1.0a2.dist-info → anchorbrowser-0.1.1.dist-info}/WHEEL +0 -0
- {anchorbrowser-0.1.0a2.dist-info → anchorbrowser-0.1.1.dist-info}/licenses/LICENSE +0 -0
|
@@ -16,18 +16,20 @@ from ._utils import (
|
|
|
16
16
|
lru_cache,
|
|
17
17
|
is_mapping,
|
|
18
18
|
is_iterable,
|
|
19
|
+
is_sequence,
|
|
19
20
|
)
|
|
20
21
|
from .._files import is_base64_file_input
|
|
22
|
+
from ._compat import get_origin, is_typeddict
|
|
21
23
|
from ._typing import (
|
|
22
24
|
is_list_type,
|
|
23
25
|
is_union_type,
|
|
24
26
|
extract_type_arg,
|
|
25
27
|
is_iterable_type,
|
|
26
28
|
is_required_type,
|
|
29
|
+
is_sequence_type,
|
|
27
30
|
is_annotated_type,
|
|
28
31
|
strip_annotated_type,
|
|
29
32
|
)
|
|
30
|
-
from .._compat import get_origin, model_dump, is_typeddict
|
|
31
33
|
|
|
32
34
|
_T = TypeVar("_T")
|
|
33
35
|
|
|
@@ -167,6 +169,8 @@ def _transform_recursive(
|
|
|
167
169
|
|
|
168
170
|
Defaults to the same value as the `annotation` argument.
|
|
169
171
|
"""
|
|
172
|
+
from .._compat import model_dump
|
|
173
|
+
|
|
170
174
|
if inner_type is None:
|
|
171
175
|
inner_type = annotation
|
|
172
176
|
|
|
@@ -184,6 +188,8 @@ def _transform_recursive(
|
|
|
184
188
|
(is_list_type(stripped_type) and is_list(data))
|
|
185
189
|
# Iterable[T]
|
|
186
190
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
191
|
+
# Sequence[T]
|
|
192
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
187
193
|
):
|
|
188
194
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
189
195
|
# intended as an iterable, so we don't transform it.
|
|
@@ -262,7 +268,7 @@ def _transform_typeddict(
|
|
|
262
268
|
annotations = get_type_hints(expected_type, include_extras=True)
|
|
263
269
|
for key, value in data.items():
|
|
264
270
|
if not is_given(value):
|
|
265
|
-
# we don't need to include
|
|
271
|
+
# we don't need to include omitted values here as they'll
|
|
266
272
|
# be stripped out before the request is sent anyway
|
|
267
273
|
continue
|
|
268
274
|
|
|
@@ -329,6 +335,8 @@ async def _async_transform_recursive(
|
|
|
329
335
|
|
|
330
336
|
Defaults to the same value as the `annotation` argument.
|
|
331
337
|
"""
|
|
338
|
+
from .._compat import model_dump
|
|
339
|
+
|
|
332
340
|
if inner_type is None:
|
|
333
341
|
inner_type = annotation
|
|
334
342
|
|
|
@@ -346,6 +354,8 @@ async def _async_transform_recursive(
|
|
|
346
354
|
(is_list_type(stripped_type) and is_list(data))
|
|
347
355
|
# Iterable[T]
|
|
348
356
|
or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str))
|
|
357
|
+
# Sequence[T]
|
|
358
|
+
or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str))
|
|
349
359
|
):
|
|
350
360
|
# dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually
|
|
351
361
|
# intended as an iterable, so we don't transform it.
|
|
@@ -424,7 +434,7 @@ async def _async_transform_typeddict(
|
|
|
424
434
|
annotations = get_type_hints(expected_type, include_extras=True)
|
|
425
435
|
for key, value in data.items():
|
|
426
436
|
if not is_given(value):
|
|
427
|
-
# we don't need to include
|
|
437
|
+
# we don't need to include omitted values here as they'll
|
|
428
438
|
# be stripped out before the request is sent anyway
|
|
429
439
|
continue
|
|
430
440
|
|
anchorbrowser/_utils/_typing.py
CHANGED
|
@@ -15,7 +15,7 @@ from typing_extensions import (
|
|
|
15
15
|
|
|
16
16
|
from ._utils import lru_cache
|
|
17
17
|
from .._types import InheritsGeneric
|
|
18
|
-
from
|
|
18
|
+
from ._compat import is_union as _is_union
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
def is_annotated_type(typ: type) -> bool:
|
|
@@ -26,6 +26,11 @@ def is_list_type(typ: type) -> bool:
|
|
|
26
26
|
return (get_origin(typ) or typ) == list
|
|
27
27
|
|
|
28
28
|
|
|
29
|
+
def is_sequence_type(typ: type) -> bool:
|
|
30
|
+
origin = get_origin(typ) or typ
|
|
31
|
+
return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence
|
|
32
|
+
|
|
33
|
+
|
|
29
34
|
def is_iterable_type(typ: type) -> bool:
|
|
30
35
|
"""If the given type is `typing.Iterable[T]`"""
|
|
31
36
|
origin = get_origin(typ) or typ
|
anchorbrowser/_utils/_utils.py
CHANGED
|
@@ -21,8 +21,7 @@ from typing_extensions import TypeGuard
|
|
|
21
21
|
|
|
22
22
|
import sniffio
|
|
23
23
|
|
|
24
|
-
from .._types import NotGiven, FileTypes,
|
|
25
|
-
from .._compat import parse_date as parse_date, parse_datetime as parse_datetime
|
|
24
|
+
from .._types import Omit, NotGiven, FileTypes, HeadersLike
|
|
26
25
|
|
|
27
26
|
_T = TypeVar("_T")
|
|
28
27
|
_TupleT = TypeVar("_TupleT", bound=Tuple[object, ...])
|
|
@@ -64,7 +63,7 @@ def _extract_items(
|
|
|
64
63
|
try:
|
|
65
64
|
key = path[index]
|
|
66
65
|
except IndexError:
|
|
67
|
-
if
|
|
66
|
+
if not is_given(obj):
|
|
68
67
|
# no value was provided - we can safely ignore
|
|
69
68
|
return []
|
|
70
69
|
|
|
@@ -127,8 +126,8 @@ def _extract_items(
|
|
|
127
126
|
return []
|
|
128
127
|
|
|
129
128
|
|
|
130
|
-
def is_given(obj:
|
|
131
|
-
return not isinstance(obj, NotGiven)
|
|
129
|
+
def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
|
|
130
|
+
return not isinstance(obj, NotGiven) and not isinstance(obj, Omit)
|
|
132
131
|
|
|
133
132
|
|
|
134
133
|
# Type safe methods for narrowing types with TypeVars.
|
anchorbrowser/_version.py
CHANGED
anchorbrowser/lib/browser.py
CHANGED
|
@@ -53,7 +53,7 @@ def get_cdp_url(api_base_url: str, session_id: str, api_key: str) -> str:
|
|
|
53
53
|
|
|
54
54
|
|
|
55
55
|
def get_agent_ws_url(api_base_url: str, session_id: str) -> str:
|
|
56
|
-
return f"{api_base_url.replace('https://', 'wss://')
|
|
56
|
+
return f"{api_base_url.replace('https://', 'wss://')}/ws?sessionId={session_id}"
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def get_ai_service_worker(browser_context: "BrowserContext") -> Optional["Worker"]:
|
|
@@ -8,6 +8,14 @@ from .tools import (
|
|
|
8
8
|
ToolsResourceWithStreamingResponse,
|
|
9
9
|
AsyncToolsResourceWithStreamingResponse,
|
|
10
10
|
)
|
|
11
|
+
from .events import (
|
|
12
|
+
EventsResource,
|
|
13
|
+
AsyncEventsResource,
|
|
14
|
+
EventsResourceWithRawResponse,
|
|
15
|
+
AsyncEventsResourceWithRawResponse,
|
|
16
|
+
EventsResourceWithStreamingResponse,
|
|
17
|
+
AsyncEventsResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
11
19
|
from .profiles import (
|
|
12
20
|
ProfilesResource,
|
|
13
21
|
AsyncProfilesResource,
|
|
@@ -58,4 +66,10 @@ __all__ = [
|
|
|
58
66
|
"AsyncExtensionsResourceWithRawResponse",
|
|
59
67
|
"ExtensionsResourceWithStreamingResponse",
|
|
60
68
|
"AsyncExtensionsResourceWithStreamingResponse",
|
|
69
|
+
"EventsResource",
|
|
70
|
+
"AsyncEventsResource",
|
|
71
|
+
"EventsResourceWithRawResponse",
|
|
72
|
+
"AsyncEventsResourceWithRawResponse",
|
|
73
|
+
"EventsResourceWithStreamingResponse",
|
|
74
|
+
"AsyncEventsResourceWithStreamingResponse",
|
|
61
75
|
]
|
|
@@ -0,0 +1,270 @@
|
|
|
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 Dict
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import event_signal_params, event_wait_for_params
|
|
10
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
11
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
12
|
+
from .._compat import cached_property
|
|
13
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
14
|
+
from .._response import (
|
|
15
|
+
to_raw_response_wrapper,
|
|
16
|
+
to_streamed_response_wrapper,
|
|
17
|
+
async_to_raw_response_wrapper,
|
|
18
|
+
async_to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
20
|
+
from .._base_client import make_request_options
|
|
21
|
+
from ..types.event_wait_for_response import EventWaitForResponse
|
|
22
|
+
from ..types.shared.success_response import SuccessResponse
|
|
23
|
+
|
|
24
|
+
__all__ = ["EventsResource", "AsyncEventsResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class EventsResource(SyncAPIResource):
|
|
28
|
+
@cached_property
|
|
29
|
+
def with_raw_response(self) -> EventsResourceWithRawResponse:
|
|
30
|
+
"""
|
|
31
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
32
|
+
the raw response object instead of the parsed content.
|
|
33
|
+
|
|
34
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
35
|
+
"""
|
|
36
|
+
return EventsResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> EventsResourceWithStreamingResponse:
|
|
40
|
+
"""
|
|
41
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
42
|
+
|
|
43
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
44
|
+
"""
|
|
45
|
+
return EventsResourceWithStreamingResponse(self)
|
|
46
|
+
|
|
47
|
+
def signal(
|
|
48
|
+
self,
|
|
49
|
+
event_name: str,
|
|
50
|
+
*,
|
|
51
|
+
data: Dict[str, object],
|
|
52
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
53
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
54
|
+
extra_headers: Headers | None = None,
|
|
55
|
+
extra_query: Query | None = None,
|
|
56
|
+
extra_body: Body | None = None,
|
|
57
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
58
|
+
) -> SuccessResponse:
|
|
59
|
+
"""
|
|
60
|
+
Signals an event with associated data, unblocking any clients waiting for this
|
|
61
|
+
event. This enables coordination between different browser sessions, workflows,
|
|
62
|
+
or external processes.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
data: Event data to be passed to waiting clients
|
|
66
|
+
|
|
67
|
+
extra_headers: Send extra headers
|
|
68
|
+
|
|
69
|
+
extra_query: Add additional query parameters to the request
|
|
70
|
+
|
|
71
|
+
extra_body: Add additional JSON properties to the request
|
|
72
|
+
|
|
73
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
74
|
+
"""
|
|
75
|
+
if not event_name:
|
|
76
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
77
|
+
return self._post(
|
|
78
|
+
f"/v1/events/{event_name}",
|
|
79
|
+
body=maybe_transform({"data": data}, event_signal_params.EventSignalParams),
|
|
80
|
+
options=make_request_options(
|
|
81
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
82
|
+
),
|
|
83
|
+
cast_to=SuccessResponse,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
def wait_for(
|
|
87
|
+
self,
|
|
88
|
+
event_name: str,
|
|
89
|
+
*,
|
|
90
|
+
timeout_ms: int | Omit = omit,
|
|
91
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
92
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
93
|
+
extra_headers: Headers | None = None,
|
|
94
|
+
extra_query: Query | None = None,
|
|
95
|
+
extra_body: Body | None = None,
|
|
96
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
97
|
+
) -> EventWaitForResponse:
|
|
98
|
+
"""
|
|
99
|
+
Waits for a specific event to be signaled by another process, workflow, or
|
|
100
|
+
session. This endpoint blocks until the event is signaled or the timeout is
|
|
101
|
+
reached. Useful for coordinating between multiple browser sessions or workflows.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
timeout_ms: Timeout in milliseconds to wait for the event. Defaults to 60000ms (1 minute).
|
|
105
|
+
|
|
106
|
+
extra_headers: Send extra headers
|
|
107
|
+
|
|
108
|
+
extra_query: Add additional query parameters to the request
|
|
109
|
+
|
|
110
|
+
extra_body: Add additional JSON properties to the request
|
|
111
|
+
|
|
112
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
113
|
+
"""
|
|
114
|
+
if not event_name:
|
|
115
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
116
|
+
return self._post(
|
|
117
|
+
f"/v1/events/{event_name}/wait",
|
|
118
|
+
body=maybe_transform({"timeout_ms": timeout_ms}, event_wait_for_params.EventWaitForParams),
|
|
119
|
+
options=make_request_options(
|
|
120
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
121
|
+
),
|
|
122
|
+
cast_to=EventWaitForResponse,
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
class AsyncEventsResource(AsyncAPIResource):
|
|
127
|
+
@cached_property
|
|
128
|
+
def with_raw_response(self) -> AsyncEventsResourceWithRawResponse:
|
|
129
|
+
"""
|
|
130
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
131
|
+
the raw response object instead of the parsed content.
|
|
132
|
+
|
|
133
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
134
|
+
"""
|
|
135
|
+
return AsyncEventsResourceWithRawResponse(self)
|
|
136
|
+
|
|
137
|
+
@cached_property
|
|
138
|
+
def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse:
|
|
139
|
+
"""
|
|
140
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
141
|
+
|
|
142
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
143
|
+
"""
|
|
144
|
+
return AsyncEventsResourceWithStreamingResponse(self)
|
|
145
|
+
|
|
146
|
+
async def signal(
|
|
147
|
+
self,
|
|
148
|
+
event_name: str,
|
|
149
|
+
*,
|
|
150
|
+
data: Dict[str, object],
|
|
151
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
152
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
153
|
+
extra_headers: Headers | None = None,
|
|
154
|
+
extra_query: Query | None = None,
|
|
155
|
+
extra_body: Body | None = None,
|
|
156
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
157
|
+
) -> SuccessResponse:
|
|
158
|
+
"""
|
|
159
|
+
Signals an event with associated data, unblocking any clients waiting for this
|
|
160
|
+
event. This enables coordination between different browser sessions, workflows,
|
|
161
|
+
or external processes.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
data: Event data to be passed to waiting clients
|
|
165
|
+
|
|
166
|
+
extra_headers: Send extra headers
|
|
167
|
+
|
|
168
|
+
extra_query: Add additional query parameters to the request
|
|
169
|
+
|
|
170
|
+
extra_body: Add additional JSON properties to the request
|
|
171
|
+
|
|
172
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
173
|
+
"""
|
|
174
|
+
if not event_name:
|
|
175
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
176
|
+
return await self._post(
|
|
177
|
+
f"/v1/events/{event_name}",
|
|
178
|
+
body=await async_maybe_transform({"data": data}, event_signal_params.EventSignalParams),
|
|
179
|
+
options=make_request_options(
|
|
180
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
181
|
+
),
|
|
182
|
+
cast_to=SuccessResponse,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
async def wait_for(
|
|
186
|
+
self,
|
|
187
|
+
event_name: str,
|
|
188
|
+
*,
|
|
189
|
+
timeout_ms: int | Omit = omit,
|
|
190
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
191
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
192
|
+
extra_headers: Headers | None = None,
|
|
193
|
+
extra_query: Query | None = None,
|
|
194
|
+
extra_body: Body | None = None,
|
|
195
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
196
|
+
) -> EventWaitForResponse:
|
|
197
|
+
"""
|
|
198
|
+
Waits for a specific event to be signaled by another process, workflow, or
|
|
199
|
+
session. This endpoint blocks until the event is signaled or the timeout is
|
|
200
|
+
reached. Useful for coordinating between multiple browser sessions or workflows.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
timeout_ms: Timeout in milliseconds to wait for the event. Defaults to 60000ms (1 minute).
|
|
204
|
+
|
|
205
|
+
extra_headers: Send extra headers
|
|
206
|
+
|
|
207
|
+
extra_query: Add additional query parameters to the request
|
|
208
|
+
|
|
209
|
+
extra_body: Add additional JSON properties to the request
|
|
210
|
+
|
|
211
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
212
|
+
"""
|
|
213
|
+
if not event_name:
|
|
214
|
+
raise ValueError(f"Expected a non-empty value for `event_name` but received {event_name!r}")
|
|
215
|
+
return await self._post(
|
|
216
|
+
f"/v1/events/{event_name}/wait",
|
|
217
|
+
body=await async_maybe_transform({"timeout_ms": timeout_ms}, event_wait_for_params.EventWaitForParams),
|
|
218
|
+
options=make_request_options(
|
|
219
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
220
|
+
),
|
|
221
|
+
cast_to=EventWaitForResponse,
|
|
222
|
+
)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class EventsResourceWithRawResponse:
|
|
226
|
+
def __init__(self, events: EventsResource) -> None:
|
|
227
|
+
self._events = events
|
|
228
|
+
|
|
229
|
+
self.signal = to_raw_response_wrapper(
|
|
230
|
+
events.signal,
|
|
231
|
+
)
|
|
232
|
+
self.wait_for = to_raw_response_wrapper(
|
|
233
|
+
events.wait_for,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
class AsyncEventsResourceWithRawResponse:
|
|
238
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
239
|
+
self._events = events
|
|
240
|
+
|
|
241
|
+
self.signal = async_to_raw_response_wrapper(
|
|
242
|
+
events.signal,
|
|
243
|
+
)
|
|
244
|
+
self.wait_for = async_to_raw_response_wrapper(
|
|
245
|
+
events.wait_for,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
class EventsResourceWithStreamingResponse:
|
|
250
|
+
def __init__(self, events: EventsResource) -> None:
|
|
251
|
+
self._events = events
|
|
252
|
+
|
|
253
|
+
self.signal = to_streamed_response_wrapper(
|
|
254
|
+
events.signal,
|
|
255
|
+
)
|
|
256
|
+
self.wait_for = to_streamed_response_wrapper(
|
|
257
|
+
events.wait_for,
|
|
258
|
+
)
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
class AsyncEventsResourceWithStreamingResponse:
|
|
262
|
+
def __init__(self, events: AsyncEventsResource) -> None:
|
|
263
|
+
self._events = events
|
|
264
|
+
|
|
265
|
+
self.signal = async_to_streamed_response_wrapper(
|
|
266
|
+
events.signal,
|
|
267
|
+
)
|
|
268
|
+
self.wait_for = async_to_streamed_response_wrapper(
|
|
269
|
+
events.wait_for,
|
|
270
|
+
)
|
|
@@ -7,7 +7,7 @@ from typing import Mapping, cast
|
|
|
7
7
|
import httpx
|
|
8
8
|
|
|
9
9
|
from ..types import extension_upload_params
|
|
10
|
-
from .._types import
|
|
10
|
+
from .._types import Body, Query, Headers, NotGiven, FileTypes, not_given
|
|
11
11
|
from .._utils import extract_files, maybe_transform, deepcopy_minimal, async_maybe_transform
|
|
12
12
|
from .._compat import cached_property
|
|
13
13
|
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
@@ -55,7 +55,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
55
55
|
extra_headers: Headers | None = None,
|
|
56
56
|
extra_query: Query | None = None,
|
|
57
57
|
extra_body: Body | None = None,
|
|
58
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
58
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
59
59
|
) -> ExtensionRetrieveResponse:
|
|
60
60
|
"""
|
|
61
61
|
Get details of a specific extension by its ID
|
|
@@ -87,7 +87,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
87
87
|
extra_headers: Headers | None = None,
|
|
88
88
|
extra_query: Query | None = None,
|
|
89
89
|
extra_body: Body | None = None,
|
|
90
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
90
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
91
91
|
) -> ExtensionListResponse:
|
|
92
92
|
"""Get all extensions for the authenticated user"""
|
|
93
93
|
return self._get(
|
|
@@ -107,7 +107,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
107
107
|
extra_headers: Headers | None = None,
|
|
108
108
|
extra_query: Query | None = None,
|
|
109
109
|
extra_body: Body | None = None,
|
|
110
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
110
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
111
111
|
) -> ExtensionDeleteResponse:
|
|
112
112
|
"""
|
|
113
113
|
Delete an extension and remove it from storage
|
|
@@ -141,7 +141,7 @@ class ExtensionsResource(SyncAPIResource):
|
|
|
141
141
|
extra_headers: Headers | None = None,
|
|
142
142
|
extra_query: Query | None = None,
|
|
143
143
|
extra_body: Body | None = None,
|
|
144
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
144
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
145
145
|
) -> ExtensionUploadResponse:
|
|
146
146
|
"""Upload a new browser extension as a ZIP file.
|
|
147
147
|
|
|
@@ -212,7 +212,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
212
212
|
extra_headers: Headers | None = None,
|
|
213
213
|
extra_query: Query | None = None,
|
|
214
214
|
extra_body: Body | None = None,
|
|
215
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
215
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
216
216
|
) -> ExtensionRetrieveResponse:
|
|
217
217
|
"""
|
|
218
218
|
Get details of a specific extension by its ID
|
|
@@ -244,7 +244,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
244
244
|
extra_headers: Headers | None = None,
|
|
245
245
|
extra_query: Query | None = None,
|
|
246
246
|
extra_body: Body | None = None,
|
|
247
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
247
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
248
248
|
) -> ExtensionListResponse:
|
|
249
249
|
"""Get all extensions for the authenticated user"""
|
|
250
250
|
return await self._get(
|
|
@@ -264,7 +264,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
264
264
|
extra_headers: Headers | None = None,
|
|
265
265
|
extra_query: Query | None = None,
|
|
266
266
|
extra_body: Body | None = None,
|
|
267
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
267
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
268
268
|
) -> ExtensionDeleteResponse:
|
|
269
269
|
"""
|
|
270
270
|
Delete an extension and remove it from storage
|
|
@@ -298,7 +298,7 @@ class AsyncExtensionsResource(AsyncAPIResource):
|
|
|
298
298
|
extra_headers: Headers | None = None,
|
|
299
299
|
extra_query: Query | None = None,
|
|
300
300
|
extra_body: Body | None = None,
|
|
301
|
-
timeout: float | httpx.Timeout | None | NotGiven =
|
|
301
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
302
302
|
) -> ExtensionUploadResponse:
|
|
303
303
|
"""Upload a new browser extension as a ZIP file.
|
|
304
304
|
|