opencode-python-sdk 0.0.1.dev1__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 +221 -0
- opencode/_base_client.py +539 -0
- opencode/_client.py +255 -0
- opencode/_constants.py +27 -0
- opencode/_errors.py +547 -0
- opencode/_events.py +732 -0
- opencode/_exceptions.py +271 -0
- opencode/_models.py +54 -0
- opencode/_pagination.py +192 -0
- opencode/_pty.py +586 -0
- opencode/_qs.py +95 -0
- opencode/_resource.py +42 -0
- opencode/_rpc.py +489 -0
- opencode/_server.py +335 -0
- opencode/_streaming.py +248 -0
- opencode/_types.py +77 -0
- opencode/_unions.py +46 -0
- opencode/_version.py +8 -0
- opencode/lib/__init__.py +5 -0
- opencode/lib/_ready.py +91 -0
- opencode/lib/_session.py +231 -0
- opencode/py.typed +0 -0
- opencode/resources/__init__.py +364 -0
- opencode/resources/agent.py +179 -0
- opencode/resources/command.py +100 -0
- opencode/resources/config.py +240 -0
- opencode/resources/credential.py +384 -0
- opencode/resources/debug.py +178 -0
- opencode/resources/event.py +88 -0
- opencode/resources/experimental.py +765 -0
- opencode/resources/file.py +355 -0
- opencode/resources/form.py +100 -0
- opencode/resources/generate.py +110 -0
- opencode/resources/integration.py +1033 -0
- opencode/resources/location.py +162 -0
- opencode/resources/mcp.py +492 -0
- opencode/resources/message.py +152 -0
- opencode/resources/migration.py +118 -0
- opencode/resources/model.py +177 -0
- opencode/resources/permission.py +704 -0
- opencode/resources/plugin.py +250 -0
- opencode/resources/project.py +187 -0
- opencode/resources/provider.py +183 -0
- opencode/resources/pty.py +522 -0
- opencode/resources/reference.py +100 -0
- opencode/resources/rpc.py +113 -0
- opencode/resources/server.py +230 -0
- opencode/resources/session.py +3567 -0
- opencode/resources/shell.py +412 -0
- opencode/resources/skill.py +100 -0
- opencode/resources/vcs.py +500 -0
- opencode/resources/voice.py +113 -0
- opencode/resources/websearch.py +184 -0
- opencode/resources/worktree.py +336 -0
- opencode/testing.py +508 -0
- opencode/types/__init__.py +1462 -0
- opencode/types/_generated.py +8540 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/METADATA +468 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/RECORD +62 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/WHEEL +4 -0
- opencode_python_sdk-0.0.1.dev1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,522 @@
|
|
|
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 ``pty`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Mapping, Sequence
|
|
9
|
+
from functools import cached_property
|
|
10
|
+
from typing import TYPE_CHECKING, cast
|
|
11
|
+
|
|
12
|
+
from .._base_client import RequestOptions
|
|
13
|
+
from .._pty import AsyncPtyAttachMixin, PtyAttachMixin
|
|
14
|
+
from .._qs import encode_path_segment
|
|
15
|
+
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
16
|
+
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
17
|
+
|
|
18
|
+
if TYPE_CHECKING:
|
|
19
|
+
from ..types import (
|
|
20
|
+
Location,
|
|
21
|
+
PtyConnectTokenResponse,
|
|
22
|
+
PtyCreateResponse,
|
|
23
|
+
PtyGetResponse,
|
|
24
|
+
PtyID,
|
|
25
|
+
PtyListResponse,
|
|
26
|
+
PtyUpdateResponse,
|
|
27
|
+
PtyUpdateSize,
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
__all__ = ["PtyResource", "AsyncPtyResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class PtyConnectResource(SyncAPIResource):
|
|
34
|
+
"""Operations under ``client.pty.connect`` (OpenCode ``pty.connect``)."""
|
|
35
|
+
|
|
36
|
+
def token(
|
|
37
|
+
self,
|
|
38
|
+
pty_id: PtyID,
|
|
39
|
+
*,
|
|
40
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
41
|
+
x_opencode_ticket: str | NotGiven | None = NOT_GIVEN,
|
|
42
|
+
extra_headers: Headers | None = None,
|
|
43
|
+
extra_query: Query | None = None,
|
|
44
|
+
extra_body: Body | None = None,
|
|
45
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
46
|
+
) -> PtyConnectTokenResponse:
|
|
47
|
+
"""Create PTY WebSocket token.
|
|
48
|
+
|
|
49
|
+
Create a short-lived single-use ticket for opening a PTY WebSocket connection.
|
|
50
|
+
|
|
51
|
+
Raises:
|
|
52
|
+
InvalidRequestError: The server answered 400.
|
|
53
|
+
UnauthorizedError: The server answered 401.
|
|
54
|
+
ForbiddenError: The server answered 403.
|
|
55
|
+
PtyNotFoundError: The server answered 404.
|
|
56
|
+
LocationNotFoundError: The server answered 404.
|
|
57
|
+
|
|
58
|
+
``POST /api/pty/:ptyID/connect-token``
|
|
59
|
+
"""
|
|
60
|
+
return cast(
|
|
61
|
+
"PtyConnectTokenResponse",
|
|
62
|
+
self._client.request(
|
|
63
|
+
RequestOptions(
|
|
64
|
+
method="POST",
|
|
65
|
+
path=f"/api/pty/{encode_path_segment(pty_id)}/connect-token",
|
|
66
|
+
query={"location": self._location(location)},
|
|
67
|
+
headers={"x-opencode-ticket": x_opencode_ticket},
|
|
68
|
+
extra_headers=extra_headers,
|
|
69
|
+
extra_query=extra_query,
|
|
70
|
+
extra_body=extra_body,
|
|
71
|
+
timeout=timeout,
|
|
72
|
+
),
|
|
73
|
+
response_type="PtyConnectTokenResponse",
|
|
74
|
+
),
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class PtyResource(PtyAttachMixin):
|
|
79
|
+
"""Operations under ``client.pty`` (OpenCode ``pty``)."""
|
|
80
|
+
|
|
81
|
+
@cached_property
|
|
82
|
+
def connect(self) -> PtyConnectResource:
|
|
83
|
+
"""Operations under ``client.pty.connect``."""
|
|
84
|
+
return PtyConnectResource(self._client)
|
|
85
|
+
|
|
86
|
+
def list(
|
|
87
|
+
self,
|
|
88
|
+
*,
|
|
89
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
90
|
+
extra_headers: Headers | None = None,
|
|
91
|
+
extra_query: Query | None = None,
|
|
92
|
+
extra_body: Body | None = None,
|
|
93
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
94
|
+
) -> PtyListResponse:
|
|
95
|
+
"""List PTY sessions.
|
|
96
|
+
|
|
97
|
+
List PTY sessions for a location, including exited sessions retained until removal.
|
|
98
|
+
|
|
99
|
+
Raises:
|
|
100
|
+
InvalidRequestError: The server answered 400.
|
|
101
|
+
UnauthorizedError: The server answered 401.
|
|
102
|
+
LocationNotFoundError: The server answered 404.
|
|
103
|
+
|
|
104
|
+
``GET /api/pty``
|
|
105
|
+
"""
|
|
106
|
+
return cast(
|
|
107
|
+
"PtyListResponse",
|
|
108
|
+
self._client.request(
|
|
109
|
+
RequestOptions(
|
|
110
|
+
method="GET",
|
|
111
|
+
path="/api/pty",
|
|
112
|
+
query={"location": self._location(location)},
|
|
113
|
+
extra_headers=extra_headers,
|
|
114
|
+
extra_query=extra_query,
|
|
115
|
+
extra_body=extra_body,
|
|
116
|
+
timeout=timeout,
|
|
117
|
+
),
|
|
118
|
+
response_type="PtyListResponse",
|
|
119
|
+
),
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
def create(
|
|
123
|
+
self,
|
|
124
|
+
*,
|
|
125
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
126
|
+
command: str | NotGiven = NOT_GIVEN,
|
|
127
|
+
args: Sequence[str] | NotGiven = NOT_GIVEN,
|
|
128
|
+
cwd: str | NotGiven = NOT_GIVEN,
|
|
129
|
+
title: str | NotGiven = NOT_GIVEN,
|
|
130
|
+
env: Mapping[str, str] | NotGiven = NOT_GIVEN,
|
|
131
|
+
extra_headers: Headers | None = None,
|
|
132
|
+
extra_query: Query | None = None,
|
|
133
|
+
extra_body: Body | None = None,
|
|
134
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
135
|
+
) -> PtyCreateResponse:
|
|
136
|
+
"""Create PTY session.
|
|
137
|
+
|
|
138
|
+
Create a pseudo-terminal session for a location.
|
|
139
|
+
|
|
140
|
+
Raises:
|
|
141
|
+
InvalidRequestError: The server answered 400.
|
|
142
|
+
UnauthorizedError: The server answered 401.
|
|
143
|
+
LocationNotFoundError: The server answered 404.
|
|
144
|
+
|
|
145
|
+
``POST /api/pty``
|
|
146
|
+
"""
|
|
147
|
+
return cast(
|
|
148
|
+
"PtyCreateResponse",
|
|
149
|
+
self._client.request(
|
|
150
|
+
RequestOptions(
|
|
151
|
+
method="POST",
|
|
152
|
+
path="/api/pty",
|
|
153
|
+
query={"location": self._location(location)},
|
|
154
|
+
body={"command": command, "args": args, "cwd": cwd, "title": title, "env": env},
|
|
155
|
+
extra_headers=extra_headers,
|
|
156
|
+
extra_query=extra_query,
|
|
157
|
+
extra_body=extra_body,
|
|
158
|
+
timeout=timeout,
|
|
159
|
+
),
|
|
160
|
+
response_type="PtyCreateResponse",
|
|
161
|
+
),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
def get(
|
|
165
|
+
self,
|
|
166
|
+
pty_id: PtyID,
|
|
167
|
+
*,
|
|
168
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
169
|
+
extra_headers: Headers | None = None,
|
|
170
|
+
extra_query: Query | None = None,
|
|
171
|
+
extra_body: Body | None = None,
|
|
172
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
173
|
+
) -> PtyGetResponse:
|
|
174
|
+
"""Get PTY session.
|
|
175
|
+
|
|
176
|
+
Get one PTY session, including its exit code once exited.
|
|
177
|
+
|
|
178
|
+
Raises:
|
|
179
|
+
InvalidRequestError: The server answered 400.
|
|
180
|
+
UnauthorizedError: The server answered 401.
|
|
181
|
+
PtyNotFoundError: The server answered 404.
|
|
182
|
+
LocationNotFoundError: The server answered 404.
|
|
183
|
+
|
|
184
|
+
``GET /api/pty/:ptyID``
|
|
185
|
+
"""
|
|
186
|
+
return cast(
|
|
187
|
+
"PtyGetResponse",
|
|
188
|
+
self._client.request(
|
|
189
|
+
RequestOptions(
|
|
190
|
+
method="GET",
|
|
191
|
+
path=f"/api/pty/{encode_path_segment(pty_id)}",
|
|
192
|
+
query={"location": self._location(location)},
|
|
193
|
+
extra_headers=extra_headers,
|
|
194
|
+
extra_query=extra_query,
|
|
195
|
+
extra_body=extra_body,
|
|
196
|
+
timeout=timeout,
|
|
197
|
+
),
|
|
198
|
+
response_type="PtyGetResponse",
|
|
199
|
+
),
|
|
200
|
+
)
|
|
201
|
+
|
|
202
|
+
def update(
|
|
203
|
+
self,
|
|
204
|
+
pty_id: PtyID,
|
|
205
|
+
*,
|
|
206
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
207
|
+
title: str | NotGiven = NOT_GIVEN,
|
|
208
|
+
size: PtyUpdateSize | NotGiven = NOT_GIVEN,
|
|
209
|
+
extra_headers: Headers | None = None,
|
|
210
|
+
extra_query: Query | None = None,
|
|
211
|
+
extra_body: Body | None = None,
|
|
212
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
213
|
+
) -> PtyUpdateResponse:
|
|
214
|
+
"""Update PTY session.
|
|
215
|
+
|
|
216
|
+
Update the title or viewport size of one PTY session.
|
|
217
|
+
|
|
218
|
+
Raises:
|
|
219
|
+
InvalidRequestError: The server answered 400.
|
|
220
|
+
UnauthorizedError: The server answered 401.
|
|
221
|
+
PtyNotFoundError: The server answered 404.
|
|
222
|
+
LocationNotFoundError: The server answered 404.
|
|
223
|
+
|
|
224
|
+
``PUT /api/pty/:ptyID``
|
|
225
|
+
"""
|
|
226
|
+
return cast(
|
|
227
|
+
"PtyUpdateResponse",
|
|
228
|
+
self._client.request(
|
|
229
|
+
RequestOptions(
|
|
230
|
+
method="PUT",
|
|
231
|
+
path=f"/api/pty/{encode_path_segment(pty_id)}",
|
|
232
|
+
query={"location": self._location(location)},
|
|
233
|
+
body={"title": title, "size": size},
|
|
234
|
+
extra_headers=extra_headers,
|
|
235
|
+
extra_query=extra_query,
|
|
236
|
+
extra_body=extra_body,
|
|
237
|
+
timeout=timeout,
|
|
238
|
+
),
|
|
239
|
+
response_type="PtyUpdateResponse",
|
|
240
|
+
),
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
def remove(
|
|
244
|
+
self,
|
|
245
|
+
pty_id: PtyID,
|
|
246
|
+
*,
|
|
247
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
248
|
+
extra_headers: Headers | None = None,
|
|
249
|
+
extra_query: Query | None = None,
|
|
250
|
+
extra_body: Body | None = None,
|
|
251
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
252
|
+
) -> None:
|
|
253
|
+
"""Remove PTY session.
|
|
254
|
+
|
|
255
|
+
Terminate and remove one PTY session.
|
|
256
|
+
|
|
257
|
+
Raises:
|
|
258
|
+
InvalidRequestError: The server answered 400.
|
|
259
|
+
UnauthorizedError: The server answered 401.
|
|
260
|
+
PtyNotFoundError: The server answered 404.
|
|
261
|
+
LocationNotFoundError: The server answered 404.
|
|
262
|
+
|
|
263
|
+
``DELETE /api/pty/:ptyID``
|
|
264
|
+
"""
|
|
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,
|
|
274
|
+
),
|
|
275
|
+
kind="void",
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
class AsyncPtyConnectResource(AsyncAPIResource):
|
|
280
|
+
"""Operations under ``client.pty.connect`` (OpenCode ``pty.connect``)."""
|
|
281
|
+
|
|
282
|
+
async def token(
|
|
283
|
+
self,
|
|
284
|
+
pty_id: PtyID,
|
|
285
|
+
*,
|
|
286
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
287
|
+
x_opencode_ticket: str | NotGiven | None = NOT_GIVEN,
|
|
288
|
+
extra_headers: Headers | None = None,
|
|
289
|
+
extra_query: Query | None = None,
|
|
290
|
+
extra_body: Body | None = None,
|
|
291
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
292
|
+
) -> PtyConnectTokenResponse:
|
|
293
|
+
"""Create PTY WebSocket token.
|
|
294
|
+
|
|
295
|
+
Create a short-lived single-use ticket for opening a PTY WebSocket connection.
|
|
296
|
+
|
|
297
|
+
Raises:
|
|
298
|
+
InvalidRequestError: The server answered 400.
|
|
299
|
+
UnauthorizedError: The server answered 401.
|
|
300
|
+
ForbiddenError: The server answered 403.
|
|
301
|
+
PtyNotFoundError: The server answered 404.
|
|
302
|
+
LocationNotFoundError: The server answered 404.
|
|
303
|
+
|
|
304
|
+
``POST /api/pty/:ptyID/connect-token``
|
|
305
|
+
"""
|
|
306
|
+
return cast(
|
|
307
|
+
"PtyConnectTokenResponse",
|
|
308
|
+
await self._client.request(
|
|
309
|
+
RequestOptions(
|
|
310
|
+
method="POST",
|
|
311
|
+
path=f"/api/pty/{encode_path_segment(pty_id)}/connect-token",
|
|
312
|
+
query={"location": self._location(location)},
|
|
313
|
+
headers={"x-opencode-ticket": x_opencode_ticket},
|
|
314
|
+
extra_headers=extra_headers,
|
|
315
|
+
extra_query=extra_query,
|
|
316
|
+
extra_body=extra_body,
|
|
317
|
+
timeout=timeout,
|
|
318
|
+
),
|
|
319
|
+
response_type="PtyConnectTokenResponse",
|
|
320
|
+
),
|
|
321
|
+
)
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
class AsyncPtyResource(AsyncPtyAttachMixin):
|
|
325
|
+
"""Operations under ``client.pty`` (OpenCode ``pty``)."""
|
|
326
|
+
|
|
327
|
+
@cached_property
|
|
328
|
+
def connect(self) -> AsyncPtyConnectResource:
|
|
329
|
+
"""Operations under ``client.pty.connect``."""
|
|
330
|
+
return AsyncPtyConnectResource(self._client)
|
|
331
|
+
|
|
332
|
+
async def list(
|
|
333
|
+
self,
|
|
334
|
+
*,
|
|
335
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
336
|
+
extra_headers: Headers | None = None,
|
|
337
|
+
extra_query: Query | None = None,
|
|
338
|
+
extra_body: Body | None = None,
|
|
339
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
340
|
+
) -> PtyListResponse:
|
|
341
|
+
"""List PTY sessions.
|
|
342
|
+
|
|
343
|
+
List PTY sessions for a location, including exited sessions retained until removal.
|
|
344
|
+
|
|
345
|
+
Raises:
|
|
346
|
+
InvalidRequestError: The server answered 400.
|
|
347
|
+
UnauthorizedError: The server answered 401.
|
|
348
|
+
LocationNotFoundError: The server answered 404.
|
|
349
|
+
|
|
350
|
+
``GET /api/pty``
|
|
351
|
+
"""
|
|
352
|
+
return cast(
|
|
353
|
+
"PtyListResponse",
|
|
354
|
+
await self._client.request(
|
|
355
|
+
RequestOptions(
|
|
356
|
+
method="GET",
|
|
357
|
+
path="/api/pty",
|
|
358
|
+
query={"location": self._location(location)},
|
|
359
|
+
extra_headers=extra_headers,
|
|
360
|
+
extra_query=extra_query,
|
|
361
|
+
extra_body=extra_body,
|
|
362
|
+
timeout=timeout,
|
|
363
|
+
),
|
|
364
|
+
response_type="PtyListResponse",
|
|
365
|
+
),
|
|
366
|
+
)
|
|
367
|
+
|
|
368
|
+
async def create(
|
|
369
|
+
self,
|
|
370
|
+
*,
|
|
371
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
372
|
+
command: str | NotGiven = NOT_GIVEN,
|
|
373
|
+
args: Sequence[str] | NotGiven = NOT_GIVEN,
|
|
374
|
+
cwd: str | NotGiven = NOT_GIVEN,
|
|
375
|
+
title: str | NotGiven = NOT_GIVEN,
|
|
376
|
+
env: Mapping[str, str] | NotGiven = NOT_GIVEN,
|
|
377
|
+
extra_headers: Headers | None = None,
|
|
378
|
+
extra_query: Query | None = None,
|
|
379
|
+
extra_body: Body | None = None,
|
|
380
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
381
|
+
) -> PtyCreateResponse:
|
|
382
|
+
"""Create PTY session.
|
|
383
|
+
|
|
384
|
+
Create a pseudo-terminal session for a location.
|
|
385
|
+
|
|
386
|
+
Raises:
|
|
387
|
+
InvalidRequestError: The server answered 400.
|
|
388
|
+
UnauthorizedError: The server answered 401.
|
|
389
|
+
LocationNotFoundError: The server answered 404.
|
|
390
|
+
|
|
391
|
+
``POST /api/pty``
|
|
392
|
+
"""
|
|
393
|
+
return cast(
|
|
394
|
+
"PtyCreateResponse",
|
|
395
|
+
await self._client.request(
|
|
396
|
+
RequestOptions(
|
|
397
|
+
method="POST",
|
|
398
|
+
path="/api/pty",
|
|
399
|
+
query={"location": self._location(location)},
|
|
400
|
+
body={"command": command, "args": args, "cwd": cwd, "title": title, "env": env},
|
|
401
|
+
extra_headers=extra_headers,
|
|
402
|
+
extra_query=extra_query,
|
|
403
|
+
extra_body=extra_body,
|
|
404
|
+
timeout=timeout,
|
|
405
|
+
),
|
|
406
|
+
response_type="PtyCreateResponse",
|
|
407
|
+
),
|
|
408
|
+
)
|
|
409
|
+
|
|
410
|
+
async def get(
|
|
411
|
+
self,
|
|
412
|
+
pty_id: PtyID,
|
|
413
|
+
*,
|
|
414
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
415
|
+
extra_headers: Headers | None = None,
|
|
416
|
+
extra_query: Query | None = None,
|
|
417
|
+
extra_body: Body | None = None,
|
|
418
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
419
|
+
) -> PtyGetResponse:
|
|
420
|
+
"""Get PTY session.
|
|
421
|
+
|
|
422
|
+
Get one PTY session, including its exit code once exited.
|
|
423
|
+
|
|
424
|
+
Raises:
|
|
425
|
+
InvalidRequestError: The server answered 400.
|
|
426
|
+
UnauthorizedError: The server answered 401.
|
|
427
|
+
PtyNotFoundError: The server answered 404.
|
|
428
|
+
LocationNotFoundError: The server answered 404.
|
|
429
|
+
|
|
430
|
+
``GET /api/pty/:ptyID``
|
|
431
|
+
"""
|
|
432
|
+
return cast(
|
|
433
|
+
"PtyGetResponse",
|
|
434
|
+
await self._client.request(
|
|
435
|
+
RequestOptions(
|
|
436
|
+
method="GET",
|
|
437
|
+
path=f"/api/pty/{encode_path_segment(pty_id)}",
|
|
438
|
+
query={"location": self._location(location)},
|
|
439
|
+
extra_headers=extra_headers,
|
|
440
|
+
extra_query=extra_query,
|
|
441
|
+
extra_body=extra_body,
|
|
442
|
+
timeout=timeout,
|
|
443
|
+
),
|
|
444
|
+
response_type="PtyGetResponse",
|
|
445
|
+
),
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
async def update(
|
|
449
|
+
self,
|
|
450
|
+
pty_id: PtyID,
|
|
451
|
+
*,
|
|
452
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
453
|
+
title: str | NotGiven = NOT_GIVEN,
|
|
454
|
+
size: PtyUpdateSize | NotGiven = NOT_GIVEN,
|
|
455
|
+
extra_headers: Headers | None = None,
|
|
456
|
+
extra_query: Query | None = None,
|
|
457
|
+
extra_body: Body | None = None,
|
|
458
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
459
|
+
) -> PtyUpdateResponse:
|
|
460
|
+
"""Update PTY session.
|
|
461
|
+
|
|
462
|
+
Update the title or viewport size of one PTY session.
|
|
463
|
+
|
|
464
|
+
Raises:
|
|
465
|
+
InvalidRequestError: The server answered 400.
|
|
466
|
+
UnauthorizedError: The server answered 401.
|
|
467
|
+
PtyNotFoundError: The server answered 404.
|
|
468
|
+
LocationNotFoundError: The server answered 404.
|
|
469
|
+
|
|
470
|
+
``PUT /api/pty/:ptyID``
|
|
471
|
+
"""
|
|
472
|
+
return cast(
|
|
473
|
+
"PtyUpdateResponse",
|
|
474
|
+
await self._client.request(
|
|
475
|
+
RequestOptions(
|
|
476
|
+
method="PUT",
|
|
477
|
+
path=f"/api/pty/{encode_path_segment(pty_id)}",
|
|
478
|
+
query={"location": self._location(location)},
|
|
479
|
+
body={"title": title, "size": size},
|
|
480
|
+
extra_headers=extra_headers,
|
|
481
|
+
extra_query=extra_query,
|
|
482
|
+
extra_body=extra_body,
|
|
483
|
+
timeout=timeout,
|
|
484
|
+
),
|
|
485
|
+
response_type="PtyUpdateResponse",
|
|
486
|
+
),
|
|
487
|
+
)
|
|
488
|
+
|
|
489
|
+
async def remove(
|
|
490
|
+
self,
|
|
491
|
+
pty_id: PtyID,
|
|
492
|
+
*,
|
|
493
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
494
|
+
extra_headers: Headers | None = None,
|
|
495
|
+
extra_query: Query | None = None,
|
|
496
|
+
extra_body: Body | None = None,
|
|
497
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
498
|
+
) -> None:
|
|
499
|
+
"""Remove PTY session.
|
|
500
|
+
|
|
501
|
+
Terminate and remove one PTY session.
|
|
502
|
+
|
|
503
|
+
Raises:
|
|
504
|
+
InvalidRequestError: The server answered 400.
|
|
505
|
+
UnauthorizedError: The server answered 401.
|
|
506
|
+
PtyNotFoundError: The server answered 404.
|
|
507
|
+
LocationNotFoundError: The server answered 404.
|
|
508
|
+
|
|
509
|
+
``DELETE /api/pty/:ptyID``
|
|
510
|
+
"""
|
|
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,
|
|
520
|
+
),
|
|
521
|
+
kind="void",
|
|
522
|
+
)
|
|
@@ -0,0 +1,100 @@
|
|
|
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 ``reference`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import TYPE_CHECKING, cast
|
|
9
|
+
|
|
10
|
+
from .._base_client import RequestOptions
|
|
11
|
+
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
12
|
+
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
13
|
+
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from ..types import (
|
|
16
|
+
Location,
|
|
17
|
+
ReferenceListResponse,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = ["ReferenceResource", "AsyncReferenceResource"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ReferenceResource(SyncAPIResource):
|
|
24
|
+
"""Operations under ``client.reference`` (OpenCode ``reference``)."""
|
|
25
|
+
|
|
26
|
+
def list(
|
|
27
|
+
self,
|
|
28
|
+
*,
|
|
29
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
30
|
+
extra_headers: Headers | None = None,
|
|
31
|
+
extra_query: Query | None = None,
|
|
32
|
+
extra_body: Body | None = None,
|
|
33
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
34
|
+
) -> ReferenceListResponse:
|
|
35
|
+
"""List references.
|
|
36
|
+
|
|
37
|
+
List references available in the requested location.
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
InvalidRequestError: The server answered 400.
|
|
41
|
+
UnauthorizedError: The server answered 401.
|
|
42
|
+
LocationNotFoundError: The server answered 404.
|
|
43
|
+
|
|
44
|
+
``GET /api/reference``
|
|
45
|
+
"""
|
|
46
|
+
return cast(
|
|
47
|
+
"ReferenceListResponse",
|
|
48
|
+
self._client.request(
|
|
49
|
+
RequestOptions(
|
|
50
|
+
method="GET",
|
|
51
|
+
path="/api/reference",
|
|
52
|
+
query={"location": self._location(location)},
|
|
53
|
+
extra_headers=extra_headers,
|
|
54
|
+
extra_query=extra_query,
|
|
55
|
+
extra_body=extra_body,
|
|
56
|
+
timeout=timeout,
|
|
57
|
+
),
|
|
58
|
+
response_type="ReferenceListResponse",
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class AsyncReferenceResource(AsyncAPIResource):
|
|
64
|
+
"""Operations under ``client.reference`` (OpenCode ``reference``)."""
|
|
65
|
+
|
|
66
|
+
async def list(
|
|
67
|
+
self,
|
|
68
|
+
*,
|
|
69
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
70
|
+
extra_headers: Headers | None = None,
|
|
71
|
+
extra_query: Query | None = None,
|
|
72
|
+
extra_body: Body | None = None,
|
|
73
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
74
|
+
) -> ReferenceListResponse:
|
|
75
|
+
"""List references.
|
|
76
|
+
|
|
77
|
+
List references available in the requested location.
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
InvalidRequestError: The server answered 400.
|
|
81
|
+
UnauthorizedError: The server answered 401.
|
|
82
|
+
LocationNotFoundError: The server answered 404.
|
|
83
|
+
|
|
84
|
+
``GET /api/reference``
|
|
85
|
+
"""
|
|
86
|
+
return cast(
|
|
87
|
+
"ReferenceListResponse",
|
|
88
|
+
await self._client.request(
|
|
89
|
+
RequestOptions(
|
|
90
|
+
method="GET",
|
|
91
|
+
path="/api/reference",
|
|
92
|
+
query={"location": self._location(location)},
|
|
93
|
+
extra_headers=extra_headers,
|
|
94
|
+
extra_query=extra_query,
|
|
95
|
+
extra_body=extra_body,
|
|
96
|
+
timeout=timeout,
|
|
97
|
+
),
|
|
98
|
+
response_type="ReferenceListResponse",
|
|
99
|
+
),
|
|
100
|
+
)
|