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
|
@@ -14,6 +14,12 @@ from .._base_client import RequestOptions
|
|
|
14
14
|
from .._pty import AsyncPersistentPtyAttachMixin, PersistentPtyAttachMixin
|
|
15
15
|
from .._qs import encode_path_segment
|
|
16
16
|
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
17
|
+
from .._response import (
|
|
18
|
+
async_to_raw_response_wrapper,
|
|
19
|
+
async_to_streamed_response_wrapper,
|
|
20
|
+
to_raw_response_wrapper,
|
|
21
|
+
to_streamed_response_wrapper,
|
|
22
|
+
)
|
|
17
23
|
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
18
24
|
|
|
19
25
|
if TYPE_CHECKING:
|
|
@@ -36,6 +42,16 @@ __all__ = ["ExperimentalResource", "AsyncExperimentalResource"]
|
|
|
36
42
|
class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
|
|
37
43
|
"""Operations under ``client.experimental.persistent_pty`` (OpenCode ``experimental.persistentPty``)."""
|
|
38
44
|
|
|
45
|
+
@cached_property
|
|
46
|
+
def with_raw_response(self) -> ExperimentalPersistentPtyResourceWithRawResponse:
|
|
47
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
48
|
+
return ExperimentalPersistentPtyResourceWithRawResponse(self)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def with_streaming_response(self) -> ExperimentalPersistentPtyResourceWithStreamingResponse:
|
|
52
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
53
|
+
return ExperimentalPersistentPtyResourceWithStreamingResponse(self)
|
|
54
|
+
|
|
39
55
|
def read(
|
|
40
56
|
self,
|
|
41
57
|
session_id: SessionID,
|
|
@@ -168,16 +184,19 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
|
|
|
168
184
|
|
|
169
185
|
``POST /api/experimental/persistent-pty/shutdown``
|
|
170
186
|
"""
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
187
|
+
return cast(
|
|
188
|
+
"None",
|
|
189
|
+
self._client.request(
|
|
190
|
+
RequestOptions(
|
|
191
|
+
method="POST",
|
|
192
|
+
path="/api/experimental/persistent-pty/shutdown",
|
|
193
|
+
extra_headers=extra_headers,
|
|
194
|
+
extra_query=extra_query,
|
|
195
|
+
extra_body=extra_body,
|
|
196
|
+
timeout=timeout,
|
|
197
|
+
),
|
|
198
|
+
kind="void",
|
|
179
199
|
),
|
|
180
|
-
kind="void",
|
|
181
200
|
)
|
|
182
201
|
|
|
183
202
|
def handoff(
|
|
@@ -339,16 +358,19 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
|
|
|
339
358
|
|
|
340
359
|
``DELETE /api/experimental/persistent-pty/:ptyID``
|
|
341
360
|
"""
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
361
|
+
return cast(
|
|
362
|
+
"None",
|
|
363
|
+
self._client.request(
|
|
364
|
+
RequestOptions(
|
|
365
|
+
method="DELETE",
|
|
366
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
367
|
+
extra_headers=extra_headers,
|
|
368
|
+
extra_query=extra_query,
|
|
369
|
+
extra_body=extra_body,
|
|
370
|
+
timeout=timeout,
|
|
371
|
+
),
|
|
372
|
+
kind="void",
|
|
350
373
|
),
|
|
351
|
-
kind="void",
|
|
352
374
|
)
|
|
353
375
|
|
|
354
376
|
def connect_token(
|
|
@@ -390,6 +412,40 @@ class ExperimentalPersistentPtyResource(PersistentPtyAttachMixin):
|
|
|
390
412
|
)
|
|
391
413
|
|
|
392
414
|
|
|
415
|
+
class ExperimentalPersistentPtyResourceWithRawResponse:
|
|
416
|
+
"""``client.experimental.persistent_pty.with_raw_response``."""
|
|
417
|
+
|
|
418
|
+
def __init__(self, resource: ExperimentalPersistentPtyResource) -> None:
|
|
419
|
+
self._resource = resource
|
|
420
|
+
self.read = to_raw_response_wrapper(resource.read)
|
|
421
|
+
self.list = to_raw_response_wrapper(resource.list)
|
|
422
|
+
self.create = to_raw_response_wrapper(resource.create)
|
|
423
|
+
self.shutdown = to_raw_response_wrapper(resource.shutdown)
|
|
424
|
+
self.handoff = to_raw_response_wrapper(resource.handoff)
|
|
425
|
+
self.get = to_raw_response_wrapper(resource.get)
|
|
426
|
+
self.update = to_raw_response_wrapper(resource.update)
|
|
427
|
+
self.snapshot = to_raw_response_wrapper(resource.snapshot)
|
|
428
|
+
self.remove = to_raw_response_wrapper(resource.remove)
|
|
429
|
+
self.connect_token = to_raw_response_wrapper(resource.connect_token)
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
class ExperimentalPersistentPtyResourceWithStreamingResponse:
|
|
433
|
+
"""``client.experimental.persistent_pty.with_streaming_response``."""
|
|
434
|
+
|
|
435
|
+
def __init__(self, resource: ExperimentalPersistentPtyResource) -> None:
|
|
436
|
+
self._resource = resource
|
|
437
|
+
self.read = to_streamed_response_wrapper(resource.read)
|
|
438
|
+
self.list = to_streamed_response_wrapper(resource.list)
|
|
439
|
+
self.create = to_streamed_response_wrapper(resource.create)
|
|
440
|
+
self.shutdown = to_streamed_response_wrapper(resource.shutdown)
|
|
441
|
+
self.handoff = to_streamed_response_wrapper(resource.handoff)
|
|
442
|
+
self.get = to_streamed_response_wrapper(resource.get)
|
|
443
|
+
self.update = to_streamed_response_wrapper(resource.update)
|
|
444
|
+
self.snapshot = to_streamed_response_wrapper(resource.snapshot)
|
|
445
|
+
self.remove = to_streamed_response_wrapper(resource.remove)
|
|
446
|
+
self.connect_token = to_streamed_response_wrapper(resource.connect_token)
|
|
447
|
+
|
|
448
|
+
|
|
393
449
|
class ExperimentalResource(SyncAPIResource):
|
|
394
450
|
"""Operations under ``client.experimental`` (OpenCode ``experimental``)."""
|
|
395
451
|
|
|
@@ -398,10 +454,54 @@ class ExperimentalResource(SyncAPIResource):
|
|
|
398
454
|
"""Operations under ``client.experimental.persistent_pty``."""
|
|
399
455
|
return ExperimentalPersistentPtyResource(self._client)
|
|
400
456
|
|
|
457
|
+
@cached_property
|
|
458
|
+
def with_raw_response(self) -> ExperimentalResourceWithRawResponse:
|
|
459
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
460
|
+
return ExperimentalResourceWithRawResponse(self)
|
|
461
|
+
|
|
462
|
+
@cached_property
|
|
463
|
+
def with_streaming_response(self) -> ExperimentalResourceWithStreamingResponse:
|
|
464
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
465
|
+
return ExperimentalResourceWithStreamingResponse(self)
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
class ExperimentalResourceWithRawResponse:
|
|
469
|
+
"""``client.experimental.with_raw_response``."""
|
|
470
|
+
|
|
471
|
+
def __init__(self, resource: ExperimentalResource) -> None:
|
|
472
|
+
self._resource = resource
|
|
473
|
+
|
|
474
|
+
@cached_property
|
|
475
|
+
def persistent_pty(self) -> ExperimentalPersistentPtyResourceWithRawResponse:
|
|
476
|
+
"""``client.experimental.persistent_pty.with_raw_response``."""
|
|
477
|
+
return ExperimentalPersistentPtyResourceWithRawResponse(self._resource.persistent_pty)
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
class ExperimentalResourceWithStreamingResponse:
|
|
481
|
+
"""``client.experimental.with_streaming_response``."""
|
|
482
|
+
|
|
483
|
+
def __init__(self, resource: ExperimentalResource) -> None:
|
|
484
|
+
self._resource = resource
|
|
485
|
+
|
|
486
|
+
@cached_property
|
|
487
|
+
def persistent_pty(self) -> ExperimentalPersistentPtyResourceWithStreamingResponse:
|
|
488
|
+
"""``client.experimental.persistent_pty.with_streaming_response``."""
|
|
489
|
+
return ExperimentalPersistentPtyResourceWithStreamingResponse(self._resource.persistent_pty)
|
|
490
|
+
|
|
401
491
|
|
|
402
492
|
class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
|
|
403
493
|
"""Operations under ``client.experimental.persistent_pty`` (OpenCode ``experimental.persistentPty``)."""
|
|
404
494
|
|
|
495
|
+
@cached_property
|
|
496
|
+
def with_raw_response(self) -> AsyncExperimentalPersistentPtyResourceWithRawResponse:
|
|
497
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
498
|
+
return AsyncExperimentalPersistentPtyResourceWithRawResponse(self)
|
|
499
|
+
|
|
500
|
+
@cached_property
|
|
501
|
+
def with_streaming_response(self) -> AsyncExperimentalPersistentPtyResourceWithStreamingResponse:
|
|
502
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
503
|
+
return AsyncExperimentalPersistentPtyResourceWithStreamingResponse(self)
|
|
504
|
+
|
|
405
505
|
async def read(
|
|
406
506
|
self,
|
|
407
507
|
session_id: SessionID,
|
|
@@ -534,16 +634,19 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
|
|
|
534
634
|
|
|
535
635
|
``POST /api/experimental/persistent-pty/shutdown``
|
|
536
636
|
"""
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
637
|
+
return cast(
|
|
638
|
+
"None",
|
|
639
|
+
await self._client.request(
|
|
640
|
+
RequestOptions(
|
|
641
|
+
method="POST",
|
|
642
|
+
path="/api/experimental/persistent-pty/shutdown",
|
|
643
|
+
extra_headers=extra_headers,
|
|
644
|
+
extra_query=extra_query,
|
|
645
|
+
extra_body=extra_body,
|
|
646
|
+
timeout=timeout,
|
|
647
|
+
),
|
|
648
|
+
kind="void",
|
|
545
649
|
),
|
|
546
|
-
kind="void",
|
|
547
650
|
)
|
|
548
651
|
|
|
549
652
|
async def handoff(
|
|
@@ -705,16 +808,19 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
|
|
|
705
808
|
|
|
706
809
|
``DELETE /api/experimental/persistent-pty/:ptyID``
|
|
707
810
|
"""
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
811
|
+
return cast(
|
|
812
|
+
"None",
|
|
813
|
+
await self._client.request(
|
|
814
|
+
RequestOptions(
|
|
815
|
+
method="DELETE",
|
|
816
|
+
path=f"/api/experimental/persistent-pty/{encode_path_segment(pty_id)}",
|
|
817
|
+
extra_headers=extra_headers,
|
|
818
|
+
extra_query=extra_query,
|
|
819
|
+
extra_body=extra_body,
|
|
820
|
+
timeout=timeout,
|
|
821
|
+
),
|
|
822
|
+
kind="void",
|
|
716
823
|
),
|
|
717
|
-
kind="void",
|
|
718
824
|
)
|
|
719
825
|
|
|
720
826
|
async def connect_token(
|
|
@@ -756,6 +862,40 @@ class AsyncExperimentalPersistentPtyResource(AsyncPersistentPtyAttachMixin):
|
|
|
756
862
|
)
|
|
757
863
|
|
|
758
864
|
|
|
865
|
+
class AsyncExperimentalPersistentPtyResourceWithRawResponse:
|
|
866
|
+
"""``client.experimental.persistent_pty.with_raw_response``."""
|
|
867
|
+
|
|
868
|
+
def __init__(self, resource: AsyncExperimentalPersistentPtyResource) -> None:
|
|
869
|
+
self._resource = resource
|
|
870
|
+
self.read = async_to_raw_response_wrapper(resource.read)
|
|
871
|
+
self.list = async_to_raw_response_wrapper(resource.list)
|
|
872
|
+
self.create = async_to_raw_response_wrapper(resource.create)
|
|
873
|
+
self.shutdown = async_to_raw_response_wrapper(resource.shutdown)
|
|
874
|
+
self.handoff = async_to_raw_response_wrapper(resource.handoff)
|
|
875
|
+
self.get = async_to_raw_response_wrapper(resource.get)
|
|
876
|
+
self.update = async_to_raw_response_wrapper(resource.update)
|
|
877
|
+
self.snapshot = async_to_raw_response_wrapper(resource.snapshot)
|
|
878
|
+
self.remove = async_to_raw_response_wrapper(resource.remove)
|
|
879
|
+
self.connect_token = async_to_raw_response_wrapper(resource.connect_token)
|
|
880
|
+
|
|
881
|
+
|
|
882
|
+
class AsyncExperimentalPersistentPtyResourceWithStreamingResponse:
|
|
883
|
+
"""``client.experimental.persistent_pty.with_streaming_response``."""
|
|
884
|
+
|
|
885
|
+
def __init__(self, resource: AsyncExperimentalPersistentPtyResource) -> None:
|
|
886
|
+
self._resource = resource
|
|
887
|
+
self.read = async_to_streamed_response_wrapper(resource.read)
|
|
888
|
+
self.list = async_to_streamed_response_wrapper(resource.list)
|
|
889
|
+
self.create = async_to_streamed_response_wrapper(resource.create)
|
|
890
|
+
self.shutdown = async_to_streamed_response_wrapper(resource.shutdown)
|
|
891
|
+
self.handoff = async_to_streamed_response_wrapper(resource.handoff)
|
|
892
|
+
self.get = async_to_streamed_response_wrapper(resource.get)
|
|
893
|
+
self.update = async_to_streamed_response_wrapper(resource.update)
|
|
894
|
+
self.snapshot = async_to_streamed_response_wrapper(resource.snapshot)
|
|
895
|
+
self.remove = async_to_streamed_response_wrapper(resource.remove)
|
|
896
|
+
self.connect_token = async_to_streamed_response_wrapper(resource.connect_token)
|
|
897
|
+
|
|
898
|
+
|
|
759
899
|
class AsyncExperimentalResource(AsyncAPIResource):
|
|
760
900
|
"""Operations under ``client.experimental`` (OpenCode ``experimental``)."""
|
|
761
901
|
|
|
@@ -763,3 +903,37 @@ class AsyncExperimentalResource(AsyncAPIResource):
|
|
|
763
903
|
def persistent_pty(self) -> AsyncExperimentalPersistentPtyResource:
|
|
764
904
|
"""Operations under ``client.experimental.persistent_pty``."""
|
|
765
905
|
return AsyncExperimentalPersistentPtyResource(self._client)
|
|
906
|
+
|
|
907
|
+
@cached_property
|
|
908
|
+
def with_raw_response(self) -> AsyncExperimentalResourceWithRawResponse:
|
|
909
|
+
"""Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
|
|
910
|
+
return AsyncExperimentalResourceWithRawResponse(self)
|
|
911
|
+
|
|
912
|
+
@cached_property
|
|
913
|
+
def with_streaming_response(self) -> AsyncExperimentalResourceWithStreamingResponse:
|
|
914
|
+
"""Same methods, returning a context manager over the HTTP response without reading the body."""
|
|
915
|
+
return AsyncExperimentalResourceWithStreamingResponse(self)
|
|
916
|
+
|
|
917
|
+
|
|
918
|
+
class AsyncExperimentalResourceWithRawResponse:
|
|
919
|
+
"""``client.experimental.with_raw_response``."""
|
|
920
|
+
|
|
921
|
+
def __init__(self, resource: AsyncExperimentalResource) -> None:
|
|
922
|
+
self._resource = resource
|
|
923
|
+
|
|
924
|
+
@cached_property
|
|
925
|
+
def persistent_pty(self) -> AsyncExperimentalPersistentPtyResourceWithRawResponse:
|
|
926
|
+
"""``client.experimental.persistent_pty.with_raw_response``."""
|
|
927
|
+
return AsyncExperimentalPersistentPtyResourceWithRawResponse(self._resource.persistent_pty)
|
|
928
|
+
|
|
929
|
+
|
|
930
|
+
class AsyncExperimentalResourceWithStreamingResponse:
|
|
931
|
+
"""``client.experimental.with_streaming_response``."""
|
|
932
|
+
|
|
933
|
+
def __init__(self, resource: AsyncExperimentalResource) -> None:
|
|
934
|
+
self._resource = resource
|
|
935
|
+
|
|
936
|
+
@cached_property
|
|
937
|
+
def persistent_pty(self) -> AsyncExperimentalPersistentPtyResourceWithStreamingResponse:
|
|
938
|
+
"""``client.experimental.persistent_pty.with_streaming_response``."""
|
|
939
|
+
return AsyncExperimentalPersistentPtyResourceWithStreamingResponse(self._resource.persistent_pty)
|
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)
|