diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 85c311828..284ce936c 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.59.0" + ".": "0.60.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 1eaf9aeec..bfc06aa5b 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 102 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-a8e2289b32b616e0bd7e15995a6553d0335bd21e30617a013d07450f8f5a7a20.yml -openapi_spec_hash: cd13a7af1ffe64c7ce8753f87786e01f -config_hash: 457068371129b47b67f0f2d6b8267368 +configured_endpoints: 104 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-0cb966ca566f4f3d7f8b4d3c37b24b4a117760dba194cb2c4f2bb4e3620027de.yml +openapi_spec_hash: c969887eb721b42a423e662127270d57 +config_hash: 103c1928ef462db5a22f26ca92caf7fe diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b00c7c10..9d9721d9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Changelog +## 0.60.0 (2025-09-10) + +Full Changelog: [v0.59.0...v0.60.0](https://github.com/runloopai/api-client-python/compare/v0.59.0...v0.60.0) + +### Features + +* **api:** api update ([82b7001](https://github.com/runloopai/api-client-python/commit/82b700156bc034cb486225ef2889b7f3b7575c9e)) +* **api:** api update ([5d1797b](https://github.com/runloopai/api-client-python/commit/5d1797b1e193ffd5b17c664fdf3894a568039c14)) +* **api:** api update ([f9e63d9](https://github.com/runloopai/api-client-python/commit/f9e63d96beac3fcdfda3b1038683ebf514b421d7)) + ## 0.59.0 (2025-09-08) Full Changelog: [v0.58.0...v0.59.0](https://github.com/runloopai/api-client-python/compare/v0.58.0...v0.59.0) diff --git a/api.md b/api.md index 3076ddf36..1504da149 100644 --- a/api.md +++ b/api.md @@ -95,6 +95,7 @@ Methods: - client.devboxes.create_tunnel(id, \*\*params) -> DevboxTunnelView - client.devboxes.delete_disk_snapshot(id) -> object - client.devboxes.download_file(id, \*\*params) -> BinaryAPIResponse +- client.devboxes.execute(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.execute_async(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.execute_sync(id, \*\*params) -> DevboxExecutionDetailView - client.devboxes.keep_alive(id) -> object @@ -107,6 +108,7 @@ Methods: - client.devboxes.snapshot_disk_async(id, \*\*params) -> DevboxSnapshotView - client.devboxes.suspend(id) -> DevboxView - client.devboxes.upload_file(id, \*\*params) -> object +- client.devboxes.wait_for_command(execution_id, \*, devbox_id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.write_file_contents(id, \*\*params) -> DevboxExecutionDetailView diff --git a/pyproject.toml b/pyproject.toml index 3aef4322c..9ff52932e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runloop_api_client" -version = "0.59.0" +version = "0.60.0" description = "The official Python library for the runloop API" dynamic = ["readme"] license = "MIT" diff --git a/src/runloop_api_client/_version.py b/src/runloop_api_client/_version.py index 533907a8a..23fb0da51 100644 --- a/src/runloop_api_client/_version.py +++ b/src/runloop_api_client/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "runloop_api_client" -__version__ = "0.59.0" # x-release-please-version +__version__ = "0.60.0" # x-release-please-version diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index 0d6b11d20..3046c4ce7 100644 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Dict, Mapping, Iterable, Optional, TypedDict, cast +from typing import Dict, List, Mapping, Iterable, Optional, TypedDict, cast from typing_extensions import Literal import httpx @@ -27,6 +27,7 @@ devbox_list_params, devbox_create_params, devbox_update_params, + devbox_execute_params, devbox_upload_file_params, devbox_execute_sync_params, devbox_create_tunnel_params, @@ -34,6 +35,7 @@ devbox_execute_async_params, devbox_remove_tunnel_params, devbox_snapshot_disk_params, + devbox_wait_for_command_params, devbox_read_file_contents_params, devbox_list_disk_snapshots_params, devbox_snapshot_disk_async_params, @@ -719,6 +721,72 @@ def download_file( cast_to=BinaryAPIResponse, ) + def execute( + self, + id: str, + *, + command: str, + command_id: str, + shell_name: Optional[str] | NotGiven = NOT_GIVEN, + # 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, + idempotency_key: str | None = None, + ) -> DevboxAsyncExecutionDetailView: + """ + Execute a command with a known command ID on a devbox, optimistically waiting + for it to complete within the specified timeout. If it completes in time, return + the result. If not, return a status indicating the command is still running. + + Args: + command: The command to execute via the Devbox shell. By default, commands are run from + the user home directory unless shell_name is specified. If shell_name is + specified the command is run from the directory based on the recent state of the + persistent shell. + + command_id: The command ID for idempotency and tracking + + shell_name: The name of the persistent shell to create or use if already created. When using + a persistent shell, the command will run from the directory at the end of the + previous command and environment variables will be preserved. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT: + timeout = 600 + return self._post( + f"/v1/devboxes/{id}/execute", + body=maybe_transform( + { + "command": command, + "command_id": command_id, + "shell_name": shell_name, + }, + devbox_execute_params.DevboxExecuteParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxAsyncExecutionDetailView, + ) + def execute_async( self, id: str, @@ -1340,6 +1408,66 @@ def upload_file( cast_to=object, ) + def wait_for_command( + self, + execution_id: str, + *, + devbox_id: str, + statuses: List[Literal["queued", "running", "completed"]], + timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN, + # 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, + idempotency_key: str | None = None, + ) -> DevboxAsyncExecutionDetailView: + """ + Polls the asynchronous execution's status until it reaches one of the desired + statuses or times out. Defaults to 60 seconds. + + Args: + statuses: The command execution statuses to wait for. At least one status must be + provided. The command will be returned as soon as it reaches any of the provided + statuses. + + timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 60 seconds. Defaults + to 60 seconds. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not devbox_id: + raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}") + if not execution_id: + raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") + return self._post( + f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status", + body=maybe_transform( + { + "statuses": statuses, + "timeout_seconds": timeout_seconds, + }, + devbox_wait_for_command_params.DevboxWaitForCommandParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxAsyncExecutionDetailView, + ) + def write_file_contents( self, id: str, @@ -1981,6 +2109,72 @@ async def download_file( cast_to=AsyncBinaryAPIResponse, ) + async def execute( + self, + id: str, + *, + command: str, + command_id: str, + shell_name: Optional[str] | NotGiven = NOT_GIVEN, + # 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, + idempotency_key: str | None = None, + ) -> DevboxAsyncExecutionDetailView: + """ + Execute a command with a known command ID on a devbox, optimistically waiting + for it to complete within the specified timeout. If it completes in time, return + the result. If not, return a status indicating the command is still running. + + Args: + command: The command to execute via the Devbox shell. By default, commands are run from + the user home directory unless shell_name is specified. If shell_name is + specified the command is run from the directory based on the recent state of the + persistent shell. + + command_id: The command ID for idempotency and tracking + + shell_name: The name of the persistent shell to create or use if already created. When using + a persistent shell, the command will run from the directory at the end of the + previous command and environment variables will be preserved. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not id: + raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") + if not is_given(timeout) and self._client.timeout == DEFAULT_TIMEOUT: + timeout = 600 + return await self._post( + f"/v1/devboxes/{id}/execute", + body=await async_maybe_transform( + { + "command": command, + "command_id": command_id, + "shell_name": shell_name, + }, + devbox_execute_params.DevboxExecuteParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxAsyncExecutionDetailView, + ) + async def execute_async( self, id: str, @@ -2602,6 +2796,66 @@ async def upload_file( cast_to=object, ) + async def wait_for_command( + self, + execution_id: str, + *, + devbox_id: str, + statuses: List[Literal["queued", "running", "completed"]], + timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN, + # 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, + idempotency_key: str | None = None, + ) -> DevboxAsyncExecutionDetailView: + """ + Polls the asynchronous execution's status until it reaches one of the desired + statuses or times out. Defaults to 60 seconds. + + Args: + statuses: The command execution statuses to wait for. At least one status must be + provided. The command will be returned as soon as it reaches any of the provided + statuses. + + timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 60 seconds. Defaults + to 60 seconds. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not devbox_id: + raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}") + if not execution_id: + raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") + return await self._post( + f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status", + body=await async_maybe_transform( + { + "statuses": statuses, + "timeout_seconds": timeout_seconds, + }, + devbox_wait_for_command_params.DevboxWaitForCommandParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=DevboxAsyncExecutionDetailView, + ) + async def write_file_contents( self, id: str, @@ -2690,6 +2944,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: devboxes.download_file, BinaryAPIResponse, ) + self.execute = to_raw_response_wrapper( + devboxes.execute, + ) self.execute_async = to_raw_response_wrapper( devboxes.execute_async, ) @@ -2726,6 +2983,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: self.upload_file = to_raw_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = to_raw_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = to_raw_response_wrapper( devboxes.write_file_contents, ) @@ -2784,6 +3044,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: devboxes.download_file, AsyncBinaryAPIResponse, ) + self.execute = async_to_raw_response_wrapper( + devboxes.execute, + ) self.execute_async = async_to_raw_response_wrapper( devboxes.execute_async, ) @@ -2820,6 +3083,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: self.upload_file = async_to_raw_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = async_to_raw_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = async_to_raw_response_wrapper( devboxes.write_file_contents, ) @@ -2878,6 +3144,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: devboxes.download_file, StreamedBinaryAPIResponse, ) + self.execute = to_streamed_response_wrapper( + devboxes.execute, + ) self.execute_async = to_streamed_response_wrapper( devboxes.execute_async, ) @@ -2914,6 +3183,9 @@ def __init__(self, devboxes: DevboxesResource) -> None: self.upload_file = to_streamed_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = to_streamed_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = to_streamed_response_wrapper( devboxes.write_file_contents, ) @@ -2972,6 +3244,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: devboxes.download_file, AsyncStreamedBinaryAPIResponse, ) + self.execute = async_to_streamed_response_wrapper( + devboxes.execute, + ) self.execute_async = async_to_streamed_response_wrapper( devboxes.execute_async, ) @@ -3008,6 +3283,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None: self.upload_file = async_to_streamed_response_wrapper( devboxes.upload_file, ) + self.wait_for_command = async_to_streamed_response_wrapper( + devboxes.wait_for_command, + ) self.write_file_contents = async_to_streamed_response_wrapper( devboxes.write_file_contents, ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index e57d0b026..4bae9f954 100644 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -41,6 +41,7 @@ from .secret_update_params import SecretUpdateParams as SecretUpdateParams from .benchmark_list_params import BenchmarkListParams as BenchmarkListParams from .blueprint_list_params import BlueprintListParams as BlueprintListParams +from .devbox_execute_params import DevboxExecuteParams as DevboxExecuteParams from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView from .object_download_params import ObjectDownloadParams as ObjectDownloadParams from .repository_list_params import RepositoryListParams as RepositoryListParams @@ -85,6 +86,7 @@ from .scoring_contract_update_param import ScoringContractUpdateParam as ScoringContractUpdateParam from .blueprint_build_logs_list_view import BlueprintBuildLogsListView as BlueprintBuildLogsListView from .devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse as DevboxCreateSSHKeyResponse +from .devbox_wait_for_command_params import DevboxWaitForCommandParams as DevboxWaitForCommandParams from .repository_connection_list_view import RepositoryConnectionListView as RepositoryConnectionListView from .repository_inspection_list_view import RepositoryInspectionListView as RepositoryInspectionListView from .devbox_read_file_contents_params import DevboxReadFileContentsParams as DevboxReadFileContentsParams diff --git a/src/runloop_api_client/types/devbox_execute_params.py b/src/runloop_api_client/types/devbox_execute_params.py new file mode 100644 index 000000000..6ac9d3632 --- /dev/null +++ b/src/runloop_api_client/types/devbox_execute_params.py @@ -0,0 +1,28 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Optional +from typing_extensions import Required, TypedDict + +__all__ = ["DevboxExecuteParams"] + + +class DevboxExecuteParams(TypedDict, total=False): + command: Required[str] + """The command to execute via the Devbox shell. + + By default, commands are run from the user home directory unless shell_name is + specified. If shell_name is specified the command is run from the directory + based on the recent state of the persistent shell. + """ + + command_id: Required[str] + """The command ID for idempotency and tracking""" + + shell_name: Optional[str] + """The name of the persistent shell to create or use if already created. + + When using a persistent shell, the command will run from the directory at the + end of the previous command and environment variables will be preserved. + """ diff --git a/src/runloop_api_client/types/devbox_wait_for_command_params.py b/src/runloop_api_client/types/devbox_wait_for_command_params.py new file mode 100644 index 000000000..93cf7e1e5 --- /dev/null +++ b/src/runloop_api_client/types/devbox_wait_for_command_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Optional +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["DevboxWaitForCommandParams"] + + +class DevboxWaitForCommandParams(TypedDict, total=False): + devbox_id: Required[str] + + statuses: Required[List[Literal["queued", "running", "completed"]]] + """The command execution statuses to wait for. + + At least one status must be provided. The command will be returned as soon as it + reaches any of the provided statuses. + """ + + timeout_seconds: Optional[int] + """(Optional) Timeout in seconds to wait for the status, up to 60 seconds. + + Defaults to 60 seconds. + """ diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index dfe1f1cbb..c638b064f 100644 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -405,6 +405,62 @@ def test_path_params_download_file(self, client: Runloop) -> None: path="path", ) + @parametrize + def test_method_execute(self, client: Runloop) -> None: + devbox = client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_method_execute_with_all_params(self, client: Runloop) -> None: + devbox = client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + shell_name="shell_name", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_raw_response_execute(self, client: Runloop) -> None: + response = client.devboxes.with_raw_response.execute( + id="id", + command="command", + command_id="command_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_streaming_response_execute(self, client: Runloop) -> None: + with client.devboxes.with_streaming_response.execute( + id="id", + command="command", + command_id="command_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_execute(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.devboxes.with_raw_response.execute( + id="", + command="command", + command_id="command_id", + ) + @parametrize def test_method_execute_async(self, client: Runloop) -> None: devbox = client.devboxes.execute_async( @@ -924,6 +980,69 @@ def test_path_params_upload_file(self, client: Runloop) -> None: path="path", ) + @parametrize + def test_method_wait_for_command(self, client: Runloop) -> None: + devbox = client.devboxes.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_method_wait_for_command_with_all_params(self, client: Runloop) -> None: + devbox = client.devboxes.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + timeout_seconds=0, + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_raw_response_wait_for_command(self, client: Runloop) -> None: + response = client.devboxes.with_raw_response.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + def test_streaming_response_wait_for_command(self, client: Runloop) -> None: + with client.devboxes.with_streaming_response.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_wait_for_command(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"): + client.devboxes.with_raw_response.wait_for_command( + execution_id="execution_id", + devbox_id="", + statuses=["queued"], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): + client.devboxes.with_raw_response.wait_for_command( + execution_id="", + devbox_id="devbox_id", + statuses=["queued"], + ) + @parametrize def test_method_write_file_contents(self, client: Runloop) -> None: devbox = client.devboxes.write_file_contents( @@ -1625,6 +1744,62 @@ async def test_path_params_download_file(self, async_client: AsyncRunloop) -> No path="path", ) + @parametrize + async def test_method_execute(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_method_execute_with_all_params(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.execute( + id="id", + command="command", + command_id="command_id", + shell_name="shell_name", + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_raw_response_execute(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.with_raw_response.execute( + id="id", + command="command", + command_id="command_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = await response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_streaming_response_execute(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.with_streaming_response.execute( + id="id", + command="command", + command_id="command_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = await response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_execute(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.devboxes.with_raw_response.execute( + id="", + command="command", + command_id="command_id", + ) + @parametrize async def test_method_execute_async(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.execute_async( @@ -2144,6 +2319,69 @@ async def test_path_params_upload_file(self, async_client: AsyncRunloop) -> None path="path", ) + @parametrize + async def test_method_wait_for_command(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_method_wait_for_command_with_all_params(self, async_client: AsyncRunloop) -> None: + devbox = await async_client.devboxes.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + timeout_seconds=0, + ) + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_raw_response_wait_for_command(self, async_client: AsyncRunloop) -> None: + response = await async_client.devboxes.with_raw_response.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + devbox = await response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + @parametrize + async def test_streaming_response_wait_for_command(self, async_client: AsyncRunloop) -> None: + async with async_client.devboxes.with_streaming_response.wait_for_command( + execution_id="execution_id", + devbox_id="devbox_id", + statuses=["queued"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + devbox = await response.parse() + assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_wait_for_command(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"): + await async_client.devboxes.with_raw_response.wait_for_command( + execution_id="execution_id", + devbox_id="", + statuses=["queued"], + ) + + with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): + await async_client.devboxes.with_raw_response.wait_for_command( + execution_id="", + devbox_id="devbox_id", + statuses=["queued"], + ) + @parametrize async def test_method_write_file_contents(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.write_file_contents(