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
@@ -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:
@@ -25,6 +31,16 @@ __all__ = ["MigrationResource", "AsyncMigrationResource"]
25
31
  class MigrationV1Resource(SyncAPIResource):
26
32
  """Operations under ``client.migration.v1`` (OpenCode ``migration.v1``)."""
27
33
 
34
+ @cached_property
35
+ def with_raw_response(self) -> MigrationV1ResourceWithRawResponse:
36
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
37
+ return MigrationV1ResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> MigrationV1ResourceWithStreamingResponse:
41
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
42
+ return MigrationV1ResourceWithStreamingResponse(self)
43
+
28
44
  def status(
29
45
  self,
30
46
  *,
@@ -61,6 +77,22 @@ class MigrationV1Resource(SyncAPIResource):
61
77
  )
62
78
 
63
79
 
80
+ class MigrationV1ResourceWithRawResponse:
81
+ """``client.migration.v1.with_raw_response``."""
82
+
83
+ def __init__(self, resource: MigrationV1Resource) -> None:
84
+ self._resource = resource
85
+ self.status = to_raw_response_wrapper(resource.status)
86
+
87
+
88
+ class MigrationV1ResourceWithStreamingResponse:
89
+ """``client.migration.v1.with_streaming_response``."""
90
+
91
+ def __init__(self, resource: MigrationV1Resource) -> None:
92
+ self._resource = resource
93
+ self.status = to_streamed_response_wrapper(resource.status)
94
+
95
+
64
96
  class MigrationResource(SyncAPIResource):
65
97
  """Operations under ``client.migration`` (OpenCode ``migration``)."""
66
98
 
@@ -69,10 +101,54 @@ class MigrationResource(SyncAPIResource):
69
101
  """Operations under ``client.migration.v1``."""
70
102
  return MigrationV1Resource(self._client)
71
103
 
104
+ @cached_property
105
+ def with_raw_response(self) -> MigrationResourceWithRawResponse:
106
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
107
+ return MigrationResourceWithRawResponse(self)
108
+
109
+ @cached_property
110
+ def with_streaming_response(self) -> MigrationResourceWithStreamingResponse:
111
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
112
+ return MigrationResourceWithStreamingResponse(self)
113
+
114
+
115
+ class MigrationResourceWithRawResponse:
116
+ """``client.migration.with_raw_response``."""
117
+
118
+ def __init__(self, resource: MigrationResource) -> None:
119
+ self._resource = resource
120
+
121
+ @cached_property
122
+ def v1(self) -> MigrationV1ResourceWithRawResponse:
123
+ """``client.migration.v1.with_raw_response``."""
124
+ return MigrationV1ResourceWithRawResponse(self._resource.v1)
125
+
126
+
127
+ class MigrationResourceWithStreamingResponse:
128
+ """``client.migration.with_streaming_response``."""
129
+
130
+ def __init__(self, resource: MigrationResource) -> None:
131
+ self._resource = resource
132
+
133
+ @cached_property
134
+ def v1(self) -> MigrationV1ResourceWithStreamingResponse:
135
+ """``client.migration.v1.with_streaming_response``."""
136
+ return MigrationV1ResourceWithStreamingResponse(self._resource.v1)
137
+
72
138
 
73
139
  class AsyncMigrationV1Resource(AsyncAPIResource):
74
140
  """Operations under ``client.migration.v1`` (OpenCode ``migration.v1``)."""
75
141
 
142
+ @cached_property
143
+ def with_raw_response(self) -> AsyncMigrationV1ResourceWithRawResponse:
144
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
145
+ return AsyncMigrationV1ResourceWithRawResponse(self)
146
+
147
+ @cached_property
148
+ def with_streaming_response(self) -> AsyncMigrationV1ResourceWithStreamingResponse:
149
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
150
+ return AsyncMigrationV1ResourceWithStreamingResponse(self)
151
+
76
152
  async def status(
77
153
  self,
78
154
  *,
@@ -109,6 +185,22 @@ class AsyncMigrationV1Resource(AsyncAPIResource):
109
185
  )
110
186
 
111
187
 
188
+ class AsyncMigrationV1ResourceWithRawResponse:
189
+ """``client.migration.v1.with_raw_response``."""
190
+
191
+ def __init__(self, resource: AsyncMigrationV1Resource) -> None:
192
+ self._resource = resource
193
+ self.status = async_to_raw_response_wrapper(resource.status)
194
+
195
+
196
+ class AsyncMigrationV1ResourceWithStreamingResponse:
197
+ """``client.migration.v1.with_streaming_response``."""
198
+
199
+ def __init__(self, resource: AsyncMigrationV1Resource) -> None:
200
+ self._resource = resource
201
+ self.status = async_to_streamed_response_wrapper(resource.status)
202
+
203
+
112
204
  class AsyncMigrationResource(AsyncAPIResource):
113
205
  """Operations under ``client.migration`` (OpenCode ``migration``)."""
114
206
 
@@ -116,3 +208,37 @@ class AsyncMigrationResource(AsyncAPIResource):
116
208
  def v1(self) -> AsyncMigrationV1Resource:
117
209
  """Operations under ``client.migration.v1``."""
118
210
  return AsyncMigrationV1Resource(self._client)
211
+
212
+ @cached_property
213
+ def with_raw_response(self) -> AsyncMigrationResourceWithRawResponse:
214
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
215
+ return AsyncMigrationResourceWithRawResponse(self)
216
+
217
+ @cached_property
218
+ def with_streaming_response(self) -> AsyncMigrationResourceWithStreamingResponse:
219
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
220
+ return AsyncMigrationResourceWithStreamingResponse(self)
221
+
222
+
223
+ class AsyncMigrationResourceWithRawResponse:
224
+ """``client.migration.with_raw_response``."""
225
+
226
+ def __init__(self, resource: AsyncMigrationResource) -> None:
227
+ self._resource = resource
228
+
229
+ @cached_property
230
+ def v1(self) -> AsyncMigrationV1ResourceWithRawResponse:
231
+ """``client.migration.v1.with_raw_response``."""
232
+ return AsyncMigrationV1ResourceWithRawResponse(self._resource.v1)
233
+
234
+
235
+ class AsyncMigrationResourceWithStreamingResponse:
236
+ """``client.migration.with_streaming_response``."""
237
+
238
+ def __init__(self, resource: AsyncMigrationResource) -> None:
239
+ self._resource = resource
240
+
241
+ @cached_property
242
+ def v1(self) -> AsyncMigrationV1ResourceWithStreamingResponse:
243
+ """``client.migration.v1.with_streaming_response``."""
244
+ return AsyncMigrationV1ResourceWithStreamingResponse(self._resource.v1)
@@ -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:
@@ -24,6 +31,16 @@ __all__ = ["ModelResource", "AsyncModelResource"]
24
31
  class ModelResource(SyncAPIResource):
25
32
  """Operations under ``client.model`` (OpenCode ``model``)."""
26
33
 
34
+ @cached_property
35
+ def with_raw_response(self) -> ModelResourceWithRawResponse:
36
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
37
+ return ModelResourceWithRawResponse(self)
38
+
39
+ @cached_property
40
+ def with_streaming_response(self) -> ModelResourceWithStreamingResponse:
41
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
42
+ return ModelResourceWithStreamingResponse(self)
43
+
27
44
  def list(
28
45
  self,
29
46
  *,
@@ -99,9 +116,37 @@ class ModelResource(SyncAPIResource):
99
116
  )
100
117
 
101
118
 
119
+ class ModelResourceWithRawResponse:
120
+ """``client.model.with_raw_response``."""
121
+
122
+ def __init__(self, resource: ModelResource) -> None:
123
+ self._resource = resource
124
+ self.list = to_raw_response_wrapper(resource.list)
125
+ self.default = to_raw_response_wrapper(resource.default)
126
+
127
+
128
+ class ModelResourceWithStreamingResponse:
129
+ """``client.model.with_streaming_response``."""
130
+
131
+ def __init__(self, resource: ModelResource) -> None:
132
+ self._resource = resource
133
+ self.list = to_streamed_response_wrapper(resource.list)
134
+ self.default = to_streamed_response_wrapper(resource.default)
135
+
136
+
102
137
  class AsyncModelResource(AsyncAPIResource):
103
138
  """Operations under ``client.model`` (OpenCode ``model``)."""
104
139
 
140
+ @cached_property
141
+ def with_raw_response(self) -> AsyncModelResourceWithRawResponse:
142
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
143
+ return AsyncModelResourceWithRawResponse(self)
144
+
145
+ @cached_property
146
+ def with_streaming_response(self) -> AsyncModelResourceWithStreamingResponse:
147
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
148
+ return AsyncModelResourceWithStreamingResponse(self)
149
+
105
150
  async def list(
106
151
  self,
107
152
  *,
@@ -175,3 +220,21 @@ class AsyncModelResource(AsyncAPIResource):
175
220
  response_type="ModelDefaultResponse",
176
221
  ),
177
222
  )
223
+
224
+
225
+ class AsyncModelResourceWithRawResponse:
226
+ """``client.model.with_raw_response``."""
227
+
228
+ def __init__(self, resource: AsyncModelResource) -> None:
229
+ self._resource = resource
230
+ self.list = async_to_raw_response_wrapper(resource.list)
231
+ self.default = async_to_raw_response_wrapper(resource.default)
232
+
233
+
234
+ class AsyncModelResourceWithStreamingResponse:
235
+ """``client.model.with_streaming_response``."""
236
+
237
+ def __init__(self, resource: AsyncModelResource) -> None:
238
+ self._resource = resource
239
+ self.list = async_to_streamed_response_wrapper(resource.list)
240
+ self.default = async_to_streamed_response_wrapper(resource.default)
@@ -13,6 +13,12 @@ from typing import TYPE_CHECKING, Any, cast
13
13
  from .._base_client import RequestOptions
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:
@@ -37,6 +43,16 @@ __all__ = ["PermissionResource", "AsyncPermissionResource"]
37
43
  class PermissionRequestResource(SyncAPIResource):
38
44
  """Operations under ``client.permission.request`` (OpenCode ``permission.request``)."""
39
45
 
46
+ @cached_property
47
+ def with_raw_response(self) -> PermissionRequestResourceWithRawResponse:
48
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
49
+ return PermissionRequestResourceWithRawResponse(self)
50
+
51
+ @cached_property
52
+ def with_streaming_response(self) -> PermissionRequestResourceWithStreamingResponse:
53
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
54
+ return PermissionRequestResourceWithStreamingResponse(self)
55
+
40
56
  def list(
41
57
  self,
42
58
  *,
@@ -74,9 +90,35 @@ class PermissionRequestResource(SyncAPIResource):
74
90
  )
75
91
 
76
92
 
93
+ class PermissionRequestResourceWithRawResponse:
94
+ """``client.permission.request.with_raw_response``."""
95
+
96
+ def __init__(self, resource: PermissionRequestResource) -> None:
97
+ self._resource = resource
98
+ self.list = to_raw_response_wrapper(resource.list)
99
+
100
+
101
+ class PermissionRequestResourceWithStreamingResponse:
102
+ """``client.permission.request.with_streaming_response``."""
103
+
104
+ def __init__(self, resource: PermissionRequestResource) -> None:
105
+ self._resource = resource
106
+ self.list = to_streamed_response_wrapper(resource.list)
107
+
108
+
77
109
  class PermissionSavedResource(SyncAPIResource):
78
110
  """Operations under ``client.permission.saved`` (OpenCode ``permission.saved``)."""
79
111
 
112
+ @cached_property
113
+ def with_raw_response(self) -> PermissionSavedResourceWithRawResponse:
114
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
115
+ return PermissionSavedResourceWithRawResponse(self)
116
+
117
+ @cached_property
118
+ def with_streaming_response(self) -> PermissionSavedResourceWithStreamingResponse:
119
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
120
+ return PermissionSavedResourceWithStreamingResponse(self)
121
+
80
122
  def list(
81
123
  self,
82
124
  *,
@@ -175,19 +217,42 @@ class PermissionSavedResource(SyncAPIResource):
175
217
 
176
218
  ``DELETE /api/permission/saved/:id``
177
219
  """
178
- self._client.request(
179
- RequestOptions(
180
- method="DELETE",
181
- path=f"/api/permission/saved/{encode_path_segment(id)}",
182
- extra_headers=extra_headers,
183
- extra_query=extra_query,
184
- extra_body=extra_body,
185
- timeout=timeout,
220
+ return cast(
221
+ "None",
222
+ self._client.request(
223
+ RequestOptions(
224
+ method="DELETE",
225
+ path=f"/api/permission/saved/{encode_path_segment(id)}",
226
+ extra_headers=extra_headers,
227
+ extra_query=extra_query,
228
+ extra_body=extra_body,
229
+ timeout=timeout,
230
+ ),
231
+ kind="void",
186
232
  ),
187
- kind="void",
188
233
  )
189
234
 
190
235
 
236
+ class PermissionSavedResourceWithRawResponse:
237
+ """``client.permission.saved.with_raw_response``."""
238
+
239
+ def __init__(self, resource: PermissionSavedResource) -> None:
240
+ self._resource = resource
241
+ self.list = to_raw_response_wrapper(resource.list)
242
+ self.update = to_raw_response_wrapper(resource.update)
243
+ self.remove = to_raw_response_wrapper(resource.remove)
244
+
245
+
246
+ class PermissionSavedResourceWithStreamingResponse:
247
+ """``client.permission.saved.with_streaming_response``."""
248
+
249
+ def __init__(self, resource: PermissionSavedResource) -> None:
250
+ self._resource = resource
251
+ self.list = to_streamed_response_wrapper(resource.list)
252
+ self.update = to_streamed_response_wrapper(resource.update)
253
+ self.remove = to_streamed_response_wrapper(resource.remove)
254
+
255
+
191
256
  class PermissionResource(SyncAPIResource):
192
257
  """Operations under ``client.permission`` (OpenCode ``permission``)."""
193
258
 
@@ -201,6 +266,16 @@ class PermissionResource(SyncAPIResource):
201
266
  """Operations under ``client.permission.saved``."""
202
267
  return PermissionSavedResource(self._client)
203
268
 
269
+ @cached_property
270
+ def with_raw_response(self) -> PermissionResourceWithRawResponse:
271
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
272
+ return PermissionResourceWithRawResponse(self)
273
+
274
+ @cached_property
275
+ def with_streaming_response(self) -> PermissionResourceWithStreamingResponse:
276
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
277
+ return PermissionResourceWithStreamingResponse(self)
278
+
204
279
  def create(
205
280
  self,
206
281
  session_id: SessionID,
@@ -355,23 +430,78 @@ class PermissionResource(SyncAPIResource):
355
430
 
356
431
  ``POST /api/session/:sessionID/permission/:requestID/reply``
357
432
  """
358
- self._client.request(
359
- RequestOptions(
360
- method="POST",
361
- path=f"/api/session/{encode_path_segment(session_id)}/permission/{encode_path_segment(request_id)}/reply",
362
- body={"decision": decision, "message": message},
363
- extra_headers=extra_headers,
364
- extra_query=extra_query,
365
- extra_body=extra_body,
366
- timeout=timeout,
433
+ return cast(
434
+ "None",
435
+ self._client.request(
436
+ RequestOptions(
437
+ method="POST",
438
+ path=f"/api/session/{encode_path_segment(session_id)}/permission/{encode_path_segment(request_id)}/reply",
439
+ body={"decision": decision, "message": message},
440
+ extra_headers=extra_headers,
441
+ extra_query=extra_query,
442
+ extra_body=extra_body,
443
+ timeout=timeout,
444
+ ),
445
+ kind="void",
367
446
  ),
368
- kind="void",
369
447
  )
370
448
 
371
449
 
450
+ class PermissionResourceWithRawResponse:
451
+ """``client.permission.with_raw_response``."""
452
+
453
+ def __init__(self, resource: PermissionResource) -> None:
454
+ self._resource = resource
455
+ self.create = to_raw_response_wrapper(resource.create)
456
+ self.list = to_raw_response_wrapper(resource.list)
457
+ self.get = to_raw_response_wrapper(resource.get)
458
+ self.reply = to_raw_response_wrapper(resource.reply)
459
+
460
+ @cached_property
461
+ def request_(self) -> PermissionRequestResourceWithRawResponse:
462
+ """``client.permission.request.with_raw_response``."""
463
+ return PermissionRequestResourceWithRawResponse(self._resource.request_)
464
+
465
+ @cached_property
466
+ def saved(self) -> PermissionSavedResourceWithRawResponse:
467
+ """``client.permission.saved.with_raw_response``."""
468
+ return PermissionSavedResourceWithRawResponse(self._resource.saved)
469
+
470
+
471
+ class PermissionResourceWithStreamingResponse:
472
+ """``client.permission.with_streaming_response``."""
473
+
474
+ def __init__(self, resource: PermissionResource) -> None:
475
+ self._resource = resource
476
+ self.create = to_streamed_response_wrapper(resource.create)
477
+ self.list = to_streamed_response_wrapper(resource.list)
478
+ self.get = to_streamed_response_wrapper(resource.get)
479
+ self.reply = to_streamed_response_wrapper(resource.reply)
480
+
481
+ @cached_property
482
+ def request_(self) -> PermissionRequestResourceWithStreamingResponse:
483
+ """``client.permission.request.with_streaming_response``."""
484
+ return PermissionRequestResourceWithStreamingResponse(self._resource.request_)
485
+
486
+ @cached_property
487
+ def saved(self) -> PermissionSavedResourceWithStreamingResponse:
488
+ """``client.permission.saved.with_streaming_response``."""
489
+ return PermissionSavedResourceWithStreamingResponse(self._resource.saved)
490
+
491
+
372
492
  class AsyncPermissionRequestResource(AsyncAPIResource):
373
493
  """Operations under ``client.permission.request`` (OpenCode ``permission.request``)."""
374
494
 
495
+ @cached_property
496
+ def with_raw_response(self) -> AsyncPermissionRequestResourceWithRawResponse:
497
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
498
+ return AsyncPermissionRequestResourceWithRawResponse(self)
499
+
500
+ @cached_property
501
+ def with_streaming_response(self) -> AsyncPermissionRequestResourceWithStreamingResponse:
502
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
503
+ return AsyncPermissionRequestResourceWithStreamingResponse(self)
504
+
375
505
  async def list(
376
506
  self,
377
507
  *,
@@ -409,9 +539,35 @@ class AsyncPermissionRequestResource(AsyncAPIResource):
409
539
  )
410
540
 
411
541
 
542
+ class AsyncPermissionRequestResourceWithRawResponse:
543
+ """``client.permission.request.with_raw_response``."""
544
+
545
+ def __init__(self, resource: AsyncPermissionRequestResource) -> None:
546
+ self._resource = resource
547
+ self.list = async_to_raw_response_wrapper(resource.list)
548
+
549
+
550
+ class AsyncPermissionRequestResourceWithStreamingResponse:
551
+ """``client.permission.request.with_streaming_response``."""
552
+
553
+ def __init__(self, resource: AsyncPermissionRequestResource) -> None:
554
+ self._resource = resource
555
+ self.list = async_to_streamed_response_wrapper(resource.list)
556
+
557
+
412
558
  class AsyncPermissionSavedResource(AsyncAPIResource):
413
559
  """Operations under ``client.permission.saved`` (OpenCode ``permission.saved``)."""
414
560
 
561
+ @cached_property
562
+ def with_raw_response(self) -> AsyncPermissionSavedResourceWithRawResponse:
563
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
564
+ return AsyncPermissionSavedResourceWithRawResponse(self)
565
+
566
+ @cached_property
567
+ def with_streaming_response(self) -> AsyncPermissionSavedResourceWithStreamingResponse:
568
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
569
+ return AsyncPermissionSavedResourceWithStreamingResponse(self)
570
+
415
571
  async def list(
416
572
  self,
417
573
  *,
@@ -510,19 +666,42 @@ class AsyncPermissionSavedResource(AsyncAPIResource):
510
666
 
511
667
  ``DELETE /api/permission/saved/:id``
512
668
  """
513
- await self._client.request(
514
- RequestOptions(
515
- method="DELETE",
516
- path=f"/api/permission/saved/{encode_path_segment(id)}",
517
- extra_headers=extra_headers,
518
- extra_query=extra_query,
519
- extra_body=extra_body,
520
- timeout=timeout,
669
+ return cast(
670
+ "None",
671
+ await self._client.request(
672
+ RequestOptions(
673
+ method="DELETE",
674
+ path=f"/api/permission/saved/{encode_path_segment(id)}",
675
+ extra_headers=extra_headers,
676
+ extra_query=extra_query,
677
+ extra_body=extra_body,
678
+ timeout=timeout,
679
+ ),
680
+ kind="void",
521
681
  ),
522
- kind="void",
523
682
  )
524
683
 
525
684
 
685
+ class AsyncPermissionSavedResourceWithRawResponse:
686
+ """``client.permission.saved.with_raw_response``."""
687
+
688
+ def __init__(self, resource: AsyncPermissionSavedResource) -> None:
689
+ self._resource = resource
690
+ self.list = async_to_raw_response_wrapper(resource.list)
691
+ self.update = async_to_raw_response_wrapper(resource.update)
692
+ self.remove = async_to_raw_response_wrapper(resource.remove)
693
+
694
+
695
+ class AsyncPermissionSavedResourceWithStreamingResponse:
696
+ """``client.permission.saved.with_streaming_response``."""
697
+
698
+ def __init__(self, resource: AsyncPermissionSavedResource) -> None:
699
+ self._resource = resource
700
+ self.list = async_to_streamed_response_wrapper(resource.list)
701
+ self.update = async_to_streamed_response_wrapper(resource.update)
702
+ self.remove = async_to_streamed_response_wrapper(resource.remove)
703
+
704
+
526
705
  class AsyncPermissionResource(AsyncAPIResource):
527
706
  """Operations under ``client.permission`` (OpenCode ``permission``)."""
528
707
 
@@ -536,6 +715,16 @@ class AsyncPermissionResource(AsyncAPIResource):
536
715
  """Operations under ``client.permission.saved``."""
537
716
  return AsyncPermissionSavedResource(self._client)
538
717
 
718
+ @cached_property
719
+ def with_raw_response(self) -> AsyncPermissionResourceWithRawResponse:
720
+ """Same methods, returning the raw HTTP response; call ``.parse()`` on it for the usual value."""
721
+ return AsyncPermissionResourceWithRawResponse(self)
722
+
723
+ @cached_property
724
+ def with_streaming_response(self) -> AsyncPermissionResourceWithStreamingResponse:
725
+ """Same methods, returning a context manager over the HTTP response without reading the body."""
726
+ return AsyncPermissionResourceWithStreamingResponse(self)
727
+
539
728
  async def create(
540
729
  self,
541
730
  session_id: SessionID,
@@ -690,15 +879,60 @@ class AsyncPermissionResource(AsyncAPIResource):
690
879
 
691
880
  ``POST /api/session/:sessionID/permission/:requestID/reply``
692
881
  """
693
- await self._client.request(
694
- RequestOptions(
695
- method="POST",
696
- path=f"/api/session/{encode_path_segment(session_id)}/permission/{encode_path_segment(request_id)}/reply",
697
- body={"decision": decision, "message": message},
698
- extra_headers=extra_headers,
699
- extra_query=extra_query,
700
- extra_body=extra_body,
701
- timeout=timeout,
882
+ return cast(
883
+ "None",
884
+ await self._client.request(
885
+ RequestOptions(
886
+ method="POST",
887
+ path=f"/api/session/{encode_path_segment(session_id)}/permission/{encode_path_segment(request_id)}/reply",
888
+ body={"decision": decision, "message": message},
889
+ extra_headers=extra_headers,
890
+ extra_query=extra_query,
891
+ extra_body=extra_body,
892
+ timeout=timeout,
893
+ ),
894
+ kind="void",
702
895
  ),
703
- kind="void",
704
896
  )
897
+
898
+
899
+ class AsyncPermissionResourceWithRawResponse:
900
+ """``client.permission.with_raw_response``."""
901
+
902
+ def __init__(self, resource: AsyncPermissionResource) -> None:
903
+ self._resource = resource
904
+ self.create = async_to_raw_response_wrapper(resource.create)
905
+ self.list = async_to_raw_response_wrapper(resource.list)
906
+ self.get = async_to_raw_response_wrapper(resource.get)
907
+ self.reply = async_to_raw_response_wrapper(resource.reply)
908
+
909
+ @cached_property
910
+ def request_(self) -> AsyncPermissionRequestResourceWithRawResponse:
911
+ """``client.permission.request.with_raw_response``."""
912
+ return AsyncPermissionRequestResourceWithRawResponse(self._resource.request_)
913
+
914
+ @cached_property
915
+ def saved(self) -> AsyncPermissionSavedResourceWithRawResponse:
916
+ """``client.permission.saved.with_raw_response``."""
917
+ return AsyncPermissionSavedResourceWithRawResponse(self._resource.saved)
918
+
919
+
920
+ class AsyncPermissionResourceWithStreamingResponse:
921
+ """``client.permission.with_streaming_response``."""
922
+
923
+ def __init__(self, resource: AsyncPermissionResource) -> None:
924
+ self._resource = resource
925
+ self.create = async_to_streamed_response_wrapper(resource.create)
926
+ self.list = async_to_streamed_response_wrapper(resource.list)
927
+ self.get = async_to_streamed_response_wrapper(resource.get)
928
+ self.reply = async_to_streamed_response_wrapper(resource.reply)
929
+
930
+ @cached_property
931
+ def request_(self) -> AsyncPermissionRequestResourceWithStreamingResponse:
932
+ """``client.permission.request.with_streaming_response``."""
933
+ return AsyncPermissionRequestResourceWithStreamingResponse(self._resource.request_)
934
+
935
+ @cached_property
936
+ def saved(self) -> AsyncPermissionSavedResourceWithStreamingResponse:
937
+ """``client.permission.saved.with_streaming_response``."""
938
+ return AsyncPermissionSavedResourceWithStreamingResponse(self._resource.saved)