Skip to content

Commit 9a644e9

Browse files
feat(api): api update
1 parent a1aad74 commit 9a644e9

5 files changed

Lines changed: 98 additions & 78 deletions

File tree

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 104
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-a8e2289b32b616e0bd7e15995a6553d0335bd21e30617a013d07450f8f5a7a20.yml
33
openapi_spec_hash: cd13a7af1ffe64c7ce8753f87786e01f
4-
config_hash: 98a0f112ecc9445456962dab3136d7b6
4+
config_hash: 3a4634de0976f3fbd7f3a5c4911d2add

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Methods:
108108
- <code title="post /v1/devboxes/{id}/snapshot_disk_async">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">snapshot_disk_async</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_snapshot_disk_async_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_snapshot_view.py">DevboxSnapshotView</a></code>
109109
- <code title="post /v1/devboxes/{id}/suspend">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">suspend</a>(id) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
110110
- <code title="post /v1/devboxes/{id}/upload_file">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">upload_file</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_upload_file_params.py">params</a>) -> object</code>
111-
- <code title="post /v1/devboxes/{id}/wait_for_status">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">wait_for_command</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_wait_for_command_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
111+
- <code title="post /v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">wait_for_command</a>(execution_id, \*, devbox_id, \*\*<a href="src/runloop_api_client/types/devbox_wait_for_command_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_async_execution_detail_view.py">DevboxAsyncExecutionDetailView</a></code>
112112
- <code title="post /v1/devboxes/{id}/write_file_contents">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">write_file_contents</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_write_file_contents_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_execution_detail_view.py">DevboxExecutionDetailView</a></code>
113113

114114

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1410,13 +1410,10 @@ def upload_file(
14101410

14111411
def wait_for_command(
14121412
self,
1413-
id: str,
1413+
execution_id: str,
14141414
*,
1415-
statuses: List[
1416-
Literal[
1417-
"provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown"
1418-
]
1419-
],
1415+
devbox_id: str,
1416+
statuses: List[Literal["queued", "running", "completed"]],
14201417
timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN,
14211418
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14221419
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -1425,17 +1422,18 @@ def wait_for_command(
14251422
extra_body: Body | None = None,
14261423
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
14271424
idempotency_key: str | None = None,
1428-
) -> DevboxView:
1425+
) -> DevboxAsyncExecutionDetailView:
14291426
"""
1430-
Polls the Devbox's status until it reaches one of the desired statuses or times
1431-
out.
1427+
Polls the asynchronous execution's status until it reaches one of the desired
1428+
statuses or times out. Defaults to 60 seconds.
14321429
14331430
Args:
1434-
statuses: The Devbox statuses to wait for. At least one status must be provided. The
1435-
devbox will be returned as soon as it reaches any of the provided statuses.
1431+
statuses: The command execution statuses to wait for. At least one status must be
1432+
provided. The command will be returned as soon as it reaches any of the provided
1433+
statuses.
14361434
1437-
timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 30 seconds. Defaults
1438-
to 10 seconds.
1435+
timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 60 seconds. Defaults
1436+
to 60 seconds.
14391437
14401438
extra_headers: Send extra headers
14411439
@@ -1447,10 +1445,12 @@ def wait_for_command(
14471445
14481446
idempotency_key: Specify a custom idempotency key for this request
14491447
"""
1450-
if not id:
1451-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
1448+
if not devbox_id:
1449+
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
1450+
if not execution_id:
1451+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
14521452
return self._post(
1453-
f"/v1/devboxes/{id}/wait_for_status",
1453+
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status",
14541454
body=maybe_transform(
14551455
{
14561456
"statuses": statuses,
@@ -1465,7 +1465,7 @@ def wait_for_command(
14651465
timeout=timeout,
14661466
idempotency_key=idempotency_key,
14671467
),
1468-
cast_to=DevboxView,
1468+
cast_to=DevboxAsyncExecutionDetailView,
14691469
)
14701470

14711471
def write_file_contents(
@@ -2798,13 +2798,10 @@ async def upload_file(
27982798

27992799
async def wait_for_command(
28002800
self,
2801-
id: str,
2801+
execution_id: str,
28022802
*,
2803-
statuses: List[
2804-
Literal[
2805-
"provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown"
2806-
]
2807-
],
2803+
devbox_id: str,
2804+
statuses: List[Literal["queued", "running", "completed"]],
28082805
timeout_seconds: Optional[int] | NotGiven = NOT_GIVEN,
28092806
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
28102807
# The extra values given here take precedence over values defined on the client or passed to this method.
@@ -2813,17 +2810,18 @@ async def wait_for_command(
28132810
extra_body: Body | None = None,
28142811
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
28152812
idempotency_key: str | None = None,
2816-
) -> DevboxView:
2813+
) -> DevboxAsyncExecutionDetailView:
28172814
"""
2818-
Polls the Devbox's status until it reaches one of the desired statuses or times
2819-
out.
2815+
Polls the asynchronous execution's status until it reaches one of the desired
2816+
statuses or times out. Defaults to 60 seconds.
28202817
28212818
Args:
2822-
statuses: The Devbox statuses to wait for. At least one status must be provided. The
2823-
devbox will be returned as soon as it reaches any of the provided statuses.
2819+
statuses: The command execution statuses to wait for. At least one status must be
2820+
provided. The command will be returned as soon as it reaches any of the provided
2821+
statuses.
28242822
2825-
timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 30 seconds. Defaults
2826-
to 10 seconds.
2823+
timeout_seconds: (Optional) Timeout in seconds to wait for the status, up to 60 seconds. Defaults
2824+
to 60 seconds.
28272825
28282826
extra_headers: Send extra headers
28292827
@@ -2835,10 +2833,12 @@ async def wait_for_command(
28352833
28362834
idempotency_key: Specify a custom idempotency key for this request
28372835
"""
2838-
if not id:
2839-
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
2836+
if not devbox_id:
2837+
raise ValueError(f"Expected a non-empty value for `devbox_id` but received {devbox_id!r}")
2838+
if not execution_id:
2839+
raise ValueError(f"Expected a non-empty value for `execution_id` but received {execution_id!r}")
28402840
return await self._post(
2841-
f"/v1/devboxes/{id}/wait_for_status",
2841+
f"/v1/devboxes/{devbox_id}/executions/{execution_id}/wait_for_status",
28422842
body=await async_maybe_transform(
28432843
{
28442844
"statuses": statuses,
@@ -2853,7 +2853,7 @@ async def wait_for_command(
28532853
timeout=timeout,
28542854
idempotency_key=idempotency_key,
28552855
),
2856-
cast_to=DevboxView,
2856+
cast_to=DevboxAsyncExecutionDetailView,
28572857
)
28582858

28592859
async def write_file_contents(

src/runloop_api_client/types/devbox_wait_for_command_params.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,17 @@
99

1010

1111
class DevboxWaitForCommandParams(TypedDict, total=False):
12-
statuses: Required[
13-
List[
14-
Literal[
15-
"provisioning", "initializing", "running", "suspending", "suspended", "resuming", "failure", "shutdown"
16-
]
17-
]
18-
]
19-
"""The Devbox statuses to wait for.
20-
21-
At least one status must be provided. The devbox will be returned as soon as it
12+
devbox_id: Required[str]
13+
14+
statuses: Required[List[Literal["queued", "running", "completed"]]]
15+
"""The command execution statuses to wait for.
16+
17+
At least one status must be provided. The command will be returned as soon as it
2218
reaches any of the provided statuses.
2319
"""
2420

2521
timeout_seconds: Optional[int]
26-
"""(Optional) Timeout in seconds to wait for the status, up to 30 seconds.
22+
"""(Optional) Timeout in seconds to wait for the status, up to 60 seconds.
2723
28-
Defaults to 10 seconds.
24+
Defaults to 60 seconds.
2925
"""

tests/api_resources/test_devboxes.py

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -983,52 +983,64 @@ def test_path_params_upload_file(self, client: Runloop) -> None:
983983
@parametrize
984984
def test_method_wait_for_command(self, client: Runloop) -> None:
985985
devbox = client.devboxes.wait_for_command(
986-
id="id",
987-
statuses=["provisioning"],
986+
execution_id="execution_id",
987+
devbox_id="devbox_id",
988+
statuses=["queued"],
988989
)
989-
assert_matches_type(DevboxView, devbox, path=["response"])
990+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
990991

991992
@parametrize
992993
def test_method_wait_for_command_with_all_params(self, client: Runloop) -> None:
993994
devbox = client.devboxes.wait_for_command(
994-
id="id",
995-
statuses=["provisioning"],
995+
execution_id="execution_id",
996+
devbox_id="devbox_id",
997+
statuses=["queued"],
996998
timeout_seconds=0,
997999
)
998-
assert_matches_type(DevboxView, devbox, path=["response"])
1000+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
9991001

10001002
@parametrize
10011003
def test_raw_response_wait_for_command(self, client: Runloop) -> None:
10021004
response = client.devboxes.with_raw_response.wait_for_command(
1003-
id="id",
1004-
statuses=["provisioning"],
1005+
execution_id="execution_id",
1006+
devbox_id="devbox_id",
1007+
statuses=["queued"],
10051008
)
10061009

10071010
assert response.is_closed is True
10081011
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
10091012
devbox = response.parse()
1010-
assert_matches_type(DevboxView, devbox, path=["response"])
1013+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
10111014

10121015
@parametrize
10131016
def test_streaming_response_wait_for_command(self, client: Runloop) -> None:
10141017
with client.devboxes.with_streaming_response.wait_for_command(
1015-
id="id",
1016-
statuses=["provisioning"],
1018+
execution_id="execution_id",
1019+
devbox_id="devbox_id",
1020+
statuses=["queued"],
10171021
) as response:
10181022
assert not response.is_closed
10191023
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
10201024

10211025
devbox = response.parse()
1022-
assert_matches_type(DevboxView, devbox, path=["response"])
1026+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
10231027

10241028
assert cast(Any, response.is_closed) is True
10251029

10261030
@parametrize
10271031
def test_path_params_wait_for_command(self, client: Runloop) -> None:
1028-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
1032+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"):
10291033
client.devboxes.with_raw_response.wait_for_command(
1030-
id="",
1031-
statuses=["provisioning"],
1034+
execution_id="execution_id",
1035+
devbox_id="",
1036+
statuses=["queued"],
1037+
)
1038+
1039+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"):
1040+
client.devboxes.with_raw_response.wait_for_command(
1041+
execution_id="",
1042+
devbox_id="devbox_id",
1043+
statuses=["queued"],
10321044
)
10331045

10341046
@parametrize
@@ -2310,52 +2322,64 @@ async def test_path_params_upload_file(self, async_client: AsyncRunloop) -> None
23102322
@parametrize
23112323
async def test_method_wait_for_command(self, async_client: AsyncRunloop) -> None:
23122324
devbox = await async_client.devboxes.wait_for_command(
2313-
id="id",
2314-
statuses=["provisioning"],
2325+
execution_id="execution_id",
2326+
devbox_id="devbox_id",
2327+
statuses=["queued"],
23152328
)
2316-
assert_matches_type(DevboxView, devbox, path=["response"])
2329+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
23172330

23182331
@parametrize
23192332
async def test_method_wait_for_command_with_all_params(self, async_client: AsyncRunloop) -> None:
23202333
devbox = await async_client.devboxes.wait_for_command(
2321-
id="id",
2322-
statuses=["provisioning"],
2334+
execution_id="execution_id",
2335+
devbox_id="devbox_id",
2336+
statuses=["queued"],
23232337
timeout_seconds=0,
23242338
)
2325-
assert_matches_type(DevboxView, devbox, path=["response"])
2339+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
23262340

23272341
@parametrize
23282342
async def test_raw_response_wait_for_command(self, async_client: AsyncRunloop) -> None:
23292343
response = await async_client.devboxes.with_raw_response.wait_for_command(
2330-
id="id",
2331-
statuses=["provisioning"],
2344+
execution_id="execution_id",
2345+
devbox_id="devbox_id",
2346+
statuses=["queued"],
23322347
)
23332348

23342349
assert response.is_closed is True
23352350
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
23362351
devbox = await response.parse()
2337-
assert_matches_type(DevboxView, devbox, path=["response"])
2352+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
23382353

23392354
@parametrize
23402355
async def test_streaming_response_wait_for_command(self, async_client: AsyncRunloop) -> None:
23412356
async with async_client.devboxes.with_streaming_response.wait_for_command(
2342-
id="id",
2343-
statuses=["provisioning"],
2357+
execution_id="execution_id",
2358+
devbox_id="devbox_id",
2359+
statuses=["queued"],
23442360
) as response:
23452361
assert not response.is_closed
23462362
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
23472363

23482364
devbox = await response.parse()
2349-
assert_matches_type(DevboxView, devbox, path=["response"])
2365+
assert_matches_type(DevboxAsyncExecutionDetailView, devbox, path=["response"])
23502366

23512367
assert cast(Any, response.is_closed) is True
23522368

23532369
@parametrize
23542370
async def test_path_params_wait_for_command(self, async_client: AsyncRunloop) -> None:
2355-
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
2371+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `devbox_id` but received ''"):
23562372
await async_client.devboxes.with_raw_response.wait_for_command(
2357-
id="",
2358-
statuses=["provisioning"],
2373+
execution_id="execution_id",
2374+
devbox_id="",
2375+
statuses=["queued"],
2376+
)
2377+
2378+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `execution_id` but received ''"):
2379+
await async_client.devboxes.with_raw_response.wait_for_command(
2380+
execution_id="",
2381+
devbox_id="devbox_id",
2382+
statuses=["queued"],
23592383
)
23602384

23612385
@parametrize

0 commit comments

Comments
 (0)