Skip to content

Commit 3940b9f

Browse files
stainless-app[bot]stainless-bot
authored andcommitted
feat(api): OpenAPI spec update via Stainless API (#127)
1 parent db6ba44 commit 3940b9f

4 files changed

Lines changed: 185 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
configured_endpoints: 24
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-ea589851f2dbba35fea6c010ac4c577cad56aa44e1d5bd4e5b472c802b2f13c4.yml
1+
configured_endpoints: 25
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-7c0be2259b864df540fecbc3b04720c184dd4142bb666849941e081c14c67b5a.yml

api.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ Methods:
100100

101101
- <code title="post /v1/devboxes/{id}/executions/execute_async">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
102102
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devboxes/execution_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devboxes/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
103+
- <code title="get /v1/devboxes/{id}/executions/{execution_id}/logs">client.devboxes.executions.<a href="./src/runloop_api_client/resources/devboxes/executions.py">logs</a>(execution_id, \*, id) -> <a href="./src/runloop_api_client/types/devboxes/devbox_logs_list_view.py">DevboxLogsListView</a></code>
103104

104105
# Functions
105106

src/runloop_api_client/resources/devboxes/executions.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
)
2020
from ..._base_client import make_request_options
2121
from ...types.devboxes import execution_execute_sync_params, execution_execute_async_params
22+
from ...types.devboxes.devbox_logs_list_view import DevboxLogsListView
2223
from ...types.devboxes.devbox_execution_detail_view import DevboxExecutionDetailView
2324
from ...types.devboxes.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
2425

@@ -108,6 +109,42 @@ def execute_sync(
108109
cast_to=DevboxExecutionDetailView,
109110
)
110111

112+
def logs(
113+
self,
114+
execution_id: str,
115+
*,
116+
id: str,
117+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
118+
# The extra values given here take precedence over values defined on the client or passed to this method.
119+
extra_headers: Headers | None = None,
120+
extra_query: Query | None = None,
121+
extra_body: Body | None = None,
122+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
123+
) -> DevboxLogsListView:
124+
"""
125+
Get all logs from a Devbox execution by id.
126+
127+
Args:
128+
extra_headers: Send extra headers
129+
130+
extra_query: Add additional query parameters to the request
131+
132+
extra_body: Add additional JSON properties to the request
133+
134+
timeout: Override the client-level default timeout for this request, in seconds
135+
"""
136+
if not id:
137+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
138+
if not execution_id:
139+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
140+
return self._get(
141+
f"/v1/devboxes/{id}/executions/{execution_id}/logs",
142+
options=make_request_options(
143+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
144+
),
145+
cast_to=DevboxLogsListView,
146+
)
147+
111148

112149
class AsyncExecutionsResource(AsyncAPIResource):
113150
@cached_property
@@ -196,6 +233,42 @@ async def execute_sync(
196233
cast_to=DevboxExecutionDetailView,
197234
)
198235

236+
async def logs(
237+
self,
238+
execution_id: str,
239+
*,
240+
id: str,
241+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
242+
# The extra values given here take precedence over values defined on the client or passed to this method.
243+
extra_headers: Headers | None = None,
244+
extra_query: Query | None = None,
245+
extra_body: Body | None = None,
246+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
247+
) -> DevboxLogsListView:
248+
"""
249+
Get all logs from a Devbox execution by id.
250+
251+
Args:
252+
extra_headers: Send extra headers
253+
254+
extra_query: Add additional query parameters to the request
255+
256+
extra_body: Add additional JSON properties to the request
257+
258+
timeout: Override the client-level default timeout for this request, in seconds
259+
"""
260+
if not id:
261+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
262+
if not execution_id:
263+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
264+
return await self._get(
265+
f"/v1/devboxes/{id}/executions/{execution_id}/logs",
266+
options=make_request_options(
267+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
268+
),
269+
cast_to=DevboxLogsListView,
270+
)
271+
199272

200273
class ExecutionsResourceWithRawResponse:
201274
def __init__(self, executions: ExecutionsResource) -> None:
@@ -207,6 +280,9 @@ def __init__(self, executions: ExecutionsResource) -> None:
207280
self.execute_sync = to_raw_response_wrapper(
208281
executions.execute_sync,
209282
)
283+
self.logs = to_raw_response_wrapper(
284+
executions.logs,
285+
)
210286

211287

212288
class AsyncExecutionsResourceWithRawResponse:
@@ -219,6 +295,9 @@ def __init__(self, executions: AsyncExecutionsResource) -> None:
219295
self.execute_sync = async_to_raw_response_wrapper(
220296
executions.execute_sync,
221297
)
298+
self.logs = async_to_raw_response_wrapper(
299+
executions.logs,
300+
)
222301

223302

224303
class ExecutionsResourceWithStreamingResponse:
@@ -231,6 +310,9 @@ def __init__(self, executions: ExecutionsResource) -> None:
231310
self.execute_sync = to_streamed_response_wrapper(
232311
executions.execute_sync,
233312
)
313+
self.logs = to_streamed_response_wrapper(
314+
executions.logs,
315+
)
234316

235317

236318
class AsyncExecutionsResourceWithStreamingResponse:
@@ -243,3 +325,6 @@ def __init__(self, executions: AsyncExecutionsResource) -> None:
243325
self.execute_sync = async_to_streamed_response_wrapper(
244326
executions.execute_sync,
245327
)
328+
self.logs = async_to_streamed_response_wrapper(
329+
executions.logs,
330+
)

tests/api_resources/devboxes/test_executions.py

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from tests.utils import assert_matches_type
1111
from runloop_api_client import Runloop, AsyncRunloop
1212
from runloop_api_client.types.devboxes import (
13+
DevboxLogsListView,
1314
DevboxExecutionDetailView,
1415
DevboxAsyncExecutionDetailView,
1516
)
@@ -112,6 +113,54 @@ def test_path_params_execute_sync(self, client: Runloop) -> None:
112113
id="",
113114
)
114115

116+
@parametrize
117+
def test_method_logs(self, client: Runloop) -> None:
118+
execution = client.devboxes.executions.logs(
119+
execution_id="execution_id",
120+
id="id",
121+
)
122+
assert_matches_type(DevboxLogsListView, execution, path=["response"])
123+
124+
@parametrize
125+
def test_raw_response_logs(self, client: Runloop) -> None:
126+
response = client.devboxes.executions.with_raw_response.logs(
127+
execution_id="execution_id",
128+
id="id",
129+
)
130+
131+
assert response.is_closed is True
132+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
133+
execution = response.parse()
134+
assert_matches_type(DevboxLogsListView, execution, path=["response"])
135+
136+
@parametrize
137+
def test_streaming_response_logs(self, client: Runloop) -> None:
138+
with client.devboxes.executions.with_streaming_response.logs(
139+
execution_id="execution_id",
140+
id="id",
141+
) as response:
142+
assert not response.is_closed
143+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
144+
145+
execution = response.parse()
146+
assert_matches_type(DevboxLogsListView, execution, path=["response"])
147+
148+
assert cast(Any, response.is_closed) is True
149+
150+
@parametrize
151+
def test_path_params_logs(self, client: Runloop) -> None:
152+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
153+
client.devboxes.executions.with_raw_response.logs(
154+
execution_id="execution_id",
155+
id="",
156+
)
157+
158+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"):
159+
client.devboxes.executions.with_raw_response.logs(
160+
execution_id="",
161+
id="id",
162+
)
163+
115164

116165
class TestAsyncExecutions:
117166
parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"])
@@ -207,3 +256,51 @@ async def test_path_params_execute_sync(self, async_client: AsyncRunloop) -> Non
207256
await async_client.devboxes.executions.with_raw_response.execute_sync(
208257
id="",
209258
)
259+
260+
@parametrize
261+
async def test_method_logs(self, async_client: AsyncRunloop) -> None:
262+
execution = await async_client.devboxes.executions.logs(
263+
execution_id="execution_id",
264+
id="id",
265+
)
266+
assert_matches_type(DevboxLogsListView, execution, path=["response"])
267+
268+
@parametrize
269+
async def test_raw_response_logs(self, async_client: AsyncRunloop) -> None:
270+
response = await async_client.devboxes.executions.with_raw_response.logs(
271+
execution_id="execution_id",
272+
id="id",
273+
)
274+
275+
assert response.is_closed is True
276+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
277+
execution = await response.parse()
278+
assert_matches_type(DevboxLogsListView, execution, path=["response"])
279+
280+
@parametrize
281+
async def test_streaming_response_logs(self, async_client: AsyncRunloop) -> None:
282+
async with async_client.devboxes.executions.with_streaming_response.logs(
283+
execution_id="execution_id",
284+
id="id",
285+
) as response:
286+
assert not response.is_closed
287+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
288+
289+
execution = await response.parse()
290+
assert_matches_type(DevboxLogsListView, execution, path=["response"])
291+
292+
assert cast(Any, response.is_closed) is True
293+
294+
@parametrize
295+
async def test_path_params_logs(self, async_client: AsyncRunloop) -> None:
296+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
297+
await async_client.devboxes.executions.with_raw_response.logs(
298+
execution_id="execution_id",
299+
id="",
300+
)
301+
302+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"):
303+
await async_client.devboxes.executions.with_raw_response.logs(
304+
execution_id="",
305+
id="id",
306+
)

0 commit comments

Comments
 (0)