From 45c156859d51416d36c77ccd16412c5b693e457b Mon Sep 17 00:00:00 2001 From: stainless-bot Date: Fri, 23 Aug 2024 23:31:08 +0000 Subject: [PATCH] feat(api): OpenAPI spec update via Stainless API --- .stats.yml | 4 +- api.md | 49 +-- src/runloop_api_client/_client.py | 12 - src/runloop_api_client/_streaming.py | 48 +- src/runloop_api_client/resources/__init__.py | 14 - .../resources/devboxes/devboxes.py | 10 +- .../resources/devboxes/executions.py | 357 +-------------- .../resources/devboxes/logs.py | 88 +--- .../resources/functions/functions.py | 50 --- .../resources/functions/invocations.py | 79 ---- src/runloop_api_client/types/__init__.py | 8 +- .../types/devboxes/__init__.py | 1 - .../types/functions/__init__.py | 1 - .../api_resources/devboxes/test_executions.py | 411 ------------------ tests/api_resources/devboxes/test_logs.py | 84 ---- .../functions/test_invocations.py | 81 +--- tests/api_resources/test_devboxes.py | 18 +- tests/api_resources/test_functions.py | 50 --- tests/test_client.py | 24 - 19 files changed, 35 insertions(+), 1354 deletions(-) diff --git a/.stats.yml b/.stats.yml index 41b5ab409..f0fee8e9b 100755 --- a/.stats.yml +++ b/.stats.yml @@ -1,2 +1,2 @@ -configured_endpoints: 36 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-ea589851f2dbba35fea6c010ac4c577cad56aa44e1d5bd4e5b472c802b2f13c4.yml +configured_endpoints: 24 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-2085d09cb7954db9bd300c0d93f1f08e25b69906011c0d65e899951880372ef1.yml diff --git a/api.md b/api.md index ba23ae8ae..6bae20322 100755 --- a/api.md +++ b/api.md @@ -43,36 +43,16 @@ Types: from runloop_api_client.types import CodeMountParameters ``` -# Deployments - -Types: - -```python -from runloop_api_client.types import ( - DeploymentRetrieveResponse, - DeploymentGetResponse, - DeploymentLogsResponse, - DeploymentRedeployResponse, - DeploymentTailResponse, -) -``` - -Methods: - -- client.deployments.retrieve(deployment_id) -> DeploymentRetrieveResponse -- client.deployments.get(\*\*params) -> DeploymentGetResponse -- client.deployments.logs(deployment_id) -> DeploymentLogsResponse -- client.deployments.redeploy(deployment_id) -> DeploymentRedeployResponse -- client.deployments.tail(deployment_id) -> DeploymentTailResponse - # Devboxes Types: ```python from runloop_api_client.types import ( + DevboxAsyncExecutionDetailView, + DevboxExecutionDetailView, + DevboxListView, DevboxView, - DevboxListResponse, DevboxCreateSSHKeyResponse, DevboxReadFileContentsResponse, DevboxUploadFileResponse, @@ -83,7 +63,7 @@ Methods: - client.devboxes.create(\*\*params) -> DevboxView - client.devboxes.retrieve(id) -> DevboxView -- client.devboxes.list(\*\*params) -> DevboxListResponse +- client.devboxes.list(\*\*params) -> DevboxListView - client.devboxes.create_ssh_key(id) -> DevboxCreateSSHKeyResponse - client.devboxes.execute_async(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.execute_sync(id, \*\*params) -> DevboxExecutionDetailView @@ -94,10 +74,15 @@ Methods: ## Logs +Types: + +```python +from runloop_api_client.types.devboxes import DevboxLogsListView +``` + Methods: - client.devboxes.logs.list(id) -> DevboxLogsListView -- client.devboxes.logs.tail(id) -> None ## Executions @@ -113,19 +98,15 @@ from runloop_api_client.types.devboxes import ( Methods: -- client.devboxes.executions.retrieve(exe_id, \*, id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.executions.execute_async(id, \*\*params) -> DevboxAsyncExecutionDetailView - client.devboxes.executions.execute_sync(id, \*\*params) -> DevboxExecutionDetailView -- client.devboxes.executions.kill(exe_id, \*, id) -> DevboxAsyncExecutionDetailView -- client.devboxes.executions.logs(execution_id, \*, id) -> DevboxLogsListView -- client.devboxes.executions.tail(execution_id, \*, id) -> None # Functions Types: ```python -from runloop_api_client.types import FunctionListView, FunctionListOpenAPIResponse +from runloop_api_client.types import FunctionListView ``` Methods: @@ -133,18 +114,13 @@ Methods: - client.functions.list() -> FunctionListView - client.functions.invoke_async(function_name, \*, project_name, \*\*params) -> FunctionInvocationExecutionDetailView - client.functions.invoke_sync(function_name, \*, project_name, \*\*params) -> FunctionInvocationExecutionDetailView -- client.functions.list_openapi() -> object ## Invocations Types: ```python -from runloop_api_client.types.functions import ( - FunctionInvocationListView, - KillOperationResponse, - InvocationLogsResponse, -) +from runloop_api_client.types.functions import FunctionInvocationListView, KillOperationResponse ``` Methods: @@ -152,7 +128,6 @@ Methods: - client.functions.invocations.retrieve(invocation_id) -> FunctionInvocationExecutionDetailView - client.functions.invocations.list(\*\*params) -> FunctionInvocationListView - client.functions.invocations.kill(invocation_id) -> object -- client.functions.invocations.logs(invocation_id) -> InvocationLogsResponse # Projects diff --git a/src/runloop_api_client/_client.py b/src/runloop_api_client/_client.py index 720cd7196..1609aebcc 100755 --- a/src/runloop_api_client/_client.py +++ b/src/runloop_api_client/_client.py @@ -47,7 +47,6 @@ class Runloop(SyncAPIClient): blueprints: resources.BlueprintsResource - deployments: resources.DeploymentsResource devboxes: resources.DevboxesResource functions: resources.FunctionsResource projects: resources.ProjectsResource @@ -108,10 +107,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self._default_stream_cls = Stream - self.blueprints = resources.BlueprintsResource(self) - self.deployments = resources.DeploymentsResource(self) self.devboxes = resources.DevboxesResource(self) self.functions = resources.FunctionsResource(self) self.projects = resources.ProjectsResource(self) @@ -225,7 +221,6 @@ def _make_status_error( class AsyncRunloop(AsyncAPIClient): blueprints: resources.AsyncBlueprintsResource - deployments: resources.AsyncDeploymentsResource devboxes: resources.AsyncDevboxesResource functions: resources.AsyncFunctionsResource projects: resources.AsyncProjectsResource @@ -286,10 +281,7 @@ def __init__( _strict_response_validation=_strict_response_validation, ) - self._default_stream_cls = AsyncStream - self.blueprints = resources.AsyncBlueprintsResource(self) - self.deployments = resources.AsyncDeploymentsResource(self) self.devboxes = resources.AsyncDevboxesResource(self) self.functions = resources.AsyncFunctionsResource(self) self.projects = resources.AsyncProjectsResource(self) @@ -404,7 +396,6 @@ def _make_status_error( class RunloopWithRawResponse: def __init__(self, client: Runloop) -> None: self.blueprints = resources.BlueprintsResourceWithRawResponse(client.blueprints) - self.deployments = resources.DeploymentsResourceWithRawResponse(client.deployments) self.devboxes = resources.DevboxesResourceWithRawResponse(client.devboxes) self.functions = resources.FunctionsResourceWithRawResponse(client.functions) self.projects = resources.ProjectsResourceWithRawResponse(client.projects) @@ -413,7 +404,6 @@ def __init__(self, client: Runloop) -> None: class AsyncRunloopWithRawResponse: def __init__(self, client: AsyncRunloop) -> None: self.blueprints = resources.AsyncBlueprintsResourceWithRawResponse(client.blueprints) - self.deployments = resources.AsyncDeploymentsResourceWithRawResponse(client.deployments) self.devboxes = resources.AsyncDevboxesResourceWithRawResponse(client.devboxes) self.functions = resources.AsyncFunctionsResourceWithRawResponse(client.functions) self.projects = resources.AsyncProjectsResourceWithRawResponse(client.projects) @@ -422,7 +412,6 @@ def __init__(self, client: AsyncRunloop) -> None: class RunloopWithStreamedResponse: def __init__(self, client: Runloop) -> None: self.blueprints = resources.BlueprintsResourceWithStreamingResponse(client.blueprints) - self.deployments = resources.DeploymentsResourceWithStreamingResponse(client.deployments) self.devboxes = resources.DevboxesResourceWithStreamingResponse(client.devboxes) self.functions = resources.FunctionsResourceWithStreamingResponse(client.functions) self.projects = resources.ProjectsResourceWithStreamingResponse(client.projects) @@ -431,7 +420,6 @@ def __init__(self, client: Runloop) -> None: class AsyncRunloopWithStreamedResponse: def __init__(self, client: AsyncRunloop) -> None: self.blueprints = resources.AsyncBlueprintsResourceWithStreamingResponse(client.blueprints) - self.deployments = resources.AsyncDeploymentsResourceWithStreamingResponse(client.deployments) self.devboxes = resources.AsyncDevboxesResourceWithStreamingResponse(client.devboxes) self.functions = resources.AsyncFunctionsResourceWithStreamingResponse(client.functions) self.projects = resources.AsyncProjectsResourceWithStreamingResponse(client.projects) diff --git a/src/runloop_api_client/_streaming.py b/src/runloop_api_client/_streaming.py index 7a008d1c2..ded05ee4b 100755 --- a/src/runloop_api_client/_streaming.py +++ b/src/runloop_api_client/_streaming.py @@ -55,29 +55,7 @@ def __stream__(self) -> Iterator[_T]: iterator = self._iter_events() for sse in iterator: - if sse.event == "completion": - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - if sse.event == "message_start" or sse.event == "content_block_stop": - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - if sse.event == "ping": - continue - - if sse.event == "error": - body = sse.data - - try: - body = sse.json() - err_msg = f"{body}" - except Exception: - err_msg = sse.data or f"Error code: {response.status_code}" - - raise self._client._make_status_error( - err_msg, - body=body, - response=self.response, - ) + yield process_data(data=sse.json(), cast_to=cast_to, response=response) # Ensure the entire stream is consumed for _sse in iterator: @@ -141,29 +119,7 @@ async def __stream__(self) -> AsyncIterator[_T]: iterator = self._iter_events() async for sse in iterator: - if sse.event == "completion": - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - if sse.event == "message_start" or sse.event == "content_block_stop": - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - if sse.event == "ping": - continue - - if sse.event == "error": - body = sse.data - - try: - body = sse.json() - err_msg = f"{body}" - except Exception: - err_msg = sse.data or f"Error code: {response.status_code}" - - raise self._client._make_status_error( - err_msg, - body=body, - response=self.response, - ) + yield process_data(data=sse.json(), cast_to=cast_to, response=response) # Ensure the entire stream is consumed async for _sse in iterator: diff --git a/src/runloop_api_client/resources/__init__.py b/src/runloop_api_client/resources/__init__.py index e26ff0410..f36499829 100755 --- a/src/runloop_api_client/resources/__init__.py +++ b/src/runloop_api_client/resources/__init__.py @@ -32,14 +32,6 @@ BlueprintsResourceWithStreamingResponse, AsyncBlueprintsResourceWithStreamingResponse, ) -from .deployments import ( - DeploymentsResource, - AsyncDeploymentsResource, - DeploymentsResourceWithRawResponse, - AsyncDeploymentsResourceWithRawResponse, - DeploymentsResourceWithStreamingResponse, - AsyncDeploymentsResourceWithStreamingResponse, -) __all__ = [ "BlueprintsResource", @@ -48,12 +40,6 @@ "AsyncBlueprintsResourceWithRawResponse", "BlueprintsResourceWithStreamingResponse", "AsyncBlueprintsResourceWithStreamingResponse", - "DeploymentsResource", - "AsyncDeploymentsResource", - "DeploymentsResourceWithRawResponse", - "AsyncDeploymentsResourceWithRawResponse", - "DeploymentsResourceWithStreamingResponse", - "AsyncDeploymentsResourceWithStreamingResponse", "DevboxesResource", "AsyncDevboxesResource", "DevboxesResourceWithRawResponse", diff --git a/src/runloop_api_client/resources/devboxes/devboxes.py b/src/runloop_api_client/resources/devboxes/devboxes.py index 4586a46b5..a45032569 100755 --- a/src/runloop_api_client/resources/devboxes/devboxes.py +++ b/src/runloop_api_client/resources/devboxes/devboxes.py @@ -48,7 +48,7 @@ ) from ..._base_client import make_request_options from ...types.devbox_view import DevboxView -from ...types.devbox_list_response import DevboxListResponse +from ...types.devbox_list_view import DevboxListView from ...types.devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse from ...types.devboxes.devbox_execution_detail_view import DevboxExecutionDetailView from ...types.devboxes.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView @@ -198,7 +198,7 @@ def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DevboxListResponse: + ) -> DevboxListView: """List all devboxes or filter by status. If no status is provided, all devboxes @@ -235,7 +235,7 @@ def list( devbox_list_params.DevboxListParams, ), ), - cast_to=DevboxListResponse, + cast_to=DevboxListView, ) def create_ssh_key( @@ -656,7 +656,7 @@ async def list( extra_query: Query | None = None, extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> DevboxListResponse: + ) -> DevboxListView: """List all devboxes or filter by status. If no status is provided, all devboxes @@ -693,7 +693,7 @@ async def list( devbox_list_params.DevboxListParams, ), ), - cast_to=DevboxListResponse, + cast_to=DevboxListView, ) async def create_ssh_key( diff --git a/src/runloop_api_client/resources/devboxes/executions.py b/src/runloop_api_client/resources/devboxes/executions.py index 9b68a432f..7886822a3 100755 --- a/src/runloop_api_client/resources/devboxes/executions.py +++ b/src/runloop_api_client/resources/devboxes/executions.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._utils import ( maybe_transform, async_maybe_transform, @@ -18,8 +18,7 @@ async_to_streamed_response_wrapper, ) from ..._base_client import make_request_options -from ...types.devboxes import execution_retrieve_params, execution_execute_sync_params, execution_execute_async_params -from ...types.devboxes.devbox_logs_list_view import DevboxLogsListView +from ...types.devboxes import execution_execute_sync_params, execution_execute_async_params from ...types.devboxes.devbox_execution_detail_view import DevboxExecutionDetailView from ...types.devboxes.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView @@ -35,46 +34,6 @@ def with_raw_response(self) -> ExecutionsResourceWithRawResponse: def with_streaming_response(self) -> ExecutionsResourceWithStreamingResponse: return ExecutionsResourceWithStreamingResponse(self) - def retrieve( - self, - exe_id: str, - *, - id: str, - command: 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, - ) -> DevboxAsyncExecutionDetailView: - """ - Get status of an execution on a devbox. - - Args: - command: The command to execute on the Devbox. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not exe_id: - raise ValueError(f"Expected a non-empty value for `exe_id` but received {exe_id!r}") - return self._post( - f"/v1/devboxes/{id}/executions/{exe_id}", - body=maybe_transform({"command": command}, execution_retrieve_params.ExecutionRetrieveParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DevboxAsyncExecutionDetailView, - ) - def execute_async( self, id: str, @@ -149,118 +108,6 @@ def execute_sync( cast_to=DevboxExecutionDetailView, ) - def kill( - self, - exe_id: str, - *, - 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, - ) -> DevboxAsyncExecutionDetailView: - """ - Kill an asynchronous execution currently running on a devbox - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not exe_id: - raise ValueError(f"Expected a non-empty value for `exe_id` but received {exe_id!r}") - return self._post( - f"/v1/devboxes/{id}/executions/{exe_id}/kill", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DevboxAsyncExecutionDetailView, - ) - - def logs( - self, - execution_id: str, - *, - 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, - ) -> DevboxLogsListView: - """ - Get all logs from a Devbox execution by id. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not execution_id: - raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") - return self._get( - f"/v1/devboxes/{id}/executions/{execution_id}/logs", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DevboxLogsListView, - ) - - def tail( - self, - execution_id: str, - *, - 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, - ) -> None: - """Tail the logs for the given devbox async execution. - - This will return past log - entries and continue from there. This is a streaming api and will continue to - stream logs until the connection is closed. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not execution_id: - raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._get( - f"/v1/devboxes/{id}/executions/{execution_id}/logs/tail", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - class AsyncExecutionsResource(AsyncAPIResource): @cached_property @@ -271,46 +118,6 @@ def with_raw_response(self) -> AsyncExecutionsResourceWithRawResponse: def with_streaming_response(self) -> AsyncExecutionsResourceWithStreamingResponse: return AsyncExecutionsResourceWithStreamingResponse(self) - async def retrieve( - self, - exe_id: str, - *, - id: str, - command: 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, - ) -> DevboxAsyncExecutionDetailView: - """ - Get status of an execution on a devbox. - - Args: - command: The command to execute on the Devbox. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not exe_id: - raise ValueError(f"Expected a non-empty value for `exe_id` but received {exe_id!r}") - return await self._post( - f"/v1/devboxes/{id}/executions/{exe_id}", - body=await async_maybe_transform({"command": command}, execution_retrieve_params.ExecutionRetrieveParams), - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DevboxAsyncExecutionDetailView, - ) - async def execute_async( self, id: str, @@ -389,210 +196,50 @@ async def execute_sync( cast_to=DevboxExecutionDetailView, ) - async def kill( - self, - exe_id: str, - *, - 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, - ) -> DevboxAsyncExecutionDetailView: - """ - Kill an asynchronous execution currently running on a devbox - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not exe_id: - raise ValueError(f"Expected a non-empty value for `exe_id` but received {exe_id!r}") - return await self._post( - f"/v1/devboxes/{id}/executions/{exe_id}/kill", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DevboxAsyncExecutionDetailView, - ) - - async def logs( - self, - execution_id: str, - *, - 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, - ) -> DevboxLogsListView: - """ - Get all logs from a Devbox execution by id. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {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._get( - f"/v1/devboxes/{id}/executions/{execution_id}/logs", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=DevboxLogsListView, - ) - - async def tail( - self, - execution_id: str, - *, - 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, - ) -> None: - """Tail the logs for the given devbox async execution. - - This will return past log - entries and continue from there. This is a streaming api and will continue to - stream logs until the connection is closed. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - if not execution_id: - raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._get( - f"/v1/devboxes/{id}/executions/{execution_id}/logs/tail", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - class ExecutionsResourceWithRawResponse: def __init__(self, executions: ExecutionsResource) -> None: self._executions = executions - self.retrieve = to_raw_response_wrapper( - executions.retrieve, - ) self.execute_async = to_raw_response_wrapper( executions.execute_async, ) self.execute_sync = to_raw_response_wrapper( executions.execute_sync, ) - self.kill = to_raw_response_wrapper( - executions.kill, - ) - self.logs = to_raw_response_wrapper( - executions.logs, - ) - self.tail = to_raw_response_wrapper( - executions.tail, - ) class AsyncExecutionsResourceWithRawResponse: def __init__(self, executions: AsyncExecutionsResource) -> None: self._executions = executions - self.retrieve = async_to_raw_response_wrapper( - executions.retrieve, - ) self.execute_async = async_to_raw_response_wrapper( executions.execute_async, ) self.execute_sync = async_to_raw_response_wrapper( executions.execute_sync, ) - self.kill = async_to_raw_response_wrapper( - executions.kill, - ) - self.logs = async_to_raw_response_wrapper( - executions.logs, - ) - self.tail = async_to_raw_response_wrapper( - executions.tail, - ) class ExecutionsResourceWithStreamingResponse: def __init__(self, executions: ExecutionsResource) -> None: self._executions = executions - self.retrieve = to_streamed_response_wrapper( - executions.retrieve, - ) self.execute_async = to_streamed_response_wrapper( executions.execute_async, ) self.execute_sync = to_streamed_response_wrapper( executions.execute_sync, ) - self.kill = to_streamed_response_wrapper( - executions.kill, - ) - self.logs = to_streamed_response_wrapper( - executions.logs, - ) - self.tail = to_streamed_response_wrapper( - executions.tail, - ) class AsyncExecutionsResourceWithStreamingResponse: def __init__(self, executions: AsyncExecutionsResource) -> None: self._executions = executions - self.retrieve = async_to_streamed_response_wrapper( - executions.retrieve, - ) self.execute_async = async_to_streamed_response_wrapper( executions.execute_async, ) self.execute_sync = async_to_streamed_response_wrapper( executions.execute_sync, ) - self.kill = async_to_streamed_response_wrapper( - executions.kill, - ) - self.logs = async_to_streamed_response_wrapper( - executions.logs, - ) - self.tail = async_to_streamed_response_wrapper( - executions.tail, - ) diff --git a/src/runloop_api_client/resources/devboxes/logs.py b/src/runloop_api_client/resources/devboxes/logs.py index 1f03fc023..cabe8f329 100755 --- a/src/runloop_api_client/resources/devboxes/logs.py +++ b/src/runloop_api_client/resources/devboxes/logs.py @@ -4,7 +4,7 @@ import httpx -from ..._types import NOT_GIVEN, Body, Query, Headers, NoneType, NotGiven +from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource from ..._response import ( @@ -61,43 +61,6 @@ def list( cast_to=DevboxLogsListView, ) - def tail( - 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, - ) -> None: - """Tail the logs for the given devbox. - - This will return past log entries and - continue from there. This is a streaming api and will continue to stream logs - until the connection is closed. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return self._get( - f"/v1/devboxes/{id}/logs/tail", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - class AsyncLogsResource(AsyncAPIResource): @cached_property @@ -141,43 +104,6 @@ async def list( cast_to=DevboxLogsListView, ) - async def tail( - 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, - ) -> None: - """Tail the logs for the given devbox. - - This will return past log entries and - continue from there. This is a streaming api and will continue to stream logs - until the connection is closed. - - 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: - raise ValueError(f"Expected a non-empty value for `id` but received {id!r}") - extra_headers = {"Accept": "*/*", **(extra_headers or {})} - return await self._get( - f"/v1/devboxes/{id}/logs/tail", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=NoneType, - ) - class LogsResourceWithRawResponse: def __init__(self, logs: LogsResource) -> None: @@ -186,9 +112,6 @@ def __init__(self, logs: LogsResource) -> None: self.list = to_raw_response_wrapper( logs.list, ) - self.tail = to_raw_response_wrapper( - logs.tail, - ) class AsyncLogsResourceWithRawResponse: @@ -198,9 +121,6 @@ def __init__(self, logs: AsyncLogsResource) -> None: self.list = async_to_raw_response_wrapper( logs.list, ) - self.tail = async_to_raw_response_wrapper( - logs.tail, - ) class LogsResourceWithStreamingResponse: @@ -210,9 +130,6 @@ def __init__(self, logs: LogsResource) -> None: self.list = to_streamed_response_wrapper( logs.list, ) - self.tail = to_streamed_response_wrapper( - logs.tail, - ) class AsyncLogsResourceWithStreamingResponse: @@ -222,6 +139,3 @@ def __init__(self, logs: AsyncLogsResource) -> None: self.list = async_to_streamed_response_wrapper( logs.list, ) - self.tail = async_to_streamed_response_wrapper( - logs.tail, - ) diff --git a/src/runloop_api_client/resources/functions/functions.py b/src/runloop_api_client/resources/functions/functions.py index 8628eca96..006a23817 100755 --- a/src/runloop_api_client/resources/functions/functions.py +++ b/src/runloop_api_client/resources/functions/functions.py @@ -164,25 +164,6 @@ def invoke_sync( cast_to=FunctionInvocationExecutionDetailView, ) - def list_openapi( - self, - *, - # 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, - ) -> object: - """Get the OpenAPI Spec for this project.""" - return self._get( - "/v1/functions/openapi", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - class AsyncFunctionsResource(AsyncAPIResource): @cached_property @@ -315,25 +296,6 @@ async def invoke_sync( cast_to=FunctionInvocationExecutionDetailView, ) - async def list_openapi( - self, - *, - # 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, - ) -> object: - """Get the OpenAPI Spec for this project.""" - return await self._get( - "/v1/functions/openapi", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=object, - ) - class FunctionsResourceWithRawResponse: def __init__(self, functions: FunctionsResource) -> None: @@ -348,9 +310,6 @@ def __init__(self, functions: FunctionsResource) -> None: self.invoke_sync = to_raw_response_wrapper( functions.invoke_sync, ) - self.list_openapi = to_raw_response_wrapper( - functions.list_openapi, - ) @cached_property def invocations(self) -> InvocationsResourceWithRawResponse: @@ -370,9 +329,6 @@ def __init__(self, functions: AsyncFunctionsResource) -> None: self.invoke_sync = async_to_raw_response_wrapper( functions.invoke_sync, ) - self.list_openapi = async_to_raw_response_wrapper( - functions.list_openapi, - ) @cached_property def invocations(self) -> AsyncInvocationsResourceWithRawResponse: @@ -392,9 +348,6 @@ def __init__(self, functions: FunctionsResource) -> None: self.invoke_sync = to_streamed_response_wrapper( functions.invoke_sync, ) - self.list_openapi = to_streamed_response_wrapper( - functions.list_openapi, - ) @cached_property def invocations(self) -> InvocationsResourceWithStreamingResponse: @@ -414,9 +367,6 @@ def __init__(self, functions: AsyncFunctionsResource) -> None: self.invoke_sync = async_to_streamed_response_wrapper( functions.invoke_sync, ) - self.list_openapi = async_to_streamed_response_wrapper( - functions.list_openapi, - ) @cached_property def invocations(self) -> AsyncInvocationsResourceWithStreamingResponse: diff --git a/src/runloop_api_client/resources/functions/invocations.py b/src/runloop_api_client/resources/functions/invocations.py index 5e9c2b046..59491d1e7 100755 --- a/src/runloop_api_client/resources/functions/invocations.py +++ b/src/runloop_api_client/resources/functions/invocations.py @@ -19,7 +19,6 @@ ) from ..._base_client import make_request_options from ...types.functions import invocation_list_params -from ...types.functions.invocation_logs_response import InvocationLogsResponse from ...types.functions.function_invocation_list_view import FunctionInvocationListView from ...types.shared.function_invocation_execution_detail_view import FunctionInvocationExecutionDetailView @@ -150,39 +149,6 @@ def kill( cast_to=object, ) - def logs( - self, - invocation_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, - ) -> InvocationLogsResponse: - """ - Get the logs for the given invocation. - - 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 invocation_id: - raise ValueError(f"Expected a non-empty value for `invocation_id` but received {invocation_id!r}") - return self._get( - f"/v1/functions/invocations/{invocation_id}/logs", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=InvocationLogsResponse, - ) - class AsyncInvocationsResource(AsyncAPIResource): @cached_property @@ -308,39 +274,6 @@ async def kill( cast_to=object, ) - async def logs( - self, - invocation_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, - ) -> InvocationLogsResponse: - """ - Get the logs for the given invocation. - - 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 invocation_id: - raise ValueError(f"Expected a non-empty value for `invocation_id` but received {invocation_id!r}") - return await self._get( - f"/v1/functions/invocations/{invocation_id}/logs", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=InvocationLogsResponse, - ) - class InvocationsResourceWithRawResponse: def __init__(self, invocations: InvocationsResource) -> None: @@ -355,9 +288,6 @@ def __init__(self, invocations: InvocationsResource) -> None: self.kill = to_raw_response_wrapper( invocations.kill, ) - self.logs = to_raw_response_wrapper( - invocations.logs, - ) class AsyncInvocationsResourceWithRawResponse: @@ -373,9 +303,6 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None: self.kill = async_to_raw_response_wrapper( invocations.kill, ) - self.logs = async_to_raw_response_wrapper( - invocations.logs, - ) class InvocationsResourceWithStreamingResponse: @@ -391,9 +318,6 @@ def __init__(self, invocations: InvocationsResource) -> None: self.kill = to_streamed_response_wrapper( invocations.kill, ) - self.logs = to_streamed_response_wrapper( - invocations.logs, - ) class AsyncInvocationsResourceWithStreamingResponse: @@ -409,6 +333,3 @@ def __init__(self, invocations: AsyncInvocationsResource) -> None: self.kill = async_to_streamed_response_wrapper( invocations.kill, ) - self.logs = async_to_streamed_response_wrapper( - invocations.logs, - ) diff --git a/src/runloop_api_client/types/__init__.py b/src/runloop_api_client/types/__init__.py index e1b1ebff5..c24af1bd1 100755 --- a/src/runloop_api_client/types/__init__.py +++ b/src/runloop_api_client/types/__init__.py @@ -9,22 +9,18 @@ from .devbox_view import DevboxView as DevboxView from .resource_size import ResourceSize as ResourceSize from .blueprint_view import BlueprintView as BlueprintView +from .devbox_list_view import DevboxListView as DevboxListView from .project_list_view import ProjectListView as ProjectListView from .devbox_list_params import DevboxListParams as DevboxListParams from .function_list_view import FunctionListView as FunctionListView from .blueprint_build_log import BlueprintBuildLog as BlueprintBuildLog from .blueprint_list_view import BlueprintListView as BlueprintListView from .devbox_create_params import DevboxCreateParams as DevboxCreateParams -from .devbox_list_response import DevboxListResponse as DevboxListResponse from .blueprint_list_params import BlueprintListParams as BlueprintListParams from .code_mount_parameters import CodeMountParameters as CodeMountParameters -from .deployment_get_params import DeploymentGetParams as DeploymentGetParams from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView from .blueprint_create_params import BlueprintCreateParams as BlueprintCreateParams -from .deployment_get_response import DeploymentGetResponse as DeploymentGetResponse from .blueprint_preview_params import BlueprintPreviewParams as BlueprintPreviewParams -from .deployment_logs_response import DeploymentLogsResponse as DeploymentLogsResponse -from .deployment_tail_response import DeploymentTailResponse as DeploymentTailResponse from .devbox_write_file_params import DevboxWriteFileParams as DevboxWriteFileParams from .devbox_upload_file_params import DevboxUploadFileParams as DevboxUploadFileParams from .blueprint_build_parameters import BlueprintBuildParameters as BlueprintBuildParameters @@ -32,8 +28,6 @@ from .code_mount_parameters_param import CodeMountParametersParam as CodeMountParametersParam from .devbox_execute_async_params import DevboxExecuteAsyncParams as DevboxExecuteAsyncParams from .function_invoke_sync_params import FunctionInvokeSyncParams as FunctionInvokeSyncParams -from .deployment_redeploy_response import DeploymentRedeployResponse as DeploymentRedeployResponse -from .deployment_retrieve_response import DeploymentRetrieveResponse as DeploymentRetrieveResponse from .function_invoke_async_params import FunctionInvokeAsyncParams as FunctionInvokeAsyncParams from .blueprint_build_logs_list_view import BlueprintBuildLogsListView as BlueprintBuildLogsListView from .devbox_create_ssh_key_response import DevboxCreateSSHKeyResponse as DevboxCreateSSHKeyResponse diff --git a/src/runloop_api_client/types/devboxes/__init__.py b/src/runloop_api_client/types/devboxes/__init__.py index 90ed90bb5..cdfd4886e 100755 --- a/src/runloop_api_client/types/devboxes/__init__.py +++ b/src/runloop_api_client/types/devboxes/__init__.py @@ -3,7 +3,6 @@ from __future__ import annotations from .devbox_logs_list_view import DevboxLogsListView as DevboxLogsListView -from .execution_retrieve_params import ExecutionRetrieveParams as ExecutionRetrieveParams from .devbox_execution_detail_view import DevboxExecutionDetailView as DevboxExecutionDetailView from .execution_execute_sync_params import ExecutionExecuteSyncParams as ExecutionExecuteSyncParams from .execution_execute_async_params import ExecutionExecuteAsyncParams as ExecutionExecuteAsyncParams diff --git a/src/runloop_api_client/types/functions/__init__.py b/src/runloop_api_client/types/functions/__init__.py index da953f2d5..65762ab89 100755 --- a/src/runloop_api_client/types/functions/__init__.py +++ b/src/runloop_api_client/types/functions/__init__.py @@ -3,5 +3,4 @@ from __future__ import annotations from .invocation_list_params import InvocationListParams as InvocationListParams -from .invocation_logs_response import InvocationLogsResponse as InvocationLogsResponse from .function_invocation_list_view import FunctionInvocationListView as FunctionInvocationListView diff --git a/tests/api_resources/devboxes/test_executions.py b/tests/api_resources/devboxes/test_executions.py index a841221f0..540e32771 100755 --- a/tests/api_resources/devboxes/test_executions.py +++ b/tests/api_resources/devboxes/test_executions.py @@ -10,7 +10,6 @@ from tests.utils import assert_matches_type from runloop_api_client import Runloop, AsyncRunloop from runloop_api_client.types.devboxes import ( - DevboxLogsListView, DevboxExecutionDetailView, DevboxAsyncExecutionDetailView, ) @@ -21,63 +20,6 @@ class TestExecutions: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_retrieve(self, client: Runloop) -> None: - execution = client.devboxes.executions.retrieve( - exe_id="exeId", - id="id", - ) - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - def test_method_retrieve_with_all_params(self, client: Runloop) -> None: - execution = client.devboxes.executions.retrieve( - exe_id="exeId", - id="id", - command="command", - ) - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Runloop) -> None: - response = client.devboxes.executions.with_raw_response.retrieve( - exe_id="exeId", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Runloop) -> None: - with client.devboxes.executions.with_streaming_response.retrieve( - exe_id="exeId", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.devboxes.executions.with_raw_response.retrieve( - exe_id="exeId", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `exe_id` but received ''"): - client.devboxes.executions.with_raw_response.retrieve( - exe_id="", - id="id", - ) - @parametrize def test_method_execute_async(self, client: Runloop) -> None: execution = client.devboxes.executions.execute_async( @@ -170,215 +112,10 @@ def test_path_params_execute_sync(self, client: Runloop) -> None: id="", ) - @parametrize - def test_method_kill(self, client: Runloop) -> None: - execution = client.devboxes.executions.kill( - exe_id="exeId", - id="id", - ) - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - def test_raw_response_kill(self, client: Runloop) -> None: - response = client.devboxes.executions.with_raw_response.kill( - exe_id="exeId", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - def test_streaming_response_kill(self, client: Runloop) -> None: - with client.devboxes.executions.with_streaming_response.kill( - exe_id="exeId", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_kill(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.devboxes.executions.with_raw_response.kill( - exe_id="exeId", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `exe_id` but received ''"): - client.devboxes.executions.with_raw_response.kill( - exe_id="", - id="id", - ) - - @parametrize - def test_method_logs(self, client: Runloop) -> None: - execution = client.devboxes.executions.logs( - execution_id="execution_id", - id="id", - ) - assert_matches_type(DevboxLogsListView, execution, path=["response"]) - - @parametrize - def test_raw_response_logs(self, client: Runloop) -> None: - response = client.devboxes.executions.with_raw_response.logs( - execution_id="execution_id", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert_matches_type(DevboxLogsListView, execution, path=["response"]) - - @parametrize - def test_streaming_response_logs(self, client: Runloop) -> None: - with client.devboxes.executions.with_streaming_response.logs( - execution_id="execution_id", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert_matches_type(DevboxLogsListView, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_logs(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.devboxes.executions.with_raw_response.logs( - execution_id="execution_id", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - client.devboxes.executions.with_raw_response.logs( - execution_id="", - id="id", - ) - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_method_tail(self, client: Runloop) -> None: - execution = client.devboxes.executions.tail( - execution_id="execution_id", - id="id", - ) - assert execution is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_raw_response_tail(self, client: Runloop) -> None: - response = client.devboxes.executions.with_raw_response.tail( - execution_id="execution_id", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = response.parse() - assert execution is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_streaming_response_tail(self, client: Runloop) -> None: - with client.devboxes.executions.with_streaming_response.tail( - execution_id="execution_id", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = response.parse() - assert execution is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_path_params_tail(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.devboxes.executions.with_raw_response.tail( - execution_id="execution_id", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - client.devboxes.executions.with_raw_response.tail( - execution_id="", - id="id", - ) - class TestAsyncExecutions: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - async def test_method_retrieve(self, async_client: AsyncRunloop) -> None: - execution = await async_client.devboxes.executions.retrieve( - exe_id="exeId", - id="id", - ) - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - async def test_method_retrieve_with_all_params(self, async_client: AsyncRunloop) -> None: - execution = await async_client.devboxes.executions.retrieve( - exe_id="exeId", - id="id", - command="command", - ) - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncRunloop) -> None: - response = await async_client.devboxes.executions.with_raw_response.retrieve( - exe_id="exeId", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncRunloop) -> None: - async with async_client.devboxes.executions.with_streaming_response.retrieve( - exe_id="exeId", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.devboxes.executions.with_raw_response.retrieve( - exe_id="exeId", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `exe_id` but received ''"): - await async_client.devboxes.executions.with_raw_response.retrieve( - exe_id="", - id="id", - ) - @parametrize async def test_method_execute_async(self, async_client: AsyncRunloop) -> None: execution = await async_client.devboxes.executions.execute_async( @@ -470,151 +207,3 @@ async def test_path_params_execute_sync(self, async_client: AsyncRunloop) -> Non await async_client.devboxes.executions.with_raw_response.execute_sync( id="", ) - - @parametrize - async def test_method_kill(self, async_client: AsyncRunloop) -> None: - execution = await async_client.devboxes.executions.kill( - exe_id="exeId", - id="id", - ) - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - async def test_raw_response_kill(self, async_client: AsyncRunloop) -> None: - response = await async_client.devboxes.executions.with_raw_response.kill( - exe_id="exeId", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - @parametrize - async def test_streaming_response_kill(self, async_client: AsyncRunloop) -> None: - async with async_client.devboxes.executions.with_streaming_response.kill( - exe_id="exeId", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert_matches_type(DevboxAsyncExecutionDetailView, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_kill(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.devboxes.executions.with_raw_response.kill( - exe_id="exeId", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `exe_id` but received ''"): - await async_client.devboxes.executions.with_raw_response.kill( - exe_id="", - id="id", - ) - - @parametrize - async def test_method_logs(self, async_client: AsyncRunloop) -> None: - execution = await async_client.devboxes.executions.logs( - execution_id="execution_id", - id="id", - ) - assert_matches_type(DevboxLogsListView, execution, path=["response"]) - - @parametrize - async def test_raw_response_logs(self, async_client: AsyncRunloop) -> None: - response = await async_client.devboxes.executions.with_raw_response.logs( - execution_id="execution_id", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert_matches_type(DevboxLogsListView, execution, path=["response"]) - - @parametrize - async def test_streaming_response_logs(self, async_client: AsyncRunloop) -> None: - async with async_client.devboxes.executions.with_streaming_response.logs( - execution_id="execution_id", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert_matches_type(DevboxLogsListView, execution, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_logs(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.devboxes.executions.with_raw_response.logs( - execution_id="execution_id", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - await async_client.devboxes.executions.with_raw_response.logs( - execution_id="", - id="id", - ) - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_method_tail(self, async_client: AsyncRunloop) -> None: - execution = await async_client.devboxes.executions.tail( - execution_id="execution_id", - id="id", - ) - assert execution is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_raw_response_tail(self, async_client: AsyncRunloop) -> None: - response = await async_client.devboxes.executions.with_raw_response.tail( - execution_id="execution_id", - id="id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - execution = await response.parse() - assert execution is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_streaming_response_tail(self, async_client: AsyncRunloop) -> None: - async with async_client.devboxes.executions.with_streaming_response.tail( - execution_id="execution_id", - id="id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - execution = await response.parse() - assert execution is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_path_params_tail(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.devboxes.executions.with_raw_response.tail( - execution_id="execution_id", - id="", - ) - - with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"): - await async_client.devboxes.executions.with_raw_response.tail( - execution_id="", - id="id", - ) diff --git a/tests/api_resources/devboxes/test_logs.py b/tests/api_resources/devboxes/test_logs.py index 370066940..85ea9be84 100755 --- a/tests/api_resources/devboxes/test_logs.py +++ b/tests/api_resources/devboxes/test_logs.py @@ -55,48 +55,6 @@ def test_path_params_list(self, client: Runloop) -> None: "", ) - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_method_tail(self, client: Runloop) -> None: - log = client.devboxes.logs.tail( - "id", - ) - assert log is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_raw_response_tail(self, client: Runloop) -> None: - response = client.devboxes.logs.with_raw_response.tail( - "id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - log = response.parse() - assert log is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_streaming_response_tail(self, client: Runloop) -> None: - with client.devboxes.logs.with_streaming_response.tail( - "id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - log = response.parse() - assert log is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - def test_path_params_tail(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - client.devboxes.logs.with_raw_response.tail( - "", - ) - class TestAsyncLogs: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -138,45 +96,3 @@ async def test_path_params_list(self, async_client: AsyncRunloop) -> None: await async_client.devboxes.logs.with_raw_response.list( "", ) - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_method_tail(self, async_client: AsyncRunloop) -> None: - log = await async_client.devboxes.logs.tail( - "id", - ) - assert log is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_raw_response_tail(self, async_client: AsyncRunloop) -> None: - response = await async_client.devboxes.logs.with_raw_response.tail( - "id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - log = await response.parse() - assert log is None - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_streaming_response_tail(self, async_client: AsyncRunloop) -> None: - async with async_client.devboxes.logs.with_streaming_response.tail( - "id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - log = await response.parse() - assert log is None - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="cannot test text/event-stream") - @parametrize - async def test_path_params_tail(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"): - await async_client.devboxes.logs.with_raw_response.tail( - "", - ) diff --git a/tests/api_resources/functions/test_invocations.py b/tests/api_resources/functions/test_invocations.py index 38953c074..726e5843c 100755 --- a/tests/api_resources/functions/test_invocations.py +++ b/tests/api_resources/functions/test_invocations.py @@ -10,10 +10,7 @@ from tests.utils import assert_matches_type from runloop_api_client import Runloop, AsyncRunloop from runloop_api_client.types.shared import FunctionInvocationExecutionDetailView -from runloop_api_client.types.functions import ( - InvocationLogsResponse, - FunctionInvocationListView, -) +from runloop_api_client.types.functions import FunctionInvocationListView base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -130,44 +127,6 @@ def test_path_params_kill(self, client: Runloop) -> None: "", ) - @parametrize - def test_method_logs(self, client: Runloop) -> None: - invocation = client.functions.invocations.logs( - "invocation_id", - ) - assert_matches_type(InvocationLogsResponse, invocation, path=["response"]) - - @parametrize - def test_raw_response_logs(self, client: Runloop) -> None: - response = client.functions.invocations.with_raw_response.logs( - "invocation_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invocation = response.parse() - assert_matches_type(InvocationLogsResponse, invocation, path=["response"]) - - @parametrize - def test_streaming_response_logs(self, client: Runloop) -> None: - with client.functions.invocations.with_streaming_response.logs( - "invocation_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invocation = response.parse() - assert_matches_type(InvocationLogsResponse, invocation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_logs(self, client: Runloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `invocation_id` but received ''"): - client.functions.invocations.with_raw_response.logs( - "", - ) - class TestAsyncInvocations: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -280,41 +239,3 @@ async def test_path_params_kill(self, async_client: AsyncRunloop) -> None: await async_client.functions.invocations.with_raw_response.kill( "", ) - - @parametrize - async def test_method_logs(self, async_client: AsyncRunloop) -> None: - invocation = await async_client.functions.invocations.logs( - "invocation_id", - ) - assert_matches_type(InvocationLogsResponse, invocation, path=["response"]) - - @parametrize - async def test_raw_response_logs(self, async_client: AsyncRunloop) -> None: - response = await async_client.functions.invocations.with_raw_response.logs( - "invocation_id", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - invocation = await response.parse() - assert_matches_type(InvocationLogsResponse, invocation, path=["response"]) - - @parametrize - async def test_streaming_response_logs(self, async_client: AsyncRunloop) -> None: - async with async_client.functions.invocations.with_streaming_response.logs( - "invocation_id", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - invocation = await response.parse() - assert_matches_type(InvocationLogsResponse, invocation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_logs(self, async_client: AsyncRunloop) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `invocation_id` but received ''"): - await async_client.functions.invocations.with_raw_response.logs( - "", - ) diff --git a/tests/api_resources/test_devboxes.py b/tests/api_resources/test_devboxes.py index 9b82bde44..80fce2549 100755 --- a/tests/api_resources/test_devboxes.py +++ b/tests/api_resources/test_devboxes.py @@ -11,7 +11,7 @@ from runloop_api_client import Runloop, AsyncRunloop from runloop_api_client.types import ( DevboxView, - DevboxListResponse, + DevboxListView, DevboxCreateSSHKeyResponse, ) from runloop_api_client.types.devboxes import DevboxExecutionDetailView, DevboxAsyncExecutionDetailView @@ -107,7 +107,7 @@ def test_path_params_retrieve(self, client: Runloop) -> None: @parametrize def test_method_list(self, client: Runloop) -> None: devbox = client.devboxes.list() - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Runloop) -> None: @@ -116,7 +116,7 @@ def test_method_list_with_all_params(self, client: Runloop) -> None: starting_after="starting_after", status="status", ) - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) @parametrize def test_raw_response_list(self, client: Runloop) -> None: @@ -125,7 +125,7 @@ def test_raw_response_list(self, client: Runloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = response.parse() - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) @parametrize def test_streaming_response_list(self, client: Runloop) -> None: @@ -134,7 +134,7 @@ def test_streaming_response_list(self, client: Runloop) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = response.parse() - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) assert cast(Any, response.is_closed) is True @@ -535,7 +535,7 @@ async def test_path_params_retrieve(self, async_client: AsyncRunloop) -> None: @parametrize async def test_method_list(self, async_client: AsyncRunloop) -> None: devbox = await async_client.devboxes.list() - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> None: @@ -544,7 +544,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncRunloop) -> starting_after="starting_after", status="status", ) - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: @@ -553,7 +553,7 @@ async def test_raw_response_list(self, async_client: AsyncRunloop) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = await response.parse() - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None: @@ -562,7 +562,7 @@ async def test_streaming_response_list(self, async_client: AsyncRunloop) -> None assert response.http_request.headers.get("X-Stainless-Lang") == "python" devbox = await response.parse() - assert_matches_type(DevboxListResponse, devbox, path=["response"]) + assert_matches_type(DevboxListView, devbox, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_functions.py b/tests/api_resources/test_functions.py index fa60f9801..e168b5de1 100755 --- a/tests/api_resources/test_functions.py +++ b/tests/api_resources/test_functions.py @@ -169,31 +169,6 @@ def test_path_params_invoke_sync(self, client: Runloop) -> None: request={}, ) - @parametrize - def test_method_list_openapi(self, client: Runloop) -> None: - function = client.functions.list_openapi() - assert_matches_type(object, function, path=["response"]) - - @parametrize - def test_raw_response_list_openapi(self, client: Runloop) -> None: - response = client.functions.with_raw_response.list_openapi() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - function = response.parse() - assert_matches_type(object, function, path=["response"]) - - @parametrize - def test_streaming_response_list_openapi(self, client: Runloop) -> None: - with client.functions.with_streaming_response.list_openapi() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - function = response.parse() - assert_matches_type(object, function, path=["response"]) - - assert cast(Any, response.is_closed) is True - class TestAsyncFunctions: parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) @@ -348,28 +323,3 @@ async def test_path_params_invoke_sync(self, async_client: AsyncRunloop) -> None project_name="project_name", request={}, ) - - @parametrize - async def test_method_list_openapi(self, async_client: AsyncRunloop) -> None: - function = await async_client.functions.list_openapi() - assert_matches_type(object, function, path=["response"]) - - @parametrize - async def test_raw_response_list_openapi(self, async_client: AsyncRunloop) -> None: - response = await async_client.functions.with_raw_response.list_openapi() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - function = await response.parse() - assert_matches_type(object, function, path=["response"]) - - @parametrize - async def test_streaming_response_list_openapi(self, async_client: AsyncRunloop) -> None: - async with async_client.functions.with_streaming_response.list_openapi() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - function = await response.parse() - assert_matches_type(object, function, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/test_client.py b/tests/test_client.py index 58485333a..ab10be034 100755 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -20,7 +20,6 @@ from runloop_api_client._types import Omit from runloop_api_client._models import BaseModel, FinalRequestOptions from runloop_api_client._constants import RAW_RESPONSE_HEADER -from runloop_api_client._streaming import Stream, AsyncStream from runloop_api_client._exceptions import RunloopError, APIStatusError, APITimeoutError, APIResponseValidationError from runloop_api_client._base_client import ( DEFAULT_TIMEOUT, @@ -686,17 +685,6 @@ def test_client_max_retries_validation(self) -> None: max_retries=cast(Any, None), ) - @pytest.mark.respx(base_url=base_url) - def test_default_stream_cls(self, respx_mock: MockRouter) -> None: - class Model(BaseModel): - name: str - - respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - stream = self.client.post("/foo", cast_to=Model, stream=True, stream_cls=Stream[Model]) - assert isinstance(stream, Stream) - stream.response.close() - @pytest.mark.respx(base_url=base_url) def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): @@ -1432,18 +1420,6 @@ async def test_client_max_retries_validation(self) -> None: max_retries=cast(Any, None), ) - @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_default_stream_cls(self, respx_mock: MockRouter) -> None: - class Model(BaseModel): - name: str - - respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - - stream = await self.client.post("/foo", cast_to=Model, stream=True, stream_cls=AsyncStream[Model]) - assert isinstance(stream, AsyncStream) - await stream.response.aclose() - @pytest.mark.respx(base_url=base_url) @pytest.mark.asyncio async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: