opencode-python-sdk 0.1.0__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/.generated.json +39 -0
- opencode/__init__.py +156 -0
- opencode/_base_client.py +518 -0
- opencode/_client.py +167 -0
- opencode/_constants.py +27 -0
- opencode/_errors.py +547 -0
- opencode/_exceptions.py +249 -0
- opencode/_models.py +54 -0
- opencode/_pagination.py +192 -0
- opencode/_qs.py +95 -0
- opencode/_resource.py +42 -0
- opencode/_server.py +327 -0
- opencode/_streaming.py +227 -0
- opencode/_types.py +77 -0
- opencode/_unions.py +46 -0
- opencode/_version.py +8 -0
- opencode/py.typed +0 -0
- opencode/resources/__init__.py +364 -0
- opencode/resources/agent.py +177 -0
- opencode/resources/command.py +98 -0
- opencode/resources/config.py +238 -0
- opencode/resources/credential.py +382 -0
- opencode/resources/debug.py +174 -0
- opencode/resources/event.py +84 -0
- opencode/resources/experimental.py +760 -0
- opencode/resources/file.py +353 -0
- opencode/resources/form.py +98 -0
- opencode/resources/generate.py +108 -0
- opencode/resources/integration.py +1023 -0
- opencode/resources/location.py +160 -0
- opencode/resources/mcp.py +488 -0
- opencode/resources/message.py +151 -0
- opencode/resources/migration.py +118 -0
- opencode/resources/model.py +175 -0
- opencode/resources/permission.py +698 -0
- opencode/resources/plugin.py +248 -0
- opencode/resources/project.py +185 -0
- opencode/resources/provider.py +181 -0
- opencode/resources/pty.py +517 -0
- opencode/resources/reference.py +98 -0
- opencode/resources/rpc.py +111 -0
- opencode/resources/server.py +228 -0
- opencode/resources/session.py +3553 -0
- opencode/resources/shell.py +410 -0
- opencode/resources/skill.py +98 -0
- opencode/resources/vcs.py +496 -0
- opencode/resources/voice.py +111 -0
- opencode/resources/websearch.py +182 -0
- opencode/resources/worktree.py +334 -0
- opencode/types/__init__.py +1462 -0
- opencode/types/_generated.py +8540 -0
- opencode_python_sdk-0.1.0.dist-info/METADATA +317 -0
- opencode_python_sdk-0.1.0.dist-info/RECORD +55 -0
- opencode_python_sdk-0.1.0.dist-info/WHEEL +4 -0
- opencode_python_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
# This file is generated by `python -m codegen` from spec/contract.json. Do not edit it by hand.
|
|
2
|
+
# OpenCode 2.1.2
|
|
3
|
+
|
|
4
|
+
"""The ``vcs`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from functools import cached_property
|
|
9
|
+
from typing import cast
|
|
10
|
+
|
|
11
|
+
from .._base_client import RequestOptions
|
|
12
|
+
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
13
|
+
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
14
|
+
from ..types import (
|
|
15
|
+
Location,
|
|
16
|
+
VcsBaseResponse,
|
|
17
|
+
VcsBranchListResponse,
|
|
18
|
+
VcsDiffResponse,
|
|
19
|
+
VcsGetResponse,
|
|
20
|
+
VcsMode,
|
|
21
|
+
VcsStatusResponse,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
__all__ = ["VcsResource", "AsyncVcsResource"]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class VcsBranchResource(SyncAPIResource):
|
|
28
|
+
"""Operations under ``client.vcs.branch`` (OpenCode ``vcs.branch``)."""
|
|
29
|
+
|
|
30
|
+
def list(
|
|
31
|
+
self,
|
|
32
|
+
*,
|
|
33
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
34
|
+
search: str | NotGiven | None = NOT_GIVEN,
|
|
35
|
+
limit: int | NotGiven | None = NOT_GIVEN,
|
|
36
|
+
extra_headers: Headers | None = None,
|
|
37
|
+
extra_query: Query | None = None,
|
|
38
|
+
extra_body: Body | None = None,
|
|
39
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
40
|
+
) -> VcsBranchListResponse:
|
|
41
|
+
"""VCS branches.
|
|
42
|
+
|
|
43
|
+
List local and remote branches available at the requested location.
|
|
44
|
+
|
|
45
|
+
Raises:
|
|
46
|
+
InvalidRequestError
|
|
47
|
+
UnauthorizedError
|
|
48
|
+
LocationNotFoundError
|
|
49
|
+
|
|
50
|
+
``GET /api/vcs/branch``
|
|
51
|
+
"""
|
|
52
|
+
return cast(
|
|
53
|
+
"VcsBranchListResponse",
|
|
54
|
+
self._client.request(
|
|
55
|
+
RequestOptions(
|
|
56
|
+
method="GET",
|
|
57
|
+
path="/api/vcs/branch",
|
|
58
|
+
query={"location": self._location(location), "search": search, "limit": limit},
|
|
59
|
+
extra_headers=extra_headers,
|
|
60
|
+
extra_query=extra_query,
|
|
61
|
+
extra_body=extra_body,
|
|
62
|
+
timeout=timeout,
|
|
63
|
+
),
|
|
64
|
+
response_type=VcsBranchListResponse,
|
|
65
|
+
),
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
class VcsResource(SyncAPIResource):
|
|
70
|
+
"""Operations under ``client.vcs`` (OpenCode ``vcs``)."""
|
|
71
|
+
|
|
72
|
+
@cached_property
|
|
73
|
+
def branch(self) -> VcsBranchResource:
|
|
74
|
+
return VcsBranchResource(self._client)
|
|
75
|
+
|
|
76
|
+
def init(
|
|
77
|
+
self,
|
|
78
|
+
*,
|
|
79
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
80
|
+
provider: str | NotGiven | None = NOT_GIVEN,
|
|
81
|
+
extra_headers: Headers | None = None,
|
|
82
|
+
extra_query: Query | None = None,
|
|
83
|
+
extra_body: Body | None = None,
|
|
84
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
85
|
+
) -> None:
|
|
86
|
+
"""Initialize VCS repository.
|
|
87
|
+
|
|
88
|
+
Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.
|
|
89
|
+
|
|
90
|
+
Raises:
|
|
91
|
+
InvalidRequestError
|
|
92
|
+
UnauthorizedError
|
|
93
|
+
LocationNotFoundError
|
|
94
|
+
ConflictError
|
|
95
|
+
VcsInitNotSupportedError
|
|
96
|
+
ServiceUnavailableError
|
|
97
|
+
|
|
98
|
+
``POST /api/vcs/init``
|
|
99
|
+
"""
|
|
100
|
+
self._client.request(
|
|
101
|
+
RequestOptions(
|
|
102
|
+
method="POST",
|
|
103
|
+
path="/api/vcs/init",
|
|
104
|
+
query={"location": self._location(location), "provider": provider},
|
|
105
|
+
extra_headers=extra_headers,
|
|
106
|
+
extra_query=extra_query,
|
|
107
|
+
extra_body=extra_body,
|
|
108
|
+
timeout=timeout,
|
|
109
|
+
),
|
|
110
|
+
kind="void",
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
def get(
|
|
114
|
+
self,
|
|
115
|
+
*,
|
|
116
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
117
|
+
extra_headers: Headers | None = None,
|
|
118
|
+
extra_query: Query | None = None,
|
|
119
|
+
extra_body: Body | None = None,
|
|
120
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
121
|
+
) -> VcsGetResponse:
|
|
122
|
+
"""VCS info.
|
|
123
|
+
|
|
124
|
+
Get current and default branch information for the requested location.
|
|
125
|
+
|
|
126
|
+
Raises:
|
|
127
|
+
InvalidRequestError
|
|
128
|
+
UnauthorizedError
|
|
129
|
+
LocationNotFoundError
|
|
130
|
+
|
|
131
|
+
``GET /api/vcs``
|
|
132
|
+
"""
|
|
133
|
+
return cast(
|
|
134
|
+
"VcsGetResponse",
|
|
135
|
+
self._client.request(
|
|
136
|
+
RequestOptions(
|
|
137
|
+
method="GET",
|
|
138
|
+
path="/api/vcs",
|
|
139
|
+
query={"location": self._location(location)},
|
|
140
|
+
extra_headers=extra_headers,
|
|
141
|
+
extra_query=extra_query,
|
|
142
|
+
extra_body=extra_body,
|
|
143
|
+
timeout=timeout,
|
|
144
|
+
),
|
|
145
|
+
response_type=VcsGetResponse,
|
|
146
|
+
),
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
def base(
|
|
150
|
+
self,
|
|
151
|
+
*,
|
|
152
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
153
|
+
extra_headers: Headers | None = None,
|
|
154
|
+
extra_query: Query | None = None,
|
|
155
|
+
extra_body: Body | None = None,
|
|
156
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
157
|
+
) -> VcsBaseResponse:
|
|
158
|
+
"""VCS review base.
|
|
159
|
+
|
|
160
|
+
Infer a local review base from named branch creation history, or the repository default only when currently on that branch. Returns null before the first commit or when the provider lacks base metadata; ambiguous Git history requires an explicit base on diff requests.
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
InvalidRequestError
|
|
164
|
+
UnauthorizedError
|
|
165
|
+
LocationNotFoundError
|
|
166
|
+
ServiceUnavailableError
|
|
167
|
+
|
|
168
|
+
``GET /api/vcs/base``
|
|
169
|
+
"""
|
|
170
|
+
return cast(
|
|
171
|
+
"VcsBaseResponse",
|
|
172
|
+
self._client.request(
|
|
173
|
+
RequestOptions(
|
|
174
|
+
method="GET",
|
|
175
|
+
path="/api/vcs/base",
|
|
176
|
+
query={"location": self._location(location)},
|
|
177
|
+
extra_headers=extra_headers,
|
|
178
|
+
extra_query=extra_query,
|
|
179
|
+
extra_body=extra_body,
|
|
180
|
+
timeout=timeout,
|
|
181
|
+
),
|
|
182
|
+
response_type=VcsBaseResponse,
|
|
183
|
+
),
|
|
184
|
+
)
|
|
185
|
+
|
|
186
|
+
def status(
|
|
187
|
+
self,
|
|
188
|
+
*,
|
|
189
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
190
|
+
extra_headers: Headers | None = None,
|
|
191
|
+
extra_query: Query | None = None,
|
|
192
|
+
extra_body: Body | None = None,
|
|
193
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
194
|
+
) -> VcsStatusResponse:
|
|
195
|
+
"""VCS status.
|
|
196
|
+
|
|
197
|
+
List uncommitted working-copy changes relative to the requested location.
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
InvalidRequestError
|
|
201
|
+
UnauthorizedError
|
|
202
|
+
LocationNotFoundError
|
|
203
|
+
|
|
204
|
+
``GET /api/vcs/status``
|
|
205
|
+
"""
|
|
206
|
+
return cast(
|
|
207
|
+
"VcsStatusResponse",
|
|
208
|
+
self._client.request(
|
|
209
|
+
RequestOptions(
|
|
210
|
+
method="GET",
|
|
211
|
+
path="/api/vcs/status",
|
|
212
|
+
query={"location": self._location(location)},
|
|
213
|
+
extra_headers=extra_headers,
|
|
214
|
+
extra_query=extra_query,
|
|
215
|
+
extra_body=extra_body,
|
|
216
|
+
timeout=timeout,
|
|
217
|
+
),
|
|
218
|
+
response_type=VcsStatusResponse,
|
|
219
|
+
),
|
|
220
|
+
)
|
|
221
|
+
|
|
222
|
+
def diff(
|
|
223
|
+
self,
|
|
224
|
+
*,
|
|
225
|
+
mode: VcsMode,
|
|
226
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
227
|
+
base: str | NotGiven | None = NOT_GIVEN,
|
|
228
|
+
context: int | NotGiven | None = NOT_GIVEN,
|
|
229
|
+
extra_headers: Headers | None = None,
|
|
230
|
+
extra_query: Query | None = None,
|
|
231
|
+
extra_body: Body | None = None,
|
|
232
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
233
|
+
) -> VcsDiffResponse:
|
|
234
|
+
"""VCS diff.
|
|
235
|
+
|
|
236
|
+
Diff HEAD to the working copy (working), the base merge-base to the working copy (branch), or the base merge-base to HEAD (committed). Omitting base preserves repository-default comparison; supplying it overrides the comparison without saving it.
|
|
237
|
+
|
|
238
|
+
Raises:
|
|
239
|
+
InvalidRequestError
|
|
240
|
+
UnauthorizedError
|
|
241
|
+
LocationNotFoundError
|
|
242
|
+
ServiceUnavailableError
|
|
243
|
+
|
|
244
|
+
``GET /api/vcs/diff``
|
|
245
|
+
"""
|
|
246
|
+
return cast(
|
|
247
|
+
"VcsDiffResponse",
|
|
248
|
+
self._client.request(
|
|
249
|
+
RequestOptions(
|
|
250
|
+
method="GET",
|
|
251
|
+
path="/api/vcs/diff",
|
|
252
|
+
query={"location": self._location(location), "mode": mode, "base": base, "context": context},
|
|
253
|
+
extra_headers=extra_headers,
|
|
254
|
+
extra_query=extra_query,
|
|
255
|
+
extra_body=extra_body,
|
|
256
|
+
timeout=timeout,
|
|
257
|
+
),
|
|
258
|
+
response_type=VcsDiffResponse,
|
|
259
|
+
),
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
class AsyncVcsBranchResource(AsyncAPIResource):
|
|
264
|
+
"""Operations under ``client.vcs.branch`` (OpenCode ``vcs.branch``)."""
|
|
265
|
+
|
|
266
|
+
async def list(
|
|
267
|
+
self,
|
|
268
|
+
*,
|
|
269
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
270
|
+
search: str | NotGiven | None = NOT_GIVEN,
|
|
271
|
+
limit: int | NotGiven | None = NOT_GIVEN,
|
|
272
|
+
extra_headers: Headers | None = None,
|
|
273
|
+
extra_query: Query | None = None,
|
|
274
|
+
extra_body: Body | None = None,
|
|
275
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
276
|
+
) -> VcsBranchListResponse:
|
|
277
|
+
"""VCS branches.
|
|
278
|
+
|
|
279
|
+
List local and remote branches available at the requested location.
|
|
280
|
+
|
|
281
|
+
Raises:
|
|
282
|
+
InvalidRequestError
|
|
283
|
+
UnauthorizedError
|
|
284
|
+
LocationNotFoundError
|
|
285
|
+
|
|
286
|
+
``GET /api/vcs/branch``
|
|
287
|
+
"""
|
|
288
|
+
return cast(
|
|
289
|
+
"VcsBranchListResponse",
|
|
290
|
+
await self._client.request(
|
|
291
|
+
RequestOptions(
|
|
292
|
+
method="GET",
|
|
293
|
+
path="/api/vcs/branch",
|
|
294
|
+
query={"location": self._location(location), "search": search, "limit": limit},
|
|
295
|
+
extra_headers=extra_headers,
|
|
296
|
+
extra_query=extra_query,
|
|
297
|
+
extra_body=extra_body,
|
|
298
|
+
timeout=timeout,
|
|
299
|
+
),
|
|
300
|
+
response_type=VcsBranchListResponse,
|
|
301
|
+
),
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class AsyncVcsResource(AsyncAPIResource):
|
|
306
|
+
"""Operations under ``client.vcs`` (OpenCode ``vcs``)."""
|
|
307
|
+
|
|
308
|
+
@cached_property
|
|
309
|
+
def branch(self) -> AsyncVcsBranchResource:
|
|
310
|
+
return AsyncVcsBranchResource(self._client)
|
|
311
|
+
|
|
312
|
+
async def init(
|
|
313
|
+
self,
|
|
314
|
+
*,
|
|
315
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
316
|
+
provider: str | NotGiven | None = NOT_GIVEN,
|
|
317
|
+
extra_headers: Headers | None = None,
|
|
318
|
+
extra_query: Query | None = None,
|
|
319
|
+
extra_body: Body | None = None,
|
|
320
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
321
|
+
) -> None:
|
|
322
|
+
"""Initialize VCS repository.
|
|
323
|
+
|
|
324
|
+
Initialize a repository using the selected VCS provider in a markerless project's directory and refresh its location services. Omitting provider defaults to git; built-in git and hg providers support initialization. An unknown provider returns 400; a registered provider without init returns 501.
|
|
325
|
+
|
|
326
|
+
Raises:
|
|
327
|
+
InvalidRequestError
|
|
328
|
+
UnauthorizedError
|
|
329
|
+
LocationNotFoundError
|
|
330
|
+
ConflictError
|
|
331
|
+
VcsInitNotSupportedError
|
|
332
|
+
ServiceUnavailableError
|
|
333
|
+
|
|
334
|
+
``POST /api/vcs/init``
|
|
335
|
+
"""
|
|
336
|
+
await self._client.request(
|
|
337
|
+
RequestOptions(
|
|
338
|
+
method="POST",
|
|
339
|
+
path="/api/vcs/init",
|
|
340
|
+
query={"location": self._location(location), "provider": provider},
|
|
341
|
+
extra_headers=extra_headers,
|
|
342
|
+
extra_query=extra_query,
|
|
343
|
+
extra_body=extra_body,
|
|
344
|
+
timeout=timeout,
|
|
345
|
+
),
|
|
346
|
+
kind="void",
|
|
347
|
+
)
|
|
348
|
+
|
|
349
|
+
async def get(
|
|
350
|
+
self,
|
|
351
|
+
*,
|
|
352
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
353
|
+
extra_headers: Headers | None = None,
|
|
354
|
+
extra_query: Query | None = None,
|
|
355
|
+
extra_body: Body | None = None,
|
|
356
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
357
|
+
) -> VcsGetResponse:
|
|
358
|
+
"""VCS info.
|
|
359
|
+
|
|
360
|
+
Get current and default branch information for the requested location.
|
|
361
|
+
|
|
362
|
+
Raises:
|
|
363
|
+
InvalidRequestError
|
|
364
|
+
UnauthorizedError
|
|
365
|
+
LocationNotFoundError
|
|
366
|
+
|
|
367
|
+
``GET /api/vcs``
|
|
368
|
+
"""
|
|
369
|
+
return cast(
|
|
370
|
+
"VcsGetResponse",
|
|
371
|
+
await self._client.request(
|
|
372
|
+
RequestOptions(
|
|
373
|
+
method="GET",
|
|
374
|
+
path="/api/vcs",
|
|
375
|
+
query={"location": self._location(location)},
|
|
376
|
+
extra_headers=extra_headers,
|
|
377
|
+
extra_query=extra_query,
|
|
378
|
+
extra_body=extra_body,
|
|
379
|
+
timeout=timeout,
|
|
380
|
+
),
|
|
381
|
+
response_type=VcsGetResponse,
|
|
382
|
+
),
|
|
383
|
+
)
|
|
384
|
+
|
|
385
|
+
async def base(
|
|
386
|
+
self,
|
|
387
|
+
*,
|
|
388
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
389
|
+
extra_headers: Headers | None = None,
|
|
390
|
+
extra_query: Query | None = None,
|
|
391
|
+
extra_body: Body | None = None,
|
|
392
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
393
|
+
) -> VcsBaseResponse:
|
|
394
|
+
"""VCS review base.
|
|
395
|
+
|
|
396
|
+
Infer a local review base from named branch creation history, or the repository default only when currently on that branch. Returns null before the first commit or when the provider lacks base metadata; ambiguous Git history requires an explicit base on diff requests.
|
|
397
|
+
|
|
398
|
+
Raises:
|
|
399
|
+
InvalidRequestError
|
|
400
|
+
UnauthorizedError
|
|
401
|
+
LocationNotFoundError
|
|
402
|
+
ServiceUnavailableError
|
|
403
|
+
|
|
404
|
+
``GET /api/vcs/base``
|
|
405
|
+
"""
|
|
406
|
+
return cast(
|
|
407
|
+
"VcsBaseResponse",
|
|
408
|
+
await self._client.request(
|
|
409
|
+
RequestOptions(
|
|
410
|
+
method="GET",
|
|
411
|
+
path="/api/vcs/base",
|
|
412
|
+
query={"location": self._location(location)},
|
|
413
|
+
extra_headers=extra_headers,
|
|
414
|
+
extra_query=extra_query,
|
|
415
|
+
extra_body=extra_body,
|
|
416
|
+
timeout=timeout,
|
|
417
|
+
),
|
|
418
|
+
response_type=VcsBaseResponse,
|
|
419
|
+
),
|
|
420
|
+
)
|
|
421
|
+
|
|
422
|
+
async def status(
|
|
423
|
+
self,
|
|
424
|
+
*,
|
|
425
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
426
|
+
extra_headers: Headers | None = None,
|
|
427
|
+
extra_query: Query | None = None,
|
|
428
|
+
extra_body: Body | None = None,
|
|
429
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
430
|
+
) -> VcsStatusResponse:
|
|
431
|
+
"""VCS status.
|
|
432
|
+
|
|
433
|
+
List uncommitted working-copy changes relative to the requested location.
|
|
434
|
+
|
|
435
|
+
Raises:
|
|
436
|
+
InvalidRequestError
|
|
437
|
+
UnauthorizedError
|
|
438
|
+
LocationNotFoundError
|
|
439
|
+
|
|
440
|
+
``GET /api/vcs/status``
|
|
441
|
+
"""
|
|
442
|
+
return cast(
|
|
443
|
+
"VcsStatusResponse",
|
|
444
|
+
await self._client.request(
|
|
445
|
+
RequestOptions(
|
|
446
|
+
method="GET",
|
|
447
|
+
path="/api/vcs/status",
|
|
448
|
+
query={"location": self._location(location)},
|
|
449
|
+
extra_headers=extra_headers,
|
|
450
|
+
extra_query=extra_query,
|
|
451
|
+
extra_body=extra_body,
|
|
452
|
+
timeout=timeout,
|
|
453
|
+
),
|
|
454
|
+
response_type=VcsStatusResponse,
|
|
455
|
+
),
|
|
456
|
+
)
|
|
457
|
+
|
|
458
|
+
async def diff(
|
|
459
|
+
self,
|
|
460
|
+
*,
|
|
461
|
+
mode: VcsMode,
|
|
462
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
463
|
+
base: str | NotGiven | None = NOT_GIVEN,
|
|
464
|
+
context: int | NotGiven | None = NOT_GIVEN,
|
|
465
|
+
extra_headers: Headers | None = None,
|
|
466
|
+
extra_query: Query | None = None,
|
|
467
|
+
extra_body: Body | None = None,
|
|
468
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
469
|
+
) -> VcsDiffResponse:
|
|
470
|
+
"""VCS diff.
|
|
471
|
+
|
|
472
|
+
Diff HEAD to the working copy (working), the base merge-base to the working copy (branch), or the base merge-base to HEAD (committed). Omitting base preserves repository-default comparison; supplying it overrides the comparison without saving it.
|
|
473
|
+
|
|
474
|
+
Raises:
|
|
475
|
+
InvalidRequestError
|
|
476
|
+
UnauthorizedError
|
|
477
|
+
LocationNotFoundError
|
|
478
|
+
ServiceUnavailableError
|
|
479
|
+
|
|
480
|
+
``GET /api/vcs/diff``
|
|
481
|
+
"""
|
|
482
|
+
return cast(
|
|
483
|
+
"VcsDiffResponse",
|
|
484
|
+
await self._client.request(
|
|
485
|
+
RequestOptions(
|
|
486
|
+
method="GET",
|
|
487
|
+
path="/api/vcs/diff",
|
|
488
|
+
query={"location": self._location(location), "mode": mode, "base": base, "context": context},
|
|
489
|
+
extra_headers=extra_headers,
|
|
490
|
+
extra_query=extra_query,
|
|
491
|
+
extra_body=extra_body,
|
|
492
|
+
timeout=timeout,
|
|
493
|
+
),
|
|
494
|
+
response_type=VcsDiffResponse,
|
|
495
|
+
),
|
|
496
|
+
)
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# This file is generated by `python -m codegen` from spec/contract.json. Do not edit it by hand.
|
|
2
|
+
# OpenCode 2.1.2
|
|
3
|
+
|
|
4
|
+
"""The ``voice`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Mapping
|
|
9
|
+
from typing import Any, cast
|
|
10
|
+
|
|
11
|
+
from .._base_client import RequestOptions
|
|
12
|
+
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
13
|
+
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
14
|
+
from ..types import (
|
|
15
|
+
VoiceSessionResponseData,
|
|
16
|
+
VoiceTransportInput,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
__all__ = ["VoiceResource", "AsyncVoiceResource"]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class VoiceResource(SyncAPIResource):
|
|
23
|
+
"""Operations under ``client.voice`` (OpenCode ``voice``)."""
|
|
24
|
+
|
|
25
|
+
def session(
|
|
26
|
+
self,
|
|
27
|
+
*,
|
|
28
|
+
model: str,
|
|
29
|
+
transport: VoiceTransportInput,
|
|
30
|
+
session: Mapping[str, Any] | NotGiven | None = NOT_GIVEN,
|
|
31
|
+
extra_headers: Headers | None = None,
|
|
32
|
+
extra_query: Query | None = None,
|
|
33
|
+
extra_body: Body | None = None,
|
|
34
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
35
|
+
) -> VoiceSessionResponseData:
|
|
36
|
+
"""Create voice session.
|
|
37
|
+
|
|
38
|
+
Create a server-brokered voice session using the server's configured provider credentials and return the WebRTC SDP answer or WebSocket ephemeral token.
|
|
39
|
+
|
|
40
|
+
This endpoint is experimental in OpenCode and may change without notice.
|
|
41
|
+
|
|
42
|
+
Raises:
|
|
43
|
+
InvalidRequestError
|
|
44
|
+
UnauthorizedError
|
|
45
|
+
LocationNotFoundError
|
|
46
|
+
ServiceUnavailableError
|
|
47
|
+
|
|
48
|
+
``POST /api/experimental/voice/session``
|
|
49
|
+
"""
|
|
50
|
+
return cast(
|
|
51
|
+
"VoiceSessionResponseData",
|
|
52
|
+
self._client.request(
|
|
53
|
+
RequestOptions(
|
|
54
|
+
method="POST",
|
|
55
|
+
path="/api/experimental/voice/session",
|
|
56
|
+
body={"model": model, "session": session, "transport": transport},
|
|
57
|
+
extra_headers=extra_headers,
|
|
58
|
+
extra_query=extra_query,
|
|
59
|
+
extra_body=extra_body,
|
|
60
|
+
timeout=timeout,
|
|
61
|
+
),
|
|
62
|
+
response_type=VoiceSessionResponseData,
|
|
63
|
+
unwrap=True,
|
|
64
|
+
),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class AsyncVoiceResource(AsyncAPIResource):
|
|
69
|
+
"""Operations under ``client.voice`` (OpenCode ``voice``)."""
|
|
70
|
+
|
|
71
|
+
async def session(
|
|
72
|
+
self,
|
|
73
|
+
*,
|
|
74
|
+
model: str,
|
|
75
|
+
transport: VoiceTransportInput,
|
|
76
|
+
session: Mapping[str, Any] | NotGiven | None = NOT_GIVEN,
|
|
77
|
+
extra_headers: Headers | None = None,
|
|
78
|
+
extra_query: Query | None = None,
|
|
79
|
+
extra_body: Body | None = None,
|
|
80
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
81
|
+
) -> VoiceSessionResponseData:
|
|
82
|
+
"""Create voice session.
|
|
83
|
+
|
|
84
|
+
Create a server-brokered voice session using the server's configured provider credentials and return the WebRTC SDP answer or WebSocket ephemeral token.
|
|
85
|
+
|
|
86
|
+
This endpoint is experimental in OpenCode and may change without notice.
|
|
87
|
+
|
|
88
|
+
Raises:
|
|
89
|
+
InvalidRequestError
|
|
90
|
+
UnauthorizedError
|
|
91
|
+
LocationNotFoundError
|
|
92
|
+
ServiceUnavailableError
|
|
93
|
+
|
|
94
|
+
``POST /api/experimental/voice/session``
|
|
95
|
+
"""
|
|
96
|
+
return cast(
|
|
97
|
+
"VoiceSessionResponseData",
|
|
98
|
+
await self._client.request(
|
|
99
|
+
RequestOptions(
|
|
100
|
+
method="POST",
|
|
101
|
+
path="/api/experimental/voice/session",
|
|
102
|
+
body={"model": model, "session": session, "transport": transport},
|
|
103
|
+
extra_headers=extra_headers,
|
|
104
|
+
extra_query=extra_query,
|
|
105
|
+
extra_body=extra_body,
|
|
106
|
+
timeout=timeout,
|
|
107
|
+
),
|
|
108
|
+
response_type=VoiceSessionResponseData,
|
|
109
|
+
unwrap=True,
|
|
110
|
+
),
|
|
111
|
+
)
|