From a60fa2bd48b06c8ca61005c3e29c42918ee371f2 Mon Sep 17 00:00:00 2001 From: "kernel-internal[bot]" <260533166+kernel-internal[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:01:35 +0000 Subject: [PATCH 1/2] feat: Accept browser session name on all /browsers/{id_or_name} sub-resource routes Stainless-Generated-From: c2d7f09673a4d607dd628011d15d4a531c152d8e --- .stats.yml | 2 +- api.md | 110 ++++--- src/kernel/resources/browsers/__init__.py | 14 + src/kernel/resources/browsers/browsers.py | 70 +++- src/kernel/resources/browsers/computer.py | 192 +++++------ src/kernel/resources/browsers/fs/fs.py | 192 +++++------ src/kernel/resources/browsers/fs/watch.py | 52 +-- src/kernel/resources/browsers/logs.py | 16 +- src/kernel/resources/browsers/playwright.py | 30 +- src/kernel/resources/browsers/process.py | 136 ++++---- src/kernel/resources/browsers/replays.py | 68 ++-- src/kernel/resources/browsers/telemetry.py | 32 +- src/kernel/resources/browsers/webmcp.py | 288 +++++++++++++++++ .../resources/telemetry/destinations.py | 66 ++-- src/kernel/types/browsers/__init__.py | 7 + .../types/browsers/invocation_result.py | 22 ++ .../types/browsers/process_kill_params.py | 2 +- .../types/browsers/process_resize_params.py | 2 +- .../types/browsers/process_stdin_params.py | 2 +- src/kernel/types/browsers/tool.py | 31 ++ src/kernel/types/browsers/tool_annotations.py | 20 ++ src/kernel/types/browsers/tool_frame.py | 16 + src/kernel/types/browsers/tool_source.py | 34 ++ src/kernel/types/browsers/tools_response.py | 12 + .../browsers/webmcp_invoke_tool_params.py | 17 + .../telemetry/destination_create_params.py | 2 +- .../types/telemetry/otlp_destination.py | 6 +- tests/api_resources/browsers/fs/test_watch.py | 72 ++--- tests/api_resources/browsers/test_computer.py | 292 +++++++++-------- tests/api_resources/browsers/test_fs.py | 300 ++++++++++-------- tests/api_resources/browsers/test_logs.py | 24 +- .../api_resources/browsers/test_playwright.py | 24 +- tests/api_resources/browsers/test_process.py | 168 +++++----- tests/api_resources/browsers/test_replays.py | 112 ++++--- .../api_resources/browsers/test_telemetry.py | 48 +-- tests/api_resources/browsers/test_webmcp.py | 230 ++++++++++++++ tests/api_resources/test_browsers.py | 44 +-- 37 files changed, 1809 insertions(+), 946 deletions(-) create mode 100644 src/kernel/resources/browsers/webmcp.py create mode 100644 src/kernel/types/browsers/invocation_result.py create mode 100644 src/kernel/types/browsers/tool.py create mode 100644 src/kernel/types/browsers/tool_annotations.py create mode 100644 src/kernel/types/browsers/tool_frame.py create mode 100644 src/kernel/types/browsers/tool_source.py create mode 100644 src/kernel/types/browsers/tools_response.py create mode 100644 src/kernel/types/browsers/webmcp_invoke_tool_params.py create mode 100644 tests/api_resources/browsers/test_webmcp.py diff --git a/.stats.yml b/.stats.yml index 2aae27b8..a867372d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1 @@ -configured_endpoints: 145 +configured_endpoints: 147 diff --git a/api.md b/api.md index 6cd72abc..4a09a5d9 100644 --- a/api.md +++ b/api.md @@ -140,9 +140,9 @@ Methods: - client.browsers.retrieve(id_or_name, \*\*params) -> BrowserRetrieveResponse - client.browsers.update(id_or_name, \*\*params) -> BrowserUpdateResponse - client.browsers.list(\*\*params) -> SyncOffsetPagination[BrowserListResponse] -- client.browsers.curl(id, \*\*params) -> BrowserCurlResponse +- client.browsers.curl(id_or_name, \*\*params) -> BrowserCurlResponse - client.browsers.delete_by_id(id_or_name) -> None -- client.browsers.load_extensions(id, \*\*params) -> None +- client.browsers.load_extensions(id_or_name, \*\*params) -> None ## Telemetry @@ -206,8 +206,8 @@ from kernel.types.browsers import ( Methods: -- client.browsers.telemetry.events(id, \*\*params) -> SyncOffsetPagination[TelemetryEventsResponse] -- client.browsers.telemetry.stream(id, \*\*params) -> TelemetryStreamResponse +- client.browsers.telemetry.events(id_or_name, \*\*params) -> SyncOffsetPagination[TelemetryEventsResponse] +- client.browsers.telemetry.stream(id_or_name, \*\*params) -> TelemetryStreamResponse ## Replays @@ -219,10 +219,10 @@ from kernel.types.browsers import ReplayListResponse, ReplayStartResponse Methods: -- client.browsers.replays.list(id) -> ReplayListResponse -- client.browsers.replays.download(replay_id, \*, id) -> BinaryAPIResponse -- client.browsers.replays.start(id, \*\*params) -> ReplayStartResponse -- client.browsers.replays.stop(replay_id, \*, id) -> None +- client.browsers.replays.list(id_or_name) -> ReplayListResponse +- client.browsers.replays.download(replay_id, \*, id_or_name) -> BinaryAPIResponse +- client.browsers.replays.start(id_or_name, \*\*params) -> ReplayStartResponse +- client.browsers.replays.stop(replay_id, \*, id_or_name) -> None ## Fs @@ -234,18 +234,18 @@ from kernel.types.browsers import FFileInfoResponse, FListFilesResponse Methods: -- client.browsers.fs.create_directory(id, \*\*params) -> None -- client.browsers.fs.delete_directory(id, \*\*params) -> None -- client.browsers.fs.delete_file(id, \*\*params) -> None -- client.browsers.fs.download_dir_zip(id, \*\*params) -> BinaryAPIResponse -- client.browsers.fs.file_info(id, \*\*params) -> FFileInfoResponse -- client.browsers.fs.list_files(id, \*\*params) -> FListFilesResponse -- client.browsers.fs.move(id, \*\*params) -> None -- client.browsers.fs.read_file(id, \*\*params) -> BinaryAPIResponse -- client.browsers.fs.set_file_permissions(id, \*\*params) -> None -- client.browsers.fs.upload(id, \*\*params) -> None -- client.browsers.fs.upload_zip(id, \*\*params) -> None -- client.browsers.fs.write_file(id, contents, \*\*params) -> None +- client.browsers.fs.create_directory(id_or_name, \*\*params) -> None +- client.browsers.fs.delete_directory(id_or_name, \*\*params) -> None +- client.browsers.fs.delete_file(id_or_name, \*\*params) -> None +- client.browsers.fs.download_dir_zip(id_or_name, \*\*params) -> BinaryAPIResponse +- client.browsers.fs.file_info(id_or_name, \*\*params) -> FFileInfoResponse +- client.browsers.fs.list_files(id_or_name, \*\*params) -> FListFilesResponse +- client.browsers.fs.move(id_or_name, \*\*params) -> None +- client.browsers.fs.read_file(id_or_name, \*\*params) -> BinaryAPIResponse +- client.browsers.fs.set_file_permissions(id_or_name, \*\*params) -> None +- client.browsers.fs.upload(id_or_name, \*\*params) -> None +- client.browsers.fs.upload_zip(id_or_name, \*\*params) -> None +- client.browsers.fs.write_file(id_or_name, contents, \*\*params) -> None ### Watch @@ -257,9 +257,9 @@ from kernel.types.browsers.fs import WatchEventsResponse, WatchStartResponse Methods: -- client.browsers.fs.watch.events(watch_id, \*, id) -> WatchEventsResponse -- client.browsers.fs.watch.start(id, \*\*params) -> WatchStartResponse -- client.browsers.fs.watch.stop(watch_id, \*, id) -> None +- client.browsers.fs.watch.events(watch_id, \*, id_or_name) -> WatchEventsResponse +- client.browsers.fs.watch.start(id_or_name, \*\*params) -> WatchStartResponse +- client.browsers.fs.watch.stop(watch_id, \*, id_or_name) -> None ## Process @@ -279,19 +279,19 @@ from kernel.types.browsers import ( Methods: -- client.browsers.process.exec(id, \*\*params) -> ProcessExecResponse -- client.browsers.process.kill(process_id, \*, id, \*\*params) -> ProcessKillResponse -- client.browsers.process.resize(process_id, \*, id, \*\*params) -> ProcessResizeResponse -- client.browsers.process.spawn(id, \*\*params) -> ProcessSpawnResponse -- client.browsers.process.status(process_id, \*, id) -> ProcessStatusResponse -- client.browsers.process.stdin(process_id, \*, id, \*\*params) -> ProcessStdinResponse -- client.browsers.process.stdout_stream(process_id, \*, id) -> ProcessStdoutStreamResponse +- client.browsers.process.exec(id_or_name, \*\*params) -> ProcessExecResponse +- client.browsers.process.kill(process_id, \*, id_or_name, \*\*params) -> ProcessKillResponse +- client.browsers.process.resize(process_id, \*, id_or_name, \*\*params) -> ProcessResizeResponse +- client.browsers.process.spawn(id_or_name, \*\*params) -> ProcessSpawnResponse +- client.browsers.process.status(process_id, \*, id_or_name) -> ProcessStatusResponse +- client.browsers.process.stdin(process_id, \*, id_or_name, \*\*params) -> ProcessStdinResponse +- client.browsers.process.stdout_stream(process_id, \*, id_or_name) -> ProcessStdoutStreamResponse ## Logs Methods: -- client.browsers.logs.stream(id, \*\*params) -> LogEvent +- client.browsers.logs.stream(id_or_name, \*\*params) -> LogEvent ## Computer @@ -307,18 +307,18 @@ from kernel.types.browsers import ( Methods: -- client.browsers.computer.batch(id, \*\*params) -> None -- client.browsers.computer.capture_screenshot(id, \*\*params) -> BinaryAPIResponse -- client.browsers.computer.click_mouse(id, \*\*params) -> None -- client.browsers.computer.drag_mouse(id, \*\*params) -> None -- client.browsers.computer.get_mouse_position(id) -> ComputerGetMousePositionResponse -- client.browsers.computer.move_mouse(id, \*\*params) -> None -- client.browsers.computer.press_key(id, \*\*params) -> None -- client.browsers.computer.read_clipboard(id) -> ComputerReadClipboardResponse -- client.browsers.computer.scroll(id, \*\*params) -> None -- client.browsers.computer.set_cursor_visibility(id, \*\*params) -> ComputerSetCursorVisibilityResponse -- client.browsers.computer.type_text(id, \*\*params) -> None -- client.browsers.computer.write_clipboard(id, \*\*params) -> None +- client.browsers.computer.batch(id_or_name, \*\*params) -> None +- client.browsers.computer.capture_screenshot(id_or_name, \*\*params) -> BinaryAPIResponse +- client.browsers.computer.click_mouse(id_or_name, \*\*params) -> None +- client.browsers.computer.drag_mouse(id_or_name, \*\*params) -> None +- client.browsers.computer.get_mouse_position(id_or_name) -> ComputerGetMousePositionResponse +- client.browsers.computer.move_mouse(id_or_name, \*\*params) -> None +- client.browsers.computer.press_key(id_or_name, \*\*params) -> None +- client.browsers.computer.read_clipboard(id_or_name) -> ComputerReadClipboardResponse +- client.browsers.computer.scroll(id_or_name, \*\*params) -> None +- client.browsers.computer.set_cursor_visibility(id_or_name, \*\*params) -> ComputerSetCursorVisibilityResponse +- client.browsers.computer.type_text(id_or_name, \*\*params) -> None +- client.browsers.computer.write_clipboard(id_or_name, \*\*params) -> None ## Playwright @@ -330,7 +330,29 @@ from kernel.types.browsers import PlaywrightExecuteResponse Methods: -- client.browsers.playwright.execute(id, \*\*params) -> PlaywrightExecuteResponse +- client.browsers.playwright.execute(id_or_name, \*\*params) -> PlaywrightExecuteResponse + +## Webmcp + +Types: + +```python +from kernel.types.browsers import ( + InvocationFailure, + InvocationResult, + InvokeRequest, + Tool, + ToolAnnotations, + ToolFrame, + ToolSource, + ToolsResponse, +) +``` + +Methods: + +- client.browsers.webmcp.invoke_tool(id_or_name, \*\*params) -> InvocationResult +- client.browsers.webmcp.list_tools(id_or_name) -> ToolsResponse # Profiles diff --git a/src/kernel/resources/browsers/__init__.py b/src/kernel/resources/browsers/__init__.py index 928d4553..c6ee6a5f 100644 --- a/src/kernel/resources/browsers/__init__.py +++ b/src/kernel/resources/browsers/__init__.py @@ -16,6 +16,14 @@ LogsResourceWithStreamingResponse, AsyncLogsResourceWithStreamingResponse, ) +from .webmcp import ( + WebmcpResource, + AsyncWebmcpResource, + WebmcpResourceWithRawResponse, + AsyncWebmcpResourceWithRawResponse, + WebmcpResourceWithStreamingResponse, + AsyncWebmcpResourceWithStreamingResponse, +) from .process import ( ProcessResource, AsyncProcessResource, @@ -108,6 +116,12 @@ "AsyncPlaywrightResourceWithRawResponse", "PlaywrightResourceWithStreamingResponse", "AsyncPlaywrightResourceWithStreamingResponse", + "WebmcpResource", + "AsyncWebmcpResource", + "WebmcpResourceWithRawResponse", + "AsyncWebmcpResourceWithRawResponse", + "WebmcpResourceWithStreamingResponse", + "AsyncWebmcpResourceWithStreamingResponse", "BrowsersResource", "AsyncBrowsersResource", "BrowsersResourceWithRawResponse", diff --git a/src/kernel/resources/browsers/browsers.py b/src/kernel/resources/browsers/browsers.py index 920a65cf..d703df24 100644 --- a/src/kernel/resources/browsers/browsers.py +++ b/src/kernel/resources/browsers/browsers.py @@ -24,6 +24,14 @@ FsResourceWithStreamingResponse, AsyncFsResourceWithStreamingResponse, ) +from .webmcp import ( + WebmcpResource, + AsyncWebmcpResource, + WebmcpResourceWithRawResponse, + AsyncWebmcpResourceWithRawResponse, + WebmcpResourceWithStreamingResponse, + AsyncWebmcpResourceWithStreamingResponse, +) from ...types import ( BrowserMemoryRequest, browser_curl_params, @@ -148,6 +156,11 @@ def playwright(self) -> PlaywrightResource: """Execute Playwright code against the browser instance.""" return PlaywrightResource(self._client) + @cached_property + def webmcp(self) -> WebmcpResource: + """Discover and invoke native page tools across the browser instance.""" + return WebmcpResource(self._client) + @cached_property def with_raw_response(self) -> BrowsersResourceWithRawResponse: """ @@ -527,7 +540,7 @@ def list( def curl( self, - id: str, + id_or_name: str, *, url: str, body: str | Omit = omit, @@ -568,10 +581,10 @@ def curl( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/curl", id=id), + path_template("/browsers/{id_or_name}/curl", id_or_name=id_or_name), body=maybe_transform( { "url": url, @@ -683,7 +696,7 @@ def delete_by_id( def load_extensions( self, - id: str, + id_or_name: str, *, extensions: Iterable[browser_load_extensions_params.Extension], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -708,8 +721,8 @@ def load_extensions( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} body = deepcopy_with_paths({"extensions": extensions}, [["extensions", "", "zip_file"]]) files = extract_files(cast(Mapping[str, object], body), paths=[["extensions", "", "zip_file"]]) @@ -718,7 +731,7 @@ def load_extensions( # multipart/form-data; boundary=---abc-- extra_headers["Content-Type"] = "multipart/form-data" return self._post( - path_template("/browsers/{id}/extensions", id=id), + path_template("/browsers/{id_or_name}/extensions", id_or_name=id_or_name), body=maybe_transform(body, browser_load_extensions_params.BrowserLoadExtensionsParams), files=files, options=make_request_options( @@ -768,6 +781,11 @@ def playwright(self) -> AsyncPlaywrightResource: """Execute Playwright code against the browser instance.""" return AsyncPlaywrightResource(self._client) + @cached_property + def webmcp(self) -> AsyncWebmcpResource: + """Discover and invoke native page tools across the browser instance.""" + return AsyncWebmcpResource(self._client) + @cached_property def with_raw_response(self) -> AsyncBrowsersResourceWithRawResponse: """ @@ -1147,7 +1165,7 @@ def list( async def curl( self, - id: str, + id_or_name: str, *, url: str, body: str | Omit = omit, @@ -1188,10 +1206,10 @@ async def curl( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/curl", id=id), + path_template("/browsers/{id_or_name}/curl", id_or_name=id_or_name), body=await async_maybe_transform( { "url": url, @@ -1303,7 +1321,7 @@ async def delete_by_id( async def load_extensions( self, - id: str, + id_or_name: str, *, extensions: Iterable[browser_load_extensions_params.Extension], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1328,8 +1346,8 @@ async def load_extensions( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} body = deepcopy_with_paths({"extensions": extensions}, [["extensions", "", "zip_file"]]) files = extract_files(cast(Mapping[str, object], body), paths=[["extensions", "", "zip_file"]]) @@ -1338,7 +1356,7 @@ async def load_extensions( # multipart/form-data; boundary=---abc-- extra_headers["Content-Type"] = "multipart/form-data" return await self._post( - path_template("/browsers/{id}/extensions", id=id), + path_template("/browsers/{id_or_name}/extensions", id_or_name=id_or_name), body=await async_maybe_transform(body, browser_load_extensions_params.BrowserLoadExtensionsParams), files=files, options=make_request_options( @@ -1411,6 +1429,11 @@ def playwright(self) -> PlaywrightResourceWithRawResponse: """Execute Playwright code against the browser instance.""" return PlaywrightResourceWithRawResponse(self._browsers.playwright) + @cached_property + def webmcp(self) -> WebmcpResourceWithRawResponse: + """Discover and invoke native page tools across the browser instance.""" + return WebmcpResourceWithRawResponse(self._browsers.webmcp) + class AsyncBrowsersResourceWithRawResponse: def __init__(self, browsers: AsyncBrowsersResource) -> None: @@ -1475,6 +1498,11 @@ def playwright(self) -> AsyncPlaywrightResourceWithRawResponse: """Execute Playwright code against the browser instance.""" return AsyncPlaywrightResourceWithRawResponse(self._browsers.playwright) + @cached_property + def webmcp(self) -> AsyncWebmcpResourceWithRawResponse: + """Discover and invoke native page tools across the browser instance.""" + return AsyncWebmcpResourceWithRawResponse(self._browsers.webmcp) + class BrowsersResourceWithStreamingResponse: def __init__(self, browsers: BrowsersResource) -> None: @@ -1539,6 +1567,11 @@ def playwright(self) -> PlaywrightResourceWithStreamingResponse: """Execute Playwright code against the browser instance.""" return PlaywrightResourceWithStreamingResponse(self._browsers.playwright) + @cached_property + def webmcp(self) -> WebmcpResourceWithStreamingResponse: + """Discover and invoke native page tools across the browser instance.""" + return WebmcpResourceWithStreamingResponse(self._browsers.webmcp) + class AsyncBrowsersResourceWithStreamingResponse: def __init__(self, browsers: AsyncBrowsersResource) -> None: @@ -1602,3 +1635,8 @@ def computer(self) -> AsyncComputerResourceWithStreamingResponse: def playwright(self) -> AsyncPlaywrightResourceWithStreamingResponse: """Execute Playwright code against the browser instance.""" return AsyncPlaywrightResourceWithStreamingResponse(self._browsers.playwright) + + @cached_property + def webmcp(self) -> AsyncWebmcpResourceWithStreamingResponse: + """Discover and invoke native page tools across the browser instance.""" + return AsyncWebmcpResourceWithStreamingResponse(self._browsers.webmcp) diff --git a/src/kernel/resources/browsers/computer.py b/src/kernel/resources/browsers/computer.py index d2b57304..dcb242c6 100644 --- a/src/kernel/resources/browsers/computer.py +++ b/src/kernel/resources/browsers/computer.py @@ -69,7 +69,7 @@ def with_streaming_response(self) -> ComputerResourceWithStreamingResponse: def batch( self, - id: str, + id_or_name: str, *, actions: Iterable[computer_batch_params.Action], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -95,11 +95,11 @@ def batch( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/batch", id=id), + path_template("/browsers/{id_or_name}/computer/batch", id_or_name=id_or_name), body=maybe_transform({"actions": actions}, computer_batch_params.ComputerBatchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -109,7 +109,7 @@ def batch( def capture_screenshot( self, - id: str, + id_or_name: str, *, region: computer_capture_screenshot_params.Region | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -131,11 +131,11 @@ def capture_screenshot( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "image/png", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/screenshot", id=id), + path_template("/browsers/{id_or_name}/computer/screenshot", id_or_name=id_or_name), body=maybe_transform( {"region": region}, computer_capture_screenshot_params.ComputerCaptureScreenshotParams ), @@ -147,7 +147,7 @@ def capture_screenshot( def click_mouse( self, - id: str, + id_or_name: str, *, x: int, y: int, @@ -186,11 +186,11 @@ def click_mouse( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/click_mouse", id=id), + path_template("/browsers/{id_or_name}/computer/click_mouse", id_or_name=id_or_name), body=maybe_transform( { "x": x, @@ -210,7 +210,7 @@ def click_mouse( def drag_mouse( self, - id: str, + id_or_name: str, *, path: Iterable[Iterable[int]], button: Literal["left", "middle", "right"] | Omit = omit, @@ -259,11 +259,11 @@ def drag_mouse( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/drag_mouse", id=id), + path_template("/browsers/{id_or_name}/computer/drag_mouse", id_or_name=id_or_name), body=maybe_transform( { "path": path, @@ -285,7 +285,7 @@ def drag_mouse( def get_mouse_position( self, - id: str, + id_or_name: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -306,10 +306,10 @@ def get_mouse_position( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/computer/get_mouse_position", id=id), + path_template("/browsers/{id_or_name}/computer/get_mouse_position", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -318,7 +318,7 @@ def get_mouse_position( def move_mouse( self, - id: str, + id_or_name: str, *, x: int, y: int, @@ -355,11 +355,11 @@ def move_mouse( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/move_mouse", id=id), + path_template("/browsers/{id_or_name}/computer/move_mouse", id_or_name=id_or_name), body=maybe_transform( { "x": x, @@ -378,7 +378,7 @@ def move_mouse( def press_key( self, - id: str, + id_or_name: str, *, keys: SequenceNotStr[str], duration: int | Omit = omit, @@ -412,11 +412,11 @@ def press_key( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/press_key", id=id), + path_template("/browsers/{id_or_name}/computer/press_key", id_or_name=id_or_name), body=maybe_transform( { "keys": keys, @@ -433,7 +433,7 @@ def press_key( def read_clipboard( self, - id: str, + id_or_name: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -454,10 +454,10 @@ def read_clipboard( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/computer/clipboard/read", id=id), + path_template("/browsers/{id_or_name}/computer/clipboard/read", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,7 +466,7 @@ def read_clipboard( def scroll( self, - id: str, + id_or_name: str, *, x: int, y: int, @@ -504,11 +504,11 @@ def scroll( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/scroll", id=id), + path_template("/browsers/{id_or_name}/computer/scroll", id_or_name=id_or_name), body=maybe_transform( { "x": x, @@ -527,7 +527,7 @@ def scroll( def set_cursor_visibility( self, - id: str, + id_or_name: str, *, hidden: bool, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -551,10 +551,10 @@ def set_cursor_visibility( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/computer/cursor", id=id), + path_template("/browsers/{id_or_name}/computer/cursor", id_or_name=id_or_name), body=maybe_transform( {"hidden": hidden}, computer_set_cursor_visibility_params.ComputerSetCursorVisibilityParams ), @@ -566,7 +566,7 @@ def set_cursor_visibility( def type_text( self, - id: str, + id_or_name: str, *, text: str, delay: int | Omit = omit, @@ -593,11 +593,11 @@ def type_text( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/type", id=id), + path_template("/browsers/{id_or_name}/computer/type", id_or_name=id_or_name), body=maybe_transform( { "text": text, @@ -613,7 +613,7 @@ def type_text( def write_clipboard( self, - id: str, + id_or_name: str, *, text: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -637,11 +637,11 @@ def write_clipboard( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/computer/clipboard/write", id=id), + path_template("/browsers/{id_or_name}/computer/clipboard/write", id_or_name=id_or_name), body=maybe_transform({"text": text}, computer_write_clipboard_params.ComputerWriteClipboardParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -674,7 +674,7 @@ def with_streaming_response(self) -> AsyncComputerResourceWithStreamingResponse: async def batch( self, - id: str, + id_or_name: str, *, actions: Iterable[computer_batch_params.Action], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -700,11 +700,11 @@ async def batch( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/batch", id=id), + path_template("/browsers/{id_or_name}/computer/batch", id_or_name=id_or_name), body=await async_maybe_transform({"actions": actions}, computer_batch_params.ComputerBatchParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -714,7 +714,7 @@ async def batch( async def capture_screenshot( self, - id: str, + id_or_name: str, *, region: computer_capture_screenshot_params.Region | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -736,11 +736,11 @@ async def capture_screenshot( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "image/png", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/screenshot", id=id), + path_template("/browsers/{id_or_name}/computer/screenshot", id_or_name=id_or_name), body=await async_maybe_transform( {"region": region}, computer_capture_screenshot_params.ComputerCaptureScreenshotParams ), @@ -752,7 +752,7 @@ async def capture_screenshot( async def click_mouse( self, - id: str, + id_or_name: str, *, x: int, y: int, @@ -791,11 +791,11 @@ async def click_mouse( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/click_mouse", id=id), + path_template("/browsers/{id_or_name}/computer/click_mouse", id_or_name=id_or_name), body=await async_maybe_transform( { "x": x, @@ -815,7 +815,7 @@ async def click_mouse( async def drag_mouse( self, - id: str, + id_or_name: str, *, path: Iterable[Iterable[int]], button: Literal["left", "middle", "right"] | Omit = omit, @@ -864,11 +864,11 @@ async def drag_mouse( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/drag_mouse", id=id), + path_template("/browsers/{id_or_name}/computer/drag_mouse", id_or_name=id_or_name), body=await async_maybe_transform( { "path": path, @@ -890,7 +890,7 @@ async def drag_mouse( async def get_mouse_position( self, - id: str, + id_or_name: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -911,10 +911,10 @@ async def get_mouse_position( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/computer/get_mouse_position", id=id), + path_template("/browsers/{id_or_name}/computer/get_mouse_position", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -923,7 +923,7 @@ async def get_mouse_position( async def move_mouse( self, - id: str, + id_or_name: str, *, x: int, y: int, @@ -960,11 +960,11 @@ async def move_mouse( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/move_mouse", id=id), + path_template("/browsers/{id_or_name}/computer/move_mouse", id_or_name=id_or_name), body=await async_maybe_transform( { "x": x, @@ -983,7 +983,7 @@ async def move_mouse( async def press_key( self, - id: str, + id_or_name: str, *, keys: SequenceNotStr[str], duration: int | Omit = omit, @@ -1017,11 +1017,11 @@ async def press_key( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/press_key", id=id), + path_template("/browsers/{id_or_name}/computer/press_key", id_or_name=id_or_name), body=await async_maybe_transform( { "keys": keys, @@ -1038,7 +1038,7 @@ async def press_key( async def read_clipboard( self, - id: str, + id_or_name: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -1059,10 +1059,10 @@ async def read_clipboard( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/computer/clipboard/read", id=id), + path_template("/browsers/{id_or_name}/computer/clipboard/read", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -1071,7 +1071,7 @@ async def read_clipboard( async def scroll( self, - id: str, + id_or_name: str, *, x: int, y: int, @@ -1109,11 +1109,11 @@ async def scroll( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/scroll", id=id), + path_template("/browsers/{id_or_name}/computer/scroll", id_or_name=id_or_name), body=await async_maybe_transform( { "x": x, @@ -1132,7 +1132,7 @@ async def scroll( async def set_cursor_visibility( self, - id: str, + id_or_name: str, *, hidden: bool, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1156,10 +1156,10 @@ async def set_cursor_visibility( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/computer/cursor", id=id), + path_template("/browsers/{id_or_name}/computer/cursor", id_or_name=id_or_name), body=await async_maybe_transform( {"hidden": hidden}, computer_set_cursor_visibility_params.ComputerSetCursorVisibilityParams ), @@ -1171,7 +1171,7 @@ async def set_cursor_visibility( async def type_text( self, - id: str, + id_or_name: str, *, text: str, delay: int | Omit = omit, @@ -1198,11 +1198,11 @@ async def type_text( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/type", id=id), + path_template("/browsers/{id_or_name}/computer/type", id_or_name=id_or_name), body=await async_maybe_transform( { "text": text, @@ -1218,7 +1218,7 @@ async def type_text( async def write_clipboard( self, - id: str, + id_or_name: str, *, text: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1242,11 +1242,11 @@ async def write_clipboard( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/computer/clipboard/write", id=id), + path_template("/browsers/{id_or_name}/computer/clipboard/write", id_or_name=id_or_name), body=await async_maybe_transform( {"text": text}, computer_write_clipboard_params.ComputerWriteClipboardParams ), diff --git a/src/kernel/resources/browsers/fs/fs.py b/src/kernel/resources/browsers/fs/fs.py index 17149d51..a89d86f2 100644 --- a/src/kernel/resources/browsers/fs/fs.py +++ b/src/kernel/resources/browsers/fs/fs.py @@ -97,7 +97,7 @@ def with_streaming_response(self) -> FsResourceWithStreamingResponse: def create_directory( self, - id: str, + id_or_name: str, *, path: str, mode: str | Omit = omit, @@ -124,11 +124,11 @@ def create_directory( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - path_template("/browsers/{id}/fs/create_directory", id=id), + path_template("/browsers/{id_or_name}/fs/create_directory", id_or_name=id_or_name), body=maybe_transform( { "path": path, @@ -144,7 +144,7 @@ def create_directory( def delete_directory( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -168,11 +168,11 @@ def delete_directory( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - path_template("/browsers/{id}/fs/delete_directory", id=id), + path_template("/browsers/{id_or_name}/fs/delete_directory", id_or_name=id_or_name), body=maybe_transform({"path": path}, f_delete_directory_params.FDeleteDirectoryParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -182,7 +182,7 @@ def delete_directory( def delete_file( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -206,11 +206,11 @@ def delete_file( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - path_template("/browsers/{id}/fs/delete_file", id=id), + path_template("/browsers/{id_or_name}/fs/delete_file", id_or_name=id_or_name), body=maybe_transform({"path": path}, f_delete_file_params.FDeleteFileParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -220,7 +220,7 @@ def delete_file( def download_dir_zip( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -244,11 +244,11 @@ def download_dir_zip( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "application/zip", **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/fs/download_dir_zip", id=id), + path_template("/browsers/{id_or_name}/fs/download_dir_zip", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -261,7 +261,7 @@ def download_dir_zip( def file_info( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -285,10 +285,10 @@ def file_info( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._get( - path_template("/browsers/{id}/fs/file_info", id=id), + path_template("/browsers/{id_or_name}/fs/file_info", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -301,7 +301,7 @@ def file_info( def list_files( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -325,10 +325,10 @@ def list_files( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._get( - path_template("/browsers/{id}/fs/list_files", id=id), + path_template("/browsers/{id_or_name}/fs/list_files", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -341,7 +341,7 @@ def list_files( def move( self, - id: str, + id_or_name: str, *, dest_path: str, src_path: str, @@ -368,11 +368,11 @@ def move( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - path_template("/browsers/{id}/fs/move", id=id), + path_template("/browsers/{id_or_name}/fs/move", id_or_name=id_or_name), body=maybe_transform( { "dest_path": dest_path, @@ -388,7 +388,7 @@ def move( def read_file( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -412,11 +412,11 @@ def read_file( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/fs/read_file", id=id), + path_template("/browsers/{id_or_name}/fs/read_file", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -429,7 +429,7 @@ def read_file( def set_file_permissions( self, - id: str, + id_or_name: str, *, mode: str, path: str, @@ -462,11 +462,11 @@ def set_file_permissions( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._put( - path_template("/browsers/{id}/fs/set_file_permissions", id=id), + path_template("/browsers/{id_or_name}/fs/set_file_permissions", id_or_name=id_or_name), body=maybe_transform( { "mode": mode, @@ -484,7 +484,7 @@ def set_file_permissions( def upload( self, - id: str, + id_or_name: str, *, files: Iterable[f_upload_params.File], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -506,8 +506,8 @@ def upload( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} body = deepcopy_with_paths({"files": files}, [["files", "", "file"]]) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "", "file"]]) @@ -516,7 +516,7 @@ def upload( # multipart/form-data; boundary=---abc-- extra_headers["Content-Type"] = "multipart/form-data" return self._post( - path_template("/browsers/{id}/fs/upload", id=id), + path_template("/browsers/{id_or_name}/fs/upload", id_or_name=id_or_name), body=maybe_transform(body, f_upload_params.FUploadParams), files=extracted_files, options=make_request_options( @@ -527,7 +527,7 @@ def upload( def upload_zip( self, - id: str, + id_or_name: str, *, dest_path: str, zip_file: FileTypes, @@ -552,8 +552,8 @@ def upload_zip( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} body = deepcopy_with_paths( { @@ -568,7 +568,7 @@ def upload_zip( # multipart/form-data; boundary=---abc-- extra_headers["Content-Type"] = "multipart/form-data" return self._post( - path_template("/browsers/{id}/fs/upload_zip", id=id), + path_template("/browsers/{id_or_name}/fs/upload_zip", id_or_name=id_or_name), body=maybe_transform(body, f_upload_zip_params.FUploadZipParams), files=files, options=make_request_options( @@ -579,7 +579,7 @@ def upload_zip( def write_file( self, - id: str, + id_or_name: str, contents: FileContent | BinaryTypes, *, path: str, @@ -607,12 +607,12 @@ def write_file( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} extra_headers["Content-Type"] = "application/octet-stream" return self._put( - path_template("/browsers/{id}/fs/write_file", id=id), + path_template("/browsers/{id_or_name}/fs/write_file", id_or_name=id_or_name), content=read_file_content(contents) if isinstance(contents, os.PathLike) else contents, options=make_request_options( extra_headers=extra_headers, @@ -660,7 +660,7 @@ def with_streaming_response(self) -> AsyncFsResourceWithStreamingResponse: async def create_directory( self, - id: str, + id_or_name: str, *, path: str, mode: str | Omit = omit, @@ -687,11 +687,11 @@ async def create_directory( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - path_template("/browsers/{id}/fs/create_directory", id=id), + path_template("/browsers/{id_or_name}/fs/create_directory", id_or_name=id_or_name), body=await async_maybe_transform( { "path": path, @@ -707,7 +707,7 @@ async def create_directory( async def delete_directory( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -731,11 +731,11 @@ async def delete_directory( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - path_template("/browsers/{id}/fs/delete_directory", id=id), + path_template("/browsers/{id_or_name}/fs/delete_directory", id_or_name=id_or_name), body=await async_maybe_transform({"path": path}, f_delete_directory_params.FDeleteDirectoryParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -745,7 +745,7 @@ async def delete_directory( async def delete_file( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -769,11 +769,11 @@ async def delete_file( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - path_template("/browsers/{id}/fs/delete_file", id=id), + path_template("/browsers/{id_or_name}/fs/delete_file", id_or_name=id_or_name), body=await async_maybe_transform({"path": path}, f_delete_file_params.FDeleteFileParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -783,7 +783,7 @@ async def delete_file( async def download_dir_zip( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -807,11 +807,11 @@ async def download_dir_zip( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "application/zip", **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/fs/download_dir_zip", id=id), + path_template("/browsers/{id_or_name}/fs/download_dir_zip", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -824,7 +824,7 @@ async def download_dir_zip( async def file_info( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -848,10 +848,10 @@ async def file_info( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._get( - path_template("/browsers/{id}/fs/file_info", id=id), + path_template("/browsers/{id_or_name}/fs/file_info", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -864,7 +864,7 @@ async def file_info( async def list_files( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -888,10 +888,10 @@ async def list_files( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._get( - path_template("/browsers/{id}/fs/list_files", id=id), + path_template("/browsers/{id_or_name}/fs/list_files", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -904,7 +904,7 @@ async def list_files( async def move( self, - id: str, + id_or_name: str, *, dest_path: str, src_path: str, @@ -931,11 +931,11 @@ async def move( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - path_template("/browsers/{id}/fs/move", id=id), + path_template("/browsers/{id_or_name}/fs/move", id_or_name=id_or_name), body=await async_maybe_transform( { "dest_path": dest_path, @@ -951,7 +951,7 @@ async def move( async def read_file( self, - id: str, + id_or_name: str, *, path: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -975,11 +975,11 @@ async def read_file( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/fs/read_file", id=id), + path_template("/browsers/{id_or_name}/fs/read_file", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -992,7 +992,7 @@ async def read_file( async def set_file_permissions( self, - id: str, + id_or_name: str, *, mode: str, path: str, @@ -1025,11 +1025,11 @@ async def set_file_permissions( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._put( - path_template("/browsers/{id}/fs/set_file_permissions", id=id), + path_template("/browsers/{id_or_name}/fs/set_file_permissions", id_or_name=id_or_name), body=await async_maybe_transform( { "mode": mode, @@ -1047,7 +1047,7 @@ async def set_file_permissions( async def upload( self, - id: str, + id_or_name: str, *, files: Iterable[f_upload_params.File], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -1069,8 +1069,8 @@ async def upload( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} body = deepcopy_with_paths({"files": files}, [["files", "", "file"]]) extracted_files = extract_files(cast(Mapping[str, object], body), paths=[["files", "", "file"]]) @@ -1079,7 +1079,7 @@ async def upload( # multipart/form-data; boundary=---abc-- extra_headers["Content-Type"] = "multipart/form-data" return await self._post( - path_template("/browsers/{id}/fs/upload", id=id), + path_template("/browsers/{id_or_name}/fs/upload", id_or_name=id_or_name), body=await async_maybe_transform(body, f_upload_params.FUploadParams), files=extracted_files, options=make_request_options( @@ -1090,7 +1090,7 @@ async def upload( async def upload_zip( self, - id: str, + id_or_name: str, *, dest_path: str, zip_file: FileTypes, @@ -1115,8 +1115,8 @@ async def upload_zip( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} body = deepcopy_with_paths( { @@ -1131,7 +1131,7 @@ async def upload_zip( # multipart/form-data; boundary=---abc-- extra_headers["Content-Type"] = "multipart/form-data" return await self._post( - path_template("/browsers/{id}/fs/upload_zip", id=id), + path_template("/browsers/{id_or_name}/fs/upload_zip", id_or_name=id_or_name), body=await async_maybe_transform(body, f_upload_zip_params.FUploadZipParams), files=files, options=make_request_options( @@ -1142,7 +1142,7 @@ async def upload_zip( async def write_file( self, - id: str, + id_or_name: str, contents: FileContent | AsyncBinaryTypes, *, path: str, @@ -1170,12 +1170,12 @@ async def write_file( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} extra_headers["Content-Type"] = "application/octet-stream" return await self._put( - path_template("/browsers/{id}/fs/write_file", id=id), + path_template("/browsers/{id_or_name}/fs/write_file", id_or_name=id_or_name), content=await async_read_file_content(contents) if isinstance(contents, os.PathLike) else contents, options=make_request_options( extra_headers=extra_headers, diff --git a/src/kernel/resources/browsers/fs/watch.py b/src/kernel/resources/browsers/fs/watch.py index bc046053..06ba75ef 100644 --- a/src/kernel/resources/browsers/fs/watch.py +++ b/src/kernel/resources/browsers/fs/watch.py @@ -49,7 +49,7 @@ def events( self, watch_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -69,13 +69,15 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not watch_id: raise ValueError(f"Expected a non-empty value for `watch_id` but received {watch_id!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/fs/watch/{watch_id}/events", id=id, watch_id=watch_id), + path_template( + "/browsers/{id_or_name}/fs/watch/{watch_id}/events", id_or_name=id_or_name, watch_id=watch_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -86,7 +88,7 @@ def events( def start( self, - id: str, + id_or_name: str, *, path: str, recursive: bool | Omit = omit, @@ -113,10 +115,10 @@ def start( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/fs/watch", id=id), + path_template("/browsers/{id_or_name}/fs/watch", id_or_name=id_or_name), body=maybe_transform( { "path": path, @@ -134,7 +136,7 @@ def stop( self, watch_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -154,13 +156,13 @@ def stop( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not watch_id: raise ValueError(f"Expected a non-empty value for `watch_id` but received {watch_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._delete( - path_template("/browsers/{id}/fs/watch/{watch_id}", id=id, watch_id=watch_id), + path_template("/browsers/{id_or_name}/fs/watch/{watch_id}", id_or_name=id_or_name, watch_id=watch_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -194,7 +196,7 @@ async def events( self, watch_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -214,13 +216,15 @@ async def events( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not watch_id: raise ValueError(f"Expected a non-empty value for `watch_id` but received {watch_id!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/fs/watch/{watch_id}/events", id=id, watch_id=watch_id), + path_template( + "/browsers/{id_or_name}/fs/watch/{watch_id}/events", id_or_name=id_or_name, watch_id=watch_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -231,7 +235,7 @@ async def events( async def start( self, - id: str, + id_or_name: str, *, path: str, recursive: bool | Omit = omit, @@ -258,10 +262,10 @@ async def start( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/fs/watch", id=id), + path_template("/browsers/{id_or_name}/fs/watch", id_or_name=id_or_name), body=await async_maybe_transform( { "path": path, @@ -279,7 +283,7 @@ async def stop( self, watch_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -299,13 +303,13 @@ async def stop( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not watch_id: raise ValueError(f"Expected a non-empty value for `watch_id` but received {watch_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._delete( - path_template("/browsers/{id}/fs/watch/{watch_id}", id=id, watch_id=watch_id), + path_template("/browsers/{id_or_name}/fs/watch/{watch_id}", id_or_name=id_or_name, watch_id=watch_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/kernel/resources/browsers/logs.py b/src/kernel/resources/browsers/logs.py index 35ee66dc..db65f29b 100644 --- a/src/kernel/resources/browsers/logs.py +++ b/src/kernel/resources/browsers/logs.py @@ -48,7 +48,7 @@ def with_streaming_response(self) -> LogsResourceWithStreamingResponse: def stream( self, - id: str, + id_or_name: str, *, source: Literal["path", "supervisor"], follow: bool | Omit = omit, @@ -77,11 +77,11 @@ def stream( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/logs/stream", id=id), + path_template("/browsers/{id_or_name}/logs/stream", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -127,7 +127,7 @@ def with_streaming_response(self) -> AsyncLogsResourceWithStreamingResponse: async def stream( self, - id: str, + id_or_name: str, *, source: Literal["path", "supervisor"], follow: bool | Omit = omit, @@ -156,11 +156,11 @@ async def stream( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/logs/stream", id=id), + path_template("/browsers/{id_or_name}/logs/stream", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/kernel/resources/browsers/playwright.py b/src/kernel/resources/browsers/playwright.py index 8d261ed5..c1f9cea5 100644 --- a/src/kernel/resources/browsers/playwright.py +++ b/src/kernel/resources/browsers/playwright.py @@ -45,7 +45,7 @@ def with_streaming_response(self) -> PlaywrightResourceWithStreamingResponse: def execute( self, - id: str, + id_or_name: str, *, code: str, timeout_sec: int | Omit = omit, @@ -59,8 +59,11 @@ def execute( """ Execute arbitrary Playwright code in a fresh execution context against the browser. The code runs in the same VM as the browser, minimizing latency and - maximizing throughput. It has access to 'page', 'context', and 'browser' - variables. It can `return` a value, and this value is returned in the response. + maximizing throughput. It has access to 'page', 'context', 'browser', and + 'webmcp' variables. Use 'webmcp.listTools()' to discover browser-wide WebMCP + tools and 'webmcp.invokeTool(toolRef, input?, { timeoutSec? })' to invoke an + exact registration. It can `return` a value, and this value is returned in the + response. Args: code: TypeScript/JavaScript code to execute. The code has access to 'page', 'context', @@ -79,10 +82,10 @@ def execute( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/playwright/execute", id=id), + path_template("/browsers/{id_or_name}/playwright/execute", id_or_name=id_or_name), body=maybe_transform( { "code": code, @@ -121,7 +124,7 @@ def with_streaming_response(self) -> AsyncPlaywrightResourceWithStreamingRespons async def execute( self, - id: str, + id_or_name: str, *, code: str, timeout_sec: int | Omit = omit, @@ -135,8 +138,11 @@ async def execute( """ Execute arbitrary Playwright code in a fresh execution context against the browser. The code runs in the same VM as the browser, minimizing latency and - maximizing throughput. It has access to 'page', 'context', and 'browser' - variables. It can `return` a value, and this value is returned in the response. + maximizing throughput. It has access to 'page', 'context', 'browser', and + 'webmcp' variables. Use 'webmcp.listTools()' to discover browser-wide WebMCP + tools and 'webmcp.invokeTool(toolRef, input?, { timeoutSec? })' to invoke an + exact registration. It can `return` a value, and this value is returned in the + response. Args: code: TypeScript/JavaScript code to execute. The code has access to 'page', 'context', @@ -155,10 +161,10 @@ async def execute( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/playwright/execute", id=id), + path_template("/browsers/{id_or_name}/playwright/execute", id_or_name=id_or_name), body=await async_maybe_transform( { "code": code, diff --git a/src/kernel/resources/browsers/process.py b/src/kernel/resources/browsers/process.py index 83827d38..c792148d 100644 --- a/src/kernel/resources/browsers/process.py +++ b/src/kernel/resources/browsers/process.py @@ -61,7 +61,7 @@ def with_streaming_response(self) -> ProcessResourceWithStreamingResponse: def exec( self, - id: str, + id_or_name: str, *, command: str, args: SequenceNotStr[str] | Omit = omit, @@ -103,10 +103,10 @@ def exec( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/process/exec", id=id), + path_template("/browsers/{id_or_name}/process/exec", id_or_name=id_or_name), body=maybe_transform( { "command": command, @@ -129,7 +129,7 @@ def kill( self, process_id: str, *, - id: str, + id_or_name: str, signal: Literal["TERM", "KILL", "INT", "HUP"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -152,12 +152,14 @@ def kill( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return self._post( - path_template("/browsers/{id}/process/{process_id}/kill", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/kill", id_or_name=id_or_name, process_id=process_id + ), body=maybe_transform({"signal": signal}, process_kill_params.ProcessKillParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -169,7 +171,7 @@ def resize( self, process_id: str, *, - id: str, + id_or_name: str, cols: int, rows: int, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -195,12 +197,14 @@ def resize( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return self._post( - path_template("/browsers/{id}/process/{process_id}/resize", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/resize", id_or_name=id_or_name, process_id=process_id + ), body=maybe_transform( { "cols": cols, @@ -216,7 +220,7 @@ def resize( def spawn( self, - id: str, + id_or_name: str, *, command: str, allocate_tty: bool | Omit = omit, @@ -267,10 +271,10 @@ def spawn( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/process/spawn", id=id), + path_template("/browsers/{id_or_name}/process/spawn", id_or_name=id_or_name), body=maybe_transform( { "command": command, @@ -296,7 +300,7 @@ def status( self, process_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -316,12 +320,14 @@ def status( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return self._get( - path_template("/browsers/{id}/process/{process_id}/status", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/status", id_or_name=id_or_name, process_id=process_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -332,7 +338,7 @@ def stdin( self, process_id: str, *, - id: str, + id_or_name: str, data_b64: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -355,12 +361,14 @@ def stdin( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return self._post( - path_template("/browsers/{id}/process/{process_id}/stdin", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/stdin", id_or_name=id_or_name, process_id=process_id + ), body=maybe_transform({"data_b64": data_b64}, process_stdin_params.ProcessStdinParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -372,7 +380,7 @@ def stdout_stream( self, process_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -392,13 +400,17 @@ def stdout_stream( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/process/{process_id}/stdout/stream", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/stdout/stream", + id_or_name=id_or_name, + process_id=process_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -432,7 +444,7 @@ def with_streaming_response(self) -> AsyncProcessResourceWithStreamingResponse: async def exec( self, - id: str, + id_or_name: str, *, command: str, args: SequenceNotStr[str] | Omit = omit, @@ -474,10 +486,10 @@ async def exec( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/process/exec", id=id), + path_template("/browsers/{id_or_name}/process/exec", id_or_name=id_or_name), body=await async_maybe_transform( { "command": command, @@ -500,7 +512,7 @@ async def kill( self, process_id: str, *, - id: str, + id_or_name: str, signal: Literal["TERM", "KILL", "INT", "HUP"], # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -523,12 +535,14 @@ async def kill( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return await self._post( - path_template("/browsers/{id}/process/{process_id}/kill", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/kill", id_or_name=id_or_name, process_id=process_id + ), body=await async_maybe_transform({"signal": signal}, process_kill_params.ProcessKillParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -540,7 +554,7 @@ async def resize( self, process_id: str, *, - id: str, + id_or_name: str, cols: int, rows: int, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -566,12 +580,14 @@ async def resize( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return await self._post( - path_template("/browsers/{id}/process/{process_id}/resize", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/resize", id_or_name=id_or_name, process_id=process_id + ), body=await async_maybe_transform( { "cols": cols, @@ -587,7 +603,7 @@ async def resize( async def spawn( self, - id: str, + id_or_name: str, *, command: str, allocate_tty: bool | Omit = omit, @@ -638,10 +654,10 @@ async def spawn( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/process/spawn", id=id), + path_template("/browsers/{id_or_name}/process/spawn", id_or_name=id_or_name), body=await async_maybe_transform( { "command": command, @@ -667,7 +683,7 @@ async def status( self, process_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -687,12 +703,14 @@ async def status( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return await self._get( - path_template("/browsers/{id}/process/{process_id}/status", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/status", id_or_name=id_or_name, process_id=process_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -703,7 +721,7 @@ async def stdin( self, process_id: str, *, - id: str, + id_or_name: str, data_b64: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -726,12 +744,14 @@ async def stdin( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") return await self._post( - path_template("/browsers/{id}/process/{process_id}/stdin", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/stdin", id_or_name=id_or_name, process_id=process_id + ), body=await async_maybe_transform({"data_b64": data_b64}, process_stdin_params.ProcessStdinParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout @@ -743,7 +763,7 @@ async def stdout_stream( self, process_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -763,13 +783,17 @@ async def stdout_stream( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not process_id: raise ValueError(f"Expected a non-empty value for `process_id` but received {process_id!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/process/{process_id}/stdout/stream", id=id, process_id=process_id), + path_template( + "/browsers/{id_or_name}/process/{process_id}/stdout/stream", + id_or_name=id_or_name, + process_id=process_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/kernel/resources/browsers/replays.py b/src/kernel/resources/browsers/replays.py index e58f8333..d74ce81c 100644 --- a/src/kernel/resources/browsers/replays.py +++ b/src/kernel/resources/browsers/replays.py @@ -54,7 +54,7 @@ def with_streaming_response(self) -> ReplaysResourceWithStreamingResponse: def list( self, - id: str, + id_or_name: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -75,10 +75,10 @@ def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._get( - path_template("/browsers/{id}/replays", id=id), + path_template("/browsers/{id_or_name}/replays", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -89,7 +89,7 @@ def download( self, replay_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -109,13 +109,13 @@ def download( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not replay_id: raise ValueError(f"Expected a non-empty value for `replay_id` but received {replay_id!r}") extra_headers = {"Accept": "video/mp4", **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/replays/{replay_id}", id=id, replay_id=replay_id), + path_template("/browsers/{id_or_name}/replays/{replay_id}", id_or_name=id_or_name, replay_id=replay_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -124,7 +124,7 @@ def download( def start( self, - id: str, + id_or_name: str, *, framerate: int | Omit = omit, max_duration_in_seconds: int | Omit = omit, @@ -156,10 +156,10 @@ def start( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._post( - path_template("/browsers/{id}/replays", id=id), + path_template("/browsers/{id_or_name}/replays", id_or_name=id_or_name), body=maybe_transform( { "framerate": framerate, @@ -178,7 +178,7 @@ def stop( self, replay_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -198,13 +198,15 @@ def stop( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not replay_id: raise ValueError(f"Expected a non-empty value for `replay_id` but received {replay_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return self._post( - path_template("/browsers/{id}/replays/{replay_id}/stop", id=id, replay_id=replay_id), + path_template( + "/browsers/{id_or_name}/replays/{replay_id}/stop", id_or_name=id_or_name, replay_id=replay_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -236,7 +238,7 @@ def with_streaming_response(self) -> AsyncReplaysResourceWithStreamingResponse: async def list( self, - id: str, + id_or_name: str, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. @@ -257,10 +259,10 @@ async def list( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._get( - path_template("/browsers/{id}/replays", id=id), + path_template("/browsers/{id_or_name}/replays", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -271,7 +273,7 @@ async def download( self, replay_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -291,13 +293,13 @@ async def download( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not replay_id: raise ValueError(f"Expected a non-empty value for `replay_id` but received {replay_id!r}") extra_headers = {"Accept": "video/mp4", **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/replays/{replay_id}", id=id, replay_id=replay_id), + path_template("/browsers/{id_or_name}/replays/{replay_id}", id_or_name=id_or_name, replay_id=replay_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -306,7 +308,7 @@ async def download( async def start( self, - id: str, + id_or_name: str, *, framerate: int | Omit = omit, max_duration_in_seconds: int | Omit = omit, @@ -338,10 +340,10 @@ async def start( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return await self._post( - path_template("/browsers/{id}/replays", id=id), + path_template("/browsers/{id_or_name}/replays", id_or_name=id_or_name), body=await async_maybe_transform( { "framerate": framerate, @@ -360,7 +362,7 @@ async def stop( self, replay_id: str, *, - id: str, + id_or_name: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -380,13 +382,15 @@ async def stop( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") if not replay_id: raise ValueError(f"Expected a non-empty value for `replay_id` but received {replay_id!r}") extra_headers = {"Accept": "*/*", **(extra_headers or {})} return await self._post( - path_template("/browsers/{id}/replays/{replay_id}/stop", id=id, replay_id=replay_id), + path_template( + "/browsers/{id_or_name}/replays/{replay_id}/stop", id_or_name=id_or_name, replay_id=replay_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), diff --git a/src/kernel/resources/browsers/telemetry.py b/src/kernel/resources/browsers/telemetry.py index c6fa04ea..367ac734 100644 --- a/src/kernel/resources/browsers/telemetry.py +++ b/src/kernel/resources/browsers/telemetry.py @@ -53,7 +53,7 @@ def with_streaming_response(self) -> TelemetryResourceWithStreamingResponse: def events( self, - id: str, + id_or_name: str, *, category: List[ Literal[ @@ -122,10 +122,10 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._get_api_list( - path_template("/browsers/{id}/telemetry/events", id=id), + path_template("/browsers/{id_or_name}/telemetry/events", id_or_name=id_or_name), page=SyncOffsetPagination[TelemetryEventsResponse], options=make_request_options( extra_headers=extra_headers, @@ -149,7 +149,7 @@ def events( def stream( self, - id: str, + id_or_name: str, *, replay: str | Omit = omit, last_event_id: str | Omit = omit, @@ -185,12 +185,12 @@ def stream( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} extra_headers = {**strip_not_given({"Last-Event-ID": last_event_id}), **(extra_headers or {})} return self._get( - path_template("/browsers/{id}/telemetry/stream", id=id), + path_template("/browsers/{id_or_name}/telemetry/stream", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -230,7 +230,7 @@ def with_streaming_response(self) -> AsyncTelemetryResourceWithStreamingResponse def events( self, - id: str, + id_or_name: str, *, category: List[ Literal[ @@ -299,10 +299,10 @@ def events( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") return self._get_api_list( - path_template("/browsers/{id}/telemetry/events", id=id), + path_template("/browsers/{id_or_name}/telemetry/events", id_or_name=id_or_name), page=AsyncOffsetPagination[TelemetryEventsResponse], options=make_request_options( extra_headers=extra_headers, @@ -326,7 +326,7 @@ def events( async def stream( self, - id: str, + id_or_name: str, *, replay: str | Omit = omit, last_event_id: str | Omit = omit, @@ -362,12 +362,12 @@ async def stream( timeout: Override the client-level default timeout for this request, in seconds """ - if not id: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") extra_headers = {"Accept": "text/event-stream", **(extra_headers or {})} extra_headers = {**strip_not_given({"Last-Event-ID": last_event_id}), **(extra_headers or {})} return await self._get( - path_template("/browsers/{id}/telemetry/stream", id=id), + path_template("/browsers/{id_or_name}/telemetry/stream", id_or_name=id_or_name), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, diff --git a/src/kernel/resources/browsers/webmcp.py b/src/kernel/resources/browsers/webmcp.py new file mode 100644 index 00000000..00f571de --- /dev/null +++ b/src/kernel/resources/browsers/webmcp.py @@ -0,0 +1,288 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.browsers import webmcp_invoke_tool_params +from ...types.browsers.tools_response import ToolsResponse +from ...types.browsers.invocation_result import InvocationResult + +__all__ = ["WebmcpResource", "AsyncWebmcpResource"] + + +class WebmcpResource(SyncAPIResource): + """Discover and invoke native page tools across the browser instance.""" + + @cached_property + def with_raw_response(self) -> WebmcpResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/kernel/kernel-python-sdk#accessing-raw-response-data-eg-headers + """ + return WebmcpResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> WebmcpResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/kernel/kernel-python-sdk#with_streaming_response + """ + return WebmcpResourceWithStreamingResponse(self) + + def invoke_tool( + self, + id_or_name: str, + *, + input: Dict[str, object], + tool_ref: str, + timeout_sec: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InvocationResult: + """ + Invokes the exact live registration identified by tool_ref and waits + synchronously for its result. Navigation during execution is allowed. If the tab + or embedded frame disappears, or the request times out after invocation begins, + the response reports outcome_unknown and the tool is not retried. + + Args: + input: Tool input, limited to 1 MiB after JSON serialization. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") + return self._post( + path_template("/browsers/{id_or_name}/webmcp/invoke", id_or_name=id_or_name), + body=maybe_transform( + { + "input": input, + "tool_ref": tool_ref, + "timeout_sec": timeout_sec, + }, + webmcp_invoke_tool_params.WebmcpInvokeToolParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InvocationResult, + ) + + def list_tools( + self, + id_or_name: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ToolsResponse: + """ + Returns a snapshot of native WebMCP tools available across every open tab and + embedded frame in the browser. Each tool includes an opaque tool_ref for + invoking that exact live registration. Tools disappear when their document + closes or navigates away. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") + return self._get( + path_template("/browsers/{id_or_name}/webmcp/tools", id_or_name=id_or_name), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ToolsResponse, + ) + + +class AsyncWebmcpResource(AsyncAPIResource): + """Discover and invoke native page tools across the browser instance.""" + + @cached_property + def with_raw_response(self) -> AsyncWebmcpResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/kernel/kernel-python-sdk#accessing-raw-response-data-eg-headers + """ + return AsyncWebmcpResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncWebmcpResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/kernel/kernel-python-sdk#with_streaming_response + """ + return AsyncWebmcpResourceWithStreamingResponse(self) + + async def invoke_tool( + self, + id_or_name: str, + *, + input: Dict[str, object], + tool_ref: str, + timeout_sec: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InvocationResult: + """ + Invokes the exact live registration identified by tool_ref and waits + synchronously for its result. Navigation during execution is allowed. If the tab + or embedded frame disappears, or the request times out after invocation begins, + the response reports outcome_unknown and the tool is not retried. + + Args: + input: Tool input, limited to 1 MiB after JSON serialization. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") + return await self._post( + path_template("/browsers/{id_or_name}/webmcp/invoke", id_or_name=id_or_name), + body=await async_maybe_transform( + { + "input": input, + "tool_ref": tool_ref, + "timeout_sec": timeout_sec, + }, + webmcp_invoke_tool_params.WebmcpInvokeToolParams, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InvocationResult, + ) + + async def list_tools( + self, + id_or_name: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> ToolsResponse: + """ + Returns a snapshot of native WebMCP tools available across every open tab and + embedded frame in the browser. Each tool includes an opaque tool_ref for + invoking that exact live registration. Tools disappear when their document + closes or navigates away. + + Args: + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not id_or_name: + raise ValueError(f"Expected a non-empty value for `id_or_name` but received {id_or_name!r}") + return await self._get( + path_template("/browsers/{id_or_name}/webmcp/tools", id_or_name=id_or_name), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=ToolsResponse, + ) + + +class WebmcpResourceWithRawResponse: + def __init__(self, webmcp: WebmcpResource) -> None: + self._webmcp = webmcp + + self.invoke_tool = to_raw_response_wrapper( + webmcp.invoke_tool, + ) + self.list_tools = to_raw_response_wrapper( + webmcp.list_tools, + ) + + +class AsyncWebmcpResourceWithRawResponse: + def __init__(self, webmcp: AsyncWebmcpResource) -> None: + self._webmcp = webmcp + + self.invoke_tool = async_to_raw_response_wrapper( + webmcp.invoke_tool, + ) + self.list_tools = async_to_raw_response_wrapper( + webmcp.list_tools, + ) + + +class WebmcpResourceWithStreamingResponse: + def __init__(self, webmcp: WebmcpResource) -> None: + self._webmcp = webmcp + + self.invoke_tool = to_streamed_response_wrapper( + webmcp.invoke_tool, + ) + self.list_tools = to_streamed_response_wrapper( + webmcp.list_tools, + ) + + +class AsyncWebmcpResourceWithStreamingResponse: + def __init__(self, webmcp: AsyncWebmcpResource) -> None: + self._webmcp = webmcp + + self.invoke_tool = async_to_streamed_response_wrapper( + webmcp.invoke_tool, + ) + self.list_tools = async_to_streamed_response_wrapper( + webmcp.list_tools, + ) diff --git a/src/kernel/resources/telemetry/destinations.py b/src/kernel/resources/telemetry/destinations.py index 09442435..4d6592fc 100644 --- a/src/kernel/resources/telemetry/destinations.py +++ b/src/kernel/resources/telemetry/destinations.py @@ -62,10 +62,11 @@ def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OtlpDestination: - """Create an OTLP export destination in the resolved project. + """Create an OTLP export destination in the authenticated organization. - Names must be unique - within the project. + Names must + be unique within the organization. Requires an organization-scoped credential or + dashboard authentication; project-scoped credentials receive a 403. Args: endpoint: Base endpoint of the OTLP/HTTP collector, without a signal path. Kernel appends @@ -80,7 +81,7 @@ def create( `https://otlp.datadoghq.com` (Datadog's OTLP intake for US1, not its logs intake). - name: Unique within the project. + name: Unique within the organization. headers: Headers sent with each export request, typically an ingestion key. Encrypted at rest and returned redacted. Names and values must be valid HTTP header tokens, @@ -125,7 +126,10 @@ def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OtlpDestination: """ - Retrieve a single OTLP destination in the resolved project by its ID or name. + Retrieve a customer-visible OTLP destination in the authenticated organization + by its ID or name. Project-scoped credentials can retrieve these destinations + for selection by workloads in their project. Non-dashboard reads return header + values redacted. Args: extra_headers: Send extra headers @@ -167,10 +171,11 @@ def update( values without restarting, which makes this the way to rotate credentials without interrupting export. - Names must be unique within the project. Renaming is refused with a 409 while a - managed auth connection selects this destination by name, since that connection - resolves the name on every login. Every other field, including `headers`, stays - editable. + Names must be unique within the organization. Renaming is refused with a 409 + while a managed auth connection selects this destination by name, since that + connection resolves the name on every login. Every other field, including + `headers`, stays editable. Requires an organization-scoped credential or + dashboard authentication; project-scoped credentials receive a 403. Args: endpoint: Base endpoint of the OTLP/HTTP collector, without a signal path. Same rules as @@ -225,8 +230,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncOffsetPagination[OtlpDestination]: - """ - List OTLP export destinations in the resolved project. + """List customer-visible OTLP export destinations in the authenticated + organization. + + Project-scoped credentials can list these destinations for + selection by workloads in their project. Non-dashboard reads return header + values redacted. Args: limit: Limit the number of destinations to return. @@ -286,6 +295,8 @@ def delete( end or delete them first. It is refused the same way while a managed auth connection still selects it, because that connection re-resolves the destination on every login, and while a managed auth login using it is still in progress. + Requires an organization-scoped credential or dashboard authentication; + project-scoped credentials receive a 403. Args: extra_headers: Send extra headers @@ -346,10 +357,11 @@ async def create( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OtlpDestination: - """Create an OTLP export destination in the resolved project. + """Create an OTLP export destination in the authenticated organization. - Names must be unique - within the project. + Names must + be unique within the organization. Requires an organization-scoped credential or + dashboard authentication; project-scoped credentials receive a 403. Args: endpoint: Base endpoint of the OTLP/HTTP collector, without a signal path. Kernel appends @@ -364,7 +376,7 @@ async def create( `https://otlp.datadoghq.com` (Datadog's OTLP intake for US1, not its logs intake). - name: Unique within the project. + name: Unique within the organization. headers: Headers sent with each export request, typically an ingestion key. Encrypted at rest and returned redacted. Names and values must be valid HTTP header tokens, @@ -409,7 +421,10 @@ async def retrieve( timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OtlpDestination: """ - Retrieve a single OTLP destination in the resolved project by its ID or name. + Retrieve a customer-visible OTLP destination in the authenticated organization + by its ID or name. Project-scoped credentials can retrieve these destinations + for selection by workloads in their project. Non-dashboard reads return header + values redacted. Args: extra_headers: Send extra headers @@ -451,10 +466,11 @@ async def update( values without restarting, which makes this the way to rotate credentials without interrupting export. - Names must be unique within the project. Renaming is refused with a 409 while a - managed auth connection selects this destination by name, since that connection - resolves the name on every login. Every other field, including `headers`, stays - editable. + Names must be unique within the organization. Renaming is refused with a 409 + while a managed auth connection selects this destination by name, since that + connection resolves the name on every login. Every other field, including + `headers`, stays editable. Requires an organization-scoped credential or + dashboard authentication; project-scoped credentials receive a 403. Args: endpoint: Base endpoint of the OTLP/HTTP collector, without a signal path. Same rules as @@ -509,8 +525,12 @@ def list( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[OtlpDestination, AsyncOffsetPagination[OtlpDestination]]: - """ - List OTLP export destinations in the resolved project. + """List customer-visible OTLP export destinations in the authenticated + organization. + + Project-scoped credentials can list these destinations for + selection by workloads in their project. Non-dashboard reads return header + values redacted. Args: limit: Limit the number of destinations to return. @@ -570,6 +590,8 @@ async def delete( end or delete them first. It is refused the same way while a managed auth connection still selects it, because that connection re-resolves the destination on every login, and while a managed auth login using it is still in progress. + Requires an organization-scoped credential or dashboard authentication; + project-scoped credentials receive a 403. Args: extra_headers: Send extra headers diff --git a/src/kernel/types/browsers/__init__.py b/src/kernel/types/browsers/__init__.py index 927f8a40..34ed9b73 100644 --- a/src/kernel/types/browsers/__init__.py +++ b/src/kernel/types/browsers/__init__.py @@ -2,8 +2,14 @@ from __future__ import annotations +from .tool import Tool as Tool +from .tool_frame import ToolFrame as ToolFrame +from .tool_source import ToolSource as ToolSource from .f_move_params import FMoveParams as FMoveParams +from .tools_response import ToolsResponse as ToolsResponse from .f_upload_params import FUploadParams as FUploadParams +from .tool_annotations import ToolAnnotations as ToolAnnotations +from .invocation_result import InvocationResult as InvocationResult from .log_stream_params import LogStreamParams as LogStreamParams from .browser_call_stack import BrowserCallStack as BrowserCallStack from .f_file_info_params import FFileInfoParams as FFileInfoParams @@ -52,6 +58,7 @@ from .playwright_execute_params import PlaywrightExecuteParams as PlaywrightExecuteParams from .telemetry_events_response import TelemetryEventsResponse as TelemetryEventsResponse from .telemetry_stream_response import TelemetryStreamResponse as TelemetryStreamResponse +from .webmcp_invoke_tool_params import WebmcpInvokeToolParams as WebmcpInvokeToolParams from .browser_cdp_command_method import BrowserCdpCommandMethod as BrowserCdpCommandMethod from .browser_network_idle_event import BrowserNetworkIdleEvent as BrowserNetworkIdleEvent from .browser_page_crashed_event import BrowserPageCrashedEvent as BrowserPageCrashedEvent diff --git a/src/kernel/types/browsers/invocation_result.py b/src/kernel/types/browsers/invocation_result.py new file mode 100644 index 00000000..7ecd69ce --- /dev/null +++ b/src/kernel/types/browsers/invocation_result.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel + +__all__ = ["InvocationResult"] + + +class InvocationResult(BaseModel): + invocation_id: str + + status: Literal["completed", "canceled", "error"] + + error_text: Optional[str] = None + + output: Optional[object] = None + """Untrusted page-provided output. + + Callers must treat it as potentially malicious input. + """ diff --git a/src/kernel/types/browsers/process_kill_params.py b/src/kernel/types/browsers/process_kill_params.py index 84be2770..def8a7c1 100644 --- a/src/kernel/types/browsers/process_kill_params.py +++ b/src/kernel/types/browsers/process_kill_params.py @@ -8,7 +8,7 @@ class ProcessKillParams(TypedDict, total=False): - id: Required[str] + id_or_name: Required[str] signal: Required[Literal["TERM", "KILL", "INT", "HUP"]] """Signal to send.""" diff --git a/src/kernel/types/browsers/process_resize_params.py b/src/kernel/types/browsers/process_resize_params.py index 4fdb8ad5..5a7532ed 100644 --- a/src/kernel/types/browsers/process_resize_params.py +++ b/src/kernel/types/browsers/process_resize_params.py @@ -8,7 +8,7 @@ class ProcessResizeParams(TypedDict, total=False): - id: Required[str] + id_or_name: Required[str] cols: Required[int] """New terminal columns.""" diff --git a/src/kernel/types/browsers/process_stdin_params.py b/src/kernel/types/browsers/process_stdin_params.py index 9ece9a57..c999fa64 100644 --- a/src/kernel/types/browsers/process_stdin_params.py +++ b/src/kernel/types/browsers/process_stdin_params.py @@ -8,7 +8,7 @@ class ProcessStdinParams(TypedDict, total=False): - id: Required[str] + id_or_name: Required[str] data_b64: Required[str] """Base64-encoded data to write.""" diff --git a/src/kernel/types/browsers/tool.py b/src/kernel/types/browsers/tool.py new file mode 100644 index 00000000..12e63767 --- /dev/null +++ b/src/kernel/types/browsers/tool.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Dict, Optional + +from ..._models import BaseModel +from .tool_source import ToolSource +from .tool_annotations import ToolAnnotations + +__all__ = ["Tool"] + + +class Tool(BaseModel): + description: str + + input_schema: Dict[str, object] + + name: str + + source: ToolSource + + tool_ref: str + """Opaque reference for invoking this exact live registration. + + It becomes invalid when its document or browser process is replaced. + """ + + annotations: Optional[ToolAnnotations] = None + """Page-provided behavioral hints. + + These values are untrusted and are not enforced by Kernel. + """ diff --git a/src/kernel/types/browsers/tool_annotations.py b/src/kernel/types/browsers/tool_annotations.py new file mode 100644 index 00000000..9f9b097d --- /dev/null +++ b/src/kernel/types/browsers/tool_annotations.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ToolAnnotations"] + + +class ToolAnnotations(BaseModel): + """Page-provided behavioral hints. + + These values are untrusted and are not enforced by Kernel. + """ + + autosubmit: bool + + consequential: bool + + read_only: bool + + untrusted_content: bool diff --git a/src/kernel/types/browsers/tool_frame.py b/src/kernel/types/browsers/tool_frame.py new file mode 100644 index 00000000..687994f1 --- /dev/null +++ b/src/kernel/types/browsers/tool_frame.py @@ -0,0 +1,16 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from ..._models import BaseModel + +__all__ = ["ToolFrame"] + + +class ToolFrame(BaseModel): + frame_id: int + """ + Monotonically increasing identifier for this embedded frame during the current + browser process. + """ + + url: str + """Current frame URL with the fragment omitted.""" diff --git a/src/kernel/types/browsers/tool_source.py b/src/kernel/types/browsers/tool_source.py new file mode 100644 index 00000000..ed95f856 --- /dev/null +++ b/src/kernel/types/browsers/tool_source.py @@ -0,0 +1,34 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional + +from ..._models import BaseModel +from .tool_frame import ToolFrame + +__all__ = ["ToolSource"] + + +class ToolSource(BaseModel): + frame: Optional[ToolFrame] = None + """ + Embedded frame that registered the tool, or null when the top-level page + registered it. + """ + + page_title: str + """Current title of the top-level page.""" + + page_url: str + """Current URL of the top-level page with the fragment omitted.""" + + tab_id: int + """ + Monotonically increasing identifier for the tab during the current browser + process. + """ + + window_id: int + """ + Monotonically increasing identifier for the browser window during the current + browser process. + """ diff --git a/src/kernel/types/browsers/tools_response.py b/src/kernel/types/browsers/tools_response.py new file mode 100644 index 00000000..85952306 --- /dev/null +++ b/src/kernel/types/browsers/tools_response.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List + +from .tool import Tool +from ..._models import BaseModel + +__all__ = ["ToolsResponse"] + + +class ToolsResponse(BaseModel): + tools: List[Tool] diff --git a/src/kernel/types/browsers/webmcp_invoke_tool_params.py b/src/kernel/types/browsers/webmcp_invoke_tool_params.py new file mode 100644 index 00000000..99f0f25f --- /dev/null +++ b/src/kernel/types/browsers/webmcp_invoke_tool_params.py @@ -0,0 +1,17 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict +from typing_extensions import Required, TypedDict + +__all__ = ["WebmcpInvokeToolParams"] + + +class WebmcpInvokeToolParams(TypedDict, total=False): + input: Required[Dict[str, object]] + """Tool input, limited to 1 MiB after JSON serialization.""" + + tool_ref: Required[str] + + timeout_sec: int diff --git a/src/kernel/types/telemetry/destination_create_params.py b/src/kernel/types/telemetry/destination_create_params.py index 882f7cc6..5d10b71f 100644 --- a/src/kernel/types/telemetry/destination_create_params.py +++ b/src/kernel/types/telemetry/destination_create_params.py @@ -25,7 +25,7 @@ class DestinationCreateParams(TypedDict, total=False): """ name: Required[str] - """Unique within the project.""" + """Unique within the organization.""" description: str diff --git a/src/kernel/types/telemetry/otlp_destination.py b/src/kernel/types/telemetry/otlp_destination.py index c6e6f2bc..0afe6ae8 100644 --- a/src/kernel/types/telemetry/otlp_destination.py +++ b/src/kernel/types/telemetry/otlp_destination.py @@ -25,12 +25,12 @@ class OtlpDestination(BaseModel): """Headers sent with each export request. Names are returned in canonical form (`Authorization`, not `authorization`). - Values are returned redacted as empty strings, so the keys are visible but the - credentials are not. + Non-dashboard reads return values redacted as empty strings, so the keys are + visible but the credentials are not. Dashboard reads return the stored values. """ name: str - """Unique within the project. + """Unique within the organization. Usable in place of the ID when selecting a destination, so it cannot be shaped like an ID. diff --git a/tests/api_resources/browsers/fs/test_watch.py b/tests/api_resources/browsers/fs/test_watch.py index b28086ba..e81b2ade 100644 --- a/tests/api_resources/browsers/fs/test_watch.py +++ b/tests/api_resources/browsers/fs/test_watch.py @@ -22,7 +22,7 @@ class TestWatch: def test_method_events(self, client: Kernel) -> None: watch_stream = client.browsers.fs.watch.events( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) watch_stream.response.close() @@ -31,7 +31,7 @@ def test_method_events(self, client: Kernel) -> None: def test_raw_response_events(self, client: Kernel) -> None: response = client.browsers.fs.watch.with_raw_response.events( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -43,7 +43,7 @@ def test_raw_response_events(self, client: Kernel) -> None: def test_streaming_response_events(self, client: Kernel) -> None: with client.browsers.fs.watch.with_streaming_response.events( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,23 +56,23 @@ def test_streaming_response_events(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_events(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.watch.with_raw_response.events( watch_id="watch_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `watch_id` but received ''"): client.browsers.fs.watch.with_raw_response.events( watch_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_start(self, client: Kernel) -> None: watch = client.browsers.fs.watch.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", ) assert_matches_type(WatchStartResponse, watch, path=["response"]) @@ -81,7 +81,7 @@ def test_method_start(self, client: Kernel) -> None: @parametrize def test_method_start_with_all_params(self, client: Kernel) -> None: watch = client.browsers.fs.watch.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", recursive=True, ) @@ -91,7 +91,7 @@ def test_method_start_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_start(self, client: Kernel) -> None: response = client.browsers.fs.watch.with_raw_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", ) @@ -104,7 +104,7 @@ def test_raw_response_start(self, client: Kernel) -> None: @parametrize def test_streaming_response_start(self, client: Kernel) -> None: with client.browsers.fs.watch.with_streaming_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", ) as response: assert not response.is_closed @@ -118,9 +118,9 @@ def test_streaming_response_start(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_start(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.watch.with_raw_response.start( - id="", + id_or_name="", path="path", ) @@ -129,7 +129,7 @@ def test_path_params_start(self, client: Kernel) -> None: def test_method_stop(self, client: Kernel) -> None: watch = client.browsers.fs.watch.stop( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert watch is None @@ -138,7 +138,7 @@ def test_method_stop(self, client: Kernel) -> None: def test_raw_response_stop(self, client: Kernel) -> None: response = client.browsers.fs.watch.with_raw_response.stop( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -151,7 +151,7 @@ def test_raw_response_stop(self, client: Kernel) -> None: def test_streaming_response_stop(self, client: Kernel) -> None: with client.browsers.fs.watch.with_streaming_response.stop( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -164,16 +164,16 @@ def test_streaming_response_stop(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stop(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.watch.with_raw_response.stop( watch_id="watch_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `watch_id` but received ''"): client.browsers.fs.watch.with_raw_response.stop( watch_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @@ -187,7 +187,7 @@ class TestAsyncWatch: async def test_method_events(self, async_client: AsyncKernel) -> None: watch_stream = await async_client.browsers.fs.watch.events( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) await watch_stream.response.aclose() @@ -196,7 +196,7 @@ async def test_method_events(self, async_client: AsyncKernel) -> None: async def test_raw_response_events(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.watch.with_raw_response.events( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -208,7 +208,7 @@ async def test_raw_response_events(self, async_client: AsyncKernel) -> None: async def test_streaming_response_events(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.watch.with_streaming_response.events( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -221,23 +221,23 @@ async def test_streaming_response_events(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_events(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.watch.with_raw_response.events( watch_id="watch_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `watch_id` but received ''"): await async_client.browsers.fs.watch.with_raw_response.events( watch_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_start(self, async_client: AsyncKernel) -> None: watch = await async_client.browsers.fs.watch.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", ) assert_matches_type(WatchStartResponse, watch, path=["response"]) @@ -246,7 +246,7 @@ async def test_method_start(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_start_with_all_params(self, async_client: AsyncKernel) -> None: watch = await async_client.browsers.fs.watch.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", recursive=True, ) @@ -256,7 +256,7 @@ async def test_method_start_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_start(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.watch.with_raw_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", ) @@ -269,7 +269,7 @@ async def test_raw_response_start(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_start(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.watch.with_streaming_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="path", ) as response: assert not response.is_closed @@ -283,9 +283,9 @@ async def test_streaming_response_start(self, async_client: AsyncKernel) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_start(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.watch.with_raw_response.start( - id="", + id_or_name="", path="path", ) @@ -294,7 +294,7 @@ async def test_path_params_start(self, async_client: AsyncKernel) -> None: async def test_method_stop(self, async_client: AsyncKernel) -> None: watch = await async_client.browsers.fs.watch.stop( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert watch is None @@ -303,7 +303,7 @@ async def test_method_stop(self, async_client: AsyncKernel) -> None: async def test_raw_response_stop(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.watch.with_raw_response.stop( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -316,7 +316,7 @@ async def test_raw_response_stop(self, async_client: AsyncKernel) -> None: async def test_streaming_response_stop(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.watch.with_streaming_response.stop( watch_id="watch_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -329,14 +329,14 @@ async def test_streaming_response_stop(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stop(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.watch.with_raw_response.stop( watch_id="watch_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `watch_id` but received ''"): await async_client.browsers.fs.watch.with_raw_response.stop( watch_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) diff --git a/tests/api_resources/browsers/test_computer.py b/tests/api_resources/browsers/test_computer.py index 31974d5b..916dbcb0 100644 --- a/tests/api_resources/browsers/test_computer.py +++ b/tests/api_resources/browsers/test_computer.py @@ -33,7 +33,7 @@ class TestComputer: @parametrize def test_method_batch(self, client: Kernel) -> None: computer = client.browsers.computer.batch( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", actions=[{"type": "click_mouse"}], ) assert computer is None @@ -42,7 +42,7 @@ def test_method_batch(self, client: Kernel) -> None: @parametrize def test_raw_response_batch(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.batch( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", actions=[{"type": "click_mouse"}], ) @@ -55,7 +55,7 @@ def test_raw_response_batch(self, client: Kernel) -> None: @parametrize def test_streaming_response_batch(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.batch( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", actions=[{"type": "click_mouse"}], ) as response: assert not response.is_closed @@ -69,18 +69,20 @@ def test_streaming_response_batch(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_batch(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.batch( - id="", + id_or_name="", actions=[{"type": "click_mouse"}], ) @parametrize @pytest.mark.respx(base_url=base_url) def test_method_capture_screenshot(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) computer = client.browsers.computer.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert computer.is_closed assert computer.json() == {"foo": "bar"} @@ -90,9 +92,11 @@ def test_method_capture_screenshot(self, client: Kernel, respx_mock: MockRouter) @parametrize @pytest.mark.respx(base_url=base_url) def test_method_capture_screenshot_with_all_params(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) computer = client.browsers.computer.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", region={ "height": 0, "width": 0, @@ -108,10 +112,12 @@ def test_method_capture_screenshot_with_all_params(self, client: Kernel, respx_m @parametrize @pytest.mark.respx(base_url=base_url) def test_raw_response_capture_screenshot(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) computer = client.browsers.computer.with_raw_response.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert computer.is_closed is True @@ -122,9 +128,11 @@ def test_raw_response_capture_screenshot(self, client: Kernel, respx_mock: MockR @parametrize @pytest.mark.respx(base_url=base_url) def test_streaming_response_capture_screenshot(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) with client.browsers.computer.with_streaming_response.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as computer: assert not computer.is_closed assert computer.http_request.headers.get("X-Stainless-Lang") == "python" @@ -138,16 +146,16 @@ def test_streaming_response_capture_screenshot(self, client: Kernel, respx_mock: @parametrize @pytest.mark.respx(base_url=base_url) def test_path_params_capture_screenshot(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.capture_screenshot( - id="", + id_or_name="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_click_mouse(self, client: Kernel) -> None: computer = client.browsers.computer.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -157,7 +165,7 @@ def test_method_click_mouse(self, client: Kernel) -> None: @parametrize def test_method_click_mouse_with_all_params(self, client: Kernel) -> None: computer = client.browsers.computer.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, button="left", @@ -171,7 +179,7 @@ def test_method_click_mouse_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_click_mouse(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -185,7 +193,7 @@ def test_raw_response_click_mouse(self, client: Kernel) -> None: @parametrize def test_streaming_response_click_mouse(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) as response: @@ -200,9 +208,9 @@ def test_streaming_response_click_mouse(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_click_mouse(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.click_mouse( - id="", + id_or_name="", x=0, y=0, ) @@ -211,7 +219,7 @@ def test_path_params_click_mouse(self, client: Kernel) -> None: @parametrize def test_method_drag_mouse(self, client: Kernel) -> None: computer = client.browsers.computer.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], ) assert computer is None @@ -220,7 +228,7 @@ def test_method_drag_mouse(self, client: Kernel) -> None: @parametrize def test_method_drag_mouse_with_all_params(self, client: Kernel) -> None: computer = client.browsers.computer.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], button="left", delay=0, @@ -236,7 +244,7 @@ def test_method_drag_mouse_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_drag_mouse(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], ) @@ -249,7 +257,7 @@ def test_raw_response_drag_mouse(self, client: Kernel) -> None: @parametrize def test_streaming_response_drag_mouse(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], ) as response: assert not response.is_closed @@ -263,9 +271,9 @@ def test_streaming_response_drag_mouse(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_drag_mouse(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.drag_mouse( - id="", + id_or_name="", path=[[0, 0], [0, 0]], ) @@ -273,7 +281,7 @@ def test_path_params_drag_mouse(self, client: Kernel) -> None: @parametrize def test_method_get_mouse_position(self, client: Kernel) -> None: computer = client.browsers.computer.get_mouse_position( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ComputerGetMousePositionResponse, computer, path=["response"]) @@ -281,7 +289,7 @@ def test_method_get_mouse_position(self, client: Kernel) -> None: @parametrize def test_raw_response_get_mouse_position(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.get_mouse_position( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -293,7 +301,7 @@ def test_raw_response_get_mouse_position(self, client: Kernel) -> None: @parametrize def test_streaming_response_get_mouse_position(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.get_mouse_position( - "id", + "htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -306,7 +314,7 @@ def test_streaming_response_get_mouse_position(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_get_mouse_position(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.get_mouse_position( "", ) @@ -315,7 +323,7 @@ def test_path_params_get_mouse_position(self, client: Kernel) -> None: @parametrize def test_method_move_mouse(self, client: Kernel) -> None: computer = client.browsers.computer.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -325,7 +333,7 @@ def test_method_move_mouse(self, client: Kernel) -> None: @parametrize def test_method_move_mouse_with_all_params(self, client: Kernel) -> None: computer = client.browsers.computer.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, duration_ms=50, @@ -338,7 +346,7 @@ def test_method_move_mouse_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_move_mouse(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -352,7 +360,7 @@ def test_raw_response_move_mouse(self, client: Kernel) -> None: @parametrize def test_streaming_response_move_mouse(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) as response: @@ -367,9 +375,9 @@ def test_streaming_response_move_mouse(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_move_mouse(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.move_mouse( - id="", + id_or_name="", x=0, y=0, ) @@ -378,7 +386,7 @@ def test_path_params_move_mouse(self, client: Kernel) -> None: @parametrize def test_method_press_key(self, client: Kernel) -> None: computer = client.browsers.computer.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], ) assert computer is None @@ -387,7 +395,7 @@ def test_method_press_key(self, client: Kernel) -> None: @parametrize def test_method_press_key_with_all_params(self, client: Kernel) -> None: computer = client.browsers.computer.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], duration=0, hold_keys=["string"], @@ -398,7 +406,7 @@ def test_method_press_key_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_press_key(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], ) @@ -411,7 +419,7 @@ def test_raw_response_press_key(self, client: Kernel) -> None: @parametrize def test_streaming_response_press_key(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], ) as response: assert not response.is_closed @@ -425,9 +433,9 @@ def test_streaming_response_press_key(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_press_key(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.press_key( - id="", + id_or_name="", keys=["string"], ) @@ -435,7 +443,7 @@ def test_path_params_press_key(self, client: Kernel) -> None: @parametrize def test_method_read_clipboard(self, client: Kernel) -> None: computer = client.browsers.computer.read_clipboard( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ComputerReadClipboardResponse, computer, path=["response"]) @@ -443,7 +451,7 @@ def test_method_read_clipboard(self, client: Kernel) -> None: @parametrize def test_raw_response_read_clipboard(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.read_clipboard( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -455,7 +463,7 @@ def test_raw_response_read_clipboard(self, client: Kernel) -> None: @parametrize def test_streaming_response_read_clipboard(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.read_clipboard( - "id", + "htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -468,7 +476,7 @@ def test_streaming_response_read_clipboard(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_read_clipboard(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.read_clipboard( "", ) @@ -477,7 +485,7 @@ def test_path_params_read_clipboard(self, client: Kernel) -> None: @parametrize def test_method_scroll(self, client: Kernel) -> None: computer = client.browsers.computer.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -487,7 +495,7 @@ def test_method_scroll(self, client: Kernel) -> None: @parametrize def test_method_scroll_with_all_params(self, client: Kernel) -> None: computer = client.browsers.computer.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, delta_x=0, @@ -500,7 +508,7 @@ def test_method_scroll_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_scroll(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -514,7 +522,7 @@ def test_raw_response_scroll(self, client: Kernel) -> None: @parametrize def test_streaming_response_scroll(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) as response: @@ -529,9 +537,9 @@ def test_streaming_response_scroll(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_scroll(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.scroll( - id="", + id_or_name="", x=0, y=0, ) @@ -540,7 +548,7 @@ def test_path_params_scroll(self, client: Kernel) -> None: @parametrize def test_method_set_cursor_visibility(self, client: Kernel) -> None: computer = client.browsers.computer.set_cursor_visibility( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", hidden=True, ) assert_matches_type(ComputerSetCursorVisibilityResponse, computer, path=["response"]) @@ -549,7 +557,7 @@ def test_method_set_cursor_visibility(self, client: Kernel) -> None: @parametrize def test_raw_response_set_cursor_visibility(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.set_cursor_visibility( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", hidden=True, ) @@ -562,7 +570,7 @@ def test_raw_response_set_cursor_visibility(self, client: Kernel) -> None: @parametrize def test_streaming_response_set_cursor_visibility(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.set_cursor_visibility( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", hidden=True, ) as response: assert not response.is_closed @@ -576,9 +584,9 @@ def test_streaming_response_set_cursor_visibility(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_set_cursor_visibility(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.set_cursor_visibility( - id="", + id_or_name="", hidden=True, ) @@ -586,7 +594,7 @@ def test_path_params_set_cursor_visibility(self, client: Kernel) -> None: @parametrize def test_method_type_text(self, client: Kernel) -> None: computer = client.browsers.computer.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) assert computer is None @@ -595,7 +603,7 @@ def test_method_type_text(self, client: Kernel) -> None: @parametrize def test_method_type_text_with_all_params(self, client: Kernel) -> None: computer = client.browsers.computer.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", delay=0, ) @@ -605,7 +613,7 @@ def test_method_type_text_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_type_text(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) @@ -618,7 +626,7 @@ def test_raw_response_type_text(self, client: Kernel) -> None: @parametrize def test_streaming_response_type_text(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) as response: assert not response.is_closed @@ -632,9 +640,9 @@ def test_streaming_response_type_text(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_type_text(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.type_text( - id="", + id_or_name="", text="text", ) @@ -642,7 +650,7 @@ def test_path_params_type_text(self, client: Kernel) -> None: @parametrize def test_method_write_clipboard(self, client: Kernel) -> None: computer = client.browsers.computer.write_clipboard( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) assert computer is None @@ -651,7 +659,7 @@ def test_method_write_clipboard(self, client: Kernel) -> None: @parametrize def test_raw_response_write_clipboard(self, client: Kernel) -> None: response = client.browsers.computer.with_raw_response.write_clipboard( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) @@ -664,7 +672,7 @@ def test_raw_response_write_clipboard(self, client: Kernel) -> None: @parametrize def test_streaming_response_write_clipboard(self, client: Kernel) -> None: with client.browsers.computer.with_streaming_response.write_clipboard( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) as response: assert not response.is_closed @@ -678,9 +686,9 @@ def test_streaming_response_write_clipboard(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_write_clipboard(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.computer.with_raw_response.write_clipboard( - id="", + id_or_name="", text="text", ) @@ -694,7 +702,7 @@ class TestAsyncComputer: @parametrize async def test_method_batch(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.batch( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", actions=[{"type": "click_mouse"}], ) assert computer is None @@ -703,7 +711,7 @@ async def test_method_batch(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_batch(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.batch( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", actions=[{"type": "click_mouse"}], ) @@ -716,7 +724,7 @@ async def test_raw_response_batch(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_batch(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.batch( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", actions=[{"type": "click_mouse"}], ) as response: assert not response.is_closed @@ -730,18 +738,20 @@ async def test_streaming_response_batch(self, async_client: AsyncKernel) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_batch(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.batch( - id="", + id_or_name="", actions=[{"type": "click_mouse"}], ) @parametrize @pytest.mark.respx(base_url=base_url) async def test_method_capture_screenshot(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) computer = await async_client.browsers.computer.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert computer.is_closed assert await computer.json() == {"foo": "bar"} @@ -753,9 +763,11 @@ async def test_method_capture_screenshot(self, async_client: AsyncKernel, respx_ async def test_method_capture_screenshot_with_all_params( self, async_client: AsyncKernel, respx_mock: MockRouter ) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) computer = await async_client.browsers.computer.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", region={ "height": 0, "width": 0, @@ -771,10 +783,12 @@ async def test_method_capture_screenshot_with_all_params( @parametrize @pytest.mark.respx(base_url=base_url) async def test_raw_response_capture_screenshot(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) computer = await async_client.browsers.computer.with_raw_response.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert computer.is_closed is True @@ -787,9 +801,11 @@ async def test_raw_response_capture_screenshot(self, async_client: AsyncKernel, async def test_streaming_response_capture_screenshot( self, async_client: AsyncKernel, respx_mock: MockRouter ) -> None: - respx_mock.post("/browsers/id/computer/screenshot").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.post("/browsers/htzv5orfit78e1m2biiifpbv/computer/screenshot").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) async with async_client.browsers.computer.with_streaming_response.capture_screenshot( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as computer: assert not computer.is_closed assert computer.http_request.headers.get("X-Stainless-Lang") == "python" @@ -803,16 +819,16 @@ async def test_streaming_response_capture_screenshot( @parametrize @pytest.mark.respx(base_url=base_url) async def test_path_params_capture_screenshot(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.capture_screenshot( - id="", + id_or_name="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_click_mouse(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -822,7 +838,7 @@ async def test_method_click_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_click_mouse_with_all_params(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, button="left", @@ -836,7 +852,7 @@ async def test_method_click_mouse_with_all_params(self, async_client: AsyncKerne @parametrize async def test_raw_response_click_mouse(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -850,7 +866,7 @@ async def test_raw_response_click_mouse(self, async_client: AsyncKernel) -> None @parametrize async def test_streaming_response_click_mouse(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.click_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) as response: @@ -865,9 +881,9 @@ async def test_streaming_response_click_mouse(self, async_client: AsyncKernel) - @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_click_mouse(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.click_mouse( - id="", + id_or_name="", x=0, y=0, ) @@ -876,7 +892,7 @@ async def test_path_params_click_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_drag_mouse(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], ) assert computer is None @@ -885,7 +901,7 @@ async def test_method_drag_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_drag_mouse_with_all_params(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], button="left", delay=0, @@ -901,7 +917,7 @@ async def test_method_drag_mouse_with_all_params(self, async_client: AsyncKernel @parametrize async def test_raw_response_drag_mouse(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], ) @@ -914,7 +930,7 @@ async def test_raw_response_drag_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_drag_mouse(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.drag_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path=[[0, 0], [0, 0]], ) as response: assert not response.is_closed @@ -928,9 +944,9 @@ async def test_streaming_response_drag_mouse(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_drag_mouse(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.drag_mouse( - id="", + id_or_name="", path=[[0, 0], [0, 0]], ) @@ -938,7 +954,7 @@ async def test_path_params_drag_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_get_mouse_position(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.get_mouse_position( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ComputerGetMousePositionResponse, computer, path=["response"]) @@ -946,7 +962,7 @@ async def test_method_get_mouse_position(self, async_client: AsyncKernel) -> Non @parametrize async def test_raw_response_get_mouse_position(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.get_mouse_position( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -958,7 +974,7 @@ async def test_raw_response_get_mouse_position(self, async_client: AsyncKernel) @parametrize async def test_streaming_response_get_mouse_position(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.get_mouse_position( - "id", + "htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -971,7 +987,7 @@ async def test_streaming_response_get_mouse_position(self, async_client: AsyncKe @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_get_mouse_position(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.get_mouse_position( "", ) @@ -980,7 +996,7 @@ async def test_path_params_get_mouse_position(self, async_client: AsyncKernel) - @parametrize async def test_method_move_mouse(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -990,7 +1006,7 @@ async def test_method_move_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_move_mouse_with_all_params(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, duration_ms=50, @@ -1003,7 +1019,7 @@ async def test_method_move_mouse_with_all_params(self, async_client: AsyncKernel @parametrize async def test_raw_response_move_mouse(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -1017,7 +1033,7 @@ async def test_raw_response_move_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_move_mouse(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.move_mouse( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) as response: @@ -1032,9 +1048,9 @@ async def test_streaming_response_move_mouse(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_move_mouse(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.move_mouse( - id="", + id_or_name="", x=0, y=0, ) @@ -1043,7 +1059,7 @@ async def test_path_params_move_mouse(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_press_key(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], ) assert computer is None @@ -1052,7 +1068,7 @@ async def test_method_press_key(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_press_key_with_all_params(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], duration=0, hold_keys=["string"], @@ -1063,7 +1079,7 @@ async def test_method_press_key_with_all_params(self, async_client: AsyncKernel) @parametrize async def test_raw_response_press_key(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], ) @@ -1076,7 +1092,7 @@ async def test_raw_response_press_key(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_press_key(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.press_key( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", keys=["string"], ) as response: assert not response.is_closed @@ -1090,9 +1106,9 @@ async def test_streaming_response_press_key(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_press_key(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.press_key( - id="", + id_or_name="", keys=["string"], ) @@ -1100,7 +1116,7 @@ async def test_path_params_press_key(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_read_clipboard(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.read_clipboard( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ComputerReadClipboardResponse, computer, path=["response"]) @@ -1108,7 +1124,7 @@ async def test_method_read_clipboard(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_read_clipboard(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.read_clipboard( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -1120,7 +1136,7 @@ async def test_raw_response_read_clipboard(self, async_client: AsyncKernel) -> N @parametrize async def test_streaming_response_read_clipboard(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.read_clipboard( - "id", + "htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1133,7 +1149,7 @@ async def test_streaming_response_read_clipboard(self, async_client: AsyncKernel @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_read_clipboard(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.read_clipboard( "", ) @@ -1142,7 +1158,7 @@ async def test_path_params_read_clipboard(self, async_client: AsyncKernel) -> No @parametrize async def test_method_scroll(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -1152,7 +1168,7 @@ async def test_method_scroll(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_scroll_with_all_params(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, delta_x=0, @@ -1165,7 +1181,7 @@ async def test_method_scroll_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_scroll(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) @@ -1179,7 +1195,7 @@ async def test_raw_response_scroll(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_scroll(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.scroll( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", x=0, y=0, ) as response: @@ -1194,9 +1210,9 @@ async def test_streaming_response_scroll(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_scroll(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.scroll( - id="", + id_or_name="", x=0, y=0, ) @@ -1205,7 +1221,7 @@ async def test_path_params_scroll(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_set_cursor_visibility(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.set_cursor_visibility( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", hidden=True, ) assert_matches_type(ComputerSetCursorVisibilityResponse, computer, path=["response"]) @@ -1214,7 +1230,7 @@ async def test_method_set_cursor_visibility(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_set_cursor_visibility(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.set_cursor_visibility( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", hidden=True, ) @@ -1227,7 +1243,7 @@ async def test_raw_response_set_cursor_visibility(self, async_client: AsyncKerne @parametrize async def test_streaming_response_set_cursor_visibility(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.set_cursor_visibility( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", hidden=True, ) as response: assert not response.is_closed @@ -1241,9 +1257,9 @@ async def test_streaming_response_set_cursor_visibility(self, async_client: Asyn @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_set_cursor_visibility(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.set_cursor_visibility( - id="", + id_or_name="", hidden=True, ) @@ -1251,7 +1267,7 @@ async def test_path_params_set_cursor_visibility(self, async_client: AsyncKernel @parametrize async def test_method_type_text(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) assert computer is None @@ -1260,7 +1276,7 @@ async def test_method_type_text(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_type_text_with_all_params(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", delay=0, ) @@ -1270,7 +1286,7 @@ async def test_method_type_text_with_all_params(self, async_client: AsyncKernel) @parametrize async def test_raw_response_type_text(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) @@ -1283,7 +1299,7 @@ async def test_raw_response_type_text(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_type_text(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.type_text( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) as response: assert not response.is_closed @@ -1297,9 +1313,9 @@ async def test_streaming_response_type_text(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_type_text(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.type_text( - id="", + id_or_name="", text="text", ) @@ -1307,7 +1323,7 @@ async def test_path_params_type_text(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_write_clipboard(self, async_client: AsyncKernel) -> None: computer = await async_client.browsers.computer.write_clipboard( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) assert computer is None @@ -1316,7 +1332,7 @@ async def test_method_write_clipboard(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_write_clipboard(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.computer.with_raw_response.write_clipboard( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) @@ -1329,7 +1345,7 @@ async def test_raw_response_write_clipboard(self, async_client: AsyncKernel) -> @parametrize async def test_streaming_response_write_clipboard(self, async_client: AsyncKernel) -> None: async with async_client.browsers.computer.with_streaming_response.write_clipboard( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", text="text", ) as response: assert not response.is_closed @@ -1343,8 +1359,8 @@ async def test_streaming_response_write_clipboard(self, async_client: AsyncKerne @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_write_clipboard(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.computer.with_raw_response.write_clipboard( - id="", + id_or_name="", text="text", ) diff --git a/tests/api_resources/browsers/test_fs.py b/tests/api_resources/browsers/test_fs.py index ceb179a0..f980777a 100644 --- a/tests/api_resources/browsers/test_fs.py +++ b/tests/api_resources/browsers/test_fs.py @@ -32,7 +32,7 @@ class TestFs: @parametrize def test_method_create_directory(self, client: Kernel) -> None: f = client.browsers.fs.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f is None @@ -41,7 +41,7 @@ def test_method_create_directory(self, client: Kernel) -> None: @parametrize def test_method_create_directory_with_all_params(self, client: Kernel) -> None: f = client.browsers.fs.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", mode="0611", ) @@ -51,7 +51,7 @@ def test_method_create_directory_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_create_directory(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -64,7 +64,7 @@ def test_raw_response_create_directory(self, client: Kernel) -> None: @parametrize def test_streaming_response_create_directory(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -78,9 +78,9 @@ def test_streaming_response_create_directory(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_create_directory(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.create_directory( - id="", + id_or_name="", path="/J!", ) @@ -88,7 +88,7 @@ def test_path_params_create_directory(self, client: Kernel) -> None: @parametrize def test_method_delete_directory(self, client: Kernel) -> None: f = client.browsers.fs.delete_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f is None @@ -97,7 +97,7 @@ def test_method_delete_directory(self, client: Kernel) -> None: @parametrize def test_raw_response_delete_directory(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.delete_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -110,7 +110,7 @@ def test_raw_response_delete_directory(self, client: Kernel) -> None: @parametrize def test_streaming_response_delete_directory(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.delete_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -124,9 +124,9 @@ def test_streaming_response_delete_directory(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete_directory(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.delete_directory( - id="", + id_or_name="", path="/J!", ) @@ -134,7 +134,7 @@ def test_path_params_delete_directory(self, client: Kernel) -> None: @parametrize def test_method_delete_file(self, client: Kernel) -> None: f = client.browsers.fs.delete_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f is None @@ -143,7 +143,7 @@ def test_method_delete_file(self, client: Kernel) -> None: @parametrize def test_raw_response_delete_file(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.delete_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -156,7 +156,7 @@ def test_raw_response_delete_file(self, client: Kernel) -> None: @parametrize def test_streaming_response_delete_file(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.delete_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -170,18 +170,20 @@ def test_streaming_response_delete_file(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_delete_file(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.delete_file( - id="", + id_or_name="", path="/J!", ) @parametrize @pytest.mark.respx(base_url=base_url) def test_method_download_dir_zip(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/download_dir_zip").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/download_dir_zip").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = client.browsers.fs.download_dir_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f.is_closed @@ -192,10 +194,12 @@ def test_method_download_dir_zip(self, client: Kernel, respx_mock: MockRouter) - @parametrize @pytest.mark.respx(base_url=base_url) def test_raw_response_download_dir_zip(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/download_dir_zip").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/download_dir_zip").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = client.browsers.fs.with_raw_response.download_dir_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -207,9 +211,11 @@ def test_raw_response_download_dir_zip(self, client: Kernel, respx_mock: MockRou @parametrize @pytest.mark.respx(base_url=base_url) def test_streaming_response_download_dir_zip(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/download_dir_zip").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/download_dir_zip").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) with client.browsers.fs.with_streaming_response.download_dir_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as f: assert not f.is_closed @@ -224,9 +230,9 @@ def test_streaming_response_download_dir_zip(self, client: Kernel, respx_mock: M @parametrize @pytest.mark.respx(base_url=base_url) def test_path_params_download_dir_zip(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.download_dir_zip( - id="", + id_or_name="", path="/J!", ) @@ -234,7 +240,7 @@ def test_path_params_download_dir_zip(self, client: Kernel) -> None: @parametrize def test_method_file_info(self, client: Kernel) -> None: f = client.browsers.fs.file_info( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert_matches_type(FFileInfoResponse, f, path=["response"]) @@ -243,7 +249,7 @@ def test_method_file_info(self, client: Kernel) -> None: @parametrize def test_raw_response_file_info(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.file_info( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -256,7 +262,7 @@ def test_raw_response_file_info(self, client: Kernel) -> None: @parametrize def test_streaming_response_file_info(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.file_info( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -270,9 +276,9 @@ def test_streaming_response_file_info(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_file_info(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.file_info( - id="", + id_or_name="", path="/J!", ) @@ -280,7 +286,7 @@ def test_path_params_file_info(self, client: Kernel) -> None: @parametrize def test_method_list_files(self, client: Kernel) -> None: f = client.browsers.fs.list_files( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert_matches_type(FListFilesResponse, f, path=["response"]) @@ -289,7 +295,7 @@ def test_method_list_files(self, client: Kernel) -> None: @parametrize def test_raw_response_list_files(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.list_files( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -302,7 +308,7 @@ def test_raw_response_list_files(self, client: Kernel) -> None: @parametrize def test_streaming_response_list_files(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.list_files( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -316,9 +322,9 @@ def test_streaming_response_list_files(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_list_files(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.list_files( - id="", + id_or_name="", path="/J!", ) @@ -326,7 +332,7 @@ def test_path_params_list_files(self, client: Kernel) -> None: @parametrize def test_method_move(self, client: Kernel) -> None: f = client.browsers.fs.move( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", src_path="/J!", ) @@ -336,7 +342,7 @@ def test_method_move(self, client: Kernel) -> None: @parametrize def test_raw_response_move(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.move( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", src_path="/J!", ) @@ -350,7 +356,7 @@ def test_raw_response_move(self, client: Kernel) -> None: @parametrize def test_streaming_response_move(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.move( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", src_path="/J!", ) as response: @@ -365,9 +371,9 @@ def test_streaming_response_move(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_move(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.move( - id="", + id_or_name="", dest_path="/J!", src_path="/J!", ) @@ -375,9 +381,11 @@ def test_path_params_move(self, client: Kernel) -> None: @parametrize @pytest.mark.respx(base_url=base_url) def test_method_read_file(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/read_file").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/read_file").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = client.browsers.fs.read_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f.is_closed @@ -388,10 +396,12 @@ def test_method_read_file(self, client: Kernel, respx_mock: MockRouter) -> None: @parametrize @pytest.mark.respx(base_url=base_url) def test_raw_response_read_file(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/read_file").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/read_file").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = client.browsers.fs.with_raw_response.read_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -403,9 +413,11 @@ def test_raw_response_read_file(self, client: Kernel, respx_mock: MockRouter) -> @parametrize @pytest.mark.respx(base_url=base_url) def test_streaming_response_read_file(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/read_file").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/read_file").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) with client.browsers.fs.with_streaming_response.read_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as f: assert not f.is_closed @@ -420,9 +432,9 @@ def test_streaming_response_read_file(self, client: Kernel, respx_mock: MockRout @parametrize @pytest.mark.respx(base_url=base_url) def test_path_params_read_file(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.read_file( - id="", + id_or_name="", path="/J!", ) @@ -430,7 +442,7 @@ def test_path_params_read_file(self, client: Kernel) -> None: @parametrize def test_method_set_file_permissions(self, client: Kernel) -> None: f = client.browsers.fs.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", ) @@ -440,7 +452,7 @@ def test_method_set_file_permissions(self, client: Kernel) -> None: @parametrize def test_method_set_file_permissions_with_all_params(self, client: Kernel) -> None: f = client.browsers.fs.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", group="group", @@ -452,7 +464,7 @@ def test_method_set_file_permissions_with_all_params(self, client: Kernel) -> No @parametrize def test_raw_response_set_file_permissions(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", ) @@ -466,7 +478,7 @@ def test_raw_response_set_file_permissions(self, client: Kernel) -> None: @parametrize def test_streaming_response_set_file_permissions(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", ) as response: @@ -481,9 +493,9 @@ def test_streaming_response_set_file_permissions(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_set_file_permissions(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.set_file_permissions( - id="", + id_or_name="", mode="0611", path="/J!", ) @@ -492,7 +504,7 @@ def test_path_params_set_file_permissions(self, client: Kernel) -> None: @parametrize def test_method_upload(self, client: Kernel) -> None: f = client.browsers.fs.upload( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", files=[ { "dest_path": "/J!", @@ -506,7 +518,7 @@ def test_method_upload(self, client: Kernel) -> None: @parametrize def test_raw_response_upload(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.upload( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", files=[ { "dest_path": "/J!", @@ -524,7 +536,7 @@ def test_raw_response_upload(self, client: Kernel) -> None: @parametrize def test_streaming_response_upload(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.upload( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", files=[ { "dest_path": "/J!", @@ -543,9 +555,9 @@ def test_streaming_response_upload(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_upload(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.upload( - id="", + id_or_name="", files=[ { "dest_path": "/J!", @@ -558,7 +570,7 @@ def test_path_params_upload(self, client: Kernel) -> None: @parametrize def test_method_upload_zip(self, client: Kernel) -> None: f = client.browsers.fs.upload_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", zip_file=b"Example data", ) @@ -568,7 +580,7 @@ def test_method_upload_zip(self, client: Kernel) -> None: @parametrize def test_raw_response_upload_zip(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.upload_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", zip_file=b"Example data", ) @@ -582,7 +594,7 @@ def test_raw_response_upload_zip(self, client: Kernel) -> None: @parametrize def test_streaming_response_upload_zip(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.upload_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", zip_file=b"Example data", ) as response: @@ -597,9 +609,9 @@ def test_streaming_response_upload_zip(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_upload_zip(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.upload_zip( - id="", + id_or_name="", dest_path="/J!", zip_file=b"Example data", ) @@ -608,7 +620,7 @@ def test_path_params_upload_zip(self, client: Kernel) -> None: @parametrize def test_method_write_file(self, client: Kernel) -> None: f = client.browsers.fs.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", ) @@ -618,7 +630,7 @@ def test_method_write_file(self, client: Kernel) -> None: @parametrize def test_method_write_file_with_all_params(self, client: Kernel) -> None: f = client.browsers.fs.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", mode="0611", @@ -629,7 +641,7 @@ def test_method_write_file_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_write_file(self, client: Kernel) -> None: response = client.browsers.fs.with_raw_response.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", ) @@ -643,7 +655,7 @@ def test_raw_response_write_file(self, client: Kernel) -> None: @parametrize def test_streaming_response_write_file(self, client: Kernel) -> None: with client.browsers.fs.with_streaming_response.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", ) as response: @@ -658,9 +670,9 @@ def test_streaming_response_write_file(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_write_file(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.fs.with_raw_response.write_file( - id="", + id_or_name="", contents=b"Example data", path="/J!", ) @@ -675,7 +687,7 @@ class TestAsyncFs: @parametrize async def test_method_create_directory(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f is None @@ -684,7 +696,7 @@ async def test_method_create_directory(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_create_directory_with_all_params(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", mode="0611", ) @@ -694,7 +706,7 @@ async def test_method_create_directory_with_all_params(self, async_client: Async @parametrize async def test_raw_response_create_directory(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -707,7 +719,7 @@ async def test_raw_response_create_directory(self, async_client: AsyncKernel) -> @parametrize async def test_streaming_response_create_directory(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.create_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -721,9 +733,9 @@ async def test_streaming_response_create_directory(self, async_client: AsyncKern @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_create_directory(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.create_directory( - id="", + id_or_name="", path="/J!", ) @@ -731,7 +743,7 @@ async def test_path_params_create_directory(self, async_client: AsyncKernel) -> @parametrize async def test_method_delete_directory(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.delete_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f is None @@ -740,7 +752,7 @@ async def test_method_delete_directory(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_delete_directory(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.delete_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -753,7 +765,7 @@ async def test_raw_response_delete_directory(self, async_client: AsyncKernel) -> @parametrize async def test_streaming_response_delete_directory(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.delete_directory( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -767,9 +779,9 @@ async def test_streaming_response_delete_directory(self, async_client: AsyncKern @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete_directory(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.delete_directory( - id="", + id_or_name="", path="/J!", ) @@ -777,7 +789,7 @@ async def test_path_params_delete_directory(self, async_client: AsyncKernel) -> @parametrize async def test_method_delete_file(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.delete_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f is None @@ -786,7 +798,7 @@ async def test_method_delete_file(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_delete_file(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.delete_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -799,7 +811,7 @@ async def test_raw_response_delete_file(self, async_client: AsyncKernel) -> None @parametrize async def test_streaming_response_delete_file(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.delete_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -813,18 +825,20 @@ async def test_streaming_response_delete_file(self, async_client: AsyncKernel) - @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_delete_file(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.delete_file( - id="", + id_or_name="", path="/J!", ) @parametrize @pytest.mark.respx(base_url=base_url) async def test_method_download_dir_zip(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/download_dir_zip").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/download_dir_zip").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = await async_client.browsers.fs.download_dir_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f.is_closed @@ -835,10 +849,12 @@ async def test_method_download_dir_zip(self, async_client: AsyncKernel, respx_mo @parametrize @pytest.mark.respx(base_url=base_url) async def test_raw_response_download_dir_zip(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/download_dir_zip").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/download_dir_zip").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = await async_client.browsers.fs.with_raw_response.download_dir_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -850,9 +866,11 @@ async def test_raw_response_download_dir_zip(self, async_client: AsyncKernel, re @parametrize @pytest.mark.respx(base_url=base_url) async def test_streaming_response_download_dir_zip(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/download_dir_zip").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/download_dir_zip").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) async with async_client.browsers.fs.with_streaming_response.download_dir_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as f: assert not f.is_closed @@ -867,9 +885,9 @@ async def test_streaming_response_download_dir_zip(self, async_client: AsyncKern @parametrize @pytest.mark.respx(base_url=base_url) async def test_path_params_download_dir_zip(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.download_dir_zip( - id="", + id_or_name="", path="/J!", ) @@ -877,7 +895,7 @@ async def test_path_params_download_dir_zip(self, async_client: AsyncKernel) -> @parametrize async def test_method_file_info(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.file_info( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert_matches_type(FFileInfoResponse, f, path=["response"]) @@ -886,7 +904,7 @@ async def test_method_file_info(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_file_info(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.file_info( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -899,7 +917,7 @@ async def test_raw_response_file_info(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_file_info(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.file_info( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -913,9 +931,9 @@ async def test_streaming_response_file_info(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_file_info(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.file_info( - id="", + id_or_name="", path="/J!", ) @@ -923,7 +941,7 @@ async def test_path_params_file_info(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_list_files(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.list_files( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert_matches_type(FListFilesResponse, f, path=["response"]) @@ -932,7 +950,7 @@ async def test_method_list_files(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_list_files(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.list_files( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -945,7 +963,7 @@ async def test_raw_response_list_files(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_list_files(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.list_files( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as response: assert not response.is_closed @@ -959,9 +977,9 @@ async def test_streaming_response_list_files(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_list_files(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.list_files( - id="", + id_or_name="", path="/J!", ) @@ -969,7 +987,7 @@ async def test_path_params_list_files(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_move(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.move( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", src_path="/J!", ) @@ -979,7 +997,7 @@ async def test_method_move(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_move(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.move( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", src_path="/J!", ) @@ -993,7 +1011,7 @@ async def test_raw_response_move(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_move(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.move( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", src_path="/J!", ) as response: @@ -1008,9 +1026,9 @@ async def test_streaming_response_move(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_move(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.move( - id="", + id_or_name="", dest_path="/J!", src_path="/J!", ) @@ -1018,9 +1036,11 @@ async def test_path_params_move(self, async_client: AsyncKernel) -> None: @parametrize @pytest.mark.respx(base_url=base_url) async def test_method_read_file(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/read_file").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/read_file").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = await async_client.browsers.fs.read_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) assert f.is_closed @@ -1031,10 +1051,12 @@ async def test_method_read_file(self, async_client: AsyncKernel, respx_mock: Moc @parametrize @pytest.mark.respx(base_url=base_url) async def test_raw_response_read_file(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/read_file").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/read_file").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) f = await async_client.browsers.fs.with_raw_response.read_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) @@ -1046,9 +1068,11 @@ async def test_raw_response_read_file(self, async_client: AsyncKernel, respx_moc @parametrize @pytest.mark.respx(base_url=base_url) async def test_streaming_response_read_file(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/fs/read_file").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/fs/read_file").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) async with async_client.browsers.fs.with_streaming_response.read_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", path="/J!", ) as f: assert not f.is_closed @@ -1063,9 +1087,9 @@ async def test_streaming_response_read_file(self, async_client: AsyncKernel, res @parametrize @pytest.mark.respx(base_url=base_url) async def test_path_params_read_file(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.read_file( - id="", + id_or_name="", path="/J!", ) @@ -1073,7 +1097,7 @@ async def test_path_params_read_file(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_set_file_permissions(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", ) @@ -1083,7 +1107,7 @@ async def test_method_set_file_permissions(self, async_client: AsyncKernel) -> N @parametrize async def test_method_set_file_permissions_with_all_params(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", group="group", @@ -1095,7 +1119,7 @@ async def test_method_set_file_permissions_with_all_params(self, async_client: A @parametrize async def test_raw_response_set_file_permissions(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", ) @@ -1109,7 +1133,7 @@ async def test_raw_response_set_file_permissions(self, async_client: AsyncKernel @parametrize async def test_streaming_response_set_file_permissions(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.set_file_permissions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", mode="0611", path="/J!", ) as response: @@ -1124,9 +1148,9 @@ async def test_streaming_response_set_file_permissions(self, async_client: Async @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_set_file_permissions(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.set_file_permissions( - id="", + id_or_name="", mode="0611", path="/J!", ) @@ -1135,7 +1159,7 @@ async def test_path_params_set_file_permissions(self, async_client: AsyncKernel) @parametrize async def test_method_upload(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.upload( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", files=[ { "dest_path": "/J!", @@ -1149,7 +1173,7 @@ async def test_method_upload(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_upload(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.upload( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", files=[ { "dest_path": "/J!", @@ -1167,7 +1191,7 @@ async def test_raw_response_upload(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_upload(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.upload( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", files=[ { "dest_path": "/J!", @@ -1186,9 +1210,9 @@ async def test_streaming_response_upload(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_upload(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.upload( - id="", + id_or_name="", files=[ { "dest_path": "/J!", @@ -1201,7 +1225,7 @@ async def test_path_params_upload(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_upload_zip(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.upload_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", zip_file=b"Example data", ) @@ -1211,7 +1235,7 @@ async def test_method_upload_zip(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_upload_zip(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.upload_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", zip_file=b"Example data", ) @@ -1225,7 +1249,7 @@ async def test_raw_response_upload_zip(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_upload_zip(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.upload_zip( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", dest_path="/J!", zip_file=b"Example data", ) as response: @@ -1240,9 +1264,9 @@ async def test_streaming_response_upload_zip(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_upload_zip(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.upload_zip( - id="", + id_or_name="", dest_path="/J!", zip_file=b"Example data", ) @@ -1251,7 +1275,7 @@ async def test_path_params_upload_zip(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_write_file(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", ) @@ -1261,7 +1285,7 @@ async def test_method_write_file(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_write_file_with_all_params(self, async_client: AsyncKernel) -> None: f = await async_client.browsers.fs.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", mode="0611", @@ -1272,7 +1296,7 @@ async def test_method_write_file_with_all_params(self, async_client: AsyncKernel @parametrize async def test_raw_response_write_file(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.fs.with_raw_response.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", ) @@ -1286,7 +1310,7 @@ async def test_raw_response_write_file(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_write_file(self, async_client: AsyncKernel) -> None: async with async_client.browsers.fs.with_streaming_response.write_file( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", contents=b"Example data", path="/J!", ) as response: @@ -1301,9 +1325,9 @@ async def test_streaming_response_write_file(self, async_client: AsyncKernel) -> @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_write_file(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.fs.with_raw_response.write_file( - id="", + id_or_name="", contents=b"Example data", path="/J!", ) diff --git a/tests/api_resources/browsers/test_logs.py b/tests/api_resources/browsers/test_logs.py index 27268b82..0c4bb3ea 100644 --- a/tests/api_resources/browsers/test_logs.py +++ b/tests/api_resources/browsers/test_logs.py @@ -19,7 +19,7 @@ class TestLogs: @parametrize def test_method_stream(self, client: Kernel) -> None: log_stream = client.browsers.logs.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", ) log_stream.response.close() @@ -28,7 +28,7 @@ def test_method_stream(self, client: Kernel) -> None: @parametrize def test_method_stream_with_all_params(self, client: Kernel) -> None: log_stream = client.browsers.logs.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", follow=True, path="path", @@ -40,7 +40,7 @@ def test_method_stream_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_stream(self, client: Kernel) -> None: response = client.browsers.logs.with_raw_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", ) @@ -52,7 +52,7 @@ def test_raw_response_stream(self, client: Kernel) -> None: @parametrize def test_streaming_response_stream(self, client: Kernel) -> None: with client.browsers.logs.with_streaming_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", ) as response: assert not response.is_closed @@ -66,9 +66,9 @@ def test_streaming_response_stream(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stream(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.logs.with_raw_response.stream( - id="", + id_or_name="", source="path", ) @@ -82,7 +82,7 @@ class TestAsyncLogs: @parametrize async def test_method_stream(self, async_client: AsyncKernel) -> None: log_stream = await async_client.browsers.logs.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", ) await log_stream.response.aclose() @@ -91,7 +91,7 @@ async def test_method_stream(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_stream_with_all_params(self, async_client: AsyncKernel) -> None: log_stream = await async_client.browsers.logs.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", follow=True, path="path", @@ -103,7 +103,7 @@ async def test_method_stream_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_stream(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.logs.with_raw_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", ) @@ -115,7 +115,7 @@ async def test_raw_response_stream(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_stream(self, async_client: AsyncKernel) -> None: async with async_client.browsers.logs.with_streaming_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", source="path", ) as response: assert not response.is_closed @@ -129,8 +129,8 @@ async def test_streaming_response_stream(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stream(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.logs.with_raw_response.stream( - id="", + id_or_name="", source="path", ) diff --git a/tests/api_resources/browsers/test_playwright.py b/tests/api_resources/browsers/test_playwright.py index fd91b832..5adc553f 100644 --- a/tests/api_resources/browsers/test_playwright.py +++ b/tests/api_resources/browsers/test_playwright.py @@ -21,7 +21,7 @@ class TestPlaywright: @parametrize def test_method_execute(self, client: Kernel) -> None: playwright = client.browsers.playwright.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", ) assert_matches_type(PlaywrightExecuteResponse, playwright, path=["response"]) @@ -30,7 +30,7 @@ def test_method_execute(self, client: Kernel) -> None: @parametrize def test_method_execute_with_all_params(self, client: Kernel) -> None: playwright = client.browsers.playwright.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", timeout_sec=1, ) @@ -40,7 +40,7 @@ def test_method_execute_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_execute(self, client: Kernel) -> None: response = client.browsers.playwright.with_raw_response.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", ) @@ -53,7 +53,7 @@ def test_raw_response_execute(self, client: Kernel) -> None: @parametrize def test_streaming_response_execute(self, client: Kernel) -> None: with client.browsers.playwright.with_streaming_response.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", ) as response: assert not response.is_closed @@ -67,9 +67,9 @@ def test_streaming_response_execute(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_execute(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.playwright.with_raw_response.execute( - id="", + id_or_name="", code="code", ) @@ -83,7 +83,7 @@ class TestAsyncPlaywright: @parametrize async def test_method_execute(self, async_client: AsyncKernel) -> None: playwright = await async_client.browsers.playwright.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", ) assert_matches_type(PlaywrightExecuteResponse, playwright, path=["response"]) @@ -92,7 +92,7 @@ async def test_method_execute(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_execute_with_all_params(self, async_client: AsyncKernel) -> None: playwright = await async_client.browsers.playwright.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", timeout_sec=1, ) @@ -102,7 +102,7 @@ async def test_method_execute_with_all_params(self, async_client: AsyncKernel) - @parametrize async def test_raw_response_execute(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.playwright.with_raw_response.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", ) @@ -115,7 +115,7 @@ async def test_raw_response_execute(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_execute(self, async_client: AsyncKernel) -> None: async with async_client.browsers.playwright.with_streaming_response.execute( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", code="code", ) as response: assert not response.is_closed @@ -129,8 +129,8 @@ async def test_streaming_response_execute(self, async_client: AsyncKernel) -> No @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_execute(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.playwright.with_raw_response.execute( - id="", + id_or_name="", code="code", ) diff --git a/tests/api_resources/browsers/test_process.py b/tests/api_resources/browsers/test_process.py index 0418d219..bbcd7860 100644 --- a/tests/api_resources/browsers/test_process.py +++ b/tests/api_resources/browsers/test_process.py @@ -28,7 +28,7 @@ class TestProcess: @parametrize def test_method_exec(self, client: Kernel) -> None: process = client.browsers.process.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) assert_matches_type(ProcessExecResponse, process, path=["response"]) @@ -37,7 +37,7 @@ def test_method_exec(self, client: Kernel) -> None: @parametrize def test_method_exec_with_all_params(self, client: Kernel) -> None: process = client.browsers.process.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", args=["string"], as_root=True, @@ -52,7 +52,7 @@ def test_method_exec_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_exec(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) @@ -65,7 +65,7 @@ def test_raw_response_exec(self, client: Kernel) -> None: @parametrize def test_streaming_response_exec(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) as response: assert not response.is_closed @@ -79,9 +79,9 @@ def test_streaming_response_exec(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_exec(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.exec( - id="", + id_or_name="", command="command", ) @@ -90,7 +90,7 @@ def test_path_params_exec(self, client: Kernel) -> None: def test_method_kill(self, client: Kernel) -> None: process = client.browsers.process.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) assert_matches_type(ProcessKillResponse, process, path=["response"]) @@ -100,7 +100,7 @@ def test_method_kill(self, client: Kernel) -> None: def test_raw_response_kill(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) @@ -114,7 +114,7 @@ def test_raw_response_kill(self, client: Kernel) -> None: def test_streaming_response_kill(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) as response: assert not response.is_closed @@ -128,17 +128,17 @@ def test_streaming_response_kill(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_kill(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", signal="TERM", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): client.browsers.process.with_raw_response.kill( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) @@ -147,7 +147,7 @@ def test_path_params_kill(self, client: Kernel) -> None: def test_method_resize(self, client: Kernel) -> None: process = client.browsers.process.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) @@ -158,7 +158,7 @@ def test_method_resize(self, client: Kernel) -> None: def test_raw_response_resize(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) @@ -173,7 +173,7 @@ def test_raw_response_resize(self, client: Kernel) -> None: def test_streaming_response_resize(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) as response: @@ -188,10 +188,10 @@ def test_streaming_response_resize(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_resize(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", cols=1, rows=1, ) @@ -199,7 +199,7 @@ def test_path_params_resize(self, client: Kernel) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): client.browsers.process.with_raw_response.resize( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) @@ -208,7 +208,7 @@ def test_path_params_resize(self, client: Kernel) -> None: @parametrize def test_method_spawn(self, client: Kernel) -> None: process = client.browsers.process.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) assert_matches_type(ProcessSpawnResponse, process, path=["response"]) @@ -217,7 +217,7 @@ def test_method_spawn(self, client: Kernel) -> None: @parametrize def test_method_spawn_with_all_params(self, client: Kernel) -> None: process = client.browsers.process.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", allocate_tty=True, args=["string"], @@ -235,7 +235,7 @@ def test_method_spawn_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_spawn(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) @@ -248,7 +248,7 @@ def test_raw_response_spawn(self, client: Kernel) -> None: @parametrize def test_streaming_response_spawn(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) as response: assert not response.is_closed @@ -262,9 +262,9 @@ def test_streaming_response_spawn(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_spawn(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.spawn( - id="", + id_or_name="", command="command", ) @@ -273,7 +273,7 @@ def test_path_params_spawn(self, client: Kernel) -> None: def test_method_status(self, client: Kernel) -> None: process = client.browsers.process.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ProcessStatusResponse, process, path=["response"]) @@ -282,7 +282,7 @@ def test_method_status(self, client: Kernel) -> None: def test_raw_response_status(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -295,7 +295,7 @@ def test_raw_response_status(self, client: Kernel) -> None: def test_streaming_response_status(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -308,16 +308,16 @@ def test_streaming_response_status(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_status(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): client.browsers.process.with_raw_response.status( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @pytest.mark.skip(reason="Mock server tests are disabled") @@ -325,7 +325,7 @@ def test_path_params_status(self, client: Kernel) -> None: def test_method_stdin(self, client: Kernel) -> None: process = client.browsers.process.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) assert_matches_type(ProcessStdinResponse, process, path=["response"]) @@ -335,7 +335,7 @@ def test_method_stdin(self, client: Kernel) -> None: def test_raw_response_stdin(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) @@ -349,7 +349,7 @@ def test_raw_response_stdin(self, client: Kernel) -> None: def test_streaming_response_stdin(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) as response: assert not response.is_closed @@ -363,17 +363,17 @@ def test_streaming_response_stdin(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stdin(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", data_b64="data_b64", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): client.browsers.process.with_raw_response.stdin( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) @@ -382,7 +382,7 @@ def test_path_params_stdin(self, client: Kernel) -> None: def test_method_stdout_stream(self, client: Kernel) -> None: process_stream = client.browsers.process.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) process_stream.response.close() @@ -391,7 +391,7 @@ def test_method_stdout_stream(self, client: Kernel) -> None: def test_raw_response_stdout_stream(self, client: Kernel) -> None: response = client.browsers.process.with_raw_response.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -403,7 +403,7 @@ def test_raw_response_stdout_stream(self, client: Kernel) -> None: def test_streaming_response_stdout_stream(self, client: Kernel) -> None: with client.browsers.process.with_streaming_response.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -416,16 +416,16 @@ def test_streaming_response_stdout_stream(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stdout_stream(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.process.with_raw_response.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): client.browsers.process.with_raw_response.stdout_stream( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @@ -438,7 +438,7 @@ class TestAsyncProcess: @parametrize async def test_method_exec(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) assert_matches_type(ProcessExecResponse, process, path=["response"]) @@ -447,7 +447,7 @@ async def test_method_exec(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_exec_with_all_params(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", args=["string"], as_root=True, @@ -462,7 +462,7 @@ async def test_method_exec_with_all_params(self, async_client: AsyncKernel) -> N @parametrize async def test_raw_response_exec(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) @@ -475,7 +475,7 @@ async def test_raw_response_exec(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_exec(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.exec( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) as response: assert not response.is_closed @@ -489,9 +489,9 @@ async def test_streaming_response_exec(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_exec(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.exec( - id="", + id_or_name="", command="command", ) @@ -500,7 +500,7 @@ async def test_path_params_exec(self, async_client: AsyncKernel) -> None: async def test_method_kill(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) assert_matches_type(ProcessKillResponse, process, path=["response"]) @@ -510,7 +510,7 @@ async def test_method_kill(self, async_client: AsyncKernel) -> None: async def test_raw_response_kill(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) @@ -524,7 +524,7 @@ async def test_raw_response_kill(self, async_client: AsyncKernel) -> None: async def test_streaming_response_kill(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) as response: assert not response.is_closed @@ -538,17 +538,17 @@ async def test_streaming_response_kill(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_kill(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.kill( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", signal="TERM", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): await async_client.browsers.process.with_raw_response.kill( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", signal="TERM", ) @@ -557,7 +557,7 @@ async def test_path_params_kill(self, async_client: AsyncKernel) -> None: async def test_method_resize(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) @@ -568,7 +568,7 @@ async def test_method_resize(self, async_client: AsyncKernel) -> None: async def test_raw_response_resize(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) @@ -583,7 +583,7 @@ async def test_raw_response_resize(self, async_client: AsyncKernel) -> None: async def test_streaming_response_resize(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) as response: @@ -598,10 +598,10 @@ async def test_streaming_response_resize(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_resize(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.resize( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", cols=1, rows=1, ) @@ -609,7 +609,7 @@ async def test_path_params_resize(self, async_client: AsyncKernel) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): await async_client.browsers.process.with_raw_response.resize( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", cols=1, rows=1, ) @@ -618,7 +618,7 @@ async def test_path_params_resize(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_spawn(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) assert_matches_type(ProcessSpawnResponse, process, path=["response"]) @@ -627,7 +627,7 @@ async def test_method_spawn(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_spawn_with_all_params(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", allocate_tty=True, args=["string"], @@ -645,7 +645,7 @@ async def test_method_spawn_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_spawn(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) @@ -658,7 +658,7 @@ async def test_raw_response_spawn(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_spawn(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.spawn( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", command="command", ) as response: assert not response.is_closed @@ -672,9 +672,9 @@ async def test_streaming_response_spawn(self, async_client: AsyncKernel) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_spawn(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.spawn( - id="", + id_or_name="", command="command", ) @@ -683,7 +683,7 @@ async def test_path_params_spawn(self, async_client: AsyncKernel) -> None: async def test_method_status(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ProcessStatusResponse, process, path=["response"]) @@ -692,7 +692,7 @@ async def test_method_status(self, async_client: AsyncKernel) -> None: async def test_raw_response_status(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -705,7 +705,7 @@ async def test_raw_response_status(self, async_client: AsyncKernel) -> None: async def test_streaming_response_status(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -718,16 +718,16 @@ async def test_streaming_response_status(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_status(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.status( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): await async_client.browsers.process.with_raw_response.status( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @pytest.mark.skip(reason="Mock server tests are disabled") @@ -735,7 +735,7 @@ async def test_path_params_status(self, async_client: AsyncKernel) -> None: async def test_method_stdin(self, async_client: AsyncKernel) -> None: process = await async_client.browsers.process.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) assert_matches_type(ProcessStdinResponse, process, path=["response"]) @@ -745,7 +745,7 @@ async def test_method_stdin(self, async_client: AsyncKernel) -> None: async def test_raw_response_stdin(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) @@ -759,7 +759,7 @@ async def test_raw_response_stdin(self, async_client: AsyncKernel) -> None: async def test_streaming_response_stdin(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) as response: assert not response.is_closed @@ -773,17 +773,17 @@ async def test_streaming_response_stdin(self, async_client: AsyncKernel) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stdin(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.stdin( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", data_b64="data_b64", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): await async_client.browsers.process.with_raw_response.stdin( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", data_b64="data_b64", ) @@ -792,7 +792,7 @@ async def test_path_params_stdin(self, async_client: AsyncKernel) -> None: async def test_method_stdout_stream(self, async_client: AsyncKernel) -> None: process_stream = await async_client.browsers.process.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) await process_stream.response.aclose() @@ -801,7 +801,7 @@ async def test_method_stdout_stream(self, async_client: AsyncKernel) -> None: async def test_raw_response_stdout_stream(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.process.with_raw_response.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -813,7 +813,7 @@ async def test_raw_response_stdout_stream(self, async_client: AsyncKernel) -> No async def test_streaming_response_stdout_stream(self, async_client: AsyncKernel) -> None: async with async_client.browsers.process.with_streaming_response.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -826,14 +826,14 @@ async def test_streaming_response_stdout_stream(self, async_client: AsyncKernel) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stdout_stream(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.process.with_raw_response.stdout_stream( process_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `process_id` but received ''"): await async_client.browsers.process.with_raw_response.stdout_stream( process_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) diff --git a/tests/api_resources/browsers/test_replays.py b/tests/api_resources/browsers/test_replays.py index 0b450ff8..bb6ddbdd 100644 --- a/tests/api_resources/browsers/test_replays.py +++ b/tests/api_resources/browsers/test_replays.py @@ -29,7 +29,7 @@ class TestReplays: @parametrize def test_method_list(self, client: Kernel) -> None: replay = client.browsers.replays.list( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ReplayListResponse, replay, path=["response"]) @@ -37,7 +37,7 @@ def test_method_list(self, client: Kernel) -> None: @parametrize def test_raw_response_list(self, client: Kernel) -> None: response = client.browsers.replays.with_raw_response.list( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -49,7 +49,7 @@ def test_raw_response_list(self, client: Kernel) -> None: @parametrize def test_streaming_response_list(self, client: Kernel) -> None: with client.browsers.replays.with_streaming_response.list( - "id", + "htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -62,7 +62,7 @@ def test_streaming_response_list(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_list(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.replays.with_raw_response.list( "", ) @@ -70,10 +70,12 @@ def test_path_params_list(self, client: Kernel) -> None: @parametrize @pytest.mark.respx(base_url=base_url) def test_method_download(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/replays/replay_id").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/replays/replay_id").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) replay = client.browsers.replays.download( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert replay.is_closed assert replay.json() == {"foo": "bar"} @@ -83,11 +85,13 @@ def test_method_download(self, client: Kernel, respx_mock: MockRouter) -> None: @parametrize @pytest.mark.respx(base_url=base_url) def test_raw_response_download(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/replays/replay_id").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/replays/replay_id").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) replay = client.browsers.replays.with_raw_response.download( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert replay.is_closed is True @@ -98,10 +102,12 @@ def test_raw_response_download(self, client: Kernel, respx_mock: MockRouter) -> @parametrize @pytest.mark.respx(base_url=base_url) def test_streaming_response_download(self, client: Kernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/replays/replay_id").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/replays/replay_id").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) with client.browsers.replays.with_streaming_response.download( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as replay: assert not replay.is_closed assert replay.http_request.headers.get("X-Stainless-Lang") == "python" @@ -115,23 +121,23 @@ def test_streaming_response_download(self, client: Kernel, respx_mock: MockRoute @parametrize @pytest.mark.respx(base_url=base_url) def test_path_params_download(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.replays.with_raw_response.download( replay_id="replay_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `replay_id` but received ''"): client.browsers.replays.with_raw_response.download( replay_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_start(self, client: Kernel) -> None: replay = client.browsers.replays.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ReplayStartResponse, replay, path=["response"]) @@ -139,7 +145,7 @@ def test_method_start(self, client: Kernel) -> None: @parametrize def test_method_start_with_all_params(self, client: Kernel) -> None: replay = client.browsers.replays.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", framerate=1, max_duration_in_seconds=1, record_audio=True, @@ -150,7 +156,7 @@ def test_method_start_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_start(self, client: Kernel) -> None: response = client.browsers.replays.with_raw_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -162,7 +168,7 @@ def test_raw_response_start(self, client: Kernel) -> None: @parametrize def test_streaming_response_start(self, client: Kernel) -> None: with client.browsers.replays.with_streaming_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -175,9 +181,9 @@ def test_streaming_response_start(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_start(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.replays.with_raw_response.start( - id="", + id_or_name="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @@ -185,7 +191,7 @@ def test_path_params_start(self, client: Kernel) -> None: def test_method_stop(self, client: Kernel) -> None: replay = client.browsers.replays.stop( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert replay is None @@ -194,7 +200,7 @@ def test_method_stop(self, client: Kernel) -> None: def test_raw_response_stop(self, client: Kernel) -> None: response = client.browsers.replays.with_raw_response.stop( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -207,7 +213,7 @@ def test_raw_response_stop(self, client: Kernel) -> None: def test_streaming_response_stop(self, client: Kernel) -> None: with client.browsers.replays.with_streaming_response.stop( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -220,16 +226,16 @@ def test_streaming_response_stop(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stop(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.replays.with_raw_response.stop( replay_id="replay_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `replay_id` but received ''"): client.browsers.replays.with_raw_response.stop( replay_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @@ -242,7 +248,7 @@ class TestAsyncReplays: @parametrize async def test_method_list(self, async_client: AsyncKernel) -> None: replay = await async_client.browsers.replays.list( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ReplayListResponse, replay, path=["response"]) @@ -250,7 +256,7 @@ async def test_method_list(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_list(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.replays.with_raw_response.list( - "id", + "htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -262,7 +268,7 @@ async def test_raw_response_list(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_list(self, async_client: AsyncKernel) -> None: async with async_client.browsers.replays.with_streaming_response.list( - "id", + "htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -275,7 +281,7 @@ async def test_streaming_response_list(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_list(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.replays.with_raw_response.list( "", ) @@ -283,10 +289,12 @@ async def test_path_params_list(self, async_client: AsyncKernel) -> None: @parametrize @pytest.mark.respx(base_url=base_url) async def test_method_download(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/replays/replay_id").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/replays/replay_id").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) replay = await async_client.browsers.replays.download( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert replay.is_closed assert await replay.json() == {"foo": "bar"} @@ -296,11 +304,13 @@ async def test_method_download(self, async_client: AsyncKernel, respx_mock: Mock @parametrize @pytest.mark.respx(base_url=base_url) async def test_raw_response_download(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/replays/replay_id").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/replays/replay_id").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) replay = await async_client.browsers.replays.with_raw_response.download( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert replay.is_closed is True @@ -311,10 +321,12 @@ async def test_raw_response_download(self, async_client: AsyncKernel, respx_mock @parametrize @pytest.mark.respx(base_url=base_url) async def test_streaming_response_download(self, async_client: AsyncKernel, respx_mock: MockRouter) -> None: - respx_mock.get("/browsers/id/replays/replay_id").mock(return_value=httpx.Response(200, json={"foo": "bar"})) + respx_mock.get("/browsers/htzv5orfit78e1m2biiifpbv/replays/replay_id").mock( + return_value=httpx.Response(200, json={"foo": "bar"}) + ) async with async_client.browsers.replays.with_streaming_response.download( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as replay: assert not replay.is_closed assert replay.http_request.headers.get("X-Stainless-Lang") == "python" @@ -328,23 +340,23 @@ async def test_streaming_response_download(self, async_client: AsyncKernel, resp @parametrize @pytest.mark.respx(base_url=base_url) async def test_path_params_download(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.replays.with_raw_response.download( replay_id="replay_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `replay_id` but received ''"): await async_client.browsers.replays.with_raw_response.download( replay_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_start(self, async_client: AsyncKernel) -> None: replay = await async_client.browsers.replays.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert_matches_type(ReplayStartResponse, replay, path=["response"]) @@ -352,7 +364,7 @@ async def test_method_start(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_start_with_all_params(self, async_client: AsyncKernel) -> None: replay = await async_client.browsers.replays.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", framerate=1, max_duration_in_seconds=1, record_audio=True, @@ -363,7 +375,7 @@ async def test_method_start_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_start(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.replays.with_raw_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -375,7 +387,7 @@ async def test_raw_response_start(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_start(self, async_client: AsyncKernel) -> None: async with async_client.browsers.replays.with_streaming_response.start( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -388,9 +400,9 @@ async def test_streaming_response_start(self, async_client: AsyncKernel) -> None @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_start(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.replays.with_raw_response.start( - id="", + id_or_name="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @@ -398,7 +410,7 @@ async def test_path_params_start(self, async_client: AsyncKernel) -> None: async def test_method_stop(self, async_client: AsyncKernel) -> None: replay = await async_client.browsers.replays.stop( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert replay is None @@ -407,7 +419,7 @@ async def test_method_stop(self, async_client: AsyncKernel) -> None: async def test_raw_response_stop(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.replays.with_raw_response.stop( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -420,7 +432,7 @@ async def test_raw_response_stop(self, async_client: AsyncKernel) -> None: async def test_streaming_response_stop(self, async_client: AsyncKernel) -> None: async with async_client.browsers.replays.with_streaming_response.stop( replay_id="replay_id", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -433,14 +445,14 @@ async def test_streaming_response_stop(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stop(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.replays.with_raw_response.stop( replay_id="replay_id", - id="", + id_or_name="", ) with pytest.raises(ValueError, match=r"Expected a non-empty value for `replay_id` but received ''"): await async_client.browsers.replays.with_raw_response.stop( replay_id="", - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) diff --git a/tests/api_resources/browsers/test_telemetry.py b/tests/api_resources/browsers/test_telemetry.py index 3c5dad44..b54dfbc1 100644 --- a/tests/api_resources/browsers/test_telemetry.py +++ b/tests/api_resources/browsers/test_telemetry.py @@ -22,7 +22,7 @@ class TestTelemetry: @parametrize def test_method_events(self, client: Kernel) -> None: telemetry = client.browsers.telemetry.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert_matches_type(SyncOffsetPagination[TelemetryEventsResponse], telemetry, path=["response"]) @@ -30,7 +30,7 @@ def test_method_events(self, client: Kernel) -> None: @parametrize def test_method_events_with_all_params(self, client: Kernel) -> None: telemetry = client.browsers.telemetry.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", category=["console"], limit=1, offset=0, @@ -44,7 +44,7 @@ def test_method_events_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_events(self, client: Kernel) -> None: response = client.browsers.telemetry.with_raw_response.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -56,7 +56,7 @@ def test_raw_response_events(self, client: Kernel) -> None: @parametrize def test_streaming_response_events(self, client: Kernel) -> None: with client.browsers.telemetry.with_streaming_response.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,16 +69,16 @@ def test_streaming_response_events(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_events(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.telemetry.with_raw_response.events( - id="", + id_or_name="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_method_stream(self, client: Kernel) -> None: telemetry_stream = client.browsers.telemetry.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) telemetry_stream.response.close() @@ -86,7 +86,7 @@ def test_method_stream(self, client: Kernel) -> None: @parametrize def test_method_stream_with_all_params(self, client: Kernel) -> None: telemetry_stream = client.browsers.telemetry.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", replay="replay", last_event_id="Last-Event-ID", ) @@ -96,7 +96,7 @@ def test_method_stream_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_stream(self, client: Kernel) -> None: response = client.browsers.telemetry.with_raw_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -107,7 +107,7 @@ def test_raw_response_stream(self, client: Kernel) -> None: @parametrize def test_streaming_response_stream(self, client: Kernel) -> None: with client.browsers.telemetry.with_streaming_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -120,9 +120,9 @@ def test_streaming_response_stream(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_stream(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.telemetry.with_raw_response.stream( - id="", + id_or_name="", ) @@ -135,7 +135,7 @@ class TestAsyncTelemetry: @parametrize async def test_method_events(self, async_client: AsyncKernel) -> None: telemetry = await async_client.browsers.telemetry.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert_matches_type(AsyncOffsetPagination[TelemetryEventsResponse], telemetry, path=["response"]) @@ -143,7 +143,7 @@ async def test_method_events(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_events_with_all_params(self, async_client: AsyncKernel) -> None: telemetry = await async_client.browsers.telemetry.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", category=["console"], limit=1, offset=0, @@ -157,7 +157,7 @@ async def test_method_events_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_events(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.telemetry.with_raw_response.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.is_closed is True @@ -169,7 +169,7 @@ async def test_raw_response_events(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_events(self, async_client: AsyncKernel) -> None: async with async_client.browsers.telemetry.with_streaming_response.events( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -182,16 +182,16 @@ async def test_streaming_response_events(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_events(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.telemetry.with_raw_response.events( - id="", + id_or_name="", ) @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_method_stream(self, async_client: AsyncKernel) -> None: telemetry_stream = await async_client.browsers.telemetry.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) await telemetry_stream.response.aclose() @@ -199,7 +199,7 @@ async def test_method_stream(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_stream_with_all_params(self, async_client: AsyncKernel) -> None: telemetry_stream = await async_client.browsers.telemetry.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", replay="replay", last_event_id="Last-Event-ID", ) @@ -209,7 +209,7 @@ async def test_method_stream_with_all_params(self, async_client: AsyncKernel) -> @parametrize async def test_raw_response_stream(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.telemetry.with_raw_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -220,7 +220,7 @@ async def test_raw_response_stream(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_stream(self, async_client: AsyncKernel) -> None: async with async_client.browsers.telemetry.with_streaming_response.stream( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -233,7 +233,7 @@ async def test_streaming_response_stream(self, async_client: AsyncKernel) -> Non @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_stream(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.telemetry.with_raw_response.stream( - id="", + id_or_name="", ) diff --git a/tests/api_resources/browsers/test_webmcp.py b/tests/api_resources/browsers/test_webmcp.py new file mode 100644 index 00000000..a55d692c --- /dev/null +++ b/tests/api_resources/browsers/test_webmcp.py @@ -0,0 +1,230 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from kernel import Kernel, AsyncKernel +from tests.utils import assert_matches_type +from kernel.types.browsers import ToolsResponse, InvocationResult + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestWebmcp: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_invoke_tool(self, client: Kernel) -> None: + webmcp = client.browsers.webmcp.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + ) + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_invoke_tool_with_all_params(self, client: Kernel) -> None: + webmcp = client.browsers.webmcp.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + timeout_sec=1, + ) + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_invoke_tool(self, client: Kernel) -> None: + response = client.browsers.webmcp.with_raw_response.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + webmcp = response.parse() + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_invoke_tool(self, client: Kernel) -> None: + with client.browsers.webmcp.with_streaming_response.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + webmcp = response.parse() + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_invoke_tool(self, client: Kernel) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): + client.browsers.webmcp.with_raw_response.invoke_tool( + id_or_name="", + input={"foo": "bar"}, + tool_ref="x", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_method_list_tools(self, client: Kernel) -> None: + webmcp = client.browsers.webmcp.list_tools( + "htzv5orfit78e1m2biiifpbv", + ) + assert_matches_type(ToolsResponse, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_raw_response_list_tools(self, client: Kernel) -> None: + response = client.browsers.webmcp.with_raw_response.list_tools( + "htzv5orfit78e1m2biiifpbv", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + webmcp = response.parse() + assert_matches_type(ToolsResponse, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_streaming_response_list_tools(self, client: Kernel) -> None: + with client.browsers.webmcp.with_streaming_response.list_tools( + "htzv5orfit78e1m2biiifpbv", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + webmcp = response.parse() + assert_matches_type(ToolsResponse, webmcp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + def test_path_params_list_tools(self, client: Kernel) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): + client.browsers.webmcp.with_raw_response.list_tools( + "", + ) + + +class TestAsyncWebmcp: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_invoke_tool(self, async_client: AsyncKernel) -> None: + webmcp = await async_client.browsers.webmcp.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + ) + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_invoke_tool_with_all_params(self, async_client: AsyncKernel) -> None: + webmcp = await async_client.browsers.webmcp.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + timeout_sec=1, + ) + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_invoke_tool(self, async_client: AsyncKernel) -> None: + response = await async_client.browsers.webmcp.with_raw_response.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + webmcp = await response.parse() + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_invoke_tool(self, async_client: AsyncKernel) -> None: + async with async_client.browsers.webmcp.with_streaming_response.invoke_tool( + id_or_name="htzv5orfit78e1m2biiifpbv", + input={"foo": "bar"}, + tool_ref="x", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + webmcp = await response.parse() + assert_matches_type(InvocationResult, webmcp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_invoke_tool(self, async_client: AsyncKernel) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): + await async_client.browsers.webmcp.with_raw_response.invoke_tool( + id_or_name="", + input={"foo": "bar"}, + tool_ref="x", + ) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_method_list_tools(self, async_client: AsyncKernel) -> None: + webmcp = await async_client.browsers.webmcp.list_tools( + "htzv5orfit78e1m2biiifpbv", + ) + assert_matches_type(ToolsResponse, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_raw_response_list_tools(self, async_client: AsyncKernel) -> None: + response = await async_client.browsers.webmcp.with_raw_response.list_tools( + "htzv5orfit78e1m2biiifpbv", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + webmcp = await response.parse() + assert_matches_type(ToolsResponse, webmcp, path=["response"]) + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_streaming_response_list_tools(self, async_client: AsyncKernel) -> None: + async with async_client.browsers.webmcp.with_streaming_response.list_tools( + "htzv5orfit78e1m2biiifpbv", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + webmcp = await response.parse() + assert_matches_type(ToolsResponse, webmcp, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @pytest.mark.skip(reason="Mock server tests are disabled") + @parametrize + async def test_path_params_list_tools(self, async_client: AsyncKernel) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): + await async_client.browsers.webmcp.with_raw_response.list_tools( + "", + ) diff --git a/tests/api_resources/test_browsers.py b/tests/api_resources/test_browsers.py index 55a7e66f..3d0a3eb6 100644 --- a/tests/api_resources/test_browsers.py +++ b/tests/api_resources/test_browsers.py @@ -321,7 +321,7 @@ def test_streaming_response_list(self, client: Kernel) -> None: @parametrize def test_method_curl(self, client: Kernel) -> None: browser = client.browsers.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", ) assert_matches_type(BrowserCurlResponse, browser, path=["response"]) @@ -330,7 +330,7 @@ def test_method_curl(self, client: Kernel) -> None: @parametrize def test_method_curl_with_all_params(self, client: Kernel) -> None: browser = client.browsers.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", body="body", headers={"foo": "string"}, @@ -344,7 +344,7 @@ def test_method_curl_with_all_params(self, client: Kernel) -> None: @parametrize def test_raw_response_curl(self, client: Kernel) -> None: response = client.browsers.with_raw_response.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", ) @@ -357,7 +357,7 @@ def test_raw_response_curl(self, client: Kernel) -> None: @parametrize def test_streaming_response_curl(self, client: Kernel) -> None: with client.browsers.with_streaming_response.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", ) as response: assert not response.is_closed @@ -371,9 +371,9 @@ def test_streaming_response_curl(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_curl(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.with_raw_response.curl( - id="", + id_or_name="", url="url", ) @@ -423,7 +423,7 @@ def test_path_params_delete_by_id(self, client: Kernel) -> None: @parametrize def test_method_load_extensions(self, client: Kernel) -> None: browser = client.browsers.load_extensions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", extensions=[ { "name": "name", @@ -437,7 +437,7 @@ def test_method_load_extensions(self, client: Kernel) -> None: @parametrize def test_raw_response_load_extensions(self, client: Kernel) -> None: response = client.browsers.with_raw_response.load_extensions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", extensions=[ { "name": "name", @@ -455,7 +455,7 @@ def test_raw_response_load_extensions(self, client: Kernel) -> None: @parametrize def test_streaming_response_load_extensions(self, client: Kernel) -> None: with client.browsers.with_streaming_response.load_extensions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", extensions=[ { "name": "name", @@ -474,9 +474,9 @@ def test_streaming_response_load_extensions(self, client: Kernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize def test_path_params_load_extensions(self, client: Kernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): client.browsers.with_raw_response.load_extensions( - id="", + id_or_name="", extensions=[ { "name": "name", @@ -788,7 +788,7 @@ async def test_streaming_response_list(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_curl(self, async_client: AsyncKernel) -> None: browser = await async_client.browsers.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", ) assert_matches_type(BrowserCurlResponse, browser, path=["response"]) @@ -797,7 +797,7 @@ async def test_method_curl(self, async_client: AsyncKernel) -> None: @parametrize async def test_method_curl_with_all_params(self, async_client: AsyncKernel) -> None: browser = await async_client.browsers.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", body="body", headers={"foo": "string"}, @@ -811,7 +811,7 @@ async def test_method_curl_with_all_params(self, async_client: AsyncKernel) -> N @parametrize async def test_raw_response_curl(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.with_raw_response.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", ) @@ -824,7 +824,7 @@ async def test_raw_response_curl(self, async_client: AsyncKernel) -> None: @parametrize async def test_streaming_response_curl(self, async_client: AsyncKernel) -> None: async with async_client.browsers.with_streaming_response.curl( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", url="url", ) as response: assert not response.is_closed @@ -838,9 +838,9 @@ async def test_streaming_response_curl(self, async_client: AsyncKernel) -> None: @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_curl(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.with_raw_response.curl( - id="", + id_or_name="", url="url", ) @@ -890,7 +890,7 @@ async def test_path_params_delete_by_id(self, async_client: AsyncKernel) -> None @parametrize async def test_method_load_extensions(self, async_client: AsyncKernel) -> None: browser = await async_client.browsers.load_extensions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", extensions=[ { "name": "name", @@ -904,7 +904,7 @@ async def test_method_load_extensions(self, async_client: AsyncKernel) -> None: @parametrize async def test_raw_response_load_extensions(self, async_client: AsyncKernel) -> None: response = await async_client.browsers.with_raw_response.load_extensions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", extensions=[ { "name": "name", @@ -922,7 +922,7 @@ async def test_raw_response_load_extensions(self, async_client: AsyncKernel) -> @parametrize async def test_streaming_response_load_extensions(self, async_client: AsyncKernel) -> None: async with async_client.browsers.with_streaming_response.load_extensions( - id="id", + id_or_name="htzv5orfit78e1m2biiifpbv", extensions=[ { "name": "name", @@ -941,9 +941,9 @@ async def test_streaming_response_load_extensions(self, async_client: AsyncKerne @pytest.mark.skip(reason="Mock server tests are disabled") @parametrize async def test_path_params_load_extensions(self, async_client: AsyncKernel) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id_or_name` but received ''"): await async_client.browsers.with_raw_response.load_extensions( - id="", + id_or_name="", extensions=[ { "name": "name", From 5aaaae65d3df8bbf2c9dfa4a5f7770115c383346 Mon Sep 17 00:00:00 2001 From: "kernel-internal[bot]" <260533166+kernel-internal[bot]@users.noreply.github.com> Date: Wed, 2 Sep 2026 19:06:27 +0000 Subject: [PATCH 2/2] release: 0.98.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 7 +++++++ pyproject.toml | 2 +- src/kernel/_version.py | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index ca93fdaa..a8124647 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.97.0" + ".": "0.98.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 01df1612..992c5f68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## [0.98.0](https://github.com/kernel/kernel-python-sdk/compare/v0.97.0...v0.98.0) (2026-09-02) + + +### Features + +* Accept browser session name on all /browsers/{id_or_name} sub-resource routes ([a60fa2b](https://github.com/kernel/kernel-python-sdk/commit/a60fa2bd48b06c8ca61005c3e29c42918ee371f2)) + ## [0.97.0](https://github.com/kernel/kernel-python-sdk/compare/v0.96.0...v0.97.0) (2026-08-31) diff --git a/pyproject.toml b/pyproject.toml index 2400b318..fbe3ab05 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "kernel" -version = "0.97.0" +version = "0.98.0" description = "The official Python library for the kernel API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/kernel/_version.py b/src/kernel/_version.py index f1214100..4adaa91f 100644 --- a/src/kernel/_version.py +++ b/src/kernel/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "kernel" -__version__ = "0.97.0" # x-release-please-version +__version__ = "0.98.0" # x-release-please-version