contextbase-base-client 0.0.0a1__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.
- base_client/.fern/metadata.json +13 -0
- base_client/CONTRIBUTING.md +125 -0
- base_client/README.md +176 -0
- base_client/__init__.py +188 -0
- base_client/_default_clients.py +30 -0
- base_client/bases/__init__.py +34 -0
- base_client/bases/client.py +318 -0
- base_client/bases/raw_client.py +474 -0
- base_client/bases/types/__init__.py +34 -0
- base_client/bases/types/list_bases_response.py +20 -0
- base_client/binding_plan/__init__.py +4 -0
- base_client/binding_plan/client.py +108 -0
- base_client/binding_plan/raw_client.py +128 -0
- base_client/bindings/__init__.py +34 -0
- base_client/bindings/client.py +364 -0
- base_client/bindings/raw_client.py +537 -0
- base_client/bindings/types/__init__.py +34 -0
- base_client/bindings/types/list_bindings_response.py +20 -0
- base_client/client.py +252 -0
- base_client/core/__init__.py +127 -0
- base_client/core/api_error.py +23 -0
- base_client/core/client_wrapper.py +102 -0
- base_client/core/datetime_utils.py +70 -0
- base_client/core/file.py +67 -0
- base_client/core/force_multipart.py +18 -0
- base_client/core/http_client.py +839 -0
- base_client/core/http_response.py +59 -0
- base_client/core/http_sse/__init__.py +42 -0
- base_client/core/http_sse/_api.py +170 -0
- base_client/core/http_sse/_decoders.py +61 -0
- base_client/core/http_sse/_exceptions.py +7 -0
- base_client/core/http_sse/_models.py +17 -0
- base_client/core/jsonable_encoder.py +120 -0
- base_client/core/logging.py +107 -0
- base_client/core/parse_error.py +36 -0
- base_client/core/pydantic_utilities.py +508 -0
- base_client/core/query_encoder.py +58 -0
- base_client/core/remove_none_from_dict.py +11 -0
- base_client/core/request_options.py +35 -0
- base_client/core/serialization.py +347 -0
- base_client/dsn/__init__.py +4 -0
- base_client/dsn/client.py +104 -0
- base_client/dsn/raw_client.py +128 -0
- base_client/errors/__init__.py +40 -0
- base_client/errors/bad_request_error.py +11 -0
- base_client/errors/forbidden_error.py +11 -0
- base_client/errors/not_found_error.py +11 -0
- base_client/reference.md +746 -0
- base_client/sync_state/__init__.py +34 -0
- base_client/sync_state/client.py +206 -0
- base_client/sync_state/raw_client.py +280 -0
- base_client/sync_state/types/__init__.py +34 -0
- base_client/sync_state/types/sync_state_input_bindings_value.py +23 -0
- base_client/tests/conftest.py +21 -0
- base_client/tests/test_aiohttp_autodetect.py +113 -0
- base_client/types/__init__.py +155 -0
- base_client/types/api_key_auth.py +19 -0
- base_client/types/authenticated_account_ref.py +20 -0
- base_client/types/base.py +23 -0
- base_client/types/binding.py +31 -0
- base_client/types/binding_auth.py +72 -0
- base_client/types/binding_auth_input.py +77 -0
- base_client/types/binding_auth_input_api_key.py +19 -0
- base_client/types/binding_auth_input_authenticated_account.py +20 -0
- base_client/types/binding_auth_input_client_credentials.py +20 -0
- base_client/types/binding_auth_input_none.py +17 -0
- base_client/types/binding_auth_none.py +17 -0
- base_client/types/binding_auth_resource.py +75 -0
- base_client/types/binding_auth_resource_api_key.py +17 -0
- base_client/types/binding_auth_resource_authenticated_account.py +20 -0
- base_client/types/binding_auth_resource_client_credentials.py +19 -0
- base_client/types/binding_auth_resource_none.py +17 -0
- base_client/types/binding_models.py +23 -0
- base_client/types/binding_state.py +24 -0
- base_client/types/binding_state_response.py +21 -0
- base_client/types/client_credentials_auth.py +20 -0
- base_client/types/dagster_all_plan_binding.py +27 -0
- base_client/types/dagster_all_plan_binding_mode.py +5 -0
- base_client/types/dagster_binding_plan_all.py +23 -0
- base_client/types/dsn_response.py +19 -0
- base_client/types/error.py +19 -0
- base_client/types/run_status.py +10 -0
- contextbase_base_client-0.0.0a1.dist-info/METADATA +10 -0
- contextbase_base_client-0.0.0a1.dist-info/RECORD +85 -0
- contextbase_base_client-0.0.0a1.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,537 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
from json.decoder import JSONDecodeError
|
|
5
|
+
|
|
6
|
+
from ..core.api_error import ApiError
|
|
7
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
8
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
9
|
+
from ..core.jsonable_encoder import encode_path_param
|
|
10
|
+
from ..core.parse_error import ParsingError
|
|
11
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
12
|
+
from ..core.request_options import RequestOptions
|
|
13
|
+
from ..core.serialization import convert_and_respect_annotation_metadata
|
|
14
|
+
from ..errors.bad_request_error import BadRequestError
|
|
15
|
+
from ..errors.forbidden_error import ForbiddenError
|
|
16
|
+
from ..errors.not_found_error import NotFoundError
|
|
17
|
+
from ..types.binding import Binding
|
|
18
|
+
from ..types.binding_auth_input import BindingAuthInput
|
|
19
|
+
from ..types.binding_models import BindingModels
|
|
20
|
+
from ..types.error import Error
|
|
21
|
+
from .types.list_bindings_response import ListBindingsResponse
|
|
22
|
+
from pydantic import ValidationError
|
|
23
|
+
|
|
24
|
+
# this is used as the default value for optional parameters
|
|
25
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class RawBindingsClient:
|
|
29
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
30
|
+
self._client_wrapper = client_wrapper
|
|
31
|
+
|
|
32
|
+
def list_bindings(
|
|
33
|
+
self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
34
|
+
) -> HttpResponse[ListBindingsResponse]:
|
|
35
|
+
"""
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
base_id : str
|
|
39
|
+
|
|
40
|
+
request_options : typing.Optional[RequestOptions]
|
|
41
|
+
Request-specific configuration.
|
|
42
|
+
|
|
43
|
+
Returns
|
|
44
|
+
-------
|
|
45
|
+
HttpResponse[ListBindingsResponse]
|
|
46
|
+
Bindings for the base.
|
|
47
|
+
"""
|
|
48
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
49
|
+
f"base/bases/{encode_path_param(base_id)}/bindings",
|
|
50
|
+
method="GET",
|
|
51
|
+
request_options=request_options,
|
|
52
|
+
)
|
|
53
|
+
try:
|
|
54
|
+
if 200 <= _response.status_code < 300:
|
|
55
|
+
_data = typing.cast(
|
|
56
|
+
ListBindingsResponse,
|
|
57
|
+
parse_obj_as(
|
|
58
|
+
type_=ListBindingsResponse, # type: ignore
|
|
59
|
+
object_=_response.json(),
|
|
60
|
+
),
|
|
61
|
+
)
|
|
62
|
+
return HttpResponse(response=_response, data=_data)
|
|
63
|
+
if _response.status_code == 403:
|
|
64
|
+
raise ForbiddenError(
|
|
65
|
+
headers=dict(_response.headers),
|
|
66
|
+
body=typing.cast(
|
|
67
|
+
Error,
|
|
68
|
+
parse_obj_as(
|
|
69
|
+
type_=Error, # type: ignore
|
|
70
|
+
object_=_response.json(),
|
|
71
|
+
),
|
|
72
|
+
),
|
|
73
|
+
)
|
|
74
|
+
_response_json = _response.json()
|
|
75
|
+
except JSONDecodeError:
|
|
76
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
77
|
+
except ValidationError as e:
|
|
78
|
+
raise ParsingError(
|
|
79
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
80
|
+
)
|
|
81
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
82
|
+
|
|
83
|
+
def create_binding(
|
|
84
|
+
self,
|
|
85
|
+
base_id: str,
|
|
86
|
+
*,
|
|
87
|
+
auth: BindingAuthInput,
|
|
88
|
+
plugin_id: str,
|
|
89
|
+
config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
90
|
+
enabled: typing.Optional[bool] = OMIT,
|
|
91
|
+
models: typing.Optional[BindingModels] = OMIT,
|
|
92
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
93
|
+
) -> HttpResponse[Binding]:
|
|
94
|
+
"""
|
|
95
|
+
Parameters
|
|
96
|
+
----------
|
|
97
|
+
base_id : str
|
|
98
|
+
|
|
99
|
+
auth : BindingAuthInput
|
|
100
|
+
|
|
101
|
+
plugin_id : str
|
|
102
|
+
|
|
103
|
+
config : typing.Optional[typing.Dict[str, typing.Any]]
|
|
104
|
+
|
|
105
|
+
enabled : typing.Optional[bool]
|
|
106
|
+
|
|
107
|
+
models : typing.Optional[BindingModels]
|
|
108
|
+
|
|
109
|
+
request_options : typing.Optional[RequestOptions]
|
|
110
|
+
Request-specific configuration.
|
|
111
|
+
|
|
112
|
+
Returns
|
|
113
|
+
-------
|
|
114
|
+
HttpResponse[Binding]
|
|
115
|
+
The created binding.
|
|
116
|
+
"""
|
|
117
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
118
|
+
f"base/bases/{encode_path_param(base_id)}/bindings",
|
|
119
|
+
method="POST",
|
|
120
|
+
json={
|
|
121
|
+
"auth": convert_and_respect_annotation_metadata(
|
|
122
|
+
object_=auth, annotation=BindingAuthInput, direction="write"
|
|
123
|
+
),
|
|
124
|
+
"config": config,
|
|
125
|
+
"enabled": enabled,
|
|
126
|
+
"models": convert_and_respect_annotation_metadata(
|
|
127
|
+
object_=models, annotation=typing.Optional[BindingModels], direction="write"
|
|
128
|
+
),
|
|
129
|
+
"plugin_id": plugin_id,
|
|
130
|
+
},
|
|
131
|
+
headers={
|
|
132
|
+
"content-type": "application/json",
|
|
133
|
+
},
|
|
134
|
+
request_options=request_options,
|
|
135
|
+
omit=OMIT,
|
|
136
|
+
)
|
|
137
|
+
try:
|
|
138
|
+
if 200 <= _response.status_code < 300:
|
|
139
|
+
_data = typing.cast(
|
|
140
|
+
Binding,
|
|
141
|
+
parse_obj_as(
|
|
142
|
+
type_=Binding, # type: ignore
|
|
143
|
+
object_=_response.json(),
|
|
144
|
+
),
|
|
145
|
+
)
|
|
146
|
+
return HttpResponse(response=_response, data=_data)
|
|
147
|
+
if _response.status_code == 400:
|
|
148
|
+
raise BadRequestError(
|
|
149
|
+
headers=dict(_response.headers),
|
|
150
|
+
body=typing.cast(
|
|
151
|
+
Error,
|
|
152
|
+
parse_obj_as(
|
|
153
|
+
type_=Error, # type: ignore
|
|
154
|
+
object_=_response.json(),
|
|
155
|
+
),
|
|
156
|
+
),
|
|
157
|
+
)
|
|
158
|
+
if _response.status_code == 403:
|
|
159
|
+
raise ForbiddenError(
|
|
160
|
+
headers=dict(_response.headers),
|
|
161
|
+
body=typing.cast(
|
|
162
|
+
Error,
|
|
163
|
+
parse_obj_as(
|
|
164
|
+
type_=Error, # type: ignore
|
|
165
|
+
object_=_response.json(),
|
|
166
|
+
),
|
|
167
|
+
),
|
|
168
|
+
)
|
|
169
|
+
_response_json = _response.json()
|
|
170
|
+
except JSONDecodeError:
|
|
171
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
172
|
+
except ValidationError as e:
|
|
173
|
+
raise ParsingError(
|
|
174
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
175
|
+
)
|
|
176
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
177
|
+
|
|
178
|
+
def update_binding(
|
|
179
|
+
self,
|
|
180
|
+
base_id: str,
|
|
181
|
+
binding_id: str,
|
|
182
|
+
*,
|
|
183
|
+
auth: typing.Optional[BindingAuthInput] = OMIT,
|
|
184
|
+
config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
185
|
+
enabled: typing.Optional[bool] = OMIT,
|
|
186
|
+
models: typing.Optional[BindingModels] = OMIT,
|
|
187
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
188
|
+
) -> HttpResponse[Binding]:
|
|
189
|
+
"""
|
|
190
|
+
Parameters
|
|
191
|
+
----------
|
|
192
|
+
base_id : str
|
|
193
|
+
|
|
194
|
+
binding_id : str
|
|
195
|
+
|
|
196
|
+
auth : typing.Optional[BindingAuthInput]
|
|
197
|
+
|
|
198
|
+
config : typing.Optional[typing.Dict[str, typing.Any]]
|
|
199
|
+
|
|
200
|
+
enabled : typing.Optional[bool]
|
|
201
|
+
|
|
202
|
+
models : typing.Optional[BindingModels]
|
|
203
|
+
|
|
204
|
+
request_options : typing.Optional[RequestOptions]
|
|
205
|
+
Request-specific configuration.
|
|
206
|
+
|
|
207
|
+
Returns
|
|
208
|
+
-------
|
|
209
|
+
HttpResponse[Binding]
|
|
210
|
+
The updated binding.
|
|
211
|
+
"""
|
|
212
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
213
|
+
f"base/bases/{encode_path_param(base_id)}/bindings/{encode_path_param(binding_id)}",
|
|
214
|
+
method="PATCH",
|
|
215
|
+
json={
|
|
216
|
+
"auth": convert_and_respect_annotation_metadata(
|
|
217
|
+
object_=auth, annotation=BindingAuthInput, direction="write"
|
|
218
|
+
),
|
|
219
|
+
"config": config,
|
|
220
|
+
"enabled": enabled,
|
|
221
|
+
"models": convert_and_respect_annotation_metadata(
|
|
222
|
+
object_=models, annotation=typing.Optional[BindingModels], direction="write"
|
|
223
|
+
),
|
|
224
|
+
},
|
|
225
|
+
headers={
|
|
226
|
+
"content-type": "application/json",
|
|
227
|
+
},
|
|
228
|
+
request_options=request_options,
|
|
229
|
+
omit=OMIT,
|
|
230
|
+
)
|
|
231
|
+
try:
|
|
232
|
+
if 200 <= _response.status_code < 300:
|
|
233
|
+
_data = typing.cast(
|
|
234
|
+
Binding,
|
|
235
|
+
parse_obj_as(
|
|
236
|
+
type_=Binding, # type: ignore
|
|
237
|
+
object_=_response.json(),
|
|
238
|
+
),
|
|
239
|
+
)
|
|
240
|
+
return HttpResponse(response=_response, data=_data)
|
|
241
|
+
if _response.status_code == 400:
|
|
242
|
+
raise BadRequestError(
|
|
243
|
+
headers=dict(_response.headers),
|
|
244
|
+
body=typing.cast(
|
|
245
|
+
Error,
|
|
246
|
+
parse_obj_as(
|
|
247
|
+
type_=Error, # type: ignore
|
|
248
|
+
object_=_response.json(),
|
|
249
|
+
),
|
|
250
|
+
),
|
|
251
|
+
)
|
|
252
|
+
if _response.status_code == 403:
|
|
253
|
+
raise ForbiddenError(
|
|
254
|
+
headers=dict(_response.headers),
|
|
255
|
+
body=typing.cast(
|
|
256
|
+
Error,
|
|
257
|
+
parse_obj_as(
|
|
258
|
+
type_=Error, # type: ignore
|
|
259
|
+
object_=_response.json(),
|
|
260
|
+
),
|
|
261
|
+
),
|
|
262
|
+
)
|
|
263
|
+
if _response.status_code == 404:
|
|
264
|
+
raise NotFoundError(
|
|
265
|
+
headers=dict(_response.headers),
|
|
266
|
+
body=typing.cast(
|
|
267
|
+
Error,
|
|
268
|
+
parse_obj_as(
|
|
269
|
+
type_=Error, # type: ignore
|
|
270
|
+
object_=_response.json(),
|
|
271
|
+
),
|
|
272
|
+
),
|
|
273
|
+
)
|
|
274
|
+
_response_json = _response.json()
|
|
275
|
+
except JSONDecodeError:
|
|
276
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
277
|
+
except ValidationError as e:
|
|
278
|
+
raise ParsingError(
|
|
279
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
280
|
+
)
|
|
281
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
class AsyncRawBindingsClient:
|
|
285
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
286
|
+
self._client_wrapper = client_wrapper
|
|
287
|
+
|
|
288
|
+
async def list_bindings(
|
|
289
|
+
self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
290
|
+
) -> AsyncHttpResponse[ListBindingsResponse]:
|
|
291
|
+
"""
|
|
292
|
+
Parameters
|
|
293
|
+
----------
|
|
294
|
+
base_id : str
|
|
295
|
+
|
|
296
|
+
request_options : typing.Optional[RequestOptions]
|
|
297
|
+
Request-specific configuration.
|
|
298
|
+
|
|
299
|
+
Returns
|
|
300
|
+
-------
|
|
301
|
+
AsyncHttpResponse[ListBindingsResponse]
|
|
302
|
+
Bindings for the base.
|
|
303
|
+
"""
|
|
304
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
305
|
+
f"base/bases/{encode_path_param(base_id)}/bindings",
|
|
306
|
+
method="GET",
|
|
307
|
+
request_options=request_options,
|
|
308
|
+
)
|
|
309
|
+
try:
|
|
310
|
+
if 200 <= _response.status_code < 300:
|
|
311
|
+
_data = typing.cast(
|
|
312
|
+
ListBindingsResponse,
|
|
313
|
+
parse_obj_as(
|
|
314
|
+
type_=ListBindingsResponse, # type: ignore
|
|
315
|
+
object_=_response.json(),
|
|
316
|
+
),
|
|
317
|
+
)
|
|
318
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
319
|
+
if _response.status_code == 403:
|
|
320
|
+
raise ForbiddenError(
|
|
321
|
+
headers=dict(_response.headers),
|
|
322
|
+
body=typing.cast(
|
|
323
|
+
Error,
|
|
324
|
+
parse_obj_as(
|
|
325
|
+
type_=Error, # type: ignore
|
|
326
|
+
object_=_response.json(),
|
|
327
|
+
),
|
|
328
|
+
),
|
|
329
|
+
)
|
|
330
|
+
_response_json = _response.json()
|
|
331
|
+
except JSONDecodeError:
|
|
332
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
333
|
+
except ValidationError as e:
|
|
334
|
+
raise ParsingError(
|
|
335
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
336
|
+
)
|
|
337
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
338
|
+
|
|
339
|
+
async def create_binding(
|
|
340
|
+
self,
|
|
341
|
+
base_id: str,
|
|
342
|
+
*,
|
|
343
|
+
auth: BindingAuthInput,
|
|
344
|
+
plugin_id: str,
|
|
345
|
+
config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
346
|
+
enabled: typing.Optional[bool] = OMIT,
|
|
347
|
+
models: typing.Optional[BindingModels] = OMIT,
|
|
348
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
349
|
+
) -> AsyncHttpResponse[Binding]:
|
|
350
|
+
"""
|
|
351
|
+
Parameters
|
|
352
|
+
----------
|
|
353
|
+
base_id : str
|
|
354
|
+
|
|
355
|
+
auth : BindingAuthInput
|
|
356
|
+
|
|
357
|
+
plugin_id : str
|
|
358
|
+
|
|
359
|
+
config : typing.Optional[typing.Dict[str, typing.Any]]
|
|
360
|
+
|
|
361
|
+
enabled : typing.Optional[bool]
|
|
362
|
+
|
|
363
|
+
models : typing.Optional[BindingModels]
|
|
364
|
+
|
|
365
|
+
request_options : typing.Optional[RequestOptions]
|
|
366
|
+
Request-specific configuration.
|
|
367
|
+
|
|
368
|
+
Returns
|
|
369
|
+
-------
|
|
370
|
+
AsyncHttpResponse[Binding]
|
|
371
|
+
The created binding.
|
|
372
|
+
"""
|
|
373
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
374
|
+
f"base/bases/{encode_path_param(base_id)}/bindings",
|
|
375
|
+
method="POST",
|
|
376
|
+
json={
|
|
377
|
+
"auth": convert_and_respect_annotation_metadata(
|
|
378
|
+
object_=auth, annotation=BindingAuthInput, direction="write"
|
|
379
|
+
),
|
|
380
|
+
"config": config,
|
|
381
|
+
"enabled": enabled,
|
|
382
|
+
"models": convert_and_respect_annotation_metadata(
|
|
383
|
+
object_=models, annotation=typing.Optional[BindingModels], direction="write"
|
|
384
|
+
),
|
|
385
|
+
"plugin_id": plugin_id,
|
|
386
|
+
},
|
|
387
|
+
headers={
|
|
388
|
+
"content-type": "application/json",
|
|
389
|
+
},
|
|
390
|
+
request_options=request_options,
|
|
391
|
+
omit=OMIT,
|
|
392
|
+
)
|
|
393
|
+
try:
|
|
394
|
+
if 200 <= _response.status_code < 300:
|
|
395
|
+
_data = typing.cast(
|
|
396
|
+
Binding,
|
|
397
|
+
parse_obj_as(
|
|
398
|
+
type_=Binding, # type: ignore
|
|
399
|
+
object_=_response.json(),
|
|
400
|
+
),
|
|
401
|
+
)
|
|
402
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
403
|
+
if _response.status_code == 400:
|
|
404
|
+
raise BadRequestError(
|
|
405
|
+
headers=dict(_response.headers),
|
|
406
|
+
body=typing.cast(
|
|
407
|
+
Error,
|
|
408
|
+
parse_obj_as(
|
|
409
|
+
type_=Error, # type: ignore
|
|
410
|
+
object_=_response.json(),
|
|
411
|
+
),
|
|
412
|
+
),
|
|
413
|
+
)
|
|
414
|
+
if _response.status_code == 403:
|
|
415
|
+
raise ForbiddenError(
|
|
416
|
+
headers=dict(_response.headers),
|
|
417
|
+
body=typing.cast(
|
|
418
|
+
Error,
|
|
419
|
+
parse_obj_as(
|
|
420
|
+
type_=Error, # type: ignore
|
|
421
|
+
object_=_response.json(),
|
|
422
|
+
),
|
|
423
|
+
),
|
|
424
|
+
)
|
|
425
|
+
_response_json = _response.json()
|
|
426
|
+
except JSONDecodeError:
|
|
427
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
428
|
+
except ValidationError as e:
|
|
429
|
+
raise ParsingError(
|
|
430
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
431
|
+
)
|
|
432
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
433
|
+
|
|
434
|
+
async def update_binding(
|
|
435
|
+
self,
|
|
436
|
+
base_id: str,
|
|
437
|
+
binding_id: str,
|
|
438
|
+
*,
|
|
439
|
+
auth: typing.Optional[BindingAuthInput] = OMIT,
|
|
440
|
+
config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
|
|
441
|
+
enabled: typing.Optional[bool] = OMIT,
|
|
442
|
+
models: typing.Optional[BindingModels] = OMIT,
|
|
443
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
444
|
+
) -> AsyncHttpResponse[Binding]:
|
|
445
|
+
"""
|
|
446
|
+
Parameters
|
|
447
|
+
----------
|
|
448
|
+
base_id : str
|
|
449
|
+
|
|
450
|
+
binding_id : str
|
|
451
|
+
|
|
452
|
+
auth : typing.Optional[BindingAuthInput]
|
|
453
|
+
|
|
454
|
+
config : typing.Optional[typing.Dict[str, typing.Any]]
|
|
455
|
+
|
|
456
|
+
enabled : typing.Optional[bool]
|
|
457
|
+
|
|
458
|
+
models : typing.Optional[BindingModels]
|
|
459
|
+
|
|
460
|
+
request_options : typing.Optional[RequestOptions]
|
|
461
|
+
Request-specific configuration.
|
|
462
|
+
|
|
463
|
+
Returns
|
|
464
|
+
-------
|
|
465
|
+
AsyncHttpResponse[Binding]
|
|
466
|
+
The updated binding.
|
|
467
|
+
"""
|
|
468
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
469
|
+
f"base/bases/{encode_path_param(base_id)}/bindings/{encode_path_param(binding_id)}",
|
|
470
|
+
method="PATCH",
|
|
471
|
+
json={
|
|
472
|
+
"auth": convert_and_respect_annotation_metadata(
|
|
473
|
+
object_=auth, annotation=BindingAuthInput, direction="write"
|
|
474
|
+
),
|
|
475
|
+
"config": config,
|
|
476
|
+
"enabled": enabled,
|
|
477
|
+
"models": convert_and_respect_annotation_metadata(
|
|
478
|
+
object_=models, annotation=typing.Optional[BindingModels], direction="write"
|
|
479
|
+
),
|
|
480
|
+
},
|
|
481
|
+
headers={
|
|
482
|
+
"content-type": "application/json",
|
|
483
|
+
},
|
|
484
|
+
request_options=request_options,
|
|
485
|
+
omit=OMIT,
|
|
486
|
+
)
|
|
487
|
+
try:
|
|
488
|
+
if 200 <= _response.status_code < 300:
|
|
489
|
+
_data = typing.cast(
|
|
490
|
+
Binding,
|
|
491
|
+
parse_obj_as(
|
|
492
|
+
type_=Binding, # type: ignore
|
|
493
|
+
object_=_response.json(),
|
|
494
|
+
),
|
|
495
|
+
)
|
|
496
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
497
|
+
if _response.status_code == 400:
|
|
498
|
+
raise BadRequestError(
|
|
499
|
+
headers=dict(_response.headers),
|
|
500
|
+
body=typing.cast(
|
|
501
|
+
Error,
|
|
502
|
+
parse_obj_as(
|
|
503
|
+
type_=Error, # type: ignore
|
|
504
|
+
object_=_response.json(),
|
|
505
|
+
),
|
|
506
|
+
),
|
|
507
|
+
)
|
|
508
|
+
if _response.status_code == 403:
|
|
509
|
+
raise ForbiddenError(
|
|
510
|
+
headers=dict(_response.headers),
|
|
511
|
+
body=typing.cast(
|
|
512
|
+
Error,
|
|
513
|
+
parse_obj_as(
|
|
514
|
+
type_=Error, # type: ignore
|
|
515
|
+
object_=_response.json(),
|
|
516
|
+
),
|
|
517
|
+
),
|
|
518
|
+
)
|
|
519
|
+
if _response.status_code == 404:
|
|
520
|
+
raise NotFoundError(
|
|
521
|
+
headers=dict(_response.headers),
|
|
522
|
+
body=typing.cast(
|
|
523
|
+
Error,
|
|
524
|
+
parse_obj_as(
|
|
525
|
+
type_=Error, # type: ignore
|
|
526
|
+
object_=_response.json(),
|
|
527
|
+
),
|
|
528
|
+
),
|
|
529
|
+
)
|
|
530
|
+
_response_json = _response.json()
|
|
531
|
+
except JSONDecodeError:
|
|
532
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
533
|
+
except ValidationError as e:
|
|
534
|
+
raise ParsingError(
|
|
535
|
+
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
|
|
536
|
+
)
|
|
537
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
# isort: skip_file
|
|
4
|
+
|
|
5
|
+
import typing
|
|
6
|
+
from importlib import import_module
|
|
7
|
+
|
|
8
|
+
if typing.TYPE_CHECKING:
|
|
9
|
+
from .list_bindings_response import ListBindingsResponse
|
|
10
|
+
_dynamic_imports: typing.Dict[str, str] = {"ListBindingsResponse": ".list_bindings_response"}
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def __getattr__(attr_name: str) -> typing.Any:
|
|
14
|
+
module_name = _dynamic_imports.get(attr_name)
|
|
15
|
+
if module_name is None:
|
|
16
|
+
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
|
|
17
|
+
try:
|
|
18
|
+
module = import_module(module_name, __package__)
|
|
19
|
+
if module_name == f".{attr_name}":
|
|
20
|
+
return module
|
|
21
|
+
else:
|
|
22
|
+
return getattr(module, attr_name)
|
|
23
|
+
except ImportError as e:
|
|
24
|
+
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
|
|
25
|
+
except AttributeError as e:
|
|
26
|
+
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def __dir__():
|
|
30
|
+
lazy_attrs = list(_dynamic_imports.keys())
|
|
31
|
+
return sorted(lazy_attrs)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
__all__ = ["ListBindingsResponse"]
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import typing
|
|
4
|
+
|
|
5
|
+
import pydantic
|
|
6
|
+
from ...core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
|
7
|
+
from ...types.binding import Binding
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ListBindingsResponse(UniversalBaseModel):
|
|
11
|
+
bindings: typing.List[Binding]
|
|
12
|
+
|
|
13
|
+
if IS_PYDANTIC_V2:
|
|
14
|
+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
|
15
|
+
else:
|
|
16
|
+
|
|
17
|
+
class Config:
|
|
18
|
+
frozen = True
|
|
19
|
+
smart_union = True
|
|
20
|
+
extra = pydantic.Extra.allow
|