Skip to content

Commit 8b16ebe

Browse files
refactor: deprecate and make Nullable total_count and remaining_count of ListViews (#7533)
1 parent ee5d577 commit 8b16ebe

21 files changed

Lines changed: 139 additions & 67 deletions

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 117
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-c8d61a0c8b88fa30666ba021d1239eb0d549902354513c4741e9216bcbfa8e6d.yml
3-
openapi_spec_hash: 433e6fb4ce076012b696f69ae7596c67
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/runloop-ai%2Frunloop-8704a652545c3831c8b7e246ec17f1a626b59911eb5701ddc922ca6cae1c8d57.yml
3+
openapi_spec_hash: e609bc5ed3fdce498bc7d16921bbba5e
44
config_hash: eb28692edd68a6ae95cf92af931c9976

api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ Methods:
160160
- <code title="post /v1/devboxes/{id}/remove_tunnel">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">remove_tunnel</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_remove_tunnel_params.py">params</a>) -> object</code>
161161
- <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>
162162
- <code title="get /v1/devboxes/{id}/usage">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">retrieve_resource_usage</a>(id) -> <a href="./src/runloop_api_client/types/devbox_resource_usage_view.py">DevboxResourceUsageView</a></code>
163-
- <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>
163+
- <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_shutdown_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_view.py">DevboxView</a></code>
164164
- <code title="post /v1/devboxes/{id}/snapshot_disk">client.devboxes.<a href="./src/runloop_api_client/resources/devboxes/devboxes.py">snapshot_disk</a>(id, \*\*<a href="src/runloop_api_client/types/devbox_snapshot_disk_params.py">params</a>) -> <a href="./src/runloop_api_client/types/devbox_snapshot_view.py">DevboxSnapshotView</a></code>
165165
- <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>
166166
- <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>

src/runloop_api_client/resources/devboxes/devboxes.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
devbox_create_params,
2525
devbox_update_params,
2626
devbox_execute_params,
27+
devbox_shutdown_params,
2728
devbox_upload_file_params,
2829
devbox_execute_sync_params,
2930
devbox_create_tunnel_params,
@@ -1415,6 +1416,7 @@ def shutdown(
14151416
self,
14161417
id: str,
14171418
*,
1419+
force: str | Omit = omit,
14181420
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
14191421
# The extra values given here take precedence over values defined on the client or passed to this method.
14201422
extra_headers: Headers | None = None,
@@ -1427,9 +1429,13 @@ def shutdown(
14271429
14281430
This will permanently stop the Devbox. If you want to
14291431
save the state of the Devbox, you should take a snapshot before shutting down or
1430-
should suspend the Devbox instead of shutting down.
1432+
should suspend the Devbox instead of shutting down. If the Devbox has any
1433+
in-progress snapshots, the shutdown will be rejected with a 409 Conflict unless
1434+
force=true is specified.
14311435
14321436
Args:
1437+
force: If true, force shutdown even if snapshots are in progress. Defaults to false.
1438+
14331439
extra_headers: Send extra headers
14341440
14351441
extra_query: Add additional query parameters to the request
@@ -1450,6 +1456,7 @@ def shutdown(
14501456
extra_body=extra_body,
14511457
timeout=timeout,
14521458
idempotency_key=idempotency_key,
1459+
query=maybe_transform({"force": force}, devbox_shutdown_params.DevboxShutdownParams),
14531460
),
14541461
cast_to=DevboxView,
14551462
)
@@ -3077,6 +3084,7 @@ async def shutdown(
30773084
self,
30783085
id: str,
30793086
*,
3087+
force: str | Omit = omit,
30803088
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
30813089
# The extra values given here take precedence over values defined on the client or passed to this method.
30823090
extra_headers: Headers | None = None,
@@ -3089,9 +3097,13 @@ async def shutdown(
30893097
30903098
This will permanently stop the Devbox. If you want to
30913099
save the state of the Devbox, you should take a snapshot before shutting down or
3092-
should suspend the Devbox instead of shutting down.
3100+
should suspend the Devbox instead of shutting down. If the Devbox has any
3101+
in-progress snapshots, the shutdown will be rejected with a 409 Conflict unless
3102+
force=true is specified.
30933103
30943104
Args:
3105+
force: If true, force shutdown even if snapshots are in progress. Defaults to false.
3106+
30953107
extra_headers: Send extra headers
30963108
30973109
extra_query: Add additional query parameters to the request
@@ -3112,6 +3124,7 @@ async def shutdown(
31123124
extra_body=extra_body,
31133125
timeout=timeout,
31143126
idempotency_key=idempotency_key,
3127+
query=await async_maybe_transform({"force": force}, devbox_shutdown_params.DevboxShutdownParams),
31153128
),
31163129
cast_to=DevboxView,
31173130
)

src/runloop_api_client/types/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
from .blueprint_list_params import BlueprintListParams as BlueprintListParams
5656
from .devbox_execute_params import DevboxExecuteParams as DevboxExecuteParams
5757
from .blueprint_preview_view import BlueprintPreviewView as BlueprintPreviewView
58+
from .devbox_shutdown_params import DevboxShutdownParams as DevboxShutdownParams
5859
from .mcp_config_list_params import McpConfigListParams as McpConfigListParams
5960
from .object_download_params import ObjectDownloadParams as ObjectDownloadParams
6061
from .repository_list_params import RepositoryListParams as RepositoryListParams

src/runloop_api_client/types/agent_list_view.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
44

55
from .._models import BaseModel
66
from .agent_view import AgentView
@@ -17,8 +17,14 @@ class AgentListView(BaseModel):
1717
has_more: bool
1818
"""Whether there are more Agents to fetch."""
1919

20-
remaining_count: int
21-
"""The count of remaining Agents."""
20+
remaining_count: Optional[int] = None
21+
"""The count of remaining Agents.
2222
23-
total_count: int
24-
"""The total count of Agents."""
23+
Deprecated: will be removed in a future breaking change.
24+
"""
25+
26+
total_count: Optional[int] = None
27+
"""The total count of Agents.
28+
29+
Deprecated: will be removed in a future breaking change.
30+
"""

src/runloop_api_client/types/benchmark_job_list_view.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
44

55
from .._models import BaseModel
66
from .benchmark_job_view import BenchmarkJobView
@@ -14,6 +14,6 @@ class BenchmarkJobListView(BaseModel):
1414
jobs: List[BenchmarkJobView]
1515
"""List of BenchmarkJobs matching filter."""
1616

17-
remaining_count: int
17+
remaining_count: Optional[int] = None
1818

19-
total_count: int
19+
total_count: Optional[int] = None
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
44

55
from .._models import BaseModel
66
from .benchmark_run_view import BenchmarkRunView
@@ -11,9 +11,9 @@
1111
class BenchmarkRunListView(BaseModel):
1212
has_more: bool
1313

14-
remaining_count: int
15-
1614
runs: List[BenchmarkRunView]
1715
"""List of BenchmarkRuns matching filter."""
1816

19-
total_count: int
17+
remaining_count: Optional[int] = None
18+
19+
total_count: Optional[int] = None

src/runloop_api_client/types/blueprint_list_view.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
44

55
from .._models import BaseModel
66
from .blueprint_view import BlueprintView
@@ -14,6 +14,6 @@ class BlueprintListView(BaseModel):
1414

1515
has_more: bool
1616

17-
remaining_count: int
17+
remaining_count: Optional[int] = None
1818

19-
total_count: int
19+
total_count: Optional[int] = None

src/runloop_api_client/types/devbox_list_view.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

3-
from typing import List
3+
from typing import List, Optional
44

55
from .._models import BaseModel
66
from .devbox_view import DevboxView
@@ -14,6 +14,6 @@ class DevboxListView(BaseModel):
1414

1515
has_more: bool
1616

17-
remaining_count: int
17+
remaining_count: Optional[int] = None
1818

19-
total_count: int
19+
total_count: Optional[int] = None
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from __future__ import annotations
4+
5+
from typing_extensions import TypedDict
6+
7+
__all__ = ["DevboxShutdownParams"]
8+
9+
10+
class DevboxShutdownParams(TypedDict, total=False):
11+
force: str
12+
"""If true, force shutdown even if snapshots are in progress. Defaults to false."""

0 commit comments

Comments
 (0)