anchorbrowser 0.1.1__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.
Files changed (41) hide show
  1. anchorbrowser/_client.py +18 -1
  2. anchorbrowser/_models.py +3 -0
  3. anchorbrowser/_version.py +1 -1
  4. anchorbrowser/resources/__init__.py +28 -0
  5. anchorbrowser/resources/batch_sessions.py +288 -0
  6. anchorbrowser/resources/profiles.py +1 -115
  7. anchorbrowser/resources/sessions/__init__.py +14 -0
  8. anchorbrowser/resources/sessions/agent/__init__.py +33 -0
  9. anchorbrowser/resources/sessions/agent/agent.py +273 -0
  10. anchorbrowser/resources/sessions/agent/files.py +280 -0
  11. anchorbrowser/resources/sessions/mouse.py +1 -233
  12. anchorbrowser/resources/sessions/sessions.py +39 -1
  13. anchorbrowser/resources/task/__init__.py +33 -0
  14. anchorbrowser/resources/task/run.py +225 -0
  15. anchorbrowser/resources/task/task.py +358 -0
  16. anchorbrowser/types/__init__.py +7 -1
  17. anchorbrowser/types/batch_session_create_params.py +487 -0
  18. anchorbrowser/types/batch_session_create_response.py +27 -0
  19. anchorbrowser/types/batch_session_retrieve_response.py +90 -0
  20. anchorbrowser/types/session_create_params.py +52 -9
  21. anchorbrowser/types/sessions/__init__.py +0 -4
  22. anchorbrowser/types/sessions/agent/__init__.py +7 -0
  23. anchorbrowser/types/sessions/agent/file_list_response.py +32 -0
  24. anchorbrowser/types/sessions/agent/file_upload_params.py +14 -0
  25. anchorbrowser/types/sessions/agent/file_upload_response.py +17 -0
  26. anchorbrowser/types/task/__init__.py +6 -0
  27. anchorbrowser/types/task/run_execute_params.py +324 -0
  28. anchorbrowser/types/task/run_execute_response.py +33 -0
  29. anchorbrowser/types/task_create_params.py +317 -0
  30. anchorbrowser/types/task_create_response.py +345 -0
  31. anchorbrowser/types/task_list_params.py +15 -0
  32. anchorbrowser/types/task_list_response.py +361 -0
  33. {anchorbrowser-0.1.1.dist-info → anchorbrowser-0.2.0.dist-info}/METADATA +6 -6
  34. {anchorbrowser-0.1.1.dist-info → anchorbrowser-0.2.0.dist-info}/RECORD +36 -20
  35. anchorbrowser/types/profile_update_params.py +0 -21
  36. anchorbrowser/types/sessions/mouse_down_params.py +0 -18
  37. anchorbrowser/types/sessions/mouse_down_response.py +0 -11
  38. anchorbrowser/types/sessions/mouse_up_params.py +0 -18
  39. anchorbrowser/types/sessions/mouse_up_response.py +0 -11
  40. {anchorbrowser-0.1.1.dist-info → anchorbrowser-0.2.0.dist-info}/WHEEL +0 -0
  41. {anchorbrowser-0.1.1.dist-info → anchorbrowser-0.2.0.dist-info}/licenses/LICENSE +0 -0
@@ -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)
@@ -3,14 +3,17 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  from .shared import SuccessResponse as SuccessResponse
6
+ from .task_list_params import TaskListParams as TaskListParams
6
7
  from .extension_manifest import ExtensionManifest as ExtensionManifest
8
+ from .task_create_params import TaskCreateParams as TaskCreateParams
9
+ from .task_list_response import TaskListResponse as TaskListResponse
7
10
  from .event_signal_params import EventSignalParams as EventSignalParams
8
11
  from .session_goto_params import SessionGotoParams as SessionGotoParams
9
12
  from .session_paste_params import SessionPasteParams as SessionPasteParams
13
+ from .task_create_response import TaskCreateResponse as TaskCreateResponse
10
14
  from .event_wait_for_params import EventWaitForParams as EventWaitForParams
11
15
  from .profile_create_params import ProfileCreateParams as ProfileCreateParams
12
16
  from .profile_list_response import ProfileListResponse as ProfileListResponse
13
- from .profile_update_params import ProfileUpdateParams as ProfileUpdateParams
14
17
  from .session_copy_response import SessionCopyResponse as SessionCopyResponse
15
18
  from .session_create_params import SessionCreateParams as SessionCreateParams
16
19
  from .session_goto_response import SessionGotoResponse as SessionGotoResponse
@@ -27,13 +30,16 @@ from .profile_retrieve_response import ProfileRetrieveResponse as ProfileRetriev
27
30
  from .session_retrieve_response import SessionRetrieveResponse as SessionRetrieveResponse
28
31
  from .tool_fetch_webpage_params import ToolFetchWebpageParams as ToolFetchWebpageParams
29
32
  from .session_upload_file_params import SessionUploadFileParams as SessionUploadFileParams
33
+ from .batch_session_create_params import BatchSessionCreateParams as BatchSessionCreateParams
30
34
  from .extension_retrieve_response import ExtensionRetrieveResponse as ExtensionRetrieveResponse
31
35
  from .session_list_pages_response import SessionListPagesResponse as SessionListPagesResponse
32
36
  from .tool_fetch_webpage_response import ToolFetchWebpageResponse as ToolFetchWebpageResponse
33
37
  from .session_drag_and_drop_params import SessionDragAndDropParams as SessionDragAndDropParams
34
38
  from .session_upload_file_response import SessionUploadFileResponse as SessionUploadFileResponse
35
39
  from .tool_perform_web_task_params import ToolPerformWebTaskParams as ToolPerformWebTaskParams
40
+ from .batch_session_create_response import BatchSessionCreateResponse as BatchSessionCreateResponse
36
41
  from .session_drag_and_drop_response import SessionDragAndDropResponse as SessionDragAndDropResponse
37
42
  from .tool_perform_web_task_response import ToolPerformWebTaskResponse as ToolPerformWebTaskResponse
38
43
  from .tool_screenshot_webpage_params import ToolScreenshotWebpageParams as ToolScreenshotWebpageParams
44
+ from .batch_session_retrieve_response import BatchSessionRetrieveResponse as BatchSessionRetrieveResponse
39
45
  from .session_retrieve_downloads_response import SessionRetrieveDownloadsResponse as SessionRetrieveDownloadsResponse