Skip to content

Commit 5684195

Browse files
authored
WIP docs: added base api types to the type reference (#689)
* Restructure type references to be clearer * title underline formatting * Rename SDK's RequestOptions to BaseRequestOptions (avoid conflict with API's RequestOptions) * base api types in the type reference
1 parent 57ee98e commit 5684195

14 files changed

Lines changed: 92 additions & 69 deletions

docs/sdk/async/devbox.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ The ``AsyncDevbox`` class provides asynchronous methods for managing and interac
66
.. automodule:: runloop_api_client.sdk.async_devbox
77
:members:
88

9+
.. automodule:: runloop_api_client.sdk.protocols
10+
:members: AsyncCommandInterface, AsyncFileInterface, AsyncNetworkInterface
11+
:undoc-members:

docs/sdk/sync/devbox.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ The ``Devbox`` class provides synchronous methods for managing and interacting w
66
.. automodule:: runloop_api_client.sdk.devbox
77
:members:
88

9+
.. automodule:: runloop_api_client.sdk.protocols
10+
:members: CommandInterface, FileInterface, NetworkInterface
11+
:undoc-members:

docs/sdk/types.rst

Lines changed: 47 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,21 @@
11
Type Reference
22
==============
33

4-
This page documents all TypeDict parameter types used throughout the SDK.
4+
The Runloop Python SDK uses TypeDict objects for configuration parameters to the various API calls. This page documents the TypeDict objects used throughout the SDK.
55

6-
Core Request Options
6+
Blueprint Parameters
77
--------------------
88

9-
These TypeDicts define options for streaming, timeouts, polling, and other request configuration.
10-
11-
.. autotypeddict:: runloop_api_client.sdk._types.ExecuteStreamingCallbacks
12-
13-
.. autotypeddict:: runloop_api_client.sdk._types.RequestOptions
14-
15-
.. autotypeddict:: runloop_api_client.sdk._types.LongRequestOptions
9+
These TypeDicts define parameters for blueprint creation and listing.
1610

17-
.. autotypeddict:: runloop_api_client.sdk._types.PollingRequestOptions
11+
.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintCreateParams
1812

19-
.. autotypeddict:: runloop_api_client.sdk._types.LongPollingRequestOptions
13+
.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintListParams
2014

2115
Devbox Parameters
2216
-----------------
2317

24-
These TypeDicts define parameters for devbox creation, execution, file operations, network tunnels, and snapshots.
18+
These TypeDicts define parameters for devbox creation, listing, and operations.
2519

2620
Creation Parameters
2721
~~~~~~~~~~~~~~~~~~~
@@ -30,18 +24,18 @@ Creation Parameters
3024

3125
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxCreateFromImageParams
3226

33-
Execution Parameters
34-
~~~~~~~~~~~~~~~~~~~~
35-
36-
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteParams
37-
38-
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteAsyncParams
39-
4027
Listing Parameters
4128
~~~~~~~~~~~~~~~~~~
4229

4330
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxListParams
4431

32+
Command Execution Parameters
33+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
34+
35+
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteParams
36+
37+
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxExecuteAsyncParams
38+
4539
File Operation Parameters
4640
~~~~~~~~~~~~~~~~~~~~~~~~~
4741

@@ -54,14 +48,16 @@ File Operation Parameters
5448
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxUploadFileParams
5549

5650
Network Tunnel Parameters
57-
~~~~~~~~~~~~~~~~~~~~~~~~~~
51+
~~~~~~~~~~~~~~~~~~~~~~~~~
5852

5953
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxCreateTunnelParams
6054

6155
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxRemoveTunnelParams
6256

6357
Snapshot Parameters
64-
~~~~~~~~~~~~~~~~~~~
58+
-------------------
59+
60+
These TypeDicts define parameters for snapshot creation, listing, and updating.
6561

6662
.. autotypeddict:: runloop_api_client.sdk._types.SDKDevboxSnapshotDiskParams
6763

@@ -71,15 +67,6 @@ Snapshot Parameters
7167

7268
.. autotypeddict:: runloop_api_client.sdk._types.SDKDiskSnapshotUpdateParams
7369

74-
Blueprint Parameters
75-
--------------------
76-
77-
These TypeDicts define parameters for blueprint creation and listing.
78-
79-
.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintCreateParams
80-
81-
.. autotypeddict:: runloop_api_client.sdk._types.SDKBlueprintListParams
82-
8370
Storage Object Parameters
8471
-------------------------
8572

@@ -90,3 +77,33 @@ These TypeDicts define parameters for storage object creation, listing, and down
9077
.. autotypeddict:: runloop_api_client.sdk._types.SDKObjectListParams
9178

9279
.. autotypeddict:: runloop_api_client.sdk._types.SDKObjectDownloadParams
80+
81+
Core Request Options
82+
--------------------
83+
84+
These TypeDicts define options for timeouts, idempotency, polling, and other low-level request configuration. All other TypeDicts in the SDK extend from one of these core types.
85+
86+
.. autotypeddict:: runloop_api_client.sdk._types.BaseRequestOptions
87+
88+
.. autotypeddict:: runloop_api_client.sdk._types.LongRequestOptions
89+
90+
.. autoclass:: runloop_api_client.sdk._types.PollingConfig
91+
:members:
92+
:undoc-members:
93+
94+
.. autotypeddict:: runloop_api_client.sdk._types.PollingRequestOptions
95+
96+
.. autotypeddict:: runloop_api_client.sdk._types.LongPollingRequestOptions
97+
98+
Base API Type Reference
99+
-----------------------
100+
101+
.. automodule:: runloop_api_client.types.shared_params
102+
:members:
103+
:undoc-members:
104+
:imported-members:
105+
106+
.. automodule:: runloop_api_client.types
107+
:members:
108+
:undoc-members:
109+
:imported-members:

src/runloop_api_client/sdk/_types.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class ExecuteStreamingCallbacks(TypedDict, total=False):
3636
"""Callback invoked for all log lines (both stdout and stderr)"""
3737

3838

39-
class RequestOptions(TypedDict, total=False):
39+
class BaseRequestOptions(TypedDict, total=False):
4040
extra_headers: Optional[Headers]
4141
"""Send extra headers"""
4242

@@ -50,12 +50,12 @@ class RequestOptions(TypedDict, total=False):
5050
"""Override the client-level default timeout for this request, in seconds"""
5151

5252

53-
class LongRequestOptions(RequestOptions, total=False):
53+
class LongRequestOptions(BaseRequestOptions, total=False):
5454
idempotency_key: Optional[str]
5555
"""Specify a custom idempotency key for this request"""
5656

5757

58-
class PollingRequestOptions(RequestOptions, total=False):
58+
class PollingRequestOptions(BaseRequestOptions, total=False):
5959
polling_config: Optional[PollingConfig]
6060
"""Configuration for polling behavior"""
6161

@@ -80,7 +80,7 @@ class SDKDevboxExecuteAsyncParams(DevboxExecuteAsyncParams, ExecuteStreamingCall
8080
pass
8181

8282

83-
class SDKDevboxListParams(DevboxListParams, RequestOptions):
83+
class SDKDevboxListParams(DevboxListParams, BaseRequestOptions):
8484
pass
8585

8686

@@ -116,7 +116,7 @@ class SDKDevboxSnapshotDiskParams(DevboxSnapshotDiskParams, LongPollingRequestOp
116116
pass
117117

118118

119-
class SDKDiskSnapshotListParams(DiskSnapshotListParams, RequestOptions):
119+
class SDKDiskSnapshotListParams(DiskSnapshotListParams, BaseRequestOptions):
120120
pass
121121

122122

@@ -128,17 +128,17 @@ class SDKBlueprintCreateParams(BlueprintCreateParams, LongPollingRequestOptions)
128128
pass
129129

130130

131-
class SDKBlueprintListParams(BlueprintListParams, RequestOptions):
131+
class SDKBlueprintListParams(BlueprintListParams, BaseRequestOptions):
132132
pass
133133

134134

135-
class SDKObjectListParams(ObjectListParams, RequestOptions):
135+
class SDKObjectListParams(ObjectListParams, BaseRequestOptions):
136136
pass
137137

138138

139139
class SDKObjectCreateParams(ObjectCreateParams, LongRequestOptions):
140140
pass
141141

142142

143-
class SDKObjectDownloadParams(ObjectDownloadParams, RequestOptions):
143+
class SDKObjectDownloadParams(ObjectDownloadParams, BaseRequestOptions):
144144
pass

src/runloop_api_client/sdk/async_blueprint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing_extensions import Unpack, override
66

77
from ..types import BlueprintView
8-
from ._types import RequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams
8+
from ._types import BaseRequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams
99
from .._client import AsyncRunloop
1010
from .async_devbox import AsyncDevbox
1111
from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
@@ -44,7 +44,7 @@ def id(self) -> str:
4444

4545
async def get_info(
4646
self,
47-
**options: Unpack[RequestOptions],
47+
**options: Unpack[BaseRequestOptions],
4848
) -> BlueprintView:
4949
"""Retrieve the latest blueprint details.
5050
@@ -59,7 +59,7 @@ async def get_info(
5959

6060
async def logs(
6161
self,
62-
**options: Unpack[RequestOptions],
62+
**options: Unpack[BaseRequestOptions],
6363
) -> BlueprintBuildLogsListView:
6464
"""Retrieve build logs for the blueprint.
6565

src/runloop_api_client/sdk/async_devbox.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
)
1616
from ._types import (
1717
LogCallback,
18-
RequestOptions,
18+
BaseRequestOptions,
1919
LongRequestOptions,
2020
PollingRequestOptions,
2121
SDKDevboxExecuteParams,
@@ -104,7 +104,7 @@ def id(self) -> str:
104104

105105
async def get_info(
106106
self,
107-
**options: Unpack[RequestOptions],
107+
**options: Unpack[BaseRequestOptions],
108108
) -> DevboxView:
109109
"""Retrieve current devbox status and metadata.
110110

src/runloop_api_client/sdk/async_execution.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Optional, Awaitable, cast
88
from typing_extensions import Unpack, override
99

10-
from ._types import RequestOptions, LongRequestOptions
10+
from ._types import BaseRequestOptions, LongRequestOptions
1111
from .._client import AsyncRunloop
1212
from .async_execution_result import AsyncExecutionResult
1313
from ..types.devbox_async_execution_detail_view import DevboxAsyncExecutionDetailView
@@ -119,7 +119,7 @@ async def result(self, **options: Unpack[LongRequestOptions]) -> AsyncExecutionR
119119
final = cast(DevboxAsyncExecutionDetailView, command_result)
120120
return AsyncExecutionResult(self._client, self._devbox_id, final)
121121

122-
async def get_state(self, **options: Unpack[RequestOptions]) -> DevboxAsyncExecutionDetailView:
122+
async def get_state(self, **options: Unpack[BaseRequestOptions]) -> DevboxAsyncExecutionDetailView:
123123
"""Fetch the latest execution state.
124124
125125
:param options: Optional request configuration

src/runloop_api_client/sdk/async_snapshot.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing_extensions import Unpack, override
66

77
from ._types import (
8-
RequestOptions,
8+
BaseRequestOptions,
99
LongRequestOptions,
1010
PollingRequestOptions,
1111
SDKDiskSnapshotUpdateParams,
@@ -50,7 +50,7 @@ def id(self) -> str:
5050

5151
async def get_info(
5252
self,
53-
**options: Unpack[RequestOptions],
53+
**options: Unpack[BaseRequestOptions],
5454
) -> DevboxSnapshotAsyncStatusView:
5555
"""Retrieve the latest snapshot status.
5656

src/runloop_api_client/sdk/async_storage_object.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Iterable
66
from typing_extensions import Unpack, override
77

8-
from ._types import RequestOptions, LongRequestOptions, SDKObjectDownloadParams
8+
from ._types import BaseRequestOptions, LongRequestOptions, SDKObjectDownloadParams
99
from .._client import AsyncRunloop
1010
from ..types.object_view import ObjectView
1111
from ..types.object_download_url_view import ObjectDownloadURLView
@@ -52,7 +52,7 @@ def upload_url(self) -> str | None:
5252

5353
async def refresh(
5454
self,
55-
**options: Unpack[RequestOptions],
55+
**options: Unpack[BaseRequestOptions],
5656
) -> ObjectView:
5757
"""Fetch the latest metadata for the object.
5858

src/runloop_api_client/sdk/blueprint.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing_extensions import Unpack, override
66

77
from ..types import BlueprintView
8-
from ._types import RequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams
8+
from ._types import BaseRequestOptions, LongRequestOptions, SDKDevboxCreateFromImageParams
99
from .devbox import Devbox
1010
from .._client import Runloop
1111
from ..types.blueprint_build_logs_list_view import BlueprintBuildLogsListView
@@ -44,7 +44,7 @@ def id(self) -> str:
4444

4545
def get_info(
4646
self,
47-
**options: Unpack[RequestOptions],
47+
**options: Unpack[BaseRequestOptions],
4848
) -> BlueprintView:
4949
"""Retrieve the latest blueprint details.
5050
@@ -59,7 +59,7 @@ def get_info(
5959

6060
def logs(
6161
self,
62-
**options: Unpack[RequestOptions],
62+
**options: Unpack[BaseRequestOptions],
6363
) -> BlueprintBuildLogsListView:
6464
"""Retrieve build logs for the blueprint.
6565

0 commit comments

Comments
 (0)