opencode-python-sdk 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- opencode/__init__.py +9 -0
- opencode/_aiohttp.py +44 -0
- opencode/_base_client.py +237 -11
- opencode/_client.py +8 -2
- opencode/_logs.py +29 -0
- opencode/_pagination.py +14 -0
- opencode/_response.py +316 -0
- opencode/resources/agent.py +63 -0
- opencode/resources/command.py +59 -0
- opencode/resources/config.py +93 -20
- opencode/resources/credential.py +149 -56
- opencode/resources/debug.py +156 -20
- opencode/resources/event.py +59 -0
- opencode/resources/experimental.py +210 -36
- opencode/resources/file.py +71 -0
- opencode/resources/form.py +59 -0
- opencode/resources/generate.py +59 -0
- opencode/resources/integration.py +538 -128
- opencode/resources/location.py +87 -18
- opencode/resources/mcp.py +252 -82
- opencode/resources/message.py +59 -0
- opencode/resources/migration.py +126 -0
- opencode/resources/model.py +63 -0
- opencode/resources/permission.py +272 -38
- opencode/resources/plugin.py +95 -22
- opencode/resources/project.py +63 -0
- opencode/resources/provider.py +63 -0
- opencode/resources/pty.py +172 -20
- opencode/resources/reference.py +59 -0
- opencode/resources/rpc.py +59 -0
- opencode/resources/server.py +67 -0
- opencode/resources/session.py +1159 -405
- opencode/resources/shell.py +101 -20
- opencode/resources/skill.py +59 -0
- opencode/resources/vcs.py +172 -20
- opencode/resources/voice.py +59 -0
- opencode/resources/websearch.py +63 -0
- opencode/resources/worktree.py +123 -40
- {opencode_python_sdk-0.2.2.dist-info → opencode_python_sdk-0.2.3.dist-info}/METADATA +90 -2
- opencode_python_sdk-0.2.3.dist-info/RECORD +67 -0
- opencode_python_sdk-0.2.2.dist-info/RECORD +0 -64
- {opencode_python_sdk-0.2.2.dist-info → opencode_python_sdk-0.2.3.dist-info}/WHEEL +0 -0
- {opencode_python_sdk-0.2.2.dist-info → opencode_python_sdk-0.2.3.dist-info}/licenses/LICENSE +0 -0
opencode/resources/rpc.py
CHANGED
|
@@ -5,11 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
+
from functools import cached_property
|
|
8
9
|
from typing import TYPE_CHECKING, Any, cast
|
|
9
10
|
|
|
10
11
|
from .._base_client import RequestOptions
|
|
11
12
|
from .._qs import encode_path_segment
|
|
12
13
|
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
14
|
+
from .._response import (
|
|
15
|
+
async_to_raw_response_wrapper,
|
|
16
|
+
async_to_streamed_response_wrapper,
|
|
17
|
+
to_raw_response_wrapper,
|
|
18
|
+
to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
13
20
|
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
14
21
|
|
|
15
22
|
if TYPE_CHECKING:
|
|
@@ -24,6 +31,16 @@ __all__ = ["RpcResource", "AsyncRpcResource"]
|
|
|
24
31
|
class RpcResource(SyncAPIResource):
|
|
25
32
|
"""Operations under ``client.rpc`` (OpenCode ``rpc``)."""
|
|
26
33
|
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> RpcResourceWithRawResponse:
|
|
36
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
37
|
+
return RpcResourceWithRawResponse(self)
|
|
38
|
+
|
|
39
|
+
@cached_property
|
|
40
|
+
def with_streaming_response(self) -> RpcResourceWithStreamingResponse:
|
|
41
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
42
|
+
return RpcResourceWithStreamingResponse(self)
|
|
43
|
+
|
|
27
44
|
def call(
|
|
28
45
|
self,
|
|
29
46
|
rpc_id: str,
|
|
@@ -67,9 +84,35 @@ class RpcResource(SyncAPIResource):
|
|
|
67
84
|
)
|
|
68
85
|
|
|
69
86
|
|
|
87
|
+
class RpcResourceWithRawResponse:
|
|
88
|
+
"""``client.rpc.with_raw_response``."""
|
|
89
|
+
|
|
90
|
+
def __init__(self, resource: RpcResource) -> None:
|
|
91
|
+
self._resource = resource
|
|
92
|
+
self.call = to_raw_response_wrapper(resource.call)
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class RpcResourceWithStreamingResponse:
|
|
96
|
+
"""``client.rpc.with_streaming_response``."""
|
|
97
|
+
|
|
98
|
+
def __init__(self, resource: RpcResource) -> None:
|
|
99
|
+
self._resource = resource
|
|
100
|
+
self.call = to_streamed_response_wrapper(resource.call)
|
|
101
|
+
|
|
102
|
+
|
|
70
103
|
class AsyncRpcResource(AsyncAPIResource):
|
|
71
104
|
"""Operations under ``client.rpc`` (OpenCode ``rpc``)."""
|
|
72
105
|
|
|
106
|
+
@cached_property
|
|
107
|
+
def with_raw_response(self) -> AsyncRpcResourceWithRawResponse:
|
|
108
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
109
|
+
return AsyncRpcResourceWithRawResponse(self)
|
|
110
|
+
|
|
111
|
+
@cached_property
|
|
112
|
+
def with_streaming_response(self) -> AsyncRpcResourceWithStreamingResponse:
|
|
113
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
114
|
+
return AsyncRpcResourceWithStreamingResponse(self)
|
|
115
|
+
|
|
73
116
|
async def call(
|
|
74
117
|
self,
|
|
75
118
|
rpc_id: str,
|
|
@@ -111,3 +154,19 @@ class AsyncRpcResource(AsyncAPIResource):
|
|
|
111
154
|
response_type="RpcOutput",
|
|
112
155
|
),
|
|
113
156
|
)
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
class AsyncRpcResourceWithRawResponse:
|
|
160
|
+
"""``client.rpc.with_raw_response``."""
|
|
161
|
+
|
|
162
|
+
def __init__(self, resource: AsyncRpcResource) -> None:
|
|
163
|
+
self._resource = resource
|
|
164
|
+
self.call = async_to_raw_response_wrapper(resource.call)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class AsyncRpcResourceWithStreamingResponse:
|
|
168
|
+
"""``client.rpc.with_streaming_response``."""
|
|
169
|
+
|
|
170
|
+
def __init__(self, resource: AsyncRpcResource) -> None:
|
|
171
|
+
self._resource = resource
|
|
172
|
+
self.call = async_to_streamed_response_wrapper(resource.call)
|
opencode/resources/server.py
CHANGED
|
@@ -5,11 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
+
from functools import cached_property
|
|
8
9
|
from typing import TYPE_CHECKING, cast
|
|
9
10
|
|
|
10
11
|
from .._base_client import RequestOptions
|
|
11
12
|
from .._qs import encode_path_segment
|
|
12
13
|
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
14
|
+
from .._response import (
|
|
15
|
+
async_to_raw_response_wrapper,
|
|
16
|
+
async_to_streamed_response_wrapper,
|
|
17
|
+
to_raw_response_wrapper,
|
|
18
|
+
to_streamed_response_wrapper,
|
|
19
|
+
)
|
|
13
20
|
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
14
21
|
|
|
15
22
|
if TYPE_CHECKING:
|
|
@@ -25,6 +32,16 @@ __all__ = ["ServerResource", "AsyncServerResource"]
|
|
|
25
32
|
class ServerResource(SyncAPIResource):
|
|
26
33
|
"""Operations under ``client.server`` (OpenCode ``server``)."""
|
|
27
34
|
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_raw_response(self) -> ServerResourceWithRawResponse:
|
|
37
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
38
|
+
return ServerResourceWithRawResponse(self)
|
|
39
|
+
|
|
40
|
+
@cached_property
|
|
41
|
+
def with_streaming_response(self) -> ServerResourceWithStreamingResponse:
|
|
42
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
43
|
+
return ServerResourceWithStreamingResponse(self)
|
|
44
|
+
|
|
28
45
|
def info(
|
|
29
46
|
self,
|
|
30
47
|
*,
|
|
@@ -126,9 +143,39 @@ class ServerResource(SyncAPIResource):
|
|
|
126
143
|
)
|
|
127
144
|
|
|
128
145
|
|
|
146
|
+
class ServerResourceWithRawResponse:
|
|
147
|
+
"""``client.server.with_raw_response``."""
|
|
148
|
+
|
|
149
|
+
def __init__(self, resource: ServerResource) -> None:
|
|
150
|
+
self._resource = resource
|
|
151
|
+
self.info = to_raw_response_wrapper(resource.info)
|
|
152
|
+
self.pair = to_raw_response_wrapper(resource.pair)
|
|
153
|
+
self.connect = to_raw_response_wrapper(resource.connect)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class ServerResourceWithStreamingResponse:
|
|
157
|
+
"""``client.server.with_streaming_response``."""
|
|
158
|
+
|
|
159
|
+
def __init__(self, resource: ServerResource) -> None:
|
|
160
|
+
self._resource = resource
|
|
161
|
+
self.info = to_streamed_response_wrapper(resource.info)
|
|
162
|
+
self.pair = to_streamed_response_wrapper(resource.pair)
|
|
163
|
+
self.connect = to_streamed_response_wrapper(resource.connect)
|
|
164
|
+
|
|
165
|
+
|
|
129
166
|
class AsyncServerResource(AsyncAPIResource):
|
|
130
167
|
"""Operations under ``client.server`` (OpenCode ``server``)."""
|
|
131
168
|
|
|
169
|
+
@cached_property
|
|
170
|
+
def with_raw_response(self) -> AsyncServerResourceWithRawResponse:
|
|
171
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
172
|
+
return AsyncServerResourceWithRawResponse(self)
|
|
173
|
+
|
|
174
|
+
@cached_property
|
|
175
|
+
def with_streaming_response(self) -> AsyncServerResourceWithStreamingResponse:
|
|
176
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
177
|
+
return AsyncServerResourceWithStreamingResponse(self)
|
|
178
|
+
|
|
132
179
|
async def info(
|
|
133
180
|
self,
|
|
134
181
|
*,
|
|
@@ -228,3 +275,23 @@ class AsyncServerResource(AsyncAPIResource):
|
|
|
228
275
|
response_type="PairingSession",
|
|
229
276
|
),
|
|
230
277
|
)
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
class AsyncServerResourceWithRawResponse:
|
|
281
|
+
"""``client.server.with_raw_response``."""
|
|
282
|
+
|
|
283
|
+
def __init__(self, resource: AsyncServerResource) -> None:
|
|
284
|
+
self._resource = resource
|
|
285
|
+
self.info = async_to_raw_response_wrapper(resource.info)
|
|
286
|
+
self.pair = async_to_raw_response_wrapper(resource.pair)
|
|
287
|
+
self.connect = async_to_raw_response_wrapper(resource.connect)
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class AsyncServerResourceWithStreamingResponse:
|
|
291
|
+
"""``client.server.with_streaming_response``."""
|
|
292
|
+
|
|
293
|
+
def __init__(self, resource: AsyncServerResource) -> None:
|
|
294
|
+
self._resource = resource
|
|
295
|
+
self.info = async_to_streamed_response_wrapper(resource.info)
|
|
296
|
+
self.pair = async_to_streamed_response_wrapper(resource.pair)
|
|
297
|
+
self.connect = async_to_streamed_response_wrapper(resource.connect)
|