contextbase-base-client 0.5.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 (79) hide show
  1. base_client/.fern/metadata.json +13 -0
  2. base_client/CONTRIBUTING.md +125 -0
  3. base_client/README.md +176 -0
  4. base_client/__init__.py +159 -0
  5. base_client/_default_clients.py +30 -0
  6. base_client/bases/__init__.py +34 -0
  7. base_client/bases/client.py +256 -0
  8. base_client/bases/raw_client.py +365 -0
  9. base_client/bases/types/__init__.py +34 -0
  10. base_client/bases/types/list_bases_response.py +20 -0
  11. base_client/binding_plan/__init__.py +4 -0
  12. base_client/binding_plan/client.py +108 -0
  13. base_client/binding_plan/raw_client.py +128 -0
  14. base_client/bindings/__init__.py +34 -0
  15. base_client/bindings/client.py +242 -0
  16. base_client/bindings/raw_client.py +326 -0
  17. base_client/bindings/types/__init__.py +34 -0
  18. base_client/bindings/types/list_bindings_response.py +20 -0
  19. base_client/client.py +252 -0
  20. base_client/core/__init__.py +127 -0
  21. base_client/core/api_error.py +23 -0
  22. base_client/core/client_wrapper.py +102 -0
  23. base_client/core/datetime_utils.py +70 -0
  24. base_client/core/file.py +67 -0
  25. base_client/core/force_multipart.py +18 -0
  26. base_client/core/http_client.py +839 -0
  27. base_client/core/http_response.py +59 -0
  28. base_client/core/http_sse/__init__.py +42 -0
  29. base_client/core/http_sse/_api.py +170 -0
  30. base_client/core/http_sse/_decoders.py +61 -0
  31. base_client/core/http_sse/_exceptions.py +7 -0
  32. base_client/core/http_sse/_models.py +17 -0
  33. base_client/core/jsonable_encoder.py +120 -0
  34. base_client/core/logging.py +107 -0
  35. base_client/core/parse_error.py +36 -0
  36. base_client/core/pydantic_utilities.py +508 -0
  37. base_client/core/query_encoder.py +58 -0
  38. base_client/core/remove_none_from_dict.py +11 -0
  39. base_client/core/request_options.py +35 -0
  40. base_client/core/serialization.py +347 -0
  41. base_client/dsn/__init__.py +4 -0
  42. base_client/dsn/client.py +104 -0
  43. base_client/dsn/raw_client.py +128 -0
  44. base_client/errors/__init__.py +38 -0
  45. base_client/errors/bad_request_error.py +11 -0
  46. base_client/errors/forbidden_error.py +11 -0
  47. base_client/reference.md +591 -0
  48. base_client/sync_state/__init__.py +34 -0
  49. base_client/sync_state/client.py +206 -0
  50. base_client/sync_state/raw_client.py +280 -0
  51. base_client/sync_state/types/__init__.py +34 -0
  52. base_client/sync_state/types/sync_state_input_bindings_value.py +23 -0
  53. base_client/tests/conftest.py +21 -0
  54. base_client/tests/test_aiohttp_autodetect.py +113 -0
  55. base_client/types/__init__.py +126 -0
  56. base_client/types/api_key_auth.py +19 -0
  57. base_client/types/authenticated_account_ref.py +20 -0
  58. base_client/types/base.py +23 -0
  59. base_client/types/binding.py +29 -0
  60. base_client/types/binding_auth.py +72 -0
  61. base_client/types/binding_auth_input.py +77 -0
  62. base_client/types/binding_auth_input_api_key.py +19 -0
  63. base_client/types/binding_auth_input_authenticated_account.py +20 -0
  64. base_client/types/binding_auth_input_client_credentials.py +20 -0
  65. base_client/types/binding_auth_input_none.py +17 -0
  66. base_client/types/binding_auth_none.py +17 -0
  67. base_client/types/binding_models.py +23 -0
  68. base_client/types/binding_state.py +24 -0
  69. base_client/types/binding_state_response.py +21 -0
  70. base_client/types/client_credentials_auth.py +20 -0
  71. base_client/types/dagster_all_plan_binding.py +27 -0
  72. base_client/types/dagster_all_plan_binding_mode.py +5 -0
  73. base_client/types/dagster_binding_plan_all.py +23 -0
  74. base_client/types/dsn_response.py +19 -0
  75. base_client/types/error.py +19 -0
  76. base_client/types/run_status.py +10 -0
  77. contextbase_base_client-0.5.0.dist-info/METADATA +10 -0
  78. contextbase_base_client-0.5.0.dist-info/RECORD +79 -0
  79. contextbase_base_client-0.5.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,108 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.dagster_binding_plan_all import DagsterBindingPlanAll
8
+ from .raw_client import AsyncRawBindingPlanClient, RawBindingPlanClient
9
+
10
+
11
+ class BindingPlanClient:
12
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
13
+ self._raw_client = RawBindingPlanClient(client_wrapper=client_wrapper)
14
+
15
+ @property
16
+ def with_raw_response(self) -> RawBindingPlanClient:
17
+ """
18
+ Retrieves a raw implementation of this client that returns raw responses.
19
+
20
+ Returns
21
+ -------
22
+ RawBindingPlanClient
23
+ """
24
+ return self._raw_client
25
+
26
+ def get_binding_plan(
27
+ self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
28
+ ) -> DagsterBindingPlanAll:
29
+ """
30
+ Parameters
31
+ ----------
32
+ base_id : str
33
+
34
+ request_options : typing.Optional[RequestOptions]
35
+ Request-specific configuration.
36
+
37
+ Returns
38
+ -------
39
+ DagsterBindingPlanAll
40
+ Dagster binding plan (enabled bindings, secrets resolved).
41
+
42
+ Examples
43
+ --------
44
+ from base_client import BaseAPIClient
45
+
46
+ client = BaseAPIClient(
47
+ base_url="https://yourhost.com/path/to/api",
48
+ )
49
+ client.binding_plan.get_binding_plan(
50
+ base_id="base_id",
51
+ )
52
+ """
53
+ _response = self._raw_client.get_binding_plan(base_id, request_options=request_options)
54
+ return _response.data
55
+
56
+
57
+ class AsyncBindingPlanClient:
58
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
59
+ self._raw_client = AsyncRawBindingPlanClient(client_wrapper=client_wrapper)
60
+
61
+ @property
62
+ def with_raw_response(self) -> AsyncRawBindingPlanClient:
63
+ """
64
+ Retrieves a raw implementation of this client that returns raw responses.
65
+
66
+ Returns
67
+ -------
68
+ AsyncRawBindingPlanClient
69
+ """
70
+ return self._raw_client
71
+
72
+ async def get_binding_plan(
73
+ self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
74
+ ) -> DagsterBindingPlanAll:
75
+ """
76
+ Parameters
77
+ ----------
78
+ base_id : str
79
+
80
+ request_options : typing.Optional[RequestOptions]
81
+ Request-specific configuration.
82
+
83
+ Returns
84
+ -------
85
+ DagsterBindingPlanAll
86
+ Dagster binding plan (enabled bindings, secrets resolved).
87
+
88
+ Examples
89
+ --------
90
+ import asyncio
91
+
92
+ from base_client import AsyncBaseAPIClient
93
+
94
+ client = AsyncBaseAPIClient(
95
+ base_url="https://yourhost.com/path/to/api",
96
+ )
97
+
98
+
99
+ async def main() -> None:
100
+ await client.binding_plan.get_binding_plan(
101
+ base_id="base_id",
102
+ )
103
+
104
+
105
+ asyncio.run(main())
106
+ """
107
+ _response = await self._raw_client.get_binding_plan(base_id, request_options=request_options)
108
+ return _response.data
@@ -0,0 +1,128 @@
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 ..errors.forbidden_error import ForbiddenError
14
+ from ..types.dagster_binding_plan_all import DagsterBindingPlanAll
15
+ from ..types.error import Error
16
+ from pydantic import ValidationError
17
+
18
+
19
+ class RawBindingPlanClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def get_binding_plan(
24
+ self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
25
+ ) -> HttpResponse[DagsterBindingPlanAll]:
26
+ """
27
+ Parameters
28
+ ----------
29
+ base_id : str
30
+
31
+ request_options : typing.Optional[RequestOptions]
32
+ Request-specific configuration.
33
+
34
+ Returns
35
+ -------
36
+ HttpResponse[DagsterBindingPlanAll]
37
+ Dagster binding plan (enabled bindings, secrets resolved).
38
+ """
39
+ _response = self._client_wrapper.httpx_client.request(
40
+ f"base/bases/{encode_path_param(base_id)}/binding-plan",
41
+ method="GET",
42
+ request_options=request_options,
43
+ )
44
+ try:
45
+ if 200 <= _response.status_code < 300:
46
+ _data = typing.cast(
47
+ DagsterBindingPlanAll,
48
+ parse_obj_as(
49
+ type_=DagsterBindingPlanAll, # type: ignore
50
+ object_=_response.json(),
51
+ ),
52
+ )
53
+ return HttpResponse(response=_response, data=_data)
54
+ if _response.status_code == 403:
55
+ raise ForbiddenError(
56
+ headers=dict(_response.headers),
57
+ body=typing.cast(
58
+ Error,
59
+ parse_obj_as(
60
+ type_=Error, # type: ignore
61
+ object_=_response.json(),
62
+ ),
63
+ ),
64
+ )
65
+ _response_json = _response.json()
66
+ except JSONDecodeError:
67
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
68
+ except ValidationError as e:
69
+ raise ParsingError(
70
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
71
+ )
72
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
73
+
74
+
75
+ class AsyncRawBindingPlanClient:
76
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
77
+ self._client_wrapper = client_wrapper
78
+
79
+ async def get_binding_plan(
80
+ self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
81
+ ) -> AsyncHttpResponse[DagsterBindingPlanAll]:
82
+ """
83
+ Parameters
84
+ ----------
85
+ base_id : str
86
+
87
+ request_options : typing.Optional[RequestOptions]
88
+ Request-specific configuration.
89
+
90
+ Returns
91
+ -------
92
+ AsyncHttpResponse[DagsterBindingPlanAll]
93
+ Dagster binding plan (enabled bindings, secrets resolved).
94
+ """
95
+ _response = await self._client_wrapper.httpx_client.request(
96
+ f"base/bases/{encode_path_param(base_id)}/binding-plan",
97
+ method="GET",
98
+ request_options=request_options,
99
+ )
100
+ try:
101
+ if 200 <= _response.status_code < 300:
102
+ _data = typing.cast(
103
+ DagsterBindingPlanAll,
104
+ parse_obj_as(
105
+ type_=DagsterBindingPlanAll, # type: ignore
106
+ object_=_response.json(),
107
+ ),
108
+ )
109
+ return AsyncHttpResponse(response=_response, data=_data)
110
+ if _response.status_code == 403:
111
+ raise ForbiddenError(
112
+ headers=dict(_response.headers),
113
+ body=typing.cast(
114
+ Error,
115
+ parse_obj_as(
116
+ type_=Error, # type: ignore
117
+ object_=_response.json(),
118
+ ),
119
+ ),
120
+ )
121
+ _response_json = _response.json()
122
+ except JSONDecodeError:
123
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
124
+ except ValidationError as e:
125
+ raise ParsingError(
126
+ status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
127
+ )
128
+ 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 .types import ListBindingsResponse
10
+ _dynamic_imports: typing.Dict[str, str] = {"ListBindingsResponse": ".types"}
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,242 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+
5
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
6
+ from ..core.request_options import RequestOptions
7
+ from ..types.binding import Binding
8
+ from ..types.binding_auth_input import BindingAuthInput
9
+ from ..types.binding_models import BindingModels
10
+ from .raw_client import AsyncRawBindingsClient, RawBindingsClient
11
+ from .types.list_bindings_response import ListBindingsResponse
12
+
13
+ # this is used as the default value for optional parameters
14
+ OMIT = typing.cast(typing.Any, ...)
15
+
16
+
17
+ class BindingsClient:
18
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
19
+ self._raw_client = RawBindingsClient(client_wrapper=client_wrapper)
20
+
21
+ @property
22
+ def with_raw_response(self) -> RawBindingsClient:
23
+ """
24
+ Retrieves a raw implementation of this client that returns raw responses.
25
+
26
+ Returns
27
+ -------
28
+ RawBindingsClient
29
+ """
30
+ return self._raw_client
31
+
32
+ def list_bindings(
33
+ self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
34
+ ) -> 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
+ ListBindingsResponse
46
+ Bindings for the base.
47
+
48
+ Examples
49
+ --------
50
+ from base_client import BaseAPIClient
51
+
52
+ client = BaseAPIClient(
53
+ base_url="https://yourhost.com/path/to/api",
54
+ )
55
+ client.bindings.list_bindings(
56
+ base_id="base_id",
57
+ )
58
+ """
59
+ _response = self._raw_client.list_bindings(base_id, request_options=request_options)
60
+ return _response.data
61
+
62
+ def create_binding(
63
+ self,
64
+ base_id: str,
65
+ *,
66
+ auth: BindingAuthInput,
67
+ plugin_id: str,
68
+ config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
69
+ enabled: typing.Optional[bool] = OMIT,
70
+ models: typing.Optional[BindingModels] = OMIT,
71
+ request_options: typing.Optional[RequestOptions] = None,
72
+ ) -> Binding:
73
+ """
74
+ Parameters
75
+ ----------
76
+ base_id : str
77
+
78
+ auth : BindingAuthInput
79
+
80
+ plugin_id : str
81
+
82
+ config : typing.Optional[typing.Dict[str, typing.Any]]
83
+
84
+ enabled : typing.Optional[bool]
85
+
86
+ models : typing.Optional[BindingModels]
87
+
88
+ request_options : typing.Optional[RequestOptions]
89
+ Request-specific configuration.
90
+
91
+ Returns
92
+ -------
93
+ Binding
94
+ The created binding.
95
+
96
+ Examples
97
+ --------
98
+ from base_client import BaseAPIClient, BindingAuthInput_ApiKey
99
+
100
+ client = BaseAPIClient(
101
+ base_url="https://yourhost.com/path/to/api",
102
+ )
103
+ client.bindings.create_binding(
104
+ base_id="base_id",
105
+ auth=BindingAuthInput_ApiKey(
106
+ api_key_secret="api_key_secret",
107
+ ),
108
+ plugin_id="plugin_id",
109
+ )
110
+ """
111
+ _response = self._raw_client.create_binding(
112
+ base_id,
113
+ auth=auth,
114
+ plugin_id=plugin_id,
115
+ config=config,
116
+ enabled=enabled,
117
+ models=models,
118
+ request_options=request_options,
119
+ )
120
+ return _response.data
121
+
122
+
123
+ class AsyncBindingsClient:
124
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
125
+ self._raw_client = AsyncRawBindingsClient(client_wrapper=client_wrapper)
126
+
127
+ @property
128
+ def with_raw_response(self) -> AsyncRawBindingsClient:
129
+ """
130
+ Retrieves a raw implementation of this client that returns raw responses.
131
+
132
+ Returns
133
+ -------
134
+ AsyncRawBindingsClient
135
+ """
136
+ return self._raw_client
137
+
138
+ async def list_bindings(
139
+ self, base_id: str, *, request_options: typing.Optional[RequestOptions] = None
140
+ ) -> ListBindingsResponse:
141
+ """
142
+ Parameters
143
+ ----------
144
+ base_id : str
145
+
146
+ request_options : typing.Optional[RequestOptions]
147
+ Request-specific configuration.
148
+
149
+ Returns
150
+ -------
151
+ ListBindingsResponse
152
+ Bindings for the base.
153
+
154
+ Examples
155
+ --------
156
+ import asyncio
157
+
158
+ from base_client import AsyncBaseAPIClient
159
+
160
+ client = AsyncBaseAPIClient(
161
+ base_url="https://yourhost.com/path/to/api",
162
+ )
163
+
164
+
165
+ async def main() -> None:
166
+ await client.bindings.list_bindings(
167
+ base_id="base_id",
168
+ )
169
+
170
+
171
+ asyncio.run(main())
172
+ """
173
+ _response = await self._raw_client.list_bindings(base_id, request_options=request_options)
174
+ return _response.data
175
+
176
+ async def create_binding(
177
+ self,
178
+ base_id: str,
179
+ *,
180
+ auth: BindingAuthInput,
181
+ plugin_id: str,
182
+ config: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
183
+ enabled: typing.Optional[bool] = OMIT,
184
+ models: typing.Optional[BindingModels] = OMIT,
185
+ request_options: typing.Optional[RequestOptions] = None,
186
+ ) -> Binding:
187
+ """
188
+ Parameters
189
+ ----------
190
+ base_id : str
191
+
192
+ auth : BindingAuthInput
193
+
194
+ plugin_id : str
195
+
196
+ config : typing.Optional[typing.Dict[str, typing.Any]]
197
+
198
+ enabled : typing.Optional[bool]
199
+
200
+ models : typing.Optional[BindingModels]
201
+
202
+ request_options : typing.Optional[RequestOptions]
203
+ Request-specific configuration.
204
+
205
+ Returns
206
+ -------
207
+ Binding
208
+ The created binding.
209
+
210
+ Examples
211
+ --------
212
+ import asyncio
213
+
214
+ from base_client import AsyncBaseAPIClient, BindingAuthInput_ApiKey
215
+
216
+ client = AsyncBaseAPIClient(
217
+ base_url="https://yourhost.com/path/to/api",
218
+ )
219
+
220
+
221
+ async def main() -> None:
222
+ await client.bindings.create_binding(
223
+ base_id="base_id",
224
+ auth=BindingAuthInput_ApiKey(
225
+ api_key_secret="api_key_secret",
226
+ ),
227
+ plugin_id="plugin_id",
228
+ )
229
+
230
+
231
+ asyncio.run(main())
232
+ """
233
+ _response = await self._raw_client.create_binding(
234
+ base_id,
235
+ auth=auth,
236
+ plugin_id=plugin_id,
237
+ config=config,
238
+ enabled=enabled,
239
+ models=models,
240
+ request_options=request_options,
241
+ )
242
+ return _response.data