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,238 @@
|
|
|
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 ``config`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import builtins
|
|
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
|
+
ConfigEntry,
|
|
16
|
+
ConfigShellOption,
|
|
17
|
+
Location,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
__all__ = ["ConfigResource", "AsyncConfigResource"]
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class ConfigResource(SyncAPIResource):
|
|
24
|
+
"""Operations under ``client.config`` (OpenCode ``config``)."""
|
|
25
|
+
|
|
26
|
+
def get(
|
|
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
|
+
) -> builtins.list[ConfigEntry]:
|
|
35
|
+
"""Get configuration.
|
|
36
|
+
|
|
37
|
+
Return configuration documents and discovery sources for the requested location, from lowest to highest priority.
|
|
38
|
+
|
|
39
|
+
Raises:
|
|
40
|
+
InvalidRequestError
|
|
41
|
+
UnauthorizedError
|
|
42
|
+
LocationNotFoundError
|
|
43
|
+
|
|
44
|
+
``GET /api/config``
|
|
45
|
+
"""
|
|
46
|
+
return cast(
|
|
47
|
+
"builtins.list[ConfigEntry]",
|
|
48
|
+
self._client.request(
|
|
49
|
+
RequestOptions(
|
|
50
|
+
method="GET",
|
|
51
|
+
path="/api/config",
|
|
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=builtins.list[ConfigEntry],
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def shells(
|
|
63
|
+
self,
|
|
64
|
+
*,
|
|
65
|
+
extra_headers: Headers | None = None,
|
|
66
|
+
extra_query: Query | None = None,
|
|
67
|
+
extra_body: Body | None = None,
|
|
68
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
69
|
+
) -> builtins.list[ConfigShellOption]:
|
|
70
|
+
"""List available shells.
|
|
71
|
+
|
|
72
|
+
Return shells available to terminal and agent execution.
|
|
73
|
+
|
|
74
|
+
Raises:
|
|
75
|
+
InvalidRequestError
|
|
76
|
+
UnauthorizedError
|
|
77
|
+
LocationNotFoundError
|
|
78
|
+
|
|
79
|
+
``GET /api/config/shell``
|
|
80
|
+
"""
|
|
81
|
+
return cast(
|
|
82
|
+
"builtins.list[ConfigShellOption]",
|
|
83
|
+
self._client.request(
|
|
84
|
+
RequestOptions(
|
|
85
|
+
method="GET",
|
|
86
|
+
path="/api/config/shell",
|
|
87
|
+
extra_headers=extra_headers,
|
|
88
|
+
extra_query=extra_query,
|
|
89
|
+
extra_body=extra_body,
|
|
90
|
+
timeout=timeout,
|
|
91
|
+
),
|
|
92
|
+
response_type=builtins.list[ConfigShellOption],
|
|
93
|
+
),
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
def update(
|
|
97
|
+
self,
|
|
98
|
+
*,
|
|
99
|
+
shell: str | None,
|
|
100
|
+
extra_headers: Headers | None = None,
|
|
101
|
+
extra_query: Query | None = None,
|
|
102
|
+
extra_body: Body | None = None,
|
|
103
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
104
|
+
) -> None:
|
|
105
|
+
"""Update global configuration.
|
|
106
|
+
|
|
107
|
+
Patch supported fields in the highest-precedence global configuration document.
|
|
108
|
+
|
|
109
|
+
This endpoint is experimental in OpenCode and may change without notice.
|
|
110
|
+
|
|
111
|
+
Raises:
|
|
112
|
+
InvalidRequestError
|
|
113
|
+
UnauthorizedError
|
|
114
|
+
LocationNotFoundError
|
|
115
|
+
|
|
116
|
+
``PATCH /api/experimental/config``
|
|
117
|
+
"""
|
|
118
|
+
self._client.request(
|
|
119
|
+
RequestOptions(
|
|
120
|
+
method="PATCH",
|
|
121
|
+
path="/api/experimental/config",
|
|
122
|
+
body={"shell": shell},
|
|
123
|
+
extra_headers=extra_headers,
|
|
124
|
+
extra_query=extra_query,
|
|
125
|
+
extra_body=extra_body,
|
|
126
|
+
timeout=timeout,
|
|
127
|
+
),
|
|
128
|
+
kind="void",
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
class AsyncConfigResource(AsyncAPIResource):
|
|
133
|
+
"""Operations under ``client.config`` (OpenCode ``config``)."""
|
|
134
|
+
|
|
135
|
+
async def get(
|
|
136
|
+
self,
|
|
137
|
+
*,
|
|
138
|
+
location: Location | NotGiven | None = NOT_GIVEN,
|
|
139
|
+
extra_headers: Headers | None = None,
|
|
140
|
+
extra_query: Query | None = None,
|
|
141
|
+
extra_body: Body | None = None,
|
|
142
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
143
|
+
) -> builtins.list[ConfigEntry]:
|
|
144
|
+
"""Get configuration.
|
|
145
|
+
|
|
146
|
+
Return configuration documents and discovery sources for the requested location, from lowest to highest priority.
|
|
147
|
+
|
|
148
|
+
Raises:
|
|
149
|
+
InvalidRequestError
|
|
150
|
+
UnauthorizedError
|
|
151
|
+
LocationNotFoundError
|
|
152
|
+
|
|
153
|
+
``GET /api/config``
|
|
154
|
+
"""
|
|
155
|
+
return cast(
|
|
156
|
+
"builtins.list[ConfigEntry]",
|
|
157
|
+
await self._client.request(
|
|
158
|
+
RequestOptions(
|
|
159
|
+
method="GET",
|
|
160
|
+
path="/api/config",
|
|
161
|
+
query={"location": self._location(location)},
|
|
162
|
+
extra_headers=extra_headers,
|
|
163
|
+
extra_query=extra_query,
|
|
164
|
+
extra_body=extra_body,
|
|
165
|
+
timeout=timeout,
|
|
166
|
+
),
|
|
167
|
+
response_type=builtins.list[ConfigEntry],
|
|
168
|
+
),
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
async def shells(
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
extra_headers: Headers | None = None,
|
|
175
|
+
extra_query: Query | None = None,
|
|
176
|
+
extra_body: Body | None = None,
|
|
177
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
178
|
+
) -> builtins.list[ConfigShellOption]:
|
|
179
|
+
"""List available shells.
|
|
180
|
+
|
|
181
|
+
Return shells available to terminal and agent execution.
|
|
182
|
+
|
|
183
|
+
Raises:
|
|
184
|
+
InvalidRequestError
|
|
185
|
+
UnauthorizedError
|
|
186
|
+
LocationNotFoundError
|
|
187
|
+
|
|
188
|
+
``GET /api/config/shell``
|
|
189
|
+
"""
|
|
190
|
+
return cast(
|
|
191
|
+
"builtins.list[ConfigShellOption]",
|
|
192
|
+
await self._client.request(
|
|
193
|
+
RequestOptions(
|
|
194
|
+
method="GET",
|
|
195
|
+
path="/api/config/shell",
|
|
196
|
+
extra_headers=extra_headers,
|
|
197
|
+
extra_query=extra_query,
|
|
198
|
+
extra_body=extra_body,
|
|
199
|
+
timeout=timeout,
|
|
200
|
+
),
|
|
201
|
+
response_type=builtins.list[ConfigShellOption],
|
|
202
|
+
),
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
async def update(
|
|
206
|
+
self,
|
|
207
|
+
*,
|
|
208
|
+
shell: str | None,
|
|
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
|
+
) -> None:
|
|
214
|
+
"""Update global configuration.
|
|
215
|
+
|
|
216
|
+
Patch supported fields in the highest-precedence global configuration document.
|
|
217
|
+
|
|
218
|
+
This endpoint is experimental in OpenCode and may change without notice.
|
|
219
|
+
|
|
220
|
+
Raises:
|
|
221
|
+
InvalidRequestError
|
|
222
|
+
UnauthorizedError
|
|
223
|
+
LocationNotFoundError
|
|
224
|
+
|
|
225
|
+
``PATCH /api/experimental/config``
|
|
226
|
+
"""
|
|
227
|
+
await self._client.request(
|
|
228
|
+
RequestOptions(
|
|
229
|
+
method="PATCH",
|
|
230
|
+
path="/api/experimental/config",
|
|
231
|
+
body={"shell": shell},
|
|
232
|
+
extra_headers=extra_headers,
|
|
233
|
+
extra_query=extra_query,
|
|
234
|
+
extra_body=extra_body,
|
|
235
|
+
timeout=timeout,
|
|
236
|
+
),
|
|
237
|
+
kind="void",
|
|
238
|
+
)
|
|
@@ -0,0 +1,382 @@
|
|
|
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 ``credential`` resource."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import builtins
|
|
9
|
+
from typing import cast
|
|
10
|
+
|
|
11
|
+
from .._base_client import RequestOptions
|
|
12
|
+
from .._qs import encode_path_segment
|
|
13
|
+
from .._resource import AsyncAPIResource, SyncAPIResource
|
|
14
|
+
from .._types import NOT_GIVEN, Body, Headers, NotGiven, Query, Timeout
|
|
15
|
+
from ..types import (
|
|
16
|
+
CredentialEntry,
|
|
17
|
+
CredentialID,
|
|
18
|
+
CredentialValue,
|
|
19
|
+
IntegrationID,
|
|
20
|
+
)
|
|
21
|
+
|
|
22
|
+
__all__ = ["CredentialResource", "AsyncCredentialResource"]
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class CredentialResource(SyncAPIResource):
|
|
26
|
+
"""Operations under ``client.credential`` (OpenCode ``credential``)."""
|
|
27
|
+
|
|
28
|
+
def list(
|
|
29
|
+
self,
|
|
30
|
+
*,
|
|
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
|
+
) -> builtins.list[CredentialEntry]:
|
|
36
|
+
"""List credentials.
|
|
37
|
+
|
|
38
|
+
List every stored integration credential, including its secret value.
|
|
39
|
+
|
|
40
|
+
Raises:
|
|
41
|
+
InvalidRequestError
|
|
42
|
+
UnauthorizedError
|
|
43
|
+
|
|
44
|
+
``GET /api/credential``
|
|
45
|
+
"""
|
|
46
|
+
return cast(
|
|
47
|
+
"builtins.list[CredentialEntry]",
|
|
48
|
+
self._client.request(
|
|
49
|
+
RequestOptions(
|
|
50
|
+
method="GET",
|
|
51
|
+
path="/api/credential",
|
|
52
|
+
extra_headers=extra_headers,
|
|
53
|
+
extra_query=extra_query,
|
|
54
|
+
extra_body=extra_body,
|
|
55
|
+
timeout=timeout,
|
|
56
|
+
),
|
|
57
|
+
response_type=builtins.list[CredentialEntry],
|
|
58
|
+
unwrap=True,
|
|
59
|
+
),
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
def create(
|
|
63
|
+
self,
|
|
64
|
+
*,
|
|
65
|
+
integration_id: IntegrationID,
|
|
66
|
+
value: CredentialValue,
|
|
67
|
+
id: CredentialID | NotGiven = NOT_GIVEN,
|
|
68
|
+
label: str | NotGiven = NOT_GIVEN,
|
|
69
|
+
activate: bool | NotGiven = 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
|
+
) -> CredentialEntry:
|
|
75
|
+
"""Create credential.
|
|
76
|
+
|
|
77
|
+
Store an integration credential. It becomes the integration's active credential unless activate is false and the integration already has one. Fails with a conflict when the requested ID already exists.
|
|
78
|
+
|
|
79
|
+
Raises:
|
|
80
|
+
InvalidRequestError
|
|
81
|
+
UnauthorizedError
|
|
82
|
+
ConflictError
|
|
83
|
+
|
|
84
|
+
``POST /api/credential``
|
|
85
|
+
"""
|
|
86
|
+
return cast(
|
|
87
|
+
"CredentialEntry",
|
|
88
|
+
self._client.request(
|
|
89
|
+
RequestOptions(
|
|
90
|
+
method="POST",
|
|
91
|
+
path="/api/credential",
|
|
92
|
+
body={
|
|
93
|
+
"id": id,
|
|
94
|
+
"integrationID": integration_id,
|
|
95
|
+
"label": label,
|
|
96
|
+
"value": value,
|
|
97
|
+
"activate": activate,
|
|
98
|
+
},
|
|
99
|
+
extra_headers=extra_headers,
|
|
100
|
+
extra_query=extra_query,
|
|
101
|
+
extra_body=extra_body,
|
|
102
|
+
timeout=timeout,
|
|
103
|
+
),
|
|
104
|
+
response_type=CredentialEntry,
|
|
105
|
+
unwrap=True,
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
def update(
|
|
110
|
+
self,
|
|
111
|
+
credential_id: CredentialID,
|
|
112
|
+
*,
|
|
113
|
+
label: str,
|
|
114
|
+
extra_headers: Headers | None = None,
|
|
115
|
+
extra_query: Query | None = None,
|
|
116
|
+
extra_body: Body | None = None,
|
|
117
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
118
|
+
) -> None:
|
|
119
|
+
"""Update credential.
|
|
120
|
+
|
|
121
|
+
Update a stored credential label.
|
|
122
|
+
|
|
123
|
+
Raises:
|
|
124
|
+
InvalidRequestError
|
|
125
|
+
UnauthorizedError
|
|
126
|
+
|
|
127
|
+
``PATCH /api/credential/:credentialID``
|
|
128
|
+
"""
|
|
129
|
+
self._client.request(
|
|
130
|
+
RequestOptions(
|
|
131
|
+
method="PATCH",
|
|
132
|
+
path=f"/api/credential/{encode_path_segment(credential_id)}",
|
|
133
|
+
body={"label": label},
|
|
134
|
+
extra_headers=extra_headers,
|
|
135
|
+
extra_query=extra_query,
|
|
136
|
+
extra_body=extra_body,
|
|
137
|
+
timeout=timeout,
|
|
138
|
+
),
|
|
139
|
+
kind="void",
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
def activate(
|
|
143
|
+
self,
|
|
144
|
+
credential_id: CredentialID,
|
|
145
|
+
*,
|
|
146
|
+
extra_headers: Headers | None = None,
|
|
147
|
+
extra_query: Query | None = None,
|
|
148
|
+
extra_body: Body | None = None,
|
|
149
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
150
|
+
) -> None:
|
|
151
|
+
"""Activate credential.
|
|
152
|
+
|
|
153
|
+
Activate a stored integration credential.
|
|
154
|
+
|
|
155
|
+
Raises:
|
|
156
|
+
InvalidRequestError
|
|
157
|
+
UnauthorizedError
|
|
158
|
+
|
|
159
|
+
``POST /api/credential/:credentialID/activate``
|
|
160
|
+
"""
|
|
161
|
+
self._client.request(
|
|
162
|
+
RequestOptions(
|
|
163
|
+
method="POST",
|
|
164
|
+
path=f"/api/credential/{encode_path_segment(credential_id)}/activate",
|
|
165
|
+
extra_headers=extra_headers,
|
|
166
|
+
extra_query=extra_query,
|
|
167
|
+
extra_body=extra_body,
|
|
168
|
+
timeout=timeout,
|
|
169
|
+
),
|
|
170
|
+
kind="void",
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
def remove(
|
|
174
|
+
self,
|
|
175
|
+
credential_id: CredentialID,
|
|
176
|
+
*,
|
|
177
|
+
extra_headers: Headers | None = None,
|
|
178
|
+
extra_query: Query | None = None,
|
|
179
|
+
extra_body: Body | None = None,
|
|
180
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
181
|
+
) -> None:
|
|
182
|
+
"""Remove credential.
|
|
183
|
+
|
|
184
|
+
Remove a stored integration credential.
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
InvalidRequestError
|
|
188
|
+
UnauthorizedError
|
|
189
|
+
|
|
190
|
+
``DELETE /api/credential/:credentialID``
|
|
191
|
+
"""
|
|
192
|
+
self._client.request(
|
|
193
|
+
RequestOptions(
|
|
194
|
+
method="DELETE",
|
|
195
|
+
path=f"/api/credential/{encode_path_segment(credential_id)}",
|
|
196
|
+
extra_headers=extra_headers,
|
|
197
|
+
extra_query=extra_query,
|
|
198
|
+
extra_body=extra_body,
|
|
199
|
+
timeout=timeout,
|
|
200
|
+
),
|
|
201
|
+
kind="void",
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class AsyncCredentialResource(AsyncAPIResource):
|
|
206
|
+
"""Operations under ``client.credential`` (OpenCode ``credential``)."""
|
|
207
|
+
|
|
208
|
+
async def list(
|
|
209
|
+
self,
|
|
210
|
+
*,
|
|
211
|
+
extra_headers: Headers | None = None,
|
|
212
|
+
extra_query: Query | None = None,
|
|
213
|
+
extra_body: Body | None = None,
|
|
214
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
215
|
+
) -> builtins.list[CredentialEntry]:
|
|
216
|
+
"""List credentials.
|
|
217
|
+
|
|
218
|
+
List every stored integration credential, including its secret value.
|
|
219
|
+
|
|
220
|
+
Raises:
|
|
221
|
+
InvalidRequestError
|
|
222
|
+
UnauthorizedError
|
|
223
|
+
|
|
224
|
+
``GET /api/credential``
|
|
225
|
+
"""
|
|
226
|
+
return cast(
|
|
227
|
+
"builtins.list[CredentialEntry]",
|
|
228
|
+
await self._client.request(
|
|
229
|
+
RequestOptions(
|
|
230
|
+
method="GET",
|
|
231
|
+
path="/api/credential",
|
|
232
|
+
extra_headers=extra_headers,
|
|
233
|
+
extra_query=extra_query,
|
|
234
|
+
extra_body=extra_body,
|
|
235
|
+
timeout=timeout,
|
|
236
|
+
),
|
|
237
|
+
response_type=builtins.list[CredentialEntry],
|
|
238
|
+
unwrap=True,
|
|
239
|
+
),
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
async def create(
|
|
243
|
+
self,
|
|
244
|
+
*,
|
|
245
|
+
integration_id: IntegrationID,
|
|
246
|
+
value: CredentialValue,
|
|
247
|
+
id: CredentialID | NotGiven = NOT_GIVEN,
|
|
248
|
+
label: str | NotGiven = NOT_GIVEN,
|
|
249
|
+
activate: bool | NotGiven = NOT_GIVEN,
|
|
250
|
+
extra_headers: Headers | None = None,
|
|
251
|
+
extra_query: Query | None = None,
|
|
252
|
+
extra_body: Body | None = None,
|
|
253
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
254
|
+
) -> CredentialEntry:
|
|
255
|
+
"""Create credential.
|
|
256
|
+
|
|
257
|
+
Store an integration credential. It becomes the integration's active credential unless activate is false and the integration already has one. Fails with a conflict when the requested ID already exists.
|
|
258
|
+
|
|
259
|
+
Raises:
|
|
260
|
+
InvalidRequestError
|
|
261
|
+
UnauthorizedError
|
|
262
|
+
ConflictError
|
|
263
|
+
|
|
264
|
+
``POST /api/credential``
|
|
265
|
+
"""
|
|
266
|
+
return cast(
|
|
267
|
+
"CredentialEntry",
|
|
268
|
+
await self._client.request(
|
|
269
|
+
RequestOptions(
|
|
270
|
+
method="POST",
|
|
271
|
+
path="/api/credential",
|
|
272
|
+
body={
|
|
273
|
+
"id": id,
|
|
274
|
+
"integrationID": integration_id,
|
|
275
|
+
"label": label,
|
|
276
|
+
"value": value,
|
|
277
|
+
"activate": activate,
|
|
278
|
+
},
|
|
279
|
+
extra_headers=extra_headers,
|
|
280
|
+
extra_query=extra_query,
|
|
281
|
+
extra_body=extra_body,
|
|
282
|
+
timeout=timeout,
|
|
283
|
+
),
|
|
284
|
+
response_type=CredentialEntry,
|
|
285
|
+
unwrap=True,
|
|
286
|
+
),
|
|
287
|
+
)
|
|
288
|
+
|
|
289
|
+
async def update(
|
|
290
|
+
self,
|
|
291
|
+
credential_id: CredentialID,
|
|
292
|
+
*,
|
|
293
|
+
label: str,
|
|
294
|
+
extra_headers: Headers | None = None,
|
|
295
|
+
extra_query: Query | None = None,
|
|
296
|
+
extra_body: Body | None = None,
|
|
297
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
298
|
+
) -> None:
|
|
299
|
+
"""Update credential.
|
|
300
|
+
|
|
301
|
+
Update a stored credential label.
|
|
302
|
+
|
|
303
|
+
Raises:
|
|
304
|
+
InvalidRequestError
|
|
305
|
+
UnauthorizedError
|
|
306
|
+
|
|
307
|
+
``PATCH /api/credential/:credentialID``
|
|
308
|
+
"""
|
|
309
|
+
await self._client.request(
|
|
310
|
+
RequestOptions(
|
|
311
|
+
method="PATCH",
|
|
312
|
+
path=f"/api/credential/{encode_path_segment(credential_id)}",
|
|
313
|
+
body={"label": label},
|
|
314
|
+
extra_headers=extra_headers,
|
|
315
|
+
extra_query=extra_query,
|
|
316
|
+
extra_body=extra_body,
|
|
317
|
+
timeout=timeout,
|
|
318
|
+
),
|
|
319
|
+
kind="void",
|
|
320
|
+
)
|
|
321
|
+
|
|
322
|
+
async def activate(
|
|
323
|
+
self,
|
|
324
|
+
credential_id: CredentialID,
|
|
325
|
+
*,
|
|
326
|
+
extra_headers: Headers | None = None,
|
|
327
|
+
extra_query: Query | None = None,
|
|
328
|
+
extra_body: Body | None = None,
|
|
329
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
330
|
+
) -> None:
|
|
331
|
+
"""Activate credential.
|
|
332
|
+
|
|
333
|
+
Activate a stored integration credential.
|
|
334
|
+
|
|
335
|
+
Raises:
|
|
336
|
+
InvalidRequestError
|
|
337
|
+
UnauthorizedError
|
|
338
|
+
|
|
339
|
+
``POST /api/credential/:credentialID/activate``
|
|
340
|
+
"""
|
|
341
|
+
await self._client.request(
|
|
342
|
+
RequestOptions(
|
|
343
|
+
method="POST",
|
|
344
|
+
path=f"/api/credential/{encode_path_segment(credential_id)}/activate",
|
|
345
|
+
extra_headers=extra_headers,
|
|
346
|
+
extra_query=extra_query,
|
|
347
|
+
extra_body=extra_body,
|
|
348
|
+
timeout=timeout,
|
|
349
|
+
),
|
|
350
|
+
kind="void",
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
async def remove(
|
|
354
|
+
self,
|
|
355
|
+
credential_id: CredentialID,
|
|
356
|
+
*,
|
|
357
|
+
extra_headers: Headers | None = None,
|
|
358
|
+
extra_query: Query | None = None,
|
|
359
|
+
extra_body: Body | None = None,
|
|
360
|
+
timeout: Timeout | NotGiven = NOT_GIVEN,
|
|
361
|
+
) -> None:
|
|
362
|
+
"""Remove credential.
|
|
363
|
+
|
|
364
|
+
Remove a stored integration credential.
|
|
365
|
+
|
|
366
|
+
Raises:
|
|
367
|
+
InvalidRequestError
|
|
368
|
+
UnauthorizedError
|
|
369
|
+
|
|
370
|
+
``DELETE /api/credential/:credentialID``
|
|
371
|
+
"""
|
|
372
|
+
await self._client.request(
|
|
373
|
+
RequestOptions(
|
|
374
|
+
method="DELETE",
|
|
375
|
+
path=f"/api/credential/{encode_path_segment(credential_id)}",
|
|
376
|
+
extra_headers=extra_headers,
|
|
377
|
+
extra_query=extra_query,
|
|
378
|
+
extra_body=extra_body,
|
|
379
|
+
timeout=timeout,
|
|
380
|
+
),
|
|
381
|
+
kind="void",
|
|
382
|
+
)
|