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.
Files changed (55) hide show
  1. opencode/.generated.json +39 -0
  2. opencode/__init__.py +156 -0
  3. opencode/_base_client.py +518 -0
  4. opencode/_client.py +167 -0
  5. opencode/_constants.py +27 -0
  6. opencode/_errors.py +547 -0
  7. opencode/_exceptions.py +249 -0
  8. opencode/_models.py +54 -0
  9. opencode/_pagination.py +192 -0
  10. opencode/_qs.py +95 -0
  11. opencode/_resource.py +42 -0
  12. opencode/_server.py +327 -0
  13. opencode/_streaming.py +227 -0
  14. opencode/_types.py +77 -0
  15. opencode/_unions.py +46 -0
  16. opencode/_version.py +8 -0
  17. opencode/py.typed +0 -0
  18. opencode/resources/__init__.py +364 -0
  19. opencode/resources/agent.py +177 -0
  20. opencode/resources/command.py +98 -0
  21. opencode/resources/config.py +238 -0
  22. opencode/resources/credential.py +382 -0
  23. opencode/resources/debug.py +174 -0
  24. opencode/resources/event.py +84 -0
  25. opencode/resources/experimental.py +760 -0
  26. opencode/resources/file.py +353 -0
  27. opencode/resources/form.py +98 -0
  28. opencode/resources/generate.py +108 -0
  29. opencode/resources/integration.py +1023 -0
  30. opencode/resources/location.py +160 -0
  31. opencode/resources/mcp.py +488 -0
  32. opencode/resources/message.py +151 -0
  33. opencode/resources/migration.py +118 -0
  34. opencode/resources/model.py +175 -0
  35. opencode/resources/permission.py +698 -0
  36. opencode/resources/plugin.py +248 -0
  37. opencode/resources/project.py +185 -0
  38. opencode/resources/provider.py +181 -0
  39. opencode/resources/pty.py +517 -0
  40. opencode/resources/reference.py +98 -0
  41. opencode/resources/rpc.py +111 -0
  42. opencode/resources/server.py +228 -0
  43. opencode/resources/session.py +3553 -0
  44. opencode/resources/shell.py +410 -0
  45. opencode/resources/skill.py +98 -0
  46. opencode/resources/vcs.py +496 -0
  47. opencode/resources/voice.py +111 -0
  48. opencode/resources/websearch.py +182 -0
  49. opencode/resources/worktree.py +334 -0
  50. opencode/types/__init__.py +1462 -0
  51. opencode/types/_generated.py +8540 -0
  52. opencode_python_sdk-0.1.0.dist-info/METADATA +317 -0
  53. opencode_python_sdk-0.1.0.dist-info/RECORD +55 -0
  54. opencode_python_sdk-0.1.0.dist-info/WHEEL +4 -0
  55. opencode_python_sdk-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,174 @@
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 ``debug`` resource."""
5
+
6
+ from __future__ import annotations
7
+
8
+ import builtins
9
+ from functools import cached_property
10
+ from typing import cast
11
+
12
+ from .._base_client import RequestOptions
13
+ from .._resource import AsyncAPIResource, SyncAPIResource
14
+ from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
15
+ from ..types import (
16
+ Location,
17
+ LocationPublicRef,
18
+ )
19
+
20
+ __all__ = ["DebugResource", "AsyncDebugResource"]
21
+
22
+
23
+ class DebugLocationResource(SyncAPIResource):
24
+ """Operations under ``client.debug.location`` (OpenCode ``debug.location``)."""
25
+
26
+ def list(
27
+ self,
28
+ *,
29
+ extra_headers: Headers | None = None,
30
+ extra_query: Query | None = None,
31
+ extra_body: Body | None = None,
32
+ timeout: Timeout | NotGiven = NOT_GIVEN,
33
+ ) -> builtins.list[LocationPublicRef]:
34
+ """List loaded locations.
35
+
36
+ List locations currently loaded by the server.
37
+
38
+ Raises:
39
+ InvalidRequestError
40
+ UnauthorizedError
41
+
42
+ ``GET /api/debug/location``
43
+ """
44
+ return cast(
45
+ "builtins.list[LocationPublicRef]",
46
+ self._client.request(
47
+ RequestOptions(
48
+ method="GET",
49
+ path="/api/debug/location",
50
+ extra_headers=extra_headers,
51
+ extra_query=extra_query,
52
+ extra_body=extra_body,
53
+ timeout=timeout,
54
+ ),
55
+ response_type=builtins.list[LocationPublicRef],
56
+ ),
57
+ )
58
+
59
+ def evict(
60
+ self,
61
+ *,
62
+ location: Location | NotGiven | None = NOT_GIVEN,
63
+ extra_headers: Headers | None = None,
64
+ extra_query: Query | None = None,
65
+ extra_body: Body | None = None,
66
+ timeout: Timeout | NotGiven = NOT_GIVEN,
67
+ ) -> None:
68
+ """Evict a loaded location.
69
+
70
+ Dispose the requested location's cached services so its next use boots them fresh.
71
+
72
+ Raises:
73
+ InvalidRequestError
74
+ UnauthorizedError
75
+
76
+ ``DELETE /api/debug/location``
77
+ """
78
+ self._client.request(
79
+ RequestOptions(
80
+ method="DELETE",
81
+ path="/api/debug/location",
82
+ query={"location": self._location(location)},
83
+ extra_headers=extra_headers,
84
+ extra_query=extra_query,
85
+ extra_body=extra_body,
86
+ timeout=timeout,
87
+ ),
88
+ kind="void",
89
+ )
90
+
91
+
92
+ class DebugResource(SyncAPIResource):
93
+ """Operations under ``client.debug`` (OpenCode ``debug``)."""
94
+
95
+ @cached_property
96
+ def location(self) -> DebugLocationResource:
97
+ return DebugLocationResource(self._client)
98
+
99
+
100
+ class AsyncDebugLocationResource(AsyncAPIResource):
101
+ """Operations under ``client.debug.location`` (OpenCode ``debug.location``)."""
102
+
103
+ async def list(
104
+ self,
105
+ *,
106
+ extra_headers: Headers | None = None,
107
+ extra_query: Query | None = None,
108
+ extra_body: Body | None = None,
109
+ timeout: Timeout | NotGiven = NOT_GIVEN,
110
+ ) -> builtins.list[LocationPublicRef]:
111
+ """List loaded locations.
112
+
113
+ List locations currently loaded by the server.
114
+
115
+ Raises:
116
+ InvalidRequestError
117
+ UnauthorizedError
118
+
119
+ ``GET /api/debug/location``
120
+ """
121
+ return cast(
122
+ "builtins.list[LocationPublicRef]",
123
+ await self._client.request(
124
+ RequestOptions(
125
+ method="GET",
126
+ path="/api/debug/location",
127
+ extra_headers=extra_headers,
128
+ extra_query=extra_query,
129
+ extra_body=extra_body,
130
+ timeout=timeout,
131
+ ),
132
+ response_type=builtins.list[LocationPublicRef],
133
+ ),
134
+ )
135
+
136
+ async def evict(
137
+ self,
138
+ *,
139
+ location: Location | NotGiven | None = NOT_GIVEN,
140
+ extra_headers: Headers | None = None,
141
+ extra_query: Query | None = None,
142
+ extra_body: Body | None = None,
143
+ timeout: Timeout | NotGiven = NOT_GIVEN,
144
+ ) -> None:
145
+ """Evict a loaded location.
146
+
147
+ Dispose the requested location's cached services so its next use boots them fresh.
148
+
149
+ Raises:
150
+ InvalidRequestError
151
+ UnauthorizedError
152
+
153
+ ``DELETE /api/debug/location``
154
+ """
155
+ await self._client.request(
156
+ RequestOptions(
157
+ method="DELETE",
158
+ path="/api/debug/location",
159
+ query={"location": self._location(location)},
160
+ extra_headers=extra_headers,
161
+ extra_query=extra_query,
162
+ extra_body=extra_body,
163
+ timeout=timeout,
164
+ ),
165
+ kind="void",
166
+ )
167
+
168
+
169
+ class AsyncDebugResource(AsyncAPIResource):
170
+ """Operations under ``client.debug`` (OpenCode ``debug``)."""
171
+
172
+ @cached_property
173
+ def location(self) -> AsyncDebugLocationResource:
174
+ return AsyncDebugLocationResource(self._client)
@@ -0,0 +1,84 @@
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 ``event`` resource."""
5
+
6
+ from __future__ import annotations
7
+
8
+ from .._base_client import RequestOptions
9
+ from .._resource import AsyncAPIResource, SyncAPIResource
10
+ from .._streaming import AsyncStream, Stream
11
+ from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
12
+ from ..types import (
13
+ Event,
14
+ )
15
+
16
+ __all__ = ["EventResource", "AsyncEventResource"]
17
+
18
+
19
+ class EventResource(SyncAPIResource):
20
+ """Operations under ``client.event`` (OpenCode ``event``)."""
21
+
22
+ def subscribe(
23
+ self,
24
+ *,
25
+ extra_headers: Headers | None = None,
26
+ extra_query: Query | None = None,
27
+ extra_body: Body | None = None,
28
+ timeout: Timeout | NotGiven = NOT_GIVEN,
29
+ ) -> Stream[Event]:
30
+ """Subscribe to events.
31
+
32
+ Subscribe to native events and plugin RPC events across all server locations. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.
33
+
34
+ Raises:
35
+ InvalidRequestError
36
+ UnauthorizedError
37
+
38
+ ``GET /api/event``
39
+ """
40
+ return self._client.stream(
41
+ RequestOptions(
42
+ method="GET",
43
+ path="/api/event",
44
+ extra_headers=extra_headers,
45
+ extra_query=extra_query,
46
+ extra_body=extra_body,
47
+ timeout=timeout,
48
+ ),
49
+ item_type=Event,
50
+ )
51
+
52
+
53
+ class AsyncEventResource(AsyncAPIResource):
54
+ """Operations under ``client.event`` (OpenCode ``event``)."""
55
+
56
+ async def subscribe(
57
+ self,
58
+ *,
59
+ extra_headers: Headers | None = None,
60
+ extra_query: Query | None = None,
61
+ extra_body: Body | None = None,
62
+ timeout: Timeout | NotGiven = NOT_GIVEN,
63
+ ) -> AsyncStream[Event]:
64
+ """Subscribe to events.
65
+
66
+ Subscribe to native events and plugin RPC events across all server locations. Volatile by contract: a slow consumer overflows and fails the stream, and events during disconnection are missed.
67
+
68
+ Raises:
69
+ InvalidRequestError
70
+ UnauthorizedError
71
+
72
+ ``GET /api/event``
73
+ """
74
+ return await self._client.stream(
75
+ RequestOptions(
76
+ method="GET",
77
+ path="/api/event",
78
+ extra_headers=extra_headers,
79
+ extra_query=extra_query,
80
+ extra_body=extra_body,
81
+ timeout=timeout,
82
+ ),
83
+ item_type=Event,
84
+ )