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.
Files changed (43) hide show
  1. opencode/__init__.py +9 -0
  2. opencode/_aiohttp.py +44 -0
  3. opencode/_base_client.py +237 -11
  4. opencode/_client.py +8 -2
  5. opencode/_logs.py +29 -0
  6. opencode/_pagination.py +14 -0
  7. opencode/_response.py +316 -0
  8. opencode/resources/agent.py +63 -0
  9. opencode/resources/command.py +59 -0
  10. opencode/resources/config.py +93 -20
  11. opencode/resources/credential.py +149 -56
  12. opencode/resources/debug.py +156 -20
  13. opencode/resources/event.py +59 -0
  14. opencode/resources/experimental.py +210 -36
  15. opencode/resources/file.py +71 -0
  16. opencode/resources/form.py +59 -0
  17. opencode/resources/generate.py +59 -0
  18. opencode/resources/integration.py +538 -128
  19. opencode/resources/location.py +87 -18
  20. opencode/resources/mcp.py +252 -82
  21. opencode/resources/message.py +59 -0
  22. opencode/resources/migration.py +126 -0
  23. opencode/resources/model.py +63 -0
  24. opencode/resources/permission.py +272 -38
  25. opencode/resources/plugin.py +95 -22
  26. opencode/resources/project.py +63 -0
  27. opencode/resources/provider.py +63 -0
  28. opencode/resources/pty.py +172 -20
  29. opencode/resources/reference.py +59 -0
  30. opencode/resources/rpc.py +59 -0
  31. opencode/resources/server.py +67 -0
  32. opencode/resources/session.py +1159 -405
  33. opencode/resources/shell.py +101 -20
  34. opencode/resources/skill.py +59 -0
  35. opencode/resources/vcs.py +172 -20
  36. opencode/resources/voice.py +59 -0
  37. opencode/resources/websearch.py +63 -0
  38. opencode/resources/worktree.py +123 -40
  39. {opencode_python_sdk-0.2.2.dist-info → opencode_python_sdk-0.2.3.dist-info}/METADATA +90 -2
  40. opencode_python_sdk-0.2.3.dist-info/RECORD +67 -0
  41. opencode_python_sdk-0.2.2.dist-info/RECORD +0 -64
  42. {opencode_python_sdk-0.2.2.dist-info → opencode_python_sdk-0.2.3.dist-info}/WHEEL +0 -0
  43. {opencode_python_sdk-0.2.2.dist-info → opencode_python_sdk-0.2.3.dist-info}/licenses/LICENSE +0 -0
@@ -6,11 +6,18 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  from collections.abc import Mapping
9
+ from functools import cached_property
9
10
  from typing import TYPE_CHECKING, Any, cast
10
11
 
11
12
  from .._base_client import RequestOptions
12
13
  from .._qs import encode_path_segment
13
14
  from .._resource import AsyncAPIResource, SyncAPIResource
15
+ from .._response import (
16
+ async_to_raw_response_wrapper,
17
+ async_to_streamed_response_wrapper,
18
+ to_raw_response_wrapper,
19
+ to_streamed_response_wrapper,
20
+ )
14
21
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
15
22
 
16
23
  if TYPE_CHECKING:
@@ -29,6 +36,16 @@ __all__ = ["ShellResource", "AsyncShellResource"]
29
36
  class ShellResource(SyncAPIResource):
30
37
  """Operations under ``client.shell`` (OpenCode ``shell``)."""
31
38
 
39
+ @cached_property
40
+ def with_raw_response(self) -> ShellResourceWithRawResponse:
41
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
42
+ return ShellResourceWithRawResponse(self)
43
+
44
+ @cached_property
45
+ def with_streaming_response(self) -> ShellResourceWithStreamingResponse:
46
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
47
+ return ShellResourceWithStreamingResponse(self)
48
+
32
49
  def list(
33
50
  self,
34
51
  *,
@@ -205,23 +222,60 @@ class ShellResource(SyncAPIResource):
205
222
 
206
223
  ``DELETE /api/shell/:id``
207
224
  """
208
- self._client.request(
209
- RequestOptions(
210
- method="DELETE",
211
- path=f"/api/shell/{encode_path_segment(id)}",
212
- query={"location": self._location(location)},
213
- extra_headers=extra_headers,
214
- extra_query=extra_query,
215
- extra_body=extra_body,
216
- timeout=timeout,
225
+ return cast(
226
+ "None",
227
+ self._client.request(
228
+ RequestOptions(
229
+ method="DELETE",
230
+ path=f"/api/shell/{encode_path_segment(id)}",
231
+ query={"location": self._location(location)},
232
+ extra_headers=extra_headers,
233
+ extra_query=extra_query,
234
+ extra_body=extra_body,
235
+ timeout=timeout,
236
+ ),
237
+ kind="void",
217
238
  ),
218
- kind="void",
219
239
  )
220
240
 
221
241
 
242
+ class ShellResourceWithRawResponse:
243
+ """``client.shell.with_raw_response``."""
244
+
245
+ def __init__(self, resource: ShellResource) -> None:
246
+ self._resource = resource
247
+ self.list = to_raw_response_wrapper(resource.list)
248
+ self.create = to_raw_response_wrapper(resource.create)
249
+ self.get = to_raw_response_wrapper(resource.get)
250
+ self.output = to_raw_response_wrapper(resource.output)
251
+ self.remove = to_raw_response_wrapper(resource.remove)
252
+
253
+
254
+ class ShellResourceWithStreamingResponse:
255
+ """``client.shell.with_streaming_response``."""
256
+
257
+ def __init__(self, resource: ShellResource) -> None:
258
+ self._resource = resource
259
+ self.list = to_streamed_response_wrapper(resource.list)
260
+ self.create = to_streamed_response_wrapper(resource.create)
261
+ self.get = to_streamed_response_wrapper(resource.get)
262
+ self.output = to_streamed_response_wrapper(resource.output)
263
+ self.remove = to_streamed_response_wrapper(resource.remove)
264
+
265
+
222
266
  class AsyncShellResource(AsyncAPIResource):
223
267
  """Operations under ``client.shell`` (OpenCode ``shell``)."""
224
268
 
269
+ @cached_property
270
+ def with_raw_response(self) -> AsyncShellResourceWithRawResponse:
271
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
272
+ return AsyncShellResourceWithRawResponse(self)
273
+
274
+ @cached_property
275
+ def with_streaming_response(self) -> AsyncShellResourceWithStreamingResponse:
276
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
277
+ return AsyncShellResourceWithStreamingResponse(self)
278
+
225
279
  async def list(
226
280
  self,
227
281
  *,
@@ -398,15 +452,42 @@ class AsyncShellResource(AsyncAPIResource):
398
452
 
399
453
  ``DELETE /api/shell/:id``
400
454
  """
401
- await self._client.request(
402
- RequestOptions(
403
- method="DELETE",
404
- path=f"/api/shell/{encode_path_segment(id)}",
405
- query={"location": self._location(location)},
406
- extra_headers=extra_headers,
407
- extra_query=extra_query,
408
- extra_body=extra_body,
409
- timeout=timeout,
455
+ return cast(
456
+ "None",
457
+ await self._client.request(
458
+ RequestOptions(
459
+ method="DELETE",
460
+ path=f"/api/shell/{encode_path_segment(id)}",
461
+ query={"location": self._location(location)},
462
+ extra_headers=extra_headers,
463
+ extra_query=extra_query,
464
+ extra_body=extra_body,
465
+ timeout=timeout,
466
+ ),
467
+ kind="void",
410
468
  ),
411
- kind="void",
412
469
  )
470
+
471
+
472
+ class AsyncShellResourceWithRawResponse:
473
+ """``client.shell.with_raw_response``."""
474
+
475
+ def __init__(self, resource: AsyncShellResource) -> None:
476
+ self._resource = resource
477
+ self.list = async_to_raw_response_wrapper(resource.list)
478
+ self.create = async_to_raw_response_wrapper(resource.create)
479
+ self.get = async_to_raw_response_wrapper(resource.get)
480
+ self.output = async_to_raw_response_wrapper(resource.output)
481
+ self.remove = async_to_raw_response_wrapper(resource.remove)
482
+
483
+
484
+ class AsyncShellResourceWithStreamingResponse:
485
+ """``client.shell.with_streaming_response``."""
486
+
487
+ def __init__(self, resource: AsyncShellResource) -> None:
488
+ self._resource = resource
489
+ self.list = async_to_streamed_response_wrapper(resource.list)
490
+ self.create = async_to_streamed_response_wrapper(resource.create)
491
+ self.get = async_to_streamed_response_wrapper(resource.get)
492
+ self.output = async_to_streamed_response_wrapper(resource.output)
493
+ self.remove = async_to_streamed_response_wrapper(resource.remove)
@@ -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__ = ["SkillResource", "AsyncSkillResource"]
23
30
  class SkillResource(SyncAPIResource):
24
31
  """Operations under ``client.skill`` (OpenCode ``skill``)."""
25
32
 
33
+ @cached_property
34
+ def with_raw_response(self) -> SkillResourceWithRawResponse:
35
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
36
+ return SkillResourceWithRawResponse(self)
37
+
38
+ @cached_property
39
+ def with_streaming_response(self) -> SkillResourceWithStreamingResponse:
40
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
41
+ return SkillResourceWithStreamingResponse(self)
42
+
26
43
  def list(
27
44
  self,
28
45
  *,
@@ -60,9 +77,35 @@ class SkillResource(SyncAPIResource):
60
77
  )
61
78
 
62
79
 
80
+ class SkillResourceWithRawResponse:
81
+ """``client.skill.with_raw_response``."""
82
+
83
+ def __init__(self, resource: SkillResource) -> None:
84
+ self._resource = resource
85
+ self.list = to_raw_response_wrapper(resource.list)
86
+
87
+
88
+ class SkillResourceWithStreamingResponse:
89
+ """``client.skill.with_streaming_response``."""
90
+
91
+ def __init__(self, resource: SkillResource) -> None:
92
+ self._resource = resource
93
+ self.list = to_streamed_response_wrapper(resource.list)
94
+
95
+
63
96
  class AsyncSkillResource(AsyncAPIResource):
64
97
  """Operations under ``client.skill`` (OpenCode ``skill``)."""
65
98
 
99
+ @cached_property
100
+ def with_raw_response(self) -> AsyncSkillResourceWithRawResponse:
101
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
102
+ return AsyncSkillResourceWithRawResponse(self)
103
+
104
+ @cached_property
105
+ def with_streaming_response(self) -> AsyncSkillResourceWithStreamingResponse:
106
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
107
+ return AsyncSkillResourceWithStreamingResponse(self)
108
+
66
109
  async def list(
67
110
  self,
68
111
  *,
@@ -98,3 +141,19 @@ class AsyncSkillResource(AsyncAPIResource):
98
141
  response_type="SkillListResponse",
99
142
  ),
100
143
  )
144
+
145
+
146
+ class AsyncSkillResourceWithRawResponse:
147
+ """``client.skill.with_raw_response``."""
148
+
149
+ def __init__(self, resource: AsyncSkillResource) -> None:
150
+ self._resource = resource
151
+ self.list = async_to_raw_response_wrapper(resource.list)
152
+
153
+
154
+ class AsyncSkillResourceWithStreamingResponse:
155
+ """``client.skill.with_streaming_response``."""
156
+
157
+ def __init__(self, resource: AsyncSkillResource) -> None:
158
+ self._resource = resource
159
+ self.list = async_to_streamed_response_wrapper(resource.list)
opencode/resources/vcs.py CHANGED
@@ -10,6 +10,12 @@ from typing import TYPE_CHECKING, cast
10
10
 
11
11
  from .._base_client import RequestOptions
12
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
+ )
13
19
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
14
20
 
15
21
  if TYPE_CHECKING:
@@ -29,6 +35,16 @@ __all__ = ["VcsResource", "AsyncVcsResource"]
29
35
  class VcsBranchResource(SyncAPIResource):
30
36
  """Operations under ``client.vcs.branch`` (OpenCode ``vcs.branch``)."""
31
37
 
38
+ @cached_property
39
+ def with_raw_response(self) -> VcsBranchResourceWithRawResponse:
40
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
41
+ return VcsBranchResourceWithRawResponse(self)
42
+
43
+ @cached_property
44
+ def with_streaming_response(self) -> VcsBranchResourceWithStreamingResponse:
45
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
46
+ return VcsBranchResourceWithStreamingResponse(self)
47
+
32
48
  def list(
33
49
  self,
34
50
  *,
@@ -68,6 +84,22 @@ class VcsBranchResource(SyncAPIResource):
68
84
  )
69
85
 
70
86
 
87
+ class VcsBranchResourceWithRawResponse:
88
+ """``client.vcs.branch.with_raw_response``."""
89
+
90
+ def __init__(self, resource: VcsBranchResource) -> None:
91
+ self._resource = resource
92
+ self.list = to_raw_response_wrapper(resource.list)
93
+
94
+
95
+ class VcsBranchResourceWithStreamingResponse:
96
+ """``client.vcs.branch.with_streaming_response``."""
97
+
98
+ def __init__(self, resource: VcsBranchResource) -> None:
99
+ self._resource = resource
100
+ self.list = to_streamed_response_wrapper(resource.list)
101
+
102
+
71
103
  class VcsResource(SyncAPIResource):
72
104
  """Operations under ``client.vcs`` (OpenCode ``vcs``)."""
73
105
 
@@ -76,6 +108,16 @@ class VcsResource(SyncAPIResource):
76
108
  """Operations under ``client.vcs.branch``."""
77
109
  return VcsBranchResource(self._client)
78
110
 
111
+ @cached_property
112
+ def with_raw_response(self) -> VcsResourceWithRawResponse:
113
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
114
+ return VcsResourceWithRawResponse(self)
115
+
116
+ @cached_property
117
+ def with_streaming_response(self) -> VcsResourceWithStreamingResponse:
118
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
119
+ return VcsResourceWithStreamingResponse(self)
120
+
79
121
  def init(
80
122
  self,
81
123
  *,
@@ -100,17 +142,20 @@ class VcsResource(SyncAPIResource):
100
142
 
101
143
  ``POST /api/vcs/init``
102
144
  """
103
- self._client.request(
104
- RequestOptions(
105
- method="POST",
106
- path="/api/vcs/init",
107
- query={"location": self._location(location), "provider": provider},
108
- extra_headers=extra_headers,
109
- extra_query=extra_query,
110
- extra_body=extra_body,
111
- timeout=timeout,
145
+ return cast(
146
+ "None",
147
+ self._client.request(
148
+ RequestOptions(
149
+ method="POST",
150
+ path="/api/vcs/init",
151
+ query={"location": self._location(location), "provider": provider},
152
+ extra_headers=extra_headers,
153
+ extra_query=extra_query,
154
+ extra_body=extra_body,
155
+ timeout=timeout,
156
+ ),
157
+ kind="void",
112
158
  ),
113
- kind="void",
114
159
  )
115
160
 
116
161
  def get(
@@ -263,9 +308,53 @@ class VcsResource(SyncAPIResource):
263
308
  )
264
309
 
265
310
 
311
+ class VcsResourceWithRawResponse:
312
+ """``client.vcs.with_raw_response``."""
313
+
314
+ def __init__(self, resource: VcsResource) -> None:
315
+ self._resource = resource
316
+ self.init = to_raw_response_wrapper(resource.init)
317
+ self.get = to_raw_response_wrapper(resource.get)
318
+ self.base = to_raw_response_wrapper(resource.base)
319
+ self.status = to_raw_response_wrapper(resource.status)
320
+ self.diff = to_raw_response_wrapper(resource.diff)
321
+
322
+ @cached_property
323
+ def branch(self) -> VcsBranchResourceWithRawResponse:
324
+ """``client.vcs.branch.with_raw_response``."""
325
+ return VcsBranchResourceWithRawResponse(self._resource.branch)
326
+
327
+
328
+ class VcsResourceWithStreamingResponse:
329
+ """``client.vcs.with_streaming_response``."""
330
+
331
+ def __init__(self, resource: VcsResource) -> None:
332
+ self._resource = resource
333
+ self.init = to_streamed_response_wrapper(resource.init)
334
+ self.get = to_streamed_response_wrapper(resource.get)
335
+ self.base = to_streamed_response_wrapper(resource.base)
336
+ self.status = to_streamed_response_wrapper(resource.status)
337
+ self.diff = to_streamed_response_wrapper(resource.diff)
338
+
339
+ @cached_property
340
+ def branch(self) -> VcsBranchResourceWithStreamingResponse:
341
+ """``client.vcs.branch.with_streaming_response``."""
342
+ return VcsBranchResourceWithStreamingResponse(self._resource.branch)
343
+
344
+
266
345
  class AsyncVcsBranchResource(AsyncAPIResource):
267
346
  """Operations under ``client.vcs.branch`` (OpenCode ``vcs.branch``)."""
268
347
 
348
+ @cached_property
349
+ def with_raw_response(self) -> AsyncVcsBranchResourceWithRawResponse:
350
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
351
+ return AsyncVcsBranchResourceWithRawResponse(self)
352
+
353
+ @cached_property
354
+ def with_streaming_response(self) -> AsyncVcsBranchResourceWithStreamingResponse:
355
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
356
+ return AsyncVcsBranchResourceWithStreamingResponse(self)
357
+
269
358
  async def list(
270
359
  self,
271
360
  *,
@@ -305,6 +394,22 @@ class AsyncVcsBranchResource(AsyncAPIResource):
305
394
  )
306
395
 
307
396
 
397
+ class AsyncVcsBranchResourceWithRawResponse:
398
+ """``client.vcs.branch.with_raw_response``."""
399
+
400
+ def __init__(self, resource: AsyncVcsBranchResource) -> None:
401
+ self._resource = resource
402
+ self.list = async_to_raw_response_wrapper(resource.list)
403
+
404
+
405
+ class AsyncVcsBranchResourceWithStreamingResponse:
406
+ """``client.vcs.branch.with_streaming_response``."""
407
+
408
+ def __init__(self, resource: AsyncVcsBranchResource) -> None:
409
+ self._resource = resource
410
+ self.list = async_to_streamed_response_wrapper(resource.list)
411
+
412
+
308
413
  class AsyncVcsResource(AsyncAPIResource):
309
414
  """Operations under ``client.vcs`` (OpenCode ``vcs``)."""
310
415
 
@@ -313,6 +418,16 @@ class AsyncVcsResource(AsyncAPIResource):
313
418
  """Operations under ``client.vcs.branch``."""
314
419
  return AsyncVcsBranchResource(self._client)
315
420
 
421
+ @cached_property
422
+ def with_raw_response(self) -> AsyncVcsResourceWithRawResponse:
423
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
424
+ return AsyncVcsResourceWithRawResponse(self)
425
+
426
+ @cached_property
427
+ def with_streaming_response(self) -> AsyncVcsResourceWithStreamingResponse:
428
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
429
+ return AsyncVcsResourceWithStreamingResponse(self)
430
+
316
431
  async def init(
317
432
  self,
318
433
  *,
@@ -337,17 +452,20 @@ class AsyncVcsResource(AsyncAPIResource):
337
452
 
338
453
  ``POST /api/vcs/init``
339
454
  """
340
- await self._client.request(
341
- RequestOptions(
342
- method="POST",
343
- path="/api/vcs/init",
344
- query={"location": self._location(location), "provider": provider},
345
- extra_headers=extra_headers,
346
- extra_query=extra_query,
347
- extra_body=extra_body,
348
- timeout=timeout,
455
+ return cast(
456
+ "None",
457
+ await self._client.request(
458
+ RequestOptions(
459
+ method="POST",
460
+ path="/api/vcs/init",
461
+ query={"location": self._location(location), "provider": provider},
462
+ extra_headers=extra_headers,
463
+ extra_query=extra_query,
464
+ extra_body=extra_body,
465
+ timeout=timeout,
466
+ ),
467
+ kind="void",
349
468
  ),
350
- kind="void",
351
469
  )
352
470
 
353
471
  async def get(
@@ -498,3 +616,37 @@ class AsyncVcsResource(AsyncAPIResource):
498
616
  response_type="VcsDiffResponse",
499
617
  ),
500
618
  )
619
+
620
+
621
+ class AsyncVcsResourceWithRawResponse:
622
+ """``client.vcs.with_raw_response``."""
623
+
624
+ def __init__(self, resource: AsyncVcsResource) -> None:
625
+ self._resource = resource
626
+ self.init = async_to_raw_response_wrapper(resource.init)
627
+ self.get = async_to_raw_response_wrapper(resource.get)
628
+ self.base = async_to_raw_response_wrapper(resource.base)
629
+ self.status = async_to_raw_response_wrapper(resource.status)
630
+ self.diff = async_to_raw_response_wrapper(resource.diff)
631
+
632
+ @cached_property
633
+ def branch(self) -> AsyncVcsBranchResourceWithRawResponse:
634
+ """``client.vcs.branch.with_raw_response``."""
635
+ return AsyncVcsBranchResourceWithRawResponse(self._resource.branch)
636
+
637
+
638
+ class AsyncVcsResourceWithStreamingResponse:
639
+ """``client.vcs.with_streaming_response``."""
640
+
641
+ def __init__(self, resource: AsyncVcsResource) -> None:
642
+ self._resource = resource
643
+ self.init = async_to_streamed_response_wrapper(resource.init)
644
+ self.get = async_to_streamed_response_wrapper(resource.get)
645
+ self.base = async_to_streamed_response_wrapper(resource.base)
646
+ self.status = async_to_streamed_response_wrapper(resource.status)
647
+ self.diff = async_to_streamed_response_wrapper(resource.diff)
648
+
649
+ @cached_property
650
+ def branch(self) -> AsyncVcsBranchResourceWithStreamingResponse:
651
+ """``client.vcs.branch.with_streaming_response``."""
652
+ return AsyncVcsBranchResourceWithStreamingResponse(self._resource.branch)
@@ -6,10 +6,17 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  from collections.abc import Mapping
9
+ from functools import cached_property
9
10
  from typing import TYPE_CHECKING, Any, cast
10
11
 
11
12
  from .._base_client import RequestOptions
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__ = ["VoiceResource", "AsyncVoiceResource"]
24
31
  class VoiceResource(SyncAPIResource):
25
32
  """Operations under ``client.voice`` (OpenCode ``voice``)."""
26
33
 
34
+ @cached_property
35
+ def with_raw_response(self) -> VoiceResourceWithRawResponse:
36
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
37
+ return VoiceResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> VoiceResourceWithStreamingResponse:
41
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
42
+ return VoiceResourceWithStreamingResponse(self)
43
+
27
44
  def session(
28
45
  self,
29
46
  *,
@@ -67,9 +84,35 @@ class VoiceResource(SyncAPIResource):
67
84
  )
68
85
 
69
86
 
87
+ class VoiceResourceWithRawResponse:
88
+ """``client.voice.with_raw_response``."""
89
+
90
+ def __init__(self, resource: VoiceResource) -> None:
91
+ self._resource = resource
92
+ self.session = to_raw_response_wrapper(resource.session)
93
+
94
+
95
+ class VoiceResourceWithStreamingResponse:
96
+ """``client.voice.with_streaming_response``."""
97
+
98
+ def __init__(self, resource: VoiceResource) -> None:
99
+ self._resource = resource
100
+ self.session = to_streamed_response_wrapper(resource.session)
101
+
102
+
70
103
  class AsyncVoiceResource(AsyncAPIResource):
71
104
  """Operations under ``client.voice`` (OpenCode ``voice``)."""
72
105
 
106
+ @cached_property
107
+ def with_raw_response(self) -> AsyncVoiceResourceWithRawResponse:
108
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
109
+ return AsyncVoiceResourceWithRawResponse(self)
110
+
111
+ @cached_property
112
+ def with_streaming_response(self) -> AsyncVoiceResourceWithStreamingResponse:
113
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
114
+ return AsyncVoiceResourceWithStreamingResponse(self)
115
+
73
116
  async def session(
74
117
  self,
75
118
  *,
@@ -111,3 +154,19 @@ class AsyncVoiceResource(AsyncAPIResource):
111
154
  unwrap=True,
112
155
  ),
113
156
  )
157
+
158
+
159
+ class AsyncVoiceResourceWithRawResponse:
160
+ """``client.voice.with_raw_response``."""
161
+
162
+ def __init__(self, resource: AsyncVoiceResource) -> None:
163
+ self._resource = resource
164
+ self.session = async_to_raw_response_wrapper(resource.session)
165
+
166
+
167
+ class AsyncVoiceResourceWithStreamingResponse:
168
+ """``client.voice.with_streaming_response``."""
169
+
170
+ def __init__(self, resource: AsyncVoiceResource) -> None:
171
+ self._resource = resource
172
+ self.session = async_to_streamed_response_wrapper(resource.session)