anchorbrowser 0.1.0a3__py3-none-any.whl → 0.2.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 +3 -1
- anchorbrowser/_base_client.py +16 -13
- anchorbrowser/_client.py +38 -9
- anchorbrowser/_compat.py +48 -48
- anchorbrowser/_files.py +4 -4
- anchorbrowser/_models.py +54 -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 +42 -0
- anchorbrowser/resources/batch_sessions.py +288 -0
- anchorbrowser/resources/events.py +270 -0
- anchorbrowser/resources/extensions.py +9 -9
- anchorbrowser/resources/profiles.py +24 -150
- anchorbrowser/resources/sessions/__init__.py +14 -0
- anchorbrowser/resources/sessions/agent/__init__.py +33 -0
- anchorbrowser/resources/sessions/agent/agent.py +273 -0
- anchorbrowser/resources/sessions/agent/files.py +280 -0
- 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 +12 -244
- anchorbrowser/resources/sessions/recordings/primary.py +3 -3
- anchorbrowser/resources/sessions/recordings/recordings.py +7 -7
- anchorbrowser/resources/sessions/sessions.py +345 -30
- anchorbrowser/resources/task/__init__.py +33 -0
- anchorbrowser/resources/task/run.py +225 -0
- anchorbrowser/resources/task/task.py +358 -0
- anchorbrowser/resources/tools.py +107 -37
- anchorbrowser/types/__init__.py +14 -1
- anchorbrowser/types/batch_session_create_params.py +487 -0
- anchorbrowser/types/batch_session_create_response.py +27 -0
- anchorbrowser/types/batch_session_retrieve_response.py +90 -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/session_create_params.py +308 -29
- 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/__init__.py +0 -4
- anchorbrowser/types/sessions/agent/__init__.py +7 -0
- anchorbrowser/types/sessions/agent/file_list_response.py +32 -0
- anchorbrowser/types/sessions/agent/file_upload_params.py +14 -0
- anchorbrowser/types/sessions/agent/file_upload_response.py +17 -0
- anchorbrowser/types/sessions/keyboard_shortcut_params.py +2 -2
- anchorbrowser/types/sessions/recording_list_response.py +4 -8
- anchorbrowser/types/task/__init__.py +6 -0
- anchorbrowser/types/task/run_execute_params.py +324 -0
- anchorbrowser/types/task/run_execute_response.py +33 -0
- anchorbrowser/types/task_create_params.py +317 -0
- anchorbrowser/types/task_create_response.py +345 -0
- anchorbrowser/types/task_list_params.py +15 -0
- anchorbrowser/types/task_list_response.py +361 -0
- 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.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/METADATA +13 -14
- anchorbrowser-0.2.0.dist-info/RECORD +126 -0
- anchorbrowser/types/profile_update_params.py +0 -27
- anchorbrowser/types/sessions/mouse_down_params.py +0 -18
- anchorbrowser/types/sessions/mouse_down_response.py +0 -11
- anchorbrowser/types/sessions/mouse_up_params.py +0 -18
- anchorbrowser/types/sessions/mouse_up_response.py +0 -11
- anchorbrowser-0.1.0a3.dist-info/RECORD +0 -100
- {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/WHEEL +0 -0
- {anchorbrowser-0.1.0a3.dist-info → anchorbrowser-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from .run import (
|
|
4
|
+
RunResource,
|
|
5
|
+
AsyncRunResource,
|
|
6
|
+
RunResourceWithRawResponse,
|
|
7
|
+
AsyncRunResourceWithRawResponse,
|
|
8
|
+
RunResourceWithStreamingResponse,
|
|
9
|
+
AsyncRunResourceWithStreamingResponse,
|
|
10
|
+
)
|
|
11
|
+
from .task import (
|
|
12
|
+
TaskResource,
|
|
13
|
+
AsyncTaskResource,
|
|
14
|
+
TaskResourceWithRawResponse,
|
|
15
|
+
AsyncTaskResourceWithRawResponse,
|
|
16
|
+
TaskResourceWithStreamingResponse,
|
|
17
|
+
AsyncTaskResourceWithStreamingResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = [
|
|
21
|
+
"RunResource",
|
|
22
|
+
"AsyncRunResource",
|
|
23
|
+
"RunResourceWithRawResponse",
|
|
24
|
+
"AsyncRunResourceWithRawResponse",
|
|
25
|
+
"RunResourceWithStreamingResponse",
|
|
26
|
+
"AsyncRunResourceWithStreamingResponse",
|
|
27
|
+
"TaskResource",
|
|
28
|
+
"AsyncTaskResource",
|
|
29
|
+
"TaskResourceWithRawResponse",
|
|
30
|
+
"AsyncTaskResourceWithRawResponse",
|
|
31
|
+
"TaskResourceWithStreamingResponse",
|
|
32
|
+
"AsyncTaskResourceWithStreamingResponse",
|
|
33
|
+
]
|
|
@@ -0,0 +1,225 @@
|
|
|
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 Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
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 ...types.task import run_execute_params
|
|
20
|
+
from ..._base_client import make_request_options
|
|
21
|
+
from ...types.task.run_execute_response import RunExecuteResponse
|
|
22
|
+
|
|
23
|
+
__all__ = ["RunResource", "AsyncRunResource"]
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class RunResource(SyncAPIResource):
|
|
27
|
+
@cached_property
|
|
28
|
+
def with_raw_response(self) -> RunResourceWithRawResponse:
|
|
29
|
+
"""
|
|
30
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
31
|
+
the raw response object instead of the parsed content.
|
|
32
|
+
|
|
33
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
34
|
+
"""
|
|
35
|
+
return RunResourceWithRawResponse(self)
|
|
36
|
+
|
|
37
|
+
@cached_property
|
|
38
|
+
def with_streaming_response(self) -> RunResourceWithStreamingResponse:
|
|
39
|
+
"""
|
|
40
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
41
|
+
|
|
42
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
43
|
+
"""
|
|
44
|
+
return RunResourceWithStreamingResponse(self)
|
|
45
|
+
|
|
46
|
+
def execute(
|
|
47
|
+
self,
|
|
48
|
+
*,
|
|
49
|
+
task_id: str,
|
|
50
|
+
inputs: Dict[str, str] | Omit = omit,
|
|
51
|
+
override_browser_configuration: run_execute_params.OverrideBrowserConfiguration | Omit = omit,
|
|
52
|
+
session_id: str | Omit = omit,
|
|
53
|
+
task_session_id: str | Omit = omit,
|
|
54
|
+
version: str | Omit = omit,
|
|
55
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
56
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
57
|
+
extra_headers: Headers | None = None,
|
|
58
|
+
extra_query: Query | None = None,
|
|
59
|
+
extra_body: Body | None = None,
|
|
60
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
61
|
+
) -> RunExecuteResponse:
|
|
62
|
+
"""Executes a task in a browser session.
|
|
63
|
+
|
|
64
|
+
The task can be run with a specific
|
|
65
|
+
version or the latest version. Optionally, you can provide an existing session
|
|
66
|
+
ID or let the system create a new one.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
task_id: Task identifier
|
|
70
|
+
|
|
71
|
+
inputs: Environment variables for task execution (keys must start with ANCHOR\\__)
|
|
72
|
+
|
|
73
|
+
override_browser_configuration: Override browser configuration for this execution
|
|
74
|
+
|
|
75
|
+
session_id: Optional existing session ID to use
|
|
76
|
+
|
|
77
|
+
task_session_id: Optional task-specific session ID
|
|
78
|
+
|
|
79
|
+
version: Version to run (draft, latest, or version number)
|
|
80
|
+
|
|
81
|
+
extra_headers: Send extra headers
|
|
82
|
+
|
|
83
|
+
extra_query: Add additional query parameters to the request
|
|
84
|
+
|
|
85
|
+
extra_body: Add additional JSON properties to the request
|
|
86
|
+
|
|
87
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
88
|
+
"""
|
|
89
|
+
return self._post(
|
|
90
|
+
"/v1/task/run",
|
|
91
|
+
body=maybe_transform(
|
|
92
|
+
{
|
|
93
|
+
"task_id": task_id,
|
|
94
|
+
"inputs": inputs,
|
|
95
|
+
"override_browser_configuration": override_browser_configuration,
|
|
96
|
+
"session_id": session_id,
|
|
97
|
+
"task_session_id": task_session_id,
|
|
98
|
+
"version": version,
|
|
99
|
+
},
|
|
100
|
+
run_execute_params.RunExecuteParams,
|
|
101
|
+
),
|
|
102
|
+
options=make_request_options(
|
|
103
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
104
|
+
),
|
|
105
|
+
cast_to=RunExecuteResponse,
|
|
106
|
+
)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
class AsyncRunResource(AsyncAPIResource):
|
|
110
|
+
@cached_property
|
|
111
|
+
def with_raw_response(self) -> AsyncRunResourceWithRawResponse:
|
|
112
|
+
"""
|
|
113
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
114
|
+
the raw response object instead of the parsed content.
|
|
115
|
+
|
|
116
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
117
|
+
"""
|
|
118
|
+
return AsyncRunResourceWithRawResponse(self)
|
|
119
|
+
|
|
120
|
+
@cached_property
|
|
121
|
+
def with_streaming_response(self) -> AsyncRunResourceWithStreamingResponse:
|
|
122
|
+
"""
|
|
123
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
124
|
+
|
|
125
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
126
|
+
"""
|
|
127
|
+
return AsyncRunResourceWithStreamingResponse(self)
|
|
128
|
+
|
|
129
|
+
async def execute(
|
|
130
|
+
self,
|
|
131
|
+
*,
|
|
132
|
+
task_id: str,
|
|
133
|
+
inputs: Dict[str, str] | Omit = omit,
|
|
134
|
+
override_browser_configuration: run_execute_params.OverrideBrowserConfiguration | Omit = omit,
|
|
135
|
+
session_id: str | Omit = omit,
|
|
136
|
+
task_session_id: str | Omit = omit,
|
|
137
|
+
version: str | Omit = omit,
|
|
138
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
139
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
140
|
+
extra_headers: Headers | None = None,
|
|
141
|
+
extra_query: Query | None = None,
|
|
142
|
+
extra_body: Body | None = None,
|
|
143
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
144
|
+
) -> RunExecuteResponse:
|
|
145
|
+
"""Executes a task in a browser session.
|
|
146
|
+
|
|
147
|
+
The task can be run with a specific
|
|
148
|
+
version or the latest version. Optionally, you can provide an existing session
|
|
149
|
+
ID or let the system create a new one.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
task_id: Task identifier
|
|
153
|
+
|
|
154
|
+
inputs: Environment variables for task execution (keys must start with ANCHOR\\__)
|
|
155
|
+
|
|
156
|
+
override_browser_configuration: Override browser configuration for this execution
|
|
157
|
+
|
|
158
|
+
session_id: Optional existing session ID to use
|
|
159
|
+
|
|
160
|
+
task_session_id: Optional task-specific session ID
|
|
161
|
+
|
|
162
|
+
version: Version to run (draft, latest, or version number)
|
|
163
|
+
|
|
164
|
+
extra_headers: Send extra headers
|
|
165
|
+
|
|
166
|
+
extra_query: Add additional query parameters to the request
|
|
167
|
+
|
|
168
|
+
extra_body: Add additional JSON properties to the request
|
|
169
|
+
|
|
170
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
171
|
+
"""
|
|
172
|
+
return await self._post(
|
|
173
|
+
"/v1/task/run",
|
|
174
|
+
body=await async_maybe_transform(
|
|
175
|
+
{
|
|
176
|
+
"task_id": task_id,
|
|
177
|
+
"inputs": inputs,
|
|
178
|
+
"override_browser_configuration": override_browser_configuration,
|
|
179
|
+
"session_id": session_id,
|
|
180
|
+
"task_session_id": task_session_id,
|
|
181
|
+
"version": version,
|
|
182
|
+
},
|
|
183
|
+
run_execute_params.RunExecuteParams,
|
|
184
|
+
),
|
|
185
|
+
options=make_request_options(
|
|
186
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
187
|
+
),
|
|
188
|
+
cast_to=RunExecuteResponse,
|
|
189
|
+
)
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class RunResourceWithRawResponse:
|
|
193
|
+
def __init__(self, run: RunResource) -> None:
|
|
194
|
+
self._run = run
|
|
195
|
+
|
|
196
|
+
self.execute = to_raw_response_wrapper(
|
|
197
|
+
run.execute,
|
|
198
|
+
)
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
class AsyncRunResourceWithRawResponse:
|
|
202
|
+
def __init__(self, run: AsyncRunResource) -> None:
|
|
203
|
+
self._run = run
|
|
204
|
+
|
|
205
|
+
self.execute = async_to_raw_response_wrapper(
|
|
206
|
+
run.execute,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class RunResourceWithStreamingResponse:
|
|
211
|
+
def __init__(self, run: RunResource) -> None:
|
|
212
|
+
self._run = run
|
|
213
|
+
|
|
214
|
+
self.execute = to_streamed_response_wrapper(
|
|
215
|
+
run.execute,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
class AsyncRunResourceWithStreamingResponse:
|
|
220
|
+
def __init__(self, run: AsyncRunResource) -> None:
|
|
221
|
+
self._run = run
|
|
222
|
+
|
|
223
|
+
self.execute = async_to_streamed_response_wrapper(
|
|
224
|
+
run.execute,
|
|
225
|
+
)
|
|
@@ -0,0 +1,358 @@
|
|
|
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 .run import (
|
|
10
|
+
RunResource,
|
|
11
|
+
AsyncRunResource,
|
|
12
|
+
RunResourceWithRawResponse,
|
|
13
|
+
AsyncRunResourceWithRawResponse,
|
|
14
|
+
RunResourceWithStreamingResponse,
|
|
15
|
+
AsyncRunResourceWithStreamingResponse,
|
|
16
|
+
)
|
|
17
|
+
from ...types import task_list_params, task_create_params
|
|
18
|
+
from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
19
|
+
from ..._utils import maybe_transform, async_maybe_transform
|
|
20
|
+
from ..._compat import cached_property
|
|
21
|
+
from ..._resource import SyncAPIResource, AsyncAPIResource
|
|
22
|
+
from ..._response import (
|
|
23
|
+
to_raw_response_wrapper,
|
|
24
|
+
to_streamed_response_wrapper,
|
|
25
|
+
async_to_raw_response_wrapper,
|
|
26
|
+
async_to_streamed_response_wrapper,
|
|
27
|
+
)
|
|
28
|
+
from ..._base_client import make_request_options
|
|
29
|
+
from ...types.task_list_response import TaskListResponse
|
|
30
|
+
from ...types.task_create_response import TaskCreateResponse
|
|
31
|
+
|
|
32
|
+
__all__ = ["TaskResource", "AsyncTaskResource"]
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class TaskResource(SyncAPIResource):
|
|
36
|
+
@cached_property
|
|
37
|
+
def run(self) -> RunResource:
|
|
38
|
+
return RunResource(self._client)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_raw_response(self) -> TaskResourceWithRawResponse:
|
|
42
|
+
"""
|
|
43
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
44
|
+
the raw response object instead of the parsed content.
|
|
45
|
+
|
|
46
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
47
|
+
"""
|
|
48
|
+
return TaskResourceWithRawResponse(self)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def with_streaming_response(self) -> TaskResourceWithStreamingResponse:
|
|
52
|
+
"""
|
|
53
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
54
|
+
|
|
55
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
56
|
+
"""
|
|
57
|
+
return TaskResourceWithStreamingResponse(self)
|
|
58
|
+
|
|
59
|
+
def create(
|
|
60
|
+
self,
|
|
61
|
+
*,
|
|
62
|
+
language: Literal["typescript"],
|
|
63
|
+
name: str,
|
|
64
|
+
browser_configuration: task_create_params.BrowserConfiguration | Omit = omit,
|
|
65
|
+
code: str | Omit = omit,
|
|
66
|
+
description: str | Omit = omit,
|
|
67
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
68
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
69
|
+
extra_headers: Headers | None = None,
|
|
70
|
+
extra_query: Query | None = None,
|
|
71
|
+
extra_body: Body | None = None,
|
|
72
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
73
|
+
) -> TaskCreateResponse:
|
|
74
|
+
"""Creates a new task or updates an existing task with the same name.
|
|
75
|
+
|
|
76
|
+
Tasks are
|
|
77
|
+
reusable code snippets that can be executed in browser sessions. Tasks support
|
|
78
|
+
versioning with draft and published versions.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
language: Programming language for the task
|
|
82
|
+
|
|
83
|
+
name: Task name (letters, numbers, hyphens, and underscores only)
|
|
84
|
+
|
|
85
|
+
browser_configuration: Browser configuration for task execution
|
|
86
|
+
|
|
87
|
+
code: Base64 encoded task code (optional)
|
|
88
|
+
|
|
89
|
+
description: Optional description of the task
|
|
90
|
+
|
|
91
|
+
extra_headers: Send extra headers
|
|
92
|
+
|
|
93
|
+
extra_query: Add additional query parameters to the request
|
|
94
|
+
|
|
95
|
+
extra_body: Add additional JSON properties to the request
|
|
96
|
+
|
|
97
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
98
|
+
"""
|
|
99
|
+
return self._post(
|
|
100
|
+
"/v1/task",
|
|
101
|
+
body=maybe_transform(
|
|
102
|
+
{
|
|
103
|
+
"language": language,
|
|
104
|
+
"name": name,
|
|
105
|
+
"browser_configuration": browser_configuration,
|
|
106
|
+
"code": code,
|
|
107
|
+
"description": description,
|
|
108
|
+
},
|
|
109
|
+
task_create_params.TaskCreateParams,
|
|
110
|
+
),
|
|
111
|
+
options=make_request_options(
|
|
112
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
113
|
+
),
|
|
114
|
+
cast_to=TaskCreateResponse,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
def list(
|
|
118
|
+
self,
|
|
119
|
+
*,
|
|
120
|
+
limit: str | Omit = omit,
|
|
121
|
+
page: str | Omit = omit,
|
|
122
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
123
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
124
|
+
extra_headers: Headers | None = None,
|
|
125
|
+
extra_query: Query | None = None,
|
|
126
|
+
extra_body: Body | None = None,
|
|
127
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
128
|
+
) -> TaskListResponse:
|
|
129
|
+
"""Retrieves a paginated list of all tasks for the authenticated team.
|
|
130
|
+
|
|
131
|
+
Tasks are
|
|
132
|
+
returned with their latest version information and metadata.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
limit: Number of tasks per page
|
|
136
|
+
|
|
137
|
+
page: Page number
|
|
138
|
+
|
|
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
|
+
return self._get(
|
|
148
|
+
"/v1/task",
|
|
149
|
+
options=make_request_options(
|
|
150
|
+
extra_headers=extra_headers,
|
|
151
|
+
extra_query=extra_query,
|
|
152
|
+
extra_body=extra_body,
|
|
153
|
+
timeout=timeout,
|
|
154
|
+
query=maybe_transform(
|
|
155
|
+
{
|
|
156
|
+
"limit": limit,
|
|
157
|
+
"page": page,
|
|
158
|
+
},
|
|
159
|
+
task_list_params.TaskListParams,
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
cast_to=TaskListResponse,
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class AsyncTaskResource(AsyncAPIResource):
|
|
167
|
+
@cached_property
|
|
168
|
+
def run(self) -> AsyncRunResource:
|
|
169
|
+
return AsyncRunResource(self._client)
|
|
170
|
+
|
|
171
|
+
@cached_property
|
|
172
|
+
def with_raw_response(self) -> AsyncTaskResourceWithRawResponse:
|
|
173
|
+
"""
|
|
174
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
175
|
+
the raw response object instead of the parsed content.
|
|
176
|
+
|
|
177
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#accessing-raw-response-data-eg-headers
|
|
178
|
+
"""
|
|
179
|
+
return AsyncTaskResourceWithRawResponse(self)
|
|
180
|
+
|
|
181
|
+
@cached_property
|
|
182
|
+
def with_streaming_response(self) -> AsyncTaskResourceWithStreamingResponse:
|
|
183
|
+
"""
|
|
184
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
185
|
+
|
|
186
|
+
For more information, see https://www.github.com/anchorbrowser/AnchorBrowser-SDK-Python#with_streaming_response
|
|
187
|
+
"""
|
|
188
|
+
return AsyncTaskResourceWithStreamingResponse(self)
|
|
189
|
+
|
|
190
|
+
async def create(
|
|
191
|
+
self,
|
|
192
|
+
*,
|
|
193
|
+
language: Literal["typescript"],
|
|
194
|
+
name: str,
|
|
195
|
+
browser_configuration: task_create_params.BrowserConfiguration | Omit = omit,
|
|
196
|
+
code: str | Omit = omit,
|
|
197
|
+
description: str | Omit = omit,
|
|
198
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
199
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
200
|
+
extra_headers: Headers | None = None,
|
|
201
|
+
extra_query: Query | None = None,
|
|
202
|
+
extra_body: Body | None = None,
|
|
203
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
204
|
+
) -> TaskCreateResponse:
|
|
205
|
+
"""Creates a new task or updates an existing task with the same name.
|
|
206
|
+
|
|
207
|
+
Tasks are
|
|
208
|
+
reusable code snippets that can be executed in browser sessions. Tasks support
|
|
209
|
+
versioning with draft and published versions.
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
language: Programming language for the task
|
|
213
|
+
|
|
214
|
+
name: Task name (letters, numbers, hyphens, and underscores only)
|
|
215
|
+
|
|
216
|
+
browser_configuration: Browser configuration for task execution
|
|
217
|
+
|
|
218
|
+
code: Base64 encoded task code (optional)
|
|
219
|
+
|
|
220
|
+
description: Optional description of the task
|
|
221
|
+
|
|
222
|
+
extra_headers: Send extra headers
|
|
223
|
+
|
|
224
|
+
extra_query: Add additional query parameters to the request
|
|
225
|
+
|
|
226
|
+
extra_body: Add additional JSON properties to the request
|
|
227
|
+
|
|
228
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
229
|
+
"""
|
|
230
|
+
return await self._post(
|
|
231
|
+
"/v1/task",
|
|
232
|
+
body=await async_maybe_transform(
|
|
233
|
+
{
|
|
234
|
+
"language": language,
|
|
235
|
+
"name": name,
|
|
236
|
+
"browser_configuration": browser_configuration,
|
|
237
|
+
"code": code,
|
|
238
|
+
"description": description,
|
|
239
|
+
},
|
|
240
|
+
task_create_params.TaskCreateParams,
|
|
241
|
+
),
|
|
242
|
+
options=make_request_options(
|
|
243
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
244
|
+
),
|
|
245
|
+
cast_to=TaskCreateResponse,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
async def list(
|
|
249
|
+
self,
|
|
250
|
+
*,
|
|
251
|
+
limit: str | Omit = omit,
|
|
252
|
+
page: str | Omit = omit,
|
|
253
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
254
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
255
|
+
extra_headers: Headers | None = None,
|
|
256
|
+
extra_query: Query | None = None,
|
|
257
|
+
extra_body: Body | None = None,
|
|
258
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
259
|
+
) -> TaskListResponse:
|
|
260
|
+
"""Retrieves a paginated list of all tasks for the authenticated team.
|
|
261
|
+
|
|
262
|
+
Tasks are
|
|
263
|
+
returned with their latest version information and metadata.
|
|
264
|
+
|
|
265
|
+
Args:
|
|
266
|
+
limit: Number of tasks per page
|
|
267
|
+
|
|
268
|
+
page: Page number
|
|
269
|
+
|
|
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
|
+
return await self._get(
|
|
279
|
+
"/v1/task",
|
|
280
|
+
options=make_request_options(
|
|
281
|
+
extra_headers=extra_headers,
|
|
282
|
+
extra_query=extra_query,
|
|
283
|
+
extra_body=extra_body,
|
|
284
|
+
timeout=timeout,
|
|
285
|
+
query=await async_maybe_transform(
|
|
286
|
+
{
|
|
287
|
+
"limit": limit,
|
|
288
|
+
"page": page,
|
|
289
|
+
},
|
|
290
|
+
task_list_params.TaskListParams,
|
|
291
|
+
),
|
|
292
|
+
),
|
|
293
|
+
cast_to=TaskListResponse,
|
|
294
|
+
)
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
class TaskResourceWithRawResponse:
|
|
298
|
+
def __init__(self, task: TaskResource) -> None:
|
|
299
|
+
self._task = task
|
|
300
|
+
|
|
301
|
+
self.create = to_raw_response_wrapper(
|
|
302
|
+
task.create,
|
|
303
|
+
)
|
|
304
|
+
self.list = to_raw_response_wrapper(
|
|
305
|
+
task.list,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
@cached_property
|
|
309
|
+
def run(self) -> RunResourceWithRawResponse:
|
|
310
|
+
return RunResourceWithRawResponse(self._task.run)
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
class AsyncTaskResourceWithRawResponse:
|
|
314
|
+
def __init__(self, task: AsyncTaskResource) -> None:
|
|
315
|
+
self._task = task
|
|
316
|
+
|
|
317
|
+
self.create = async_to_raw_response_wrapper(
|
|
318
|
+
task.create,
|
|
319
|
+
)
|
|
320
|
+
self.list = async_to_raw_response_wrapper(
|
|
321
|
+
task.list,
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
@cached_property
|
|
325
|
+
def run(self) -> AsyncRunResourceWithRawResponse:
|
|
326
|
+
return AsyncRunResourceWithRawResponse(self._task.run)
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
class TaskResourceWithStreamingResponse:
|
|
330
|
+
def __init__(self, task: TaskResource) -> None:
|
|
331
|
+
self._task = task
|
|
332
|
+
|
|
333
|
+
self.create = to_streamed_response_wrapper(
|
|
334
|
+
task.create,
|
|
335
|
+
)
|
|
336
|
+
self.list = to_streamed_response_wrapper(
|
|
337
|
+
task.list,
|
|
338
|
+
)
|
|
339
|
+
|
|
340
|
+
@cached_property
|
|
341
|
+
def run(self) -> RunResourceWithStreamingResponse:
|
|
342
|
+
return RunResourceWithStreamingResponse(self._task.run)
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
class AsyncTaskResourceWithStreamingResponse:
|
|
346
|
+
def __init__(self, task: AsyncTaskResource) -> None:
|
|
347
|
+
self._task = task
|
|
348
|
+
|
|
349
|
+
self.create = async_to_streamed_response_wrapper(
|
|
350
|
+
task.create,
|
|
351
|
+
)
|
|
352
|
+
self.list = async_to_streamed_response_wrapper(
|
|
353
|
+
task.list,
|
|
354
|
+
)
|
|
355
|
+
|
|
356
|
+
@cached_property
|
|
357
|
+
def run(self) -> AsyncRunResourceWithStreamingResponse:
|
|
358
|
+
return AsyncRunResourceWithStreamingResponse(self._task.run)
|