diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1d52ad841..ce5e5c7c5 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.34.1" + ".": "0.35.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index ed111e8b5..46caeac12 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 81 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-88c3df1881ce3ca780736c14f781e2b1930abb2ceeadb5cdabeda4d67f877511.yml -openapi_spec_hash: e47eece926740aba8272685c342a1d4b -config_hash: e17450cd026f260f68713ad9f12bd999 +configured_endpoints: 84 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-da7ec5b4cc55e7316bc3de6a9c0a37f5ee3057d3d68fdda9cb570d1a1fee57ea.yml +openapi_spec_hash: 5b89a8e3c67c4816dfab9a87fd67247d +config_hash: 8c014837a658512c2e23c002bb0f2ab1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c1cbc3a9..4beb5c269 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.35.0 (2025-05-30) + +Full Changelog: [v0.34.1...v0.35.0](https://github.com/runloopai/api-client-python/compare/v0.34.1...v0.35.0) + +### Features + +* **api:** api update ([c303a71](https://github.com/runloopai/api-client-python/commit/c303a710e21d6da73de907638905b08027acf64a)) + ## 0.34.1 (2025-05-28) Full Changelog: [v0.34.0...v0.34.1](https://github.com/runloopai/api-client-python/compare/v0.34.0...v0.34.1) diff --git a/api.md b/api.md index ae70d24ec..7014986f6 100644 --- a/api.md +++ b/api.md @@ -22,6 +22,7 @@ Methods: - client.benchmarks.create(\*\*params) -> BenchmarkView - client.benchmarks.retrieve(id) -> BenchmarkView +- client.benchmarks.update(id, \*\*params) -> BenchmarkView - client.benchmarks.list(\*\*params) -> SyncBenchmarksCursorIDPage[BenchmarkView] - client.benchmarks.list_public(\*\*params) -> SyncBenchmarksCursorIDPage[BenchmarkView] - client.benchmarks.start_run(\*\*params) -> BenchmarkRunView @@ -32,6 +33,7 @@ Methods: - client.benchmarks.runs.retrieve(id) -> BenchmarkRunView - client.benchmarks.runs.list(\*\*params) -> SyncBenchmarkRunsCursorIDPage[BenchmarkRunView] +- client.benchmarks.runs.cancel(id) -> BenchmarkRunView - client.benchmarks.runs.complete(id) -> BenchmarkRunView # Blueprints @@ -287,6 +289,7 @@ Methods: - client.scenarios.runs.retrieve(id) -> ScenarioRunView - client.scenarios.runs.list(\*\*params) -> SyncBenchmarkRunsCursorIDPage[ScenarioRunView] +- client.scenarios.runs.cancel(id) -> ScenarioRunView - client.scenarios.runs.complete(id) -> ScenarioRunView - client.scenarios.runs.score(id) -> ScenarioRunView diff --git a/pyproject.toml b/pyproject.toml index 393834923..6338f7f73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "runloop_api_client" -version = "0.34.1" +version = "0.35.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 d1eb93af3..64c7ee59c 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.34.1" # x-release-please-version +__version__ = "0.35.0" # x-release-please-version diff --git a/src/runloop_api_client/resources/benchmarks/benchmarks.py b/src/runloop_api_client/resources/benchmarks/benchmarks.py index 0c77ce342..fdbb65b22 100644 --- a/src/runloop_api_client/resources/benchmarks/benchmarks.py +++ b/src/runloop_api_client/resources/benchmarks/benchmarks.py @@ -17,6 +17,7 @@ from ...types import ( benchmark_list_params, benchmark_create_params, + benchmark_update_params, benchmark_start_run_params, benchmark_list_public_params, ) @@ -153,6 +154,67 @@ def retrieve( cast_to=BenchmarkView, ) + def update( + self, + id: str, + *, + is_public: bool, + name: str, + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + scenario_ids: Optional[List[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, + ) -> BenchmarkView: + """ + Update a Benchmark with a set of Scenarios. + + Args: + is_public: Whether this benchmark is public. + + name: The name of the Benchmark. This must be unique. + + metadata: User defined metadata to attach to the benchmark for organization. + + scenario_ids: The Scenario IDs that make up the Benchmark. + + 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}") + return self._post( + f"/v1/benchmarks/{id}", + body=maybe_transform( + { + "is_public": is_public, + "name": name, + "metadata": metadata, + "scenario_ids": scenario_ids, + }, + benchmark_update_params.BenchmarkUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=BenchmarkView, + ) + def list( self, *, @@ -417,6 +479,67 @@ async def retrieve( cast_to=BenchmarkView, ) + async def update( + self, + id: str, + *, + is_public: bool, + name: str, + metadata: Optional[Dict[str, str]] | NotGiven = NOT_GIVEN, + scenario_ids: Optional[List[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, + ) -> BenchmarkView: + """ + Update a Benchmark with a set of Scenarios. + + Args: + is_public: Whether this benchmark is public. + + name: The name of the Benchmark. This must be unique. + + metadata: User defined metadata to attach to the benchmark for organization. + + scenario_ids: The Scenario IDs that make up the Benchmark. + + 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}") + return await self._post( + f"/v1/benchmarks/{id}", + body=await async_maybe_transform( + { + "is_public": is_public, + "name": name, + "metadata": metadata, + "scenario_ids": scenario_ids, + }, + benchmark_update_params.BenchmarkUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=BenchmarkView, + ) + def list( self, *, @@ -576,6 +699,9 @@ def __init__(self, benchmarks: BenchmarksResource) -> None: self.retrieve = to_raw_response_wrapper( benchmarks.retrieve, ) + self.update = to_raw_response_wrapper( + benchmarks.update, + ) self.list = to_raw_response_wrapper( benchmarks.list, ) @@ -601,6 +727,9 @@ def __init__(self, benchmarks: AsyncBenchmarksResource) -> None: self.retrieve = async_to_raw_response_wrapper( benchmarks.retrieve, ) + self.update = async_to_raw_response_wrapper( + benchmarks.update, + ) self.list = async_to_raw_response_wrapper( benchmarks.list, ) @@ -626,6 +755,9 @@ def __init__(self, benchmarks: BenchmarksResource) -> None: self.retrieve = to_streamed_response_wrapper( benchmarks.retrieve, ) + self.update = to_streamed_response_wrapper( + benchmarks.update, + ) self.list = to_streamed_response_wrapper( benchmarks.list, ) @@ -651,6 +783,9 @@ def __init__(self, benchmarks: AsyncBenchmarksResource) -> None: self.retrieve = async_to_streamed_response_wrapper( benchmarks.retrieve, ) + self.update = async_to_streamed_response_wrapper( + benchmarks.update, + ) self.list = async_to_streamed_response_wrapper( benchmarks.list, ) diff --git a/src/runloop_api_client/resources/benchmarks/runs.py b/src/runloop_api_client/resources/benchmarks/runs.py index 7f84c5da5..ef6022d19 100644 --- a/src/runloop_api_client/resources/benchmarks/runs.py +++ b/src/runloop_api_client/resources/benchmarks/runs.py @@ -126,6 +126,46 @@ def list( model=BenchmarkRunView, ) + def cancel( + self, + id: 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, + idempotency_key: str | None = None, + ) -> BenchmarkRunView: + """ + Cancel a currently running Benchmark run. + + 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 + + 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}") + return self._post( + f"/v1/benchmarks/runs/{id}/cancel", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=BenchmarkRunView, + ) + def complete( self, id: str, @@ -271,6 +311,46 @@ def list( model=BenchmarkRunView, ) + async def cancel( + self, + id: 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, + idempotency_key: str | None = None, + ) -> BenchmarkRunView: + """ + Cancel a currently running Benchmark run. + + 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 + + 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}") + return await self._post( + f"/v1/benchmarks/runs/{id}/cancel", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=BenchmarkRunView, + ) + async def complete( self, id: str, @@ -322,6 +402,9 @@ def __init__(self, runs: RunsResource) -> None: self.list = to_raw_response_wrapper( runs.list, ) + self.cancel = to_raw_response_wrapper( + runs.cancel, + ) self.complete = to_raw_response_wrapper( runs.complete, ) @@ -337,6 +420,9 @@ def __init__(self, runs: AsyncRunsResource) -> None: self.list = async_to_raw_response_wrapper( runs.list, ) + self.cancel = async_to_raw_response_wrapper( + runs.cancel, + ) self.complete = async_to_raw_response_wrapper( runs.complete, ) @@ -352,6 +438,9 @@ def __init__(self, runs: RunsResource) -> None: self.list = to_streamed_response_wrapper( runs.list, ) + self.cancel = to_streamed_response_wrapper( + runs.cancel, + ) self.complete = to_streamed_response_wrapper( runs.complete, ) @@ -367,6 +456,9 @@ def __init__(self, runs: AsyncRunsResource) -> None: self.list = async_to_streamed_response_wrapper( runs.list, ) + self.cancel = async_to_streamed_response_wrapper( + runs.cancel, + ) self.complete = async_to_streamed_response_wrapper( runs.complete, ) diff --git a/src/runloop_api_client/resources/scenarios/runs.py b/src/runloop_api_client/resources/scenarios/runs.py index cabd8518f..1b277d52a 100644 --- a/src/runloop_api_client/resources/scenarios/runs.py +++ b/src/runloop_api_client/resources/scenarios/runs.py @@ -129,6 +129,48 @@ def list( model=ScenarioRunView, ) + def cancel( + self, + id: 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, + idempotency_key: str | None = None, + ) -> ScenarioRunView: + """Cancel a currently running Scenario run. + + This will shutdown the underlying + Devbox resource. + + 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 + + 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}") + return self._post( + f"/v1/scenarios/runs/{id}/cancel", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=ScenarioRunView, + ) + def complete( self, id: str, @@ -457,6 +499,48 @@ def list( model=ScenarioRunView, ) + async def cancel( + self, + id: 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, + idempotency_key: str | None = None, + ) -> ScenarioRunView: + """Cancel a currently running Scenario run. + + This will shutdown the underlying + Devbox resource. + + 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 + + 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}") + return await self._post( + f"/v1/scenarios/runs/{id}/cancel", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=ScenarioRunView, + ) + async def complete( self, id: str, @@ -692,6 +776,9 @@ def __init__(self, runs: RunsResource) -> None: self.list = to_raw_response_wrapper( runs.list, ) + self.cancel = to_raw_response_wrapper( + runs.cancel, + ) self.complete = to_raw_response_wrapper( runs.complete, ) @@ -710,6 +797,9 @@ def __init__(self, runs: AsyncRunsResource) -> None: self.list = async_to_raw_response_wrapper( runs.list, ) + self.cancel = async_to_raw_response_wrapper( + runs.cancel, + ) self.complete = async_to_raw_response_wrapper( runs.complete, ) @@ -728,6 +818,9 @@ def __init__(self, runs: RunsResource) -> None: self.list = to_streamed_response_wrapper( runs.list, ) + self.cancel = to_streamed_response_wrapper( + runs.cancel, + ) self.complete = to_streamed_response_wrapper( runs.complete, ) @@ -746,6 +839,9 @@ def __init__(self, runs: AsyncRunsResource) -> None: self.list = async_to_streamed_response_wrapper( runs.list, ) + self.cancel = async_to_streamed_response_wrapper( + runs.cancel, + ) self.complete = async_to_streamed_response_wrapper( runs.complete, ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index a0205effb..8e29c98ef 100644 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -38,6 +38,7 @@ from .scoring_function_param import ScoringFunctionParam as ScoringFunctionParam from .benchmark_create_params import BenchmarkCreateParams as BenchmarkCreateParams from .benchmark_run_list_view import BenchmarkRunListView as BenchmarkRunListView +from .benchmark_update_params import BenchmarkUpdateParams as BenchmarkUpdateParams from .blueprint_create_params import BlueprintCreateParams as BlueprintCreateParams from .blueprint_preview_params import BlueprintPreviewParams as BlueprintPreviewParams from .repository_create_params import RepositoryCreateParams as RepositoryCreateParams diff --git a/src/runloop_api_client/types/benchmark_run_view.py b/src/runloop_api_client/types/benchmark_run_view.py index 9239985aa..0f88d045b 100644 --- a/src/runloop_api_client/types/benchmark_run_view.py +++ b/src/runloop_api_client/types/benchmark_run_view.py @@ -33,7 +33,7 @@ class BenchmarkRunView(BaseModel): """User defined metadata to attach to the benchmark run for organization.""" pending_scenarios: List[str] - """List of Scenarios that need to be completed before benchmark can be completed.""" + """List of Scenarios that have yet to be scored.""" scenario_runs: List[ScenarioRun] """List of Scenarios have been completed.""" @@ -41,7 +41,7 @@ class BenchmarkRunView(BaseModel): start_time_ms: int """The time the benchmark run execution started (Unix timestamp milliseconds).""" - state: Literal["running", "completed"] + state: Literal["running", "canceled", "completed"] """The state of the BenchmarkRun.""" duration_ms: Optional[int] = None diff --git a/src/runloop_api_client/types/benchmark_update_params.py b/src/runloop_api_client/types/benchmark_update_params.py new file mode 100644 index 000000000..a00a379e0 --- /dev/null +++ b/src/runloop_api_client/types/benchmark_update_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Dict, List, Optional +from typing_extensions import Required, TypedDict + +__all__ = ["BenchmarkUpdateParams"] + + +class BenchmarkUpdateParams(TypedDict, total=False): + is_public: Required[bool] + """Whether this benchmark is public.""" + + name: Required[str] + """The name of the Benchmark. This must be unique.""" + + metadata: Optional[Dict[str, str]] + """User defined metadata to attach to the benchmark for organization.""" + + scenario_ids: Optional[List[str]] + """The Scenario IDs that make up the Benchmark.""" diff --git a/tests/api_resources/benchmarks/test_runs.py b/tests/api_resources/benchmarks/test_runs.py index e6acbebad..d23aa33b7 100644 --- a/tests/api_resources/benchmarks/test_runs.py +++ b/tests/api_resources/benchmarks/test_runs.py @@ -90,6 +90,44 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_cancel(self, client: Runloop) -> None: + run = client.benchmarks.runs.cancel( + "id", + ) + assert_matches_type(BenchmarkRunView, run, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Runloop) -> None: + response = client.benchmarks.runs.with_raw_response.cancel( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + run = response.parse() + assert_matches_type(BenchmarkRunView, run, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Runloop) -> None: + with client.benchmarks.runs.with_streaming_response.cancel( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + run = response.parse() + assert_matches_type(BenchmarkRunView, run, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.benchmarks.runs.with_raw_response.cancel( + "", + ) + @parametrize def test_method_complete(self, client: Runloop) -> None: run = client.benchmarks.runs.complete( @@ -204,6 +242,44 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_cancel(self, async_client: AsyncRunloop) -> None: + run = await async_client.benchmarks.runs.cancel( + "id", + ) + assert_matches_type(BenchmarkRunView, run, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncRunloop) -> None: + response = await async_client.benchmarks.runs.with_raw_response.cancel( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + run = await response.parse() + assert_matches_type(BenchmarkRunView, run, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncRunloop) -> None: + async with async_client.benchmarks.runs.with_streaming_response.cancel( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + run = await response.parse() + assert_matches_type(BenchmarkRunView, run, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.benchmarks.runs.with_raw_response.cancel( + "", + ) + @parametrize async def test_method_complete(self, async_client: AsyncRunloop) -> None: run = await async_client.benchmarks.runs.complete( diff --git a/tests/api_resources/scenarios/test_runs.py b/tests/api_resources/scenarios/test_runs.py index 35b2e5141..de0adca5f 100644 --- a/tests/api_resources/scenarios/test_runs.py +++ b/tests/api_resources/scenarios/test_runs.py @@ -90,6 +90,44 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_cancel(self, client: Runloop) -> None: + run = client.scenarios.runs.cancel( + "id", + ) + assert_matches_type(ScenarioRunView, run, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Runloop) -> None: + response = client.scenarios.runs.with_raw_response.cancel( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + run = response.parse() + assert_matches_type(ScenarioRunView, run, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Runloop) -> None: + with client.scenarios.runs.with_streaming_response.cancel( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + run = response.parse() + assert_matches_type(ScenarioRunView, run, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.scenarios.runs.with_raw_response.cancel( + "", + ) + @parametrize def test_method_complete(self, client: Runloop) -> None: run = client.scenarios.runs.complete( @@ -242,6 +280,44 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert cast(Any, response.is_closed) is True + @parametrize + async def test_method_cancel(self, async_client: AsyncRunloop) -> None: + run = await async_client.scenarios.runs.cancel( + "id", + ) + assert_matches_type(ScenarioRunView, run, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncRunloop) -> None: + response = await async_client.scenarios.runs.with_raw_response.cancel( + "id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + run = await response.parse() + assert_matches_type(ScenarioRunView, run, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncRunloop) -> None: + async with async_client.scenarios.runs.with_streaming_response.cancel( + "id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + run = await response.parse() + assert_matches_type(ScenarioRunView, run, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.scenarios.runs.with_raw_response.cancel( + "", + ) + @parametrize async def test_method_complete(self, async_client: AsyncRunloop) -> None: run = await async_client.scenarios.runs.complete( diff --git a/tests/api_resources/test_benchmarks.py b/tests/api_resources/test_benchmarks.py index 19a93ad89..0d70ef3c8 100644 --- a/tests/api_resources/test_benchmarks.py +++ b/tests/api_resources/test_benchmarks.py @@ -103,6 +103,63 @@ def test_path_params_retrieve(self, client: Runloop) -> None: "", ) + @parametrize + def test_method_update(self, client: Runloop) -> None: + benchmark = client.benchmarks.update( + id="id", + is_public=True, + name="name", + ) + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Runloop) -> None: + benchmark = client.benchmarks.update( + id="id", + is_public=True, + name="name", + metadata={"foo": "string"}, + scenario_ids=["string"], + ) + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Runloop) -> None: + response = client.benchmarks.with_raw_response.update( + id="id", + is_public=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + benchmark = response.parse() + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Runloop) -> None: + with client.benchmarks.with_streaming_response.update( + id="id", + is_public=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + benchmark = response.parse() + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Runloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + client.benchmarks.with_raw_response.update( + id="", + is_public=True, + name="name", + ) + @parametrize def test_method_list(self, client: Runloop) -> None: benchmark = client.benchmarks.list() @@ -295,6 +352,63 @@ async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: "", ) + @parametrize + async def test_method_update(self, async_client: AsyncRunloop) -> None: + benchmark = await async_client.benchmarks.update( + id="id", + is_public=True, + name="name", + ) + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncRunloop) -> None: + benchmark = await async_client.benchmarks.update( + id="id", + is_public=True, + name="name", + metadata={"foo": "string"}, + scenario_ids=["string"], + ) + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncRunloop) -> None: + response = await async_client.benchmarks.with_raw_response.update( + id="id", + is_public=True, + name="name", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + benchmark = await response.parse() + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncRunloop) -> None: + async with async_client.benchmarks.with_streaming_response.update( + id="id", + is_public=True, + name="name", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + benchmark = await response.parse() + assert_matches_type(BenchmarkView, benchmark, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncRunloop) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): + await async_client.benchmarks.with_raw_response.update( + id="", + is_public=True, + name="name", + ) + @parametrize async def test_method_list(self, async_client: AsyncRunloop) -> None: benchmark = await async_client.benchmarks.list()