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.
Files changed (45) hide show
  1. opencode/__init__.py +14 -0
  2. opencode/_aiohttp.py +44 -0
  3. opencode/_base_client.py +237 -11
  4. opencode/_client.py +115 -3
  5. opencode/_logs.py +29 -0
  6. opencode/_pagination.py +14 -0
  7. opencode/_response.py +316 -0
  8. opencode/_service.py +1018 -0
  9. opencode/resources/agent.py +63 -0
  10. opencode/resources/command.py +59 -0
  11. opencode/resources/config.py +93 -20
  12. opencode/resources/credential.py +149 -56
  13. opencode/resources/debug.py +156 -20
  14. opencode/resources/event.py +59 -0
  15. opencode/resources/experimental.py +210 -36
  16. opencode/resources/file.py +71 -0
  17. opencode/resources/form.py +59 -0
  18. opencode/resources/generate.py +59 -0
  19. opencode/resources/integration.py +538 -128
  20. opencode/resources/location.py +87 -18
  21. opencode/resources/mcp.py +252 -82
  22. opencode/resources/message.py +59 -0
  23. opencode/resources/migration.py +126 -0
  24. opencode/resources/model.py +63 -0
  25. opencode/resources/permission.py +272 -38
  26. opencode/resources/plugin.py +95 -22
  27. opencode/resources/project.py +63 -0
  28. opencode/resources/provider.py +63 -0
  29. opencode/resources/pty.py +172 -20
  30. opencode/resources/reference.py +59 -0
  31. opencode/resources/rpc.py +59 -0
  32. opencode/resources/server.py +67 -0
  33. opencode/resources/session.py +1159 -405
  34. opencode/resources/shell.py +101 -20
  35. opencode/resources/skill.py +59 -0
  36. opencode/resources/vcs.py +172 -20
  37. opencode/resources/voice.py +59 -0
  38. opencode/resources/websearch.py +63 -0
  39. opencode/resources/worktree.py +123 -40
  40. opencode/service.py +50 -0
  41. {opencode_python_sdk-0.2.0.dist-info → opencode_python_sdk-0.2.3.dist-info}/METADATA +111 -2
  42. opencode_python_sdk-0.2.3.dist-info/RECORD +67 -0
  43. opencode_python_sdk-0.2.0.dist-info/RECORD +0 -62
  44. {opencode_python_sdk-0.2.0.dist-info → opencode_python_sdk-0.2.3.dist-info}/WHEEL +0 -0
  45. {opencode_python_sdk-0.2.0.dist-info → opencode_python_sdk-0.2.3.dist-info}/licenses/LICENSE +0 -0
@@ -6,10 +6,17 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  from collections.abc import Sequence
9
+ from functools import cached_property
9
10
  from typing import TYPE_CHECKING, 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:
@@ -25,6 +32,16 @@ __all__ = ["PluginResource", "AsyncPluginResource"]
25
32
  class PluginResource(SyncAPIResource):
26
33
  """Operations under ``client.plugin`` (OpenCode ``plugin``)."""
27
34
 
35
+ @cached_property
36
+ def with_raw_response(self) -> PluginResourceWithRawResponse:
37
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
38
+ return PluginResourceWithRawResponse(self)
39
+
40
+ @cached_property
41
+ def with_streaming_response(self) -> PluginResourceWithStreamingResponse:
42
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
43
+ return PluginResourceWithStreamingResponse(self)
44
+
28
45
  def list(
29
46
  self,
30
47
  *,
@@ -121,24 +138,57 @@ class PluginResource(SyncAPIResource):
121
138
 
122
139
  ``POST /api/plugin/update``
123
140
  """
124
- self._client.request(
125
- RequestOptions(
126
- method="POST",
127
- path="/api/plugin/update",
128
- query={"location": self._location(location)},
129
- body={"targets": targets},
130
- extra_headers=extra_headers,
131
- extra_query=extra_query,
132
- extra_body=extra_body,
133
- timeout=timeout,
141
+ return cast(
142
+ "None",
143
+ self._client.request(
144
+ RequestOptions(
145
+ method="POST",
146
+ path="/api/plugin/update",
147
+ query={"location": self._location(location)},
148
+ body={"targets": targets},
149
+ extra_headers=extra_headers,
150
+ extra_query=extra_query,
151
+ extra_body=extra_body,
152
+ timeout=timeout,
153
+ ),
154
+ kind="void",
134
155
  ),
135
- kind="void",
136
156
  )
137
157
 
138
158
 
159
+ class PluginResourceWithRawResponse:
160
+ """``client.plugin.with_raw_response``."""
161
+
162
+ def __init__(self, resource: PluginResource) -> None:
163
+ self._resource = resource
164
+ self.list = to_raw_response_wrapper(resource.list)
165
+ self.check = to_raw_response_wrapper(resource.check)
166
+ self.update = to_raw_response_wrapper(resource.update)
167
+
168
+
169
+ class PluginResourceWithStreamingResponse:
170
+ """``client.plugin.with_streaming_response``."""
171
+
172
+ def __init__(self, resource: PluginResource) -> None:
173
+ self._resource = resource
174
+ self.list = to_streamed_response_wrapper(resource.list)
175
+ self.check = to_streamed_response_wrapper(resource.check)
176
+ self.update = to_streamed_response_wrapper(resource.update)
177
+
178
+
139
179
  class AsyncPluginResource(AsyncAPIResource):
140
180
  """Operations under ``client.plugin`` (OpenCode ``plugin``)."""
141
181
 
182
+ @cached_property
183
+ def with_raw_response(self) -> AsyncPluginResourceWithRawResponse:
184
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
185
+ return AsyncPluginResourceWithRawResponse(self)
186
+
187
+ @cached_property
188
+ def with_streaming_response(self) -> AsyncPluginResourceWithStreamingResponse:
189
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
190
+ return AsyncPluginResourceWithStreamingResponse(self)
191
+
142
192
  async def list(
143
193
  self,
144
194
  *,
@@ -235,16 +285,39 @@ class AsyncPluginResource(AsyncAPIResource):
235
285
 
236
286
  ``POST /api/plugin/update``
237
287
  """
238
- await self._client.request(
239
- RequestOptions(
240
- method="POST",
241
- path="/api/plugin/update",
242
- query={"location": self._location(location)},
243
- body={"targets": targets},
244
- extra_headers=extra_headers,
245
- extra_query=extra_query,
246
- extra_body=extra_body,
247
- timeout=timeout,
288
+ return cast(
289
+ "None",
290
+ await self._client.request(
291
+ RequestOptions(
292
+ method="POST",
293
+ path="/api/plugin/update",
294
+ query={"location": self._location(location)},
295
+ body={"targets": targets},
296
+ extra_headers=extra_headers,
297
+ extra_query=extra_query,
298
+ extra_body=extra_body,
299
+ timeout=timeout,
300
+ ),
301
+ kind="void",
248
302
  ),
249
- kind="void",
250
303
  )
304
+
305
+
306
+ class AsyncPluginResourceWithRawResponse:
307
+ """``client.plugin.with_raw_response``."""
308
+
309
+ def __init__(self, resource: AsyncPluginResource) -> None:
310
+ self._resource = resource
311
+ self.list = async_to_raw_response_wrapper(resource.list)
312
+ self.check = async_to_raw_response_wrapper(resource.check)
313
+ self.update = async_to_raw_response_wrapper(resource.update)
314
+
315
+
316
+ class AsyncPluginResourceWithStreamingResponse:
317
+ """``client.plugin.with_streaming_response``."""
318
+
319
+ def __init__(self, resource: AsyncPluginResource) -> None:
320
+ self._resource = resource
321
+ self.list = async_to_streamed_response_wrapper(resource.list)
322
+ self.check = async_to_streamed_response_wrapper(resource.check)
323
+ self.update = async_to_streamed_response_wrapper(resource.update)
@@ -6,11 +6,18 @@
6
6
  from __future__ import annotations
7
7
 
8
8
  import builtins
9
+ from functools import cached_property
9
10
  from typing import TYPE_CHECKING, 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:
@@ -28,6 +35,16 @@ __all__ = ["ProjectResource", "AsyncProjectResource"]
28
35
  class ProjectResource(SyncAPIResource):
29
36
  """Operations under ``client.project`` (OpenCode ``project``)."""
30
37
 
38
+ @cached_property
39
+ def with_raw_response(self) -> ProjectResourceWithRawResponse:
40
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
41
+ return ProjectResourceWithRawResponse(self)
42
+
43
+ @cached_property
44
+ def with_streaming_response(self) -> ProjectResourceWithStreamingResponse:
45
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
46
+ return ProjectResourceWithStreamingResponse(self)
47
+
31
48
  def list(
32
49
  self,
33
50
  *,
@@ -106,9 +123,37 @@ class ProjectResource(SyncAPIResource):
106
123
  )
107
124
 
108
125
 
126
+ class ProjectResourceWithRawResponse:
127
+ """``client.project.with_raw_response``."""
128
+
129
+ def __init__(self, resource: ProjectResource) -> None:
130
+ self._resource = resource
131
+ self.list = to_raw_response_wrapper(resource.list)
132
+ self.update = to_raw_response_wrapper(resource.update)
133
+
134
+
135
+ class ProjectResourceWithStreamingResponse:
136
+ """``client.project.with_streaming_response``."""
137
+
138
+ def __init__(self, resource: ProjectResource) -> None:
139
+ self._resource = resource
140
+ self.list = to_streamed_response_wrapper(resource.list)
141
+ self.update = to_streamed_response_wrapper(resource.update)
142
+
143
+
109
144
  class AsyncProjectResource(AsyncAPIResource):
110
145
  """Operations under ``client.project`` (OpenCode ``project``)."""
111
146
 
147
+ @cached_property
148
+ def with_raw_response(self) -> AsyncProjectResourceWithRawResponse:
149
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
150
+ return AsyncProjectResourceWithRawResponse(self)
151
+
152
+ @cached_property
153
+ def with_streaming_response(self) -> AsyncProjectResourceWithStreamingResponse:
154
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
155
+ return AsyncProjectResourceWithStreamingResponse(self)
156
+
112
157
  async def list(
113
158
  self,
114
159
  *,
@@ -185,3 +230,21 @@ class AsyncProjectResource(AsyncAPIResource):
185
230
  response_type="Project",
186
231
  ),
187
232
  )
233
+
234
+
235
+ class AsyncProjectResourceWithRawResponse:
236
+ """``client.project.with_raw_response``."""
237
+
238
+ def __init__(self, resource: AsyncProjectResource) -> None:
239
+ self._resource = resource
240
+ self.list = async_to_raw_response_wrapper(resource.list)
241
+ self.update = async_to_raw_response_wrapper(resource.update)
242
+
243
+
244
+ class AsyncProjectResourceWithStreamingResponse:
245
+ """``client.project.with_streaming_response``."""
246
+
247
+ def __init__(self, resource: AsyncProjectResource) -> None:
248
+ self._resource = resource
249
+ self.list = async_to_streamed_response_wrapper(resource.list)
250
+ self.update = async_to_streamed_response_wrapper(resource.update)
@@ -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:
@@ -26,6 +33,16 @@ __all__ = ["ProviderResource", "AsyncProviderResource"]
26
33
  class ProviderResource(SyncAPIResource):
27
34
  """Operations under ``client.provider`` (OpenCode ``provider``)."""
28
35
 
36
+ @cached_property
37
+ def with_raw_response(self) -> ProviderResourceWithRawResponse:
38
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
39
+ return ProviderResourceWithRawResponse(self)
40
+
41
+ @cached_property
42
+ def with_streaming_response(self) -> ProviderResourceWithStreamingResponse:
43
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
44
+ return ProviderResourceWithStreamingResponse(self)
45
+
29
46
  def list(
30
47
  self,
31
48
  *,
@@ -103,9 +120,37 @@ class ProviderResource(SyncAPIResource):
103
120
  )
104
121
 
105
122
 
123
+ class ProviderResourceWithRawResponse:
124
+ """``client.provider.with_raw_response``."""
125
+
126
+ def __init__(self, resource: ProviderResource) -> None:
127
+ self._resource = resource
128
+ self.list = to_raw_response_wrapper(resource.list)
129
+ self.get = to_raw_response_wrapper(resource.get)
130
+
131
+
132
+ class ProviderResourceWithStreamingResponse:
133
+ """``client.provider.with_streaming_response``."""
134
+
135
+ def __init__(self, resource: ProviderResource) -> None:
136
+ self._resource = resource
137
+ self.list = to_streamed_response_wrapper(resource.list)
138
+ self.get = to_streamed_response_wrapper(resource.get)
139
+
140
+
106
141
  class AsyncProviderResource(AsyncAPIResource):
107
142
  """Operations under ``client.provider`` (OpenCode ``provider``)."""
108
143
 
144
+ @cached_property
145
+ def with_raw_response(self) -> AsyncProviderResourceWithRawResponse:
146
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
147
+ return AsyncProviderResourceWithRawResponse(self)
148
+
149
+ @cached_property
150
+ def with_streaming_response(self) -> AsyncProviderResourceWithStreamingResponse:
151
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
152
+ return AsyncProviderResourceWithStreamingResponse(self)
153
+
109
154
  async def list(
110
155
  self,
111
156
  *,
@@ -181,3 +226,21 @@ class AsyncProviderResource(AsyncAPIResource):
181
226
  response_type="ProviderGetResponse",
182
227
  ),
183
228
  )
229
+
230
+
231
+ class AsyncProviderResourceWithRawResponse:
232
+ """``client.provider.with_raw_response``."""
233
+
234
+ def __init__(self, resource: AsyncProviderResource) -> None:
235
+ self._resource = resource
236
+ self.list = async_to_raw_response_wrapper(resource.list)
237
+ self.get = async_to_raw_response_wrapper(resource.get)
238
+
239
+
240
+ class AsyncProviderResourceWithStreamingResponse:
241
+ """``client.provider.with_streaming_response``."""
242
+
243
+ def __init__(self, resource: AsyncProviderResource) -> None:
244
+ self._resource = resource
245
+ self.list = async_to_streamed_response_wrapper(resource.list)
246
+ self.get = async_to_streamed_response_wrapper(resource.get)
opencode/resources/pty.py CHANGED
@@ -13,6 +13,12 @@ from .._base_client import RequestOptions
13
13
  from .._pty import AsyncPtyAttachMixin, PtyAttachMixin
14
14
  from .._qs import encode_path_segment
15
15
  from .._resource import AsyncAPIResource, SyncAPIResource
16
+ from .._response import (
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ to_raw_response_wrapper,
20
+ to_streamed_response_wrapper,
21
+ )
16
22
  from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
17
23
 
18
24
  if TYPE_CHECKING:
@@ -33,6 +39,16 @@ __all__ = ["PtyResource", "AsyncPtyResource"]
33
39
  class PtyConnectResource(SyncAPIResource):
34
40
  """Operations under ``client.pty.connect`` (OpenCode ``pty.connect``)."""
35
41
 
42
+ @cached_property
43
+ def with_raw_response(self) -> PtyConnectResourceWithRawResponse:
44
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
45
+ return PtyConnectResourceWithRawResponse(self)
46
+
47
+ @cached_property
48
+ def with_streaming_response(self) -> PtyConnectResourceWithStreamingResponse:
49
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
50
+ return PtyConnectResourceWithStreamingResponse(self)
51
+
36
52
  def token(
37
53
  self,
38
54
  pty_id: PtyID,
@@ -75,6 +91,22 @@ class PtyConnectResource(SyncAPIResource):
75
91
  )
76
92
 
77
93
 
94
+ class PtyConnectResourceWithRawResponse:
95
+ """``client.pty.connect.with_raw_response``."""
96
+
97
+ def __init__(self, resource: PtyConnectResource) -> None:
98
+ self._resource = resource
99
+ self.token = to_raw_response_wrapper(resource.token)
100
+
101
+
102
+ class PtyConnectResourceWithStreamingResponse:
103
+ """``client.pty.connect.with_streaming_response``."""
104
+
105
+ def __init__(self, resource: PtyConnectResource) -> None:
106
+ self._resource = resource
107
+ self.token = to_streamed_response_wrapper(resource.token)
108
+
109
+
78
110
  class PtyResource(PtyAttachMixin):
79
111
  """Operations under ``client.pty`` (OpenCode ``pty``)."""
80
112
 
@@ -83,6 +115,16 @@ class PtyResource(PtyAttachMixin):
83
115
  """Operations under ``client.pty.connect``."""
84
116
  return PtyConnectResource(self._client)
85
117
 
118
+ @cached_property
119
+ def with_raw_response(self) -> PtyResourceWithRawResponse:
120
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
121
+ return PtyResourceWithRawResponse(self)
122
+
123
+ @cached_property
124
+ def with_streaming_response(self) -> PtyResourceWithStreamingResponse:
125
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
126
+ return PtyResourceWithStreamingResponse(self)
127
+
86
128
  def list(
87
129
  self,
88
130
  *,
@@ -262,23 +304,70 @@ class PtyResource(PtyAttachMixin):
262
304
 
263
305
  ``DELETE /api/pty/:ptyID``
264
306
  """
265
- self._client.request(
266
- RequestOptions(
267
- method="DELETE",
268
- path=f"/api/pty/{encode_path_segment(pty_id)}",
269
- query={"location": self._location(location)},
270
- extra_headers=extra_headers,
271
- extra_query=extra_query,
272
- extra_body=extra_body,
273
- timeout=timeout,
307
+ return cast(
308
+ "None",
309
+ self._client.request(
310
+ RequestOptions(
311
+ method="DELETE",
312
+ path=f"/api/pty/{encode_path_segment(pty_id)}",
313
+ query={"location": self._location(location)},
314
+ extra_headers=extra_headers,
315
+ extra_query=extra_query,
316
+ extra_body=extra_body,
317
+ timeout=timeout,
318
+ ),
319
+ kind="void",
274
320
  ),
275
- kind="void",
276
321
  )
277
322
 
278
323
 
324
+ class PtyResourceWithRawResponse:
325
+ """``client.pty.with_raw_response``."""
326
+
327
+ def __init__(self, resource: PtyResource) -> None:
328
+ self._resource = resource
329
+ self.list = to_raw_response_wrapper(resource.list)
330
+ self.create = to_raw_response_wrapper(resource.create)
331
+ self.get = to_raw_response_wrapper(resource.get)
332
+ self.update = to_raw_response_wrapper(resource.update)
333
+ self.remove = to_raw_response_wrapper(resource.remove)
334
+
335
+ @cached_property
336
+ def connect(self) -> PtyConnectResourceWithRawResponse:
337
+ """``client.pty.connect.with_raw_response``."""
338
+ return PtyConnectResourceWithRawResponse(self._resource.connect)
339
+
340
+
341
+ class PtyResourceWithStreamingResponse:
342
+ """``client.pty.with_streaming_response``."""
343
+
344
+ def __init__(self, resource: PtyResource) -> None:
345
+ self._resource = resource
346
+ self.list = to_streamed_response_wrapper(resource.list)
347
+ self.create = to_streamed_response_wrapper(resource.create)
348
+ self.get = to_streamed_response_wrapper(resource.get)
349
+ self.update = to_streamed_response_wrapper(resource.update)
350
+ self.remove = to_streamed_response_wrapper(resource.remove)
351
+
352
+ @cached_property
353
+ def connect(self) -> PtyConnectResourceWithStreamingResponse:
354
+ """``client.pty.connect.with_streaming_response``."""
355
+ return PtyConnectResourceWithStreamingResponse(self._resource.connect)
356
+
357
+
279
358
  class AsyncPtyConnectResource(AsyncAPIResource):
280
359
  """Operations under ``client.pty.connect`` (OpenCode ``pty.connect``)."""
281
360
 
361
+ @cached_property
362
+ def with_raw_response(self) -> AsyncPtyConnectResourceWithRawResponse:
363
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
364
+ return AsyncPtyConnectResourceWithRawResponse(self)
365
+
366
+ @cached_property
367
+ def with_streaming_response(self) -> AsyncPtyConnectResourceWithStreamingResponse:
368
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
369
+ return AsyncPtyConnectResourceWithStreamingResponse(self)
370
+
282
371
  async def token(
283
372
  self,
284
373
  pty_id: PtyID,
@@ -321,6 +410,22 @@ class AsyncPtyConnectResource(AsyncAPIResource):
321
410
  )
322
411
 
323
412
 
413
+ class AsyncPtyConnectResourceWithRawResponse:
414
+ """``client.pty.connect.with_raw_response``."""
415
+
416
+ def __init__(self, resource: AsyncPtyConnectResource) -> None:
417
+ self._resource = resource
418
+ self.token = async_to_raw_response_wrapper(resource.token)
419
+
420
+
421
+ class AsyncPtyConnectResourceWithStreamingResponse:
422
+ """``client.pty.connect.with_streaming_response``."""
423
+
424
+ def __init__(self, resource: AsyncPtyConnectResource) -> None:
425
+ self._resource = resource
426
+ self.token = async_to_streamed_response_wrapper(resource.token)
427
+
428
+
324
429
  class AsyncPtyResource(AsyncPtyAttachMixin):
325
430
  """Operations under ``client.pty`` (OpenCode ``pty``)."""
326
431
 
@@ -329,6 +434,16 @@ class AsyncPtyResource(AsyncPtyAttachMixin):
329
434
  """Operations under ``client.pty.connect``."""
330
435
  return AsyncPtyConnectResource(self._client)
331
436
 
437
+ @cached_property
438
+ def with_raw_response(self) -> AsyncPtyResourceWithRawResponse:
439
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
440
+ return AsyncPtyResourceWithRawResponse(self)
441
+
442
+ @cached_property
443
+ def with_streaming_response(self) -> AsyncPtyResourceWithStreamingResponse:
444
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
445
+ return AsyncPtyResourceWithStreamingResponse(self)
446
+
332
447
  async def list(
333
448
  self,
334
449
  *,
@@ -508,15 +623,52 @@ class AsyncPtyResource(AsyncPtyAttachMixin):
508
623
 
509
624
  ``DELETE /api/pty/:ptyID``
510
625
  """
511
- await self._client.request(
512
- RequestOptions(
513
- method="DELETE",
514
- path=f"/api/pty/{encode_path_segment(pty_id)}",
515
- query={"location": self._location(location)},
516
- extra_headers=extra_headers,
517
- extra_query=extra_query,
518
- extra_body=extra_body,
519
- timeout=timeout,
626
+ return cast(
627
+ "None",
628
+ await self._client.request(
629
+ RequestOptions(
630
+ method="DELETE",
631
+ path=f"/api/pty/{encode_path_segment(pty_id)}",
632
+ query={"location": self._location(location)},
633
+ extra_headers=extra_headers,
634
+ extra_query=extra_query,
635
+ extra_body=extra_body,
636
+ timeout=timeout,
637
+ ),
638
+ kind="void",
520
639
  ),
521
- kind="void",
522
640
  )
641
+
642
+
643
+ class AsyncPtyResourceWithRawResponse:
644
+ """``client.pty.with_raw_response``."""
645
+
646
+ def __init__(self, resource: AsyncPtyResource) -> None:
647
+ self._resource = resource
648
+ self.list = async_to_raw_response_wrapper(resource.list)
649
+ self.create = async_to_raw_response_wrapper(resource.create)
650
+ self.get = async_to_raw_response_wrapper(resource.get)
651
+ self.update = async_to_raw_response_wrapper(resource.update)
652
+ self.remove = async_to_raw_response_wrapper(resource.remove)
653
+
654
+ @cached_property
655
+ def connect(self) -> AsyncPtyConnectResourceWithRawResponse:
656
+ """``client.pty.connect.with_raw_response``."""
657
+ return AsyncPtyConnectResourceWithRawResponse(self._resource.connect)
658
+
659
+
660
+ class AsyncPtyResourceWithStreamingResponse:
661
+ """``client.pty.with_streaming_response``."""
662
+
663
+ def __init__(self, resource: AsyncPtyResource) -> None:
664
+ self._resource = resource
665
+ self.list = async_to_streamed_response_wrapper(resource.list)
666
+ self.create = async_to_streamed_response_wrapper(resource.create)
667
+ self.get = async_to_streamed_response_wrapper(resource.get)
668
+ self.update = async_to_streamed_response_wrapper(resource.update)
669
+ self.remove = async_to_streamed_response_wrapper(resource.remove)
670
+
671
+ @cached_property
672
+ def connect(self) -> AsyncPtyConnectResourceWithStreamingResponse:
673
+ """``client.pty.connect.with_streaming_response``."""
674
+ return AsyncPtyConnectResourceWithStreamingResponse(self._resource.connect)
@@ -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__ = ["ReferenceResource", "AsyncReferenceResource"]
23
30
  class ReferenceResource(SyncAPIResource):
24
31
  """Operations under ``client.reference`` (OpenCode ``reference``)."""
25
32
 
33
+ @cached_property
34
+ def with_raw_response(self) -> ReferenceResourceWithRawResponse:
35
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
36
+ return ReferenceResourceWithRawResponse(self)
37
+
38
+ @cached_property
39
+ def with_streaming_response(self) -> ReferenceResourceWithStreamingResponse:
40
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
41
+ return ReferenceResourceWithStreamingResponse(self)
42
+
26
43
  def list(
27
44
  self,
28
45
  *,
@@ -60,9 +77,35 @@ class ReferenceResource(SyncAPIResource):
60
77
  )
61
78
 
62
79
 
80
+ class ReferenceResourceWithRawResponse:
81
+ """``client.reference.with_raw_response``."""
82
+
83
+ def __init__(self, resource: ReferenceResource) -> None:
84
+ self._resource = resource
85
+ self.list = to_raw_response_wrapper(resource.list)
86
+
87
+
88
+ class ReferenceResourceWithStreamingResponse:
89
+ """``client.reference.with_streaming_response``."""
90
+
91
+ def __init__(self, resource: ReferenceResource) -> None:
92
+ self._resource = resource
93
+ self.list = to_streamed_response_wrapper(resource.list)
94
+
95
+
63
96
  class AsyncReferenceResource(AsyncAPIResource):
64
97
  """Operations under ``client.reference`` (OpenCode ``reference``)."""
65
98
 
99
+ @cached_property
100
+ def with_raw_response(self) -> AsyncReferenceResourceWithRawResponse:
101
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
102
+ return AsyncReferenceResourceWithRawResponse(self)
103
+
104
+ @cached_property
105
+ def with_streaming_response(self) -> AsyncReferenceResourceWithStreamingResponse:
106
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
107
+ return AsyncReferenceResourceWithStreamingResponse(self)
108
+
66
109
  async def list(
67
110
  self,
68
111
  *,
@@ -98,3 +141,19 @@ class AsyncReferenceResource(AsyncAPIResource):
98
141
  response_type="ReferenceListResponse",
99
142
  ),
100
143
  )
144
+
145
+
146
+ class AsyncReferenceResourceWithRawResponse:
147
+ """``client.reference.with_raw_response``."""
148
+
149
+ def __init__(self, resource: AsyncReferenceResource) -> None:
150
+ self._resource = resource
151
+ self.list = async_to_raw_response_wrapper(resource.list)
152
+
153
+
154
+ class AsyncReferenceResourceWithStreamingResponse:
155
+ """``client.reference.with_streaming_response``."""
156
+
157
+ def __init__(self, resource: AsyncReferenceResource) -> None:
158
+ self._resource = resource
159
+ self.list = async_to_streamed_response_wrapper(resource.list)