opencode-python-sdk 0.2.0__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 +14 -0
- opencode/_aiohttp.py +44 -0
- opencode/_base_client.py +237 -11
- opencode/_client.py +115 -3
- opencode/_logs.py +29 -0
- opencode/_pagination.py +14 -0
- opencode/_response.py +316 -0
- opencode/_service.py +1018 -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/service.py +50 -0
- {opencode_python_sdk-0.2.0.dist-info → opencode_python_sdk-0.2.3.dist-info}/METADATA +111 -2
- opencode_python_sdk-0.2.3.dist-info/RECORD +67 -0
- opencode_python_sdk-0.2.0.dist-info/RECORD +0 -62
- {opencode_python_sdk-0.2.0.dist-info → opencode_python_sdk-0.2.3.dist-info}/WHEEL +0 -0
- {opencode_python_sdk-0.2.0.dist-info → opencode_python_sdk-0.2.3.dist-info}/licenses/LICENSE +0 -0
opencode/resources/file.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, Literal, cast
|
|
9
10
|
|
|
10
11
|
from .._base_client import RequestOptions
|
|
11
12
|
from .._qs import encode_path
|
|
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, OpenEnum, Query, Timeout
|
|
14
21
|
|
|
15
22
|
if TYPE_CHECKING:
|
|
@@ -26,6 +33,16 @@ __all__ = ["FileResource", "AsyncFileResource"]
|
|
|
26
33
|
class FileResource(SyncAPIResource):
|
|
27
34
|
"""Operations under ``client.file`` (OpenCode ``file``)."""
|
|
28
35
|
|
|
36
|
+
@cached_property
|
|
37
|
+
def with_raw_response(self) -> FileResourceWithRawResponse:
|
|
38
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
39
|
+
return FileResourceWithRawResponse(self)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def with_streaming_response(self) -> FileResourceWithStreamingResponse:
|
|
43
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
44
|
+
return FileResourceWithStreamingResponse(self)
|
|
45
|
+
|
|
29
46
|
def read(
|
|
30
47
|
self,
|
|
31
48
|
path: str,
|
|
@@ -189,9 +206,41 @@ class FileResource(SyncAPIResource):
|
|
|
189
206
|
)
|
|
190
207
|
|
|
191
208
|
|
|
209
|
+
class FileResourceWithRawResponse:
|
|
210
|
+
"""``client.file.with_raw_response``."""
|
|
211
|
+
|
|
212
|
+
def __init__(self, resource: FileResource) -> None:
|
|
213
|
+
self._resource = resource
|
|
214
|
+
self.read = to_raw_response_wrapper(resource.read)
|
|
215
|
+
self.list = to_raw_response_wrapper(resource.list)
|
|
216
|
+
self.find = to_raw_response_wrapper(resource.find)
|
|
217
|
+
self.write = to_raw_response_wrapper(resource.write)
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class FileResourceWithStreamingResponse:
|
|
221
|
+
"""``client.file.with_streaming_response``."""
|
|
222
|
+
|
|
223
|
+
def __init__(self, resource: FileResource) -> None:
|
|
224
|
+
self._resource = resource
|
|
225
|
+
self.read = to_streamed_response_wrapper(resource.read)
|
|
226
|
+
self.list = to_streamed_response_wrapper(resource.list)
|
|
227
|
+
self.find = to_streamed_response_wrapper(resource.find)
|
|
228
|
+
self.write = to_streamed_response_wrapper(resource.write)
|
|
229
|
+
|
|
230
|
+
|
|
192
231
|
class AsyncFileResource(AsyncAPIResource):
|
|
193
232
|
"""Operations under ``client.file`` (OpenCode ``file``)."""
|
|
194
233
|
|
|
234
|
+
@cached_property
|
|
235
|
+
def with_raw_response(self) -> AsyncFileResourceWithRawResponse:
|
|
236
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
237
|
+
return AsyncFileResourceWithRawResponse(self)
|
|
238
|
+
|
|
239
|
+
@cached_property
|
|
240
|
+
def with_streaming_response(self) -> AsyncFileResourceWithStreamingResponse:
|
|
241
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
242
|
+
return AsyncFileResourceWithStreamingResponse(self)
|
|
243
|
+
|
|
195
244
|
async def read(
|
|
196
245
|
self,
|
|
197
246
|
path: str,
|
|
@@ -353,3 +402,25 @@ class AsyncFileResource(AsyncAPIResource):
|
|
|
353
402
|
response_type="FileWriteResponse",
|
|
354
403
|
),
|
|
355
404
|
)
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
class AsyncFileResourceWithRawResponse:
|
|
408
|
+
"""``client.file.with_raw_response``."""
|
|
409
|
+
|
|
410
|
+
def __init__(self, resource: AsyncFileResource) -> None:
|
|
411
|
+
self._resource = resource
|
|
412
|
+
self.read = async_to_raw_response_wrapper(resource.read)
|
|
413
|
+
self.list = async_to_raw_response_wrapper(resource.list)
|
|
414
|
+
self.find = async_to_raw_response_wrapper(resource.find)
|
|
415
|
+
self.write = async_to_raw_response_wrapper(resource.write)
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
class AsyncFileResourceWithStreamingResponse:
|
|
419
|
+
"""``client.file.with_streaming_response``."""
|
|
420
|
+
|
|
421
|
+
def __init__(self, resource: AsyncFileResource) -> None:
|
|
422
|
+
self._resource = resource
|
|
423
|
+
self.read = async_to_streamed_response_wrapper(resource.read)
|
|
424
|
+
self.list = async_to_streamed_response_wrapper(resource.list)
|
|
425
|
+
self.find = async_to_streamed_response_wrapper(resource.find)
|
|
426
|
+
self.write = async_to_streamed_response_wrapper(resource.write)
|
opencode/resources/form.py
CHANGED
|
@@ -5,10 +5,17 @@
|
|
|
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 .._resource import AsyncAPIResource, SyncAPIResource
|
|
13
|
+
from .._response import (
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
12
19
|
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
13
20
|
|
|
14
21
|
if TYPE_CHECKING:
|
|
@@ -23,6 +30,16 @@ __all__ = ["FormResource", "AsyncFormResource"]
|
|
|
23
30
|
class FormResource(SyncAPIResource):
|
|
24
31
|
"""Operations under ``client.form`` (OpenCode ``form``)."""
|
|
25
32
|
|
|
33
|
+
@cached_property
|
|
34
|
+
def with_raw_response(self) -> FormResourceWithRawResponse:
|
|
35
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
36
|
+
return FormResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> FormResourceWithStreamingResponse:
|
|
40
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
41
|
+
return FormResourceWithStreamingResponse(self)
|
|
42
|
+
|
|
26
43
|
def list(
|
|
27
44
|
self,
|
|
28
45
|
*,
|
|
@@ -60,9 +77,35 @@ class FormResource(SyncAPIResource):
|
|
|
60
77
|
)
|
|
61
78
|
|
|
62
79
|
|
|
80
|
+
class FormResourceWithRawResponse:
|
|
81
|
+
"""``client.form.with_raw_response``."""
|
|
82
|
+
|
|
83
|
+
def __init__(self, resource: FormResource) -> None:
|
|
84
|
+
self._resource = resource
|
|
85
|
+
self.list = to_raw_response_wrapper(resource.list)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
class FormResourceWithStreamingResponse:
|
|
89
|
+
"""``client.form.with_streaming_response``."""
|
|
90
|
+
|
|
91
|
+
def __init__(self, resource: FormResource) -> None:
|
|
92
|
+
self._resource = resource
|
|
93
|
+
self.list = to_streamed_response_wrapper(resource.list)
|
|
94
|
+
|
|
95
|
+
|
|
63
96
|
class AsyncFormResource(AsyncAPIResource):
|
|
64
97
|
"""Operations under ``client.form`` (OpenCode ``form``)."""
|
|
65
98
|
|
|
99
|
+
@cached_property
|
|
100
|
+
def with_raw_response(self) -> AsyncFormResourceWithRawResponse:
|
|
101
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
102
|
+
return AsyncFormResourceWithRawResponse(self)
|
|
103
|
+
|
|
104
|
+
@cached_property
|
|
105
|
+
def with_streaming_response(self) -> AsyncFormResourceWithStreamingResponse:
|
|
106
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
107
|
+
return AsyncFormResourceWithStreamingResponse(self)
|
|
108
|
+
|
|
66
109
|
async def list(
|
|
67
110
|
self,
|
|
68
111
|
*,
|
|
@@ -98,3 +141,19 @@ class AsyncFormResource(AsyncAPIResource):
|
|
|
98
141
|
response_type="FormListResponse",
|
|
99
142
|
),
|
|
100
143
|
)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
class AsyncFormResourceWithRawResponse:
|
|
147
|
+
"""``client.form.with_raw_response``."""
|
|
148
|
+
|
|
149
|
+
def __init__(self, resource: AsyncFormResource) -> None:
|
|
150
|
+
self._resource = resource
|
|
151
|
+
self.list = async_to_raw_response_wrapper(resource.list)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class AsyncFormResourceWithStreamingResponse:
|
|
155
|
+
"""``client.form.with_streaming_response``."""
|
|
156
|
+
|
|
157
|
+
def __init__(self, resource: AsyncFormResource) -> None:
|
|
158
|
+
self._resource = resource
|
|
159
|
+
self.list = async_to_streamed_response_wrapper(resource.list)
|
opencode/resources/generate.py
CHANGED
|
@@ -5,10 +5,17 @@
|
|
|
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 .._resource import AsyncAPIResource, SyncAPIResource
|
|
13
|
+
from .._response import (
|
|
14
|
+
async_to_raw_response_wrapper,
|
|
15
|
+
async_to_streamed_response_wrapper,
|
|
16
|
+
to_raw_response_wrapper,
|
|
17
|
+
to_streamed_response_wrapper,
|
|
18
|
+
)
|
|
12
19
|
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
13
20
|
|
|
14
21
|
if TYPE_CHECKING:
|
|
@@ -23,6 +30,16 @@ __all__ = ["GenerateResource", "AsyncGenerateResource"]
|
|
|
23
30
|
class GenerateResource(SyncAPIResource):
|
|
24
31
|
"""Operations under ``client.generate`` (OpenCode ``generate``)."""
|
|
25
32
|
|
|
33
|
+
@cached_property
|
|
34
|
+
def with_raw_response(self) -> GenerateResourceWithRawResponse:
|
|
35
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
36
|
+
return GenerateResourceWithRawResponse(self)
|
|
37
|
+
|
|
38
|
+
@cached_property
|
|
39
|
+
def with_streaming_response(self) -> GenerateResourceWithStreamingResponse:
|
|
40
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
41
|
+
return GenerateResourceWithStreamingResponse(self)
|
|
42
|
+
|
|
26
43
|
def text(
|
|
27
44
|
self,
|
|
28
45
|
*,
|
|
@@ -65,9 +82,35 @@ class GenerateResource(SyncAPIResource):
|
|
|
65
82
|
)
|
|
66
83
|
|
|
67
84
|
|
|
85
|
+
class GenerateResourceWithRawResponse:
|
|
86
|
+
"""``client.generate.with_raw_response``."""
|
|
87
|
+
|
|
88
|
+
def __init__(self, resource: GenerateResource) -> None:
|
|
89
|
+
self._resource = resource
|
|
90
|
+
self.text = to_raw_response_wrapper(resource.text)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class GenerateResourceWithStreamingResponse:
|
|
94
|
+
"""``client.generate.with_streaming_response``."""
|
|
95
|
+
|
|
96
|
+
def __init__(self, resource: GenerateResource) -> None:
|
|
97
|
+
self._resource = resource
|
|
98
|
+
self.text = to_streamed_response_wrapper(resource.text)
|
|
99
|
+
|
|
100
|
+
|
|
68
101
|
class AsyncGenerateResource(AsyncAPIResource):
|
|
69
102
|
"""Operations under ``client.generate`` (OpenCode ``generate``)."""
|
|
70
103
|
|
|
104
|
+
@cached_property
|
|
105
|
+
def with_raw_response(self) -> AsyncGenerateResourceWithRawResponse:
|
|
106
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
107
|
+
return AsyncGenerateResourceWithRawResponse(self)
|
|
108
|
+
|
|
109
|
+
@cached_property
|
|
110
|
+
def with_streaming_response(self) -> AsyncGenerateResourceWithStreamingResponse:
|
|
111
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
112
|
+
return AsyncGenerateResourceWithStreamingResponse(self)
|
|
113
|
+
|
|
71
114
|
async def text(
|
|
72
115
|
self,
|
|
73
116
|
*,
|
|
@@ -108,3 +151,19 @@ class AsyncGenerateResource(AsyncAPIResource):
|
|
|
108
151
|
unwrap=True,
|
|
109
152
|
),
|
|
110
153
|
)
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class AsyncGenerateResourceWithRawResponse:
|
|
157
|
+
"""``client.generate.with_raw_response``."""
|
|
158
|
+
|
|
159
|
+
def __init__(self, resource: AsyncGenerateResource) -> None:
|
|
160
|
+
self._resource = resource
|
|
161
|
+
self.text = async_to_raw_response_wrapper(resource.text)
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
class AsyncGenerateResourceWithStreamingResponse:
|
|
165
|
+
"""``client.generate.with_streaming_response``."""
|
|
166
|
+
|
|
167
|
+
def __init__(self, resource: AsyncGenerateResource) -> None:
|
|
168
|
+
self._resource = resource
|
|
169
|
+
self.text = async_to_streamed_response_wrapper(resource.text)
|