Skip to content

Commit 9ba3f6f

Browse files
feat(api): api update (#265)
1 parent dc72b4d commit 9ba3f6f

4 files changed

Lines changed: 158 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: 32
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-9ece0eb6c3a04dc53f45eeb2207f729b5ea57d68e63b211fc3fb7eaf99395e77.yml
1+
configured_endpoints: 33
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-c93213df96468708c029381048af8d18f1d14118051946429590dd0faedce456.yml

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ from runloop_api_client.types import (
5454
DevboxTunnelView,
5555
DevboxView,
5656
DevboxCreateSSHKeyResponse,
57+
DevboxKeepAliveResponse,
5758
DevboxReadFileContentsResponse,
5859
DevboxUploadFileResponse,
5960
)
@@ -70,6 +71,7 @@ Methods:
7071
- <code title="post /v1/devboxes/{id}/download_file">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">download_file</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_download_file_params.py">params</a>) -> BinaryAPIResponse</code>
7172
- <code title="post /v1/devboxes/{id}/execute_async">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_async</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_execute_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
7273
- <code title="post /v1/devboxes/{id}/execute_sync">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">execute_sync</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_execute_sync_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
74+
- <code title="post /v1/devboxes/{id}/keep_alive">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">keep_alive</a>(id) -> <a href="./src/runloop_api_client/types/devbox_keep_alive_response.py">object</a></code>
7375
- <code title="post /v1/devboxes/{id}/read_file_contents">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">read_file_contents</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_read_file_contents_params.py">params</a>) -> str</code>
7476
- <code title="post /v1/devboxes/{id}/resume">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">resume</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
7577
- <code title="post /v1/devboxes/{id}/shutdown">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">shutdown</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,39 @@ def execute_sync(
524524
cast_to=DevboxExecutionDetailView,
525525
)
526526

527+
def keep_alive(
528+
self,
529+
id: str,
530+
*,
531+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
532+
# The extra values given here take precedence over values defined on the client or passed to this method.
533+
extra_headers: Headers | None = None,
534+
extra_query: Query | None = None,
535+
extra_body: Body | None = None,
536+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
537+
) -> object:
538+
"""
539+
Keep alive a running devbox that is configured to shutdown on idle.
540+
541+
Args:
542+
extra_headers: Send extra headers
543+
544+
extra_query: Add additional query parameters to the request
545+
546+
extra_body: Add additional JSON properties to the request
547+
548+
timeout: Override the client-level default timeout for this request, in seconds
549+
"""
550+
if not id:
551+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
552+
return self._post(
553+
f"/v1/devboxes/{id}/keep_alive",
554+
options=make_request_options(
555+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
556+
),
557+
cast_to=object,
558+
)
559+
527560
def read_file_contents(
528561
self,
529562
id: str,
@@ -1257,6 +1290,39 @@ async def execute_sync(
12571290
cast_to=DevboxExecutionDetailView,
12581291
)
12591292

1293+
async def keep_alive(
1294+
self,
1295+
id: str,
1296+
*,
1297+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1298+
# The extra values given here take precedence over values defined on the client or passed to this method.
1299+
extra_headers: Headers | None = None,
1300+
extra_query: Query | None = None,
1301+
extra_body: Body | None = None,
1302+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
1303+
) -> object:
1304+
"""
1305+
Keep alive a running devbox that is configured to shutdown on idle.
1306+
1307+
Args:
1308+
extra_headers: Send extra headers
1309+
1310+
extra_query: Add additional query parameters to the request
1311+
1312+
extra_body: Add additional JSON properties to the request
1313+
1314+
timeout: Override the client-level default timeout for this request, in seconds
1315+
"""
1316+
if not id:
1317+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1318+
return await self._post(
1319+
f"/v1/devboxes/{id}/keep_alive",
1320+
options=make_request_options(
1321+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1322+
),
1323+
cast_to=object,
1324+
)
1325+
12601326
async def read_file_contents(
12611327
self,
12621328
id: str,
@@ -1571,6 +1637,9 @@ def __init__(self, devboxes: DevboxesResource) -> None:
15711637
self.execute_sync = to_raw_response_wrapper(
15721638
devboxes.execute_sync,
15731639
)
1640+
self.keep_alive = to_raw_response_wrapper(
1641+
devboxes.keep_alive,
1642+
)
15741643
self.read_file_contents = to_raw_response_wrapper(
15751644
devboxes.read_file_contents,
15761645
)
@@ -1634,6 +1703,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None:
16341703
self.execute_sync = async_to_raw_response_wrapper(
16351704
devboxes.execute_sync,
16361705
)
1706+
self.keep_alive = async_to_raw_response_wrapper(
1707+
devboxes.keep_alive,
1708+
)
16371709
self.read_file_contents = async_to_raw_response_wrapper(
16381710
devboxes.read_file_contents,
16391711
)
@@ -1697,6 +1769,9 @@ def __init__(self, devboxes: DevboxesResource) -> None:
16971769
self.execute_sync = to_streamed_response_wrapper(
16981770
devboxes.execute_sync,
16991771
)
1772+
self.keep_alive = to_streamed_response_wrapper(
1773+
devboxes.keep_alive,
1774+
)
17001775
self.read_file_contents = to_streamed_response_wrapper(
17011776
devboxes.read_file_contents,
17021777
)
@@ -1760,6 +1835,9 @@ def __init__(self, devboxes: AsyncDevboxesResource) -> None:
17601835
self.execute_sync = async_to_streamed_response_wrapper(
17611836
devboxes.execute_sync,
17621837
)
1838+
self.keep_alive = async_to_streamed_response_wrapper(
1839+
devboxes.keep_alive,
1840+
)
17631841
self.read_file_contents = async_to_streamed_response_wrapper(
17641842
devboxes.read_file_contents,
17651843
)

tests/api_resources/test_devboxes.py

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,44 @@ def test_path_params_execute_sync(self, client: Runloop) -> None:
450450
command="command",
451451
)
452452

453+
@parametrize
454+
def test_method_keep_alive(self, client: Runloop) -> None:
455+
devbox = client.devboxes.keep_alive(
456+
"id",
457+
)
458+
assert_matches_type(object, devbox, path=["response"])
459+
460+
@parametrize
461+
def test_raw_response_keep_alive(self, client: Runloop) -> None:
462+
response = client.devboxes.with_raw_response.keep_alive(
463+
"id",
464+
)
465+
466+
assert response.is_closed is True
467+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
468+
devbox = response.parse()
469+
assert_matches_type(object, devbox, path=["response"])
470+
471+
@parametrize
472+
def test_streaming_response_keep_alive(self, client: Runloop) -> None:
473+
with client.devboxes.with_streaming_response.keep_alive(
474+
"id",
475+
) as response:
476+
assert not response.is_closed
477+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
478+
479+
devbox = response.parse()
480+
assert_matches_type(object, devbox, path=["response"])
481+
482+
assert cast(Any, response.is_closed) is True
483+
484+
@parametrize
485+
def test_path_params_keep_alive(self, client: Runloop) -> None:
486+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
487+
client.devboxes.with_raw_response.keep_alive(
488+
"",
489+
)
490+
453491
@parametrize
454492
def test_method_read_file_contents(self, client: Runloop) -> None:
455493
devbox = client.devboxes.read_file_contents(
@@ -1166,6 +1204,44 @@ async def test_path_params_execute_sync(self, async_client: AsyncRunloop) -> Non
11661204
command="command",
11671205
)
11681206

1207+
@parametrize
1208+
async def test_method_keep_alive(self, async_client: AsyncRunloop) -> None:
1209+
devbox = await async_client.devboxes.keep_alive(
1210+
"id",
1211+
)
1212+
assert_matches_type(object, devbox, path=["response"])
1213+
1214+
@parametrize
1215+
async def test_raw_response_keep_alive(self, async_client: AsyncRunloop) -> None:
1216+
response = await async_client.devboxes.with_raw_response.keep_alive(
1217+
"id",
1218+
)
1219+
1220+
assert response.is_closed is True
1221+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1222+
devbox = await response.parse()
1223+
assert_matches_type(object, devbox, path=["response"])
1224+
1225+
@parametrize
1226+
async def test_streaming_response_keep_alive(self, async_client: AsyncRunloop) -> None:
1227+
async with async_client.devboxes.with_streaming_response.keep_alive(
1228+
"id",
1229+
) as response:
1230+
assert not response.is_closed
1231+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
1232+
1233+
devbox = await response.parse()
1234+
assert_matches_type(object, devbox, path=["response"])
1235+
1236+
assert cast(Any, response.is_closed) is True
1237+
1238+
@parametrize
1239+
async def test_path_params_keep_alive(self, async_client: AsyncRunloop) -> None:
1240+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
1241+
await async_client.devboxes.with_raw_response.keep_alive(
1242+
"",
1243+
)
1244+
11691245
@parametrize
11701246
async def test_method_read_file_contents(self, async_client: AsyncRunloop) -> None:
11711247
devbox = await async_client.devboxes.read_file_contents(

0 commit comments

Comments
 (0)