phenoml 0.0.2__py3-none-any.whl → 0.0.5__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.
Potentially problematic release.
This version of phenoml might be problematic. Click here for more details.
- phenoml/agent/__init__.py +6 -8
- phenoml/agent/client.py +45 -75
- phenoml/agent/raw_client.py +37 -77
- phenoml/agent/types/__init__.py +6 -8
- phenoml/agent/types/agent_create_request.py +53 -0
- phenoml/agent/types/agent_create_request_provider.py +5 -0
- phenoml/agent/types/agent_template.py +3 -6
- phenoml/agent/types/agent_template_provider.py +5 -0
- phenoml/client.py +6 -0
- phenoml/core/client_wrapper.py +2 -2
- phenoml/fhir/__init__.py +36 -0
- phenoml/fhir/client.py +970 -0
- phenoml/fhir/errors/__init__.py +10 -0
- phenoml/fhir/errors/bad_request_error.py +10 -0
- phenoml/fhir/errors/internal_server_error.py +10 -0
- phenoml/fhir/errors/not_found_error.py +10 -0
- phenoml/fhir/errors/unauthorized_error.py +10 -0
- phenoml/fhir/raw_client.py +1385 -0
- phenoml/fhir/types/__init__.py +29 -0
- phenoml/{agent/types/chat_fhir_client_config.py → fhir/types/error_response.py} +11 -6
- phenoml/fhir/types/fhir_bundle.py +43 -0
- phenoml/fhir/types/fhir_bundle_entry_item.py +34 -0
- phenoml/{agent/types/agent_fhir_config.py → fhir/types/fhir_bundle_entry_item_request.py} +5 -11
- phenoml/fhir/types/fhir_bundle_entry_item_request_method.py +5 -0
- phenoml/fhir/types/fhir_bundle_entry_item_response.py +24 -0
- phenoml/fhir/types/fhir_patch_request_body_item.py +36 -0
- phenoml/fhir/types/fhir_patch_request_body_item_op.py +7 -0
- phenoml/fhir/types/fhir_resource.py +40 -0
- phenoml/fhir/types/fhir_resource_meta.py +28 -0
- phenoml/fhir/types/fhir_search_response.py +8 -0
- phenoml/fhir_provider/__init__.py +43 -0
- phenoml/fhir_provider/client.py +731 -0
- phenoml/fhir_provider/errors/__init__.py +11 -0
- phenoml/fhir_provider/errors/bad_request_error.py +10 -0
- phenoml/fhir_provider/errors/forbidden_error.py +10 -0
- phenoml/fhir_provider/errors/internal_server_error.py +10 -0
- phenoml/fhir_provider/errors/not_found_error.py +10 -0
- phenoml/fhir_provider/errors/unauthorized_error.py +10 -0
- phenoml/fhir_provider/raw_client.py +1445 -0
- phenoml/fhir_provider/types/__init__.py +35 -0
- phenoml/fhir_provider/types/auth_method.py +7 -0
- phenoml/fhir_provider/types/fhir_provider_auth_config.py +53 -0
- phenoml/fhir_provider/types/fhir_provider_delete_response.py +20 -0
- phenoml/fhir_provider/types/fhir_provider_list_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_remove_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_set_active_auth_config_response.py +22 -0
- phenoml/fhir_provider/types/fhir_provider_template.py +66 -0
- phenoml/fhir_provider/types/fhir_query_response.py +27 -0
- phenoml/fhir_provider/types/fhir_query_response_data.py +5 -0
- phenoml/fhir_provider/types/json_web_key.py +51 -0
- phenoml/fhir_provider/types/provider.py +8 -0
- phenoml/fhir_provider/types/service_account_key.py +35 -0
- phenoml/fhir_provider/types/smart_configuration.py +46 -0
- phenoml/tools/__init__.py +0 -8
- phenoml/tools/client.py +24 -60
- phenoml/tools/raw_client.py +18 -67
- phenoml/tools/types/__init__.py +0 -8
- phenoml-0.0.5.dist-info/LICENSE +21 -0
- {phenoml-0.0.2.dist-info → phenoml-0.0.5.dist-info}/METADATA +1 -1
- {phenoml-0.0.2.dist-info → phenoml-0.0.5.dist-info}/RECORD +62 -22
- phenoml/agent/types/agent_provider.py +0 -7
- phenoml/agent/types/provider_type.py +0 -5
- phenoml/tools/types/cohort_request_provider.py +0 -5
- phenoml/tools/types/fhir_client_config.py +0 -31
- phenoml/tools/types/lang2fhir_and_create_request_provider.py +0 -7
- phenoml/tools/types/lang2fhir_and_search_request_provider.py +0 -7
- {phenoml-0.0.2.dist-info → phenoml-0.0.5.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,1445 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
import datetime as dt
|
|
4
|
+
import typing
|
|
5
|
+
from json.decoder import JSONDecodeError
|
|
6
|
+
|
|
7
|
+
from ..core.api_error import ApiError
|
|
8
|
+
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
|
|
9
|
+
from ..core.http_response import AsyncHttpResponse, HttpResponse
|
|
10
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
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.internal_server_error import InternalServerError
|
|
17
|
+
from .errors.not_found_error import NotFoundError
|
|
18
|
+
from .errors.unauthorized_error import UnauthorizedError
|
|
19
|
+
from .types.auth_method import AuthMethod
|
|
20
|
+
from .types.fhir_provider_delete_response import FhirProviderDeleteResponse
|
|
21
|
+
from .types.fhir_provider_list_response import FhirProviderListResponse
|
|
22
|
+
from .types.fhir_provider_remove_auth_config_response import FhirProviderRemoveAuthConfigResponse
|
|
23
|
+
from .types.fhir_provider_response import FhirProviderResponse
|
|
24
|
+
from .types.fhir_provider_set_active_auth_config_response import FhirProviderSetActiveAuthConfigResponse
|
|
25
|
+
from .types.provider import Provider
|
|
26
|
+
from .types.service_account_key import ServiceAccountKey
|
|
27
|
+
|
|
28
|
+
# this is used as the default value for optional parameters
|
|
29
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class RawFhirProviderClient:
|
|
33
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
34
|
+
self._client_wrapper = client_wrapper
|
|
35
|
+
|
|
36
|
+
def create(
|
|
37
|
+
self,
|
|
38
|
+
*,
|
|
39
|
+
name: str,
|
|
40
|
+
provider: Provider,
|
|
41
|
+
auth_method: AuthMethod,
|
|
42
|
+
base_url: str,
|
|
43
|
+
description: typing.Optional[str] = OMIT,
|
|
44
|
+
client_id: typing.Optional[str] = OMIT,
|
|
45
|
+
client_secret: typing.Optional[str] = OMIT,
|
|
46
|
+
service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
|
|
47
|
+
scopes: typing.Optional[str] = OMIT,
|
|
48
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
49
|
+
) -> HttpResponse[FhirProviderResponse]:
|
|
50
|
+
"""
|
|
51
|
+
Creates a new FHIR provider configuration with authentication credentials
|
|
52
|
+
|
|
53
|
+
Parameters
|
|
54
|
+
----------
|
|
55
|
+
name : str
|
|
56
|
+
Display name for the FHIR provider
|
|
57
|
+
|
|
58
|
+
provider : Provider
|
|
59
|
+
|
|
60
|
+
auth_method : AuthMethod
|
|
61
|
+
|
|
62
|
+
base_url : str
|
|
63
|
+
Base URL of the FHIR server
|
|
64
|
+
|
|
65
|
+
description : typing.Optional[str]
|
|
66
|
+
Optional description of the FHIR provider
|
|
67
|
+
|
|
68
|
+
client_id : typing.Optional[str]
|
|
69
|
+
OAuth client ID (required for most auth methods)
|
|
70
|
+
|
|
71
|
+
client_secret : typing.Optional[str]
|
|
72
|
+
OAuth client secret (required for client_secret and on_behalf_of auth methods)
|
|
73
|
+
|
|
74
|
+
service_account_key : typing.Optional[ServiceAccountKey]
|
|
75
|
+
|
|
76
|
+
scopes : typing.Optional[str]
|
|
77
|
+
OAuth scopes to request
|
|
78
|
+
|
|
79
|
+
request_options : typing.Optional[RequestOptions]
|
|
80
|
+
Request-specific configuration.
|
|
81
|
+
|
|
82
|
+
Returns
|
|
83
|
+
-------
|
|
84
|
+
HttpResponse[FhirProviderResponse]
|
|
85
|
+
FHIR provider created successfully
|
|
86
|
+
"""
|
|
87
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
88
|
+
"fhir-provider/create",
|
|
89
|
+
method="POST",
|
|
90
|
+
json={
|
|
91
|
+
"name": name,
|
|
92
|
+
"description": description,
|
|
93
|
+
"provider": provider,
|
|
94
|
+
"auth_method": auth_method,
|
|
95
|
+
"base_url": base_url,
|
|
96
|
+
"client_id": client_id,
|
|
97
|
+
"client_secret": client_secret,
|
|
98
|
+
"service_account_key": convert_and_respect_annotation_metadata(
|
|
99
|
+
object_=service_account_key, annotation=ServiceAccountKey, direction="write"
|
|
100
|
+
),
|
|
101
|
+
"scopes": scopes,
|
|
102
|
+
},
|
|
103
|
+
headers={
|
|
104
|
+
"content-type": "application/json",
|
|
105
|
+
},
|
|
106
|
+
request_options=request_options,
|
|
107
|
+
omit=OMIT,
|
|
108
|
+
)
|
|
109
|
+
try:
|
|
110
|
+
if 200 <= _response.status_code < 300:
|
|
111
|
+
_data = typing.cast(
|
|
112
|
+
FhirProviderResponse,
|
|
113
|
+
parse_obj_as(
|
|
114
|
+
type_=FhirProviderResponse, # type: ignore
|
|
115
|
+
object_=_response.json(),
|
|
116
|
+
),
|
|
117
|
+
)
|
|
118
|
+
return HttpResponse(response=_response, data=_data)
|
|
119
|
+
if _response.status_code == 400:
|
|
120
|
+
raise BadRequestError(
|
|
121
|
+
headers=dict(_response.headers),
|
|
122
|
+
body=typing.cast(
|
|
123
|
+
typing.Optional[typing.Any],
|
|
124
|
+
parse_obj_as(
|
|
125
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
126
|
+
object_=_response.json(),
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
)
|
|
130
|
+
if _response.status_code == 401:
|
|
131
|
+
raise UnauthorizedError(
|
|
132
|
+
headers=dict(_response.headers),
|
|
133
|
+
body=typing.cast(
|
|
134
|
+
typing.Optional[typing.Any],
|
|
135
|
+
parse_obj_as(
|
|
136
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
137
|
+
object_=_response.json(),
|
|
138
|
+
),
|
|
139
|
+
),
|
|
140
|
+
)
|
|
141
|
+
if _response.status_code == 403:
|
|
142
|
+
raise ForbiddenError(
|
|
143
|
+
headers=dict(_response.headers),
|
|
144
|
+
body=typing.cast(
|
|
145
|
+
typing.Optional[typing.Any],
|
|
146
|
+
parse_obj_as(
|
|
147
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
148
|
+
object_=_response.json(),
|
|
149
|
+
),
|
|
150
|
+
),
|
|
151
|
+
)
|
|
152
|
+
if _response.status_code == 500:
|
|
153
|
+
raise InternalServerError(
|
|
154
|
+
headers=dict(_response.headers),
|
|
155
|
+
body=typing.cast(
|
|
156
|
+
typing.Optional[typing.Any],
|
|
157
|
+
parse_obj_as(
|
|
158
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
159
|
+
object_=_response.json(),
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
)
|
|
163
|
+
_response_json = _response.json()
|
|
164
|
+
except JSONDecodeError:
|
|
165
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
166
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
167
|
+
|
|
168
|
+
def list(
|
|
169
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
170
|
+
) -> HttpResponse[FhirProviderListResponse]:
|
|
171
|
+
"""
|
|
172
|
+
Retrieves a list of all active FHIR providers for the authenticated user
|
|
173
|
+
|
|
174
|
+
Parameters
|
|
175
|
+
----------
|
|
176
|
+
request_options : typing.Optional[RequestOptions]
|
|
177
|
+
Request-specific configuration.
|
|
178
|
+
|
|
179
|
+
Returns
|
|
180
|
+
-------
|
|
181
|
+
HttpResponse[FhirProviderListResponse]
|
|
182
|
+
FHIR providers retrieved successfully
|
|
183
|
+
"""
|
|
184
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
185
|
+
"fhir-provider/list",
|
|
186
|
+
method="GET",
|
|
187
|
+
request_options=request_options,
|
|
188
|
+
)
|
|
189
|
+
try:
|
|
190
|
+
if 200 <= _response.status_code < 300:
|
|
191
|
+
_data = typing.cast(
|
|
192
|
+
FhirProviderListResponse,
|
|
193
|
+
parse_obj_as(
|
|
194
|
+
type_=FhirProviderListResponse, # type: ignore
|
|
195
|
+
object_=_response.json(),
|
|
196
|
+
),
|
|
197
|
+
)
|
|
198
|
+
return HttpResponse(response=_response, data=_data)
|
|
199
|
+
if _response.status_code == 401:
|
|
200
|
+
raise UnauthorizedError(
|
|
201
|
+
headers=dict(_response.headers),
|
|
202
|
+
body=typing.cast(
|
|
203
|
+
typing.Optional[typing.Any],
|
|
204
|
+
parse_obj_as(
|
|
205
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
206
|
+
object_=_response.json(),
|
|
207
|
+
),
|
|
208
|
+
),
|
|
209
|
+
)
|
|
210
|
+
if _response.status_code == 403:
|
|
211
|
+
raise ForbiddenError(
|
|
212
|
+
headers=dict(_response.headers),
|
|
213
|
+
body=typing.cast(
|
|
214
|
+
typing.Optional[typing.Any],
|
|
215
|
+
parse_obj_as(
|
|
216
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
217
|
+
object_=_response.json(),
|
|
218
|
+
),
|
|
219
|
+
),
|
|
220
|
+
)
|
|
221
|
+
if _response.status_code == 500:
|
|
222
|
+
raise InternalServerError(
|
|
223
|
+
headers=dict(_response.headers),
|
|
224
|
+
body=typing.cast(
|
|
225
|
+
typing.Optional[typing.Any],
|
|
226
|
+
parse_obj_as(
|
|
227
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
228
|
+
object_=_response.json(),
|
|
229
|
+
),
|
|
230
|
+
),
|
|
231
|
+
)
|
|
232
|
+
_response_json = _response.json()
|
|
233
|
+
except JSONDecodeError:
|
|
234
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
235
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
236
|
+
|
|
237
|
+
def get(
|
|
238
|
+
self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
239
|
+
) -> HttpResponse[FhirProviderResponse]:
|
|
240
|
+
"""
|
|
241
|
+
Retrieves a specific FHIR provider configuration by its ID
|
|
242
|
+
|
|
243
|
+
Parameters
|
|
244
|
+
----------
|
|
245
|
+
fhir_provider_id : str
|
|
246
|
+
ID of the FHIR provider to retrieve
|
|
247
|
+
|
|
248
|
+
request_options : typing.Optional[RequestOptions]
|
|
249
|
+
Request-specific configuration.
|
|
250
|
+
|
|
251
|
+
Returns
|
|
252
|
+
-------
|
|
253
|
+
HttpResponse[FhirProviderResponse]
|
|
254
|
+
FHIR provider retrieved successfully
|
|
255
|
+
"""
|
|
256
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
257
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}",
|
|
258
|
+
method="GET",
|
|
259
|
+
request_options=request_options,
|
|
260
|
+
)
|
|
261
|
+
try:
|
|
262
|
+
if 200 <= _response.status_code < 300:
|
|
263
|
+
_data = typing.cast(
|
|
264
|
+
FhirProviderResponse,
|
|
265
|
+
parse_obj_as(
|
|
266
|
+
type_=FhirProviderResponse, # type: ignore
|
|
267
|
+
object_=_response.json(),
|
|
268
|
+
),
|
|
269
|
+
)
|
|
270
|
+
return HttpResponse(response=_response, data=_data)
|
|
271
|
+
if _response.status_code == 401:
|
|
272
|
+
raise UnauthorizedError(
|
|
273
|
+
headers=dict(_response.headers),
|
|
274
|
+
body=typing.cast(
|
|
275
|
+
typing.Optional[typing.Any],
|
|
276
|
+
parse_obj_as(
|
|
277
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
278
|
+
object_=_response.json(),
|
|
279
|
+
),
|
|
280
|
+
),
|
|
281
|
+
)
|
|
282
|
+
if _response.status_code == 403:
|
|
283
|
+
raise ForbiddenError(
|
|
284
|
+
headers=dict(_response.headers),
|
|
285
|
+
body=typing.cast(
|
|
286
|
+
typing.Optional[typing.Any],
|
|
287
|
+
parse_obj_as(
|
|
288
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
289
|
+
object_=_response.json(),
|
|
290
|
+
),
|
|
291
|
+
),
|
|
292
|
+
)
|
|
293
|
+
if _response.status_code == 404:
|
|
294
|
+
raise NotFoundError(
|
|
295
|
+
headers=dict(_response.headers),
|
|
296
|
+
body=typing.cast(
|
|
297
|
+
typing.Optional[typing.Any],
|
|
298
|
+
parse_obj_as(
|
|
299
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
300
|
+
object_=_response.json(),
|
|
301
|
+
),
|
|
302
|
+
),
|
|
303
|
+
)
|
|
304
|
+
if _response.status_code == 500:
|
|
305
|
+
raise InternalServerError(
|
|
306
|
+
headers=dict(_response.headers),
|
|
307
|
+
body=typing.cast(
|
|
308
|
+
typing.Optional[typing.Any],
|
|
309
|
+
parse_obj_as(
|
|
310
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
311
|
+
object_=_response.json(),
|
|
312
|
+
),
|
|
313
|
+
),
|
|
314
|
+
)
|
|
315
|
+
_response_json = _response.json()
|
|
316
|
+
except JSONDecodeError:
|
|
317
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
318
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
319
|
+
|
|
320
|
+
def delete(
|
|
321
|
+
self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
322
|
+
) -> HttpResponse[FhirProviderDeleteResponse]:
|
|
323
|
+
"""
|
|
324
|
+
Soft deletes a FHIR provider by setting is_active to false
|
|
325
|
+
|
|
326
|
+
Parameters
|
|
327
|
+
----------
|
|
328
|
+
fhir_provider_id : str
|
|
329
|
+
ID of the FHIR provider to delete
|
|
330
|
+
|
|
331
|
+
request_options : typing.Optional[RequestOptions]
|
|
332
|
+
Request-specific configuration.
|
|
333
|
+
|
|
334
|
+
Returns
|
|
335
|
+
-------
|
|
336
|
+
HttpResponse[FhirProviderDeleteResponse]
|
|
337
|
+
FHIR provider deleted successfully
|
|
338
|
+
"""
|
|
339
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
340
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}",
|
|
341
|
+
method="DELETE",
|
|
342
|
+
request_options=request_options,
|
|
343
|
+
)
|
|
344
|
+
try:
|
|
345
|
+
if 200 <= _response.status_code < 300:
|
|
346
|
+
_data = typing.cast(
|
|
347
|
+
FhirProviderDeleteResponse,
|
|
348
|
+
parse_obj_as(
|
|
349
|
+
type_=FhirProviderDeleteResponse, # type: ignore
|
|
350
|
+
object_=_response.json(),
|
|
351
|
+
),
|
|
352
|
+
)
|
|
353
|
+
return HttpResponse(response=_response, data=_data)
|
|
354
|
+
if _response.status_code == 401:
|
|
355
|
+
raise UnauthorizedError(
|
|
356
|
+
headers=dict(_response.headers),
|
|
357
|
+
body=typing.cast(
|
|
358
|
+
typing.Optional[typing.Any],
|
|
359
|
+
parse_obj_as(
|
|
360
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
361
|
+
object_=_response.json(),
|
|
362
|
+
),
|
|
363
|
+
),
|
|
364
|
+
)
|
|
365
|
+
if _response.status_code == 403:
|
|
366
|
+
raise ForbiddenError(
|
|
367
|
+
headers=dict(_response.headers),
|
|
368
|
+
body=typing.cast(
|
|
369
|
+
typing.Optional[typing.Any],
|
|
370
|
+
parse_obj_as(
|
|
371
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
372
|
+
object_=_response.json(),
|
|
373
|
+
),
|
|
374
|
+
),
|
|
375
|
+
)
|
|
376
|
+
if _response.status_code == 404:
|
|
377
|
+
raise NotFoundError(
|
|
378
|
+
headers=dict(_response.headers),
|
|
379
|
+
body=typing.cast(
|
|
380
|
+
typing.Optional[typing.Any],
|
|
381
|
+
parse_obj_as(
|
|
382
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
383
|
+
object_=_response.json(),
|
|
384
|
+
),
|
|
385
|
+
),
|
|
386
|
+
)
|
|
387
|
+
if _response.status_code == 500:
|
|
388
|
+
raise InternalServerError(
|
|
389
|
+
headers=dict(_response.headers),
|
|
390
|
+
body=typing.cast(
|
|
391
|
+
typing.Optional[typing.Any],
|
|
392
|
+
parse_obj_as(
|
|
393
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
394
|
+
object_=_response.json(),
|
|
395
|
+
),
|
|
396
|
+
),
|
|
397
|
+
)
|
|
398
|
+
_response_json = _response.json()
|
|
399
|
+
except JSONDecodeError:
|
|
400
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
401
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
402
|
+
|
|
403
|
+
def add_auth_config(
|
|
404
|
+
self,
|
|
405
|
+
fhir_provider_id: str,
|
|
406
|
+
*,
|
|
407
|
+
auth_method: AuthMethod,
|
|
408
|
+
client_secret: typing.Optional[str] = OMIT,
|
|
409
|
+
service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
|
|
410
|
+
credential_expiry: typing.Optional[dt.datetime] = OMIT,
|
|
411
|
+
scopes: typing.Optional[str] = OMIT,
|
|
412
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
413
|
+
) -> HttpResponse[FhirProviderResponse]:
|
|
414
|
+
"""
|
|
415
|
+
Adds a new authentication configuration to an existing FHIR provider. This enables key rotation and multiple auth configurations per provider.
|
|
416
|
+
|
|
417
|
+
Parameters
|
|
418
|
+
----------
|
|
419
|
+
fhir_provider_id : str
|
|
420
|
+
ID of the FHIR provider to add auth config to
|
|
421
|
+
|
|
422
|
+
auth_method : AuthMethod
|
|
423
|
+
|
|
424
|
+
client_secret : typing.Optional[str]
|
|
425
|
+
OAuth client secret (required for client_secret and on_behalf_of auth methods)
|
|
426
|
+
|
|
427
|
+
service_account_key : typing.Optional[ServiceAccountKey]
|
|
428
|
+
|
|
429
|
+
credential_expiry : typing.Optional[dt.datetime]
|
|
430
|
+
Expiry time for JWT credentials (only applicable for JWT auth method)
|
|
431
|
+
|
|
432
|
+
scopes : typing.Optional[str]
|
|
433
|
+
OAuth scopes to request
|
|
434
|
+
|
|
435
|
+
request_options : typing.Optional[RequestOptions]
|
|
436
|
+
Request-specific configuration.
|
|
437
|
+
|
|
438
|
+
Returns
|
|
439
|
+
-------
|
|
440
|
+
HttpResponse[FhirProviderResponse]
|
|
441
|
+
Auth configuration added successfully
|
|
442
|
+
"""
|
|
443
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
444
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}/add-auth-config",
|
|
445
|
+
method="PATCH",
|
|
446
|
+
json={
|
|
447
|
+
"auth_method": auth_method,
|
|
448
|
+
"client_secret": client_secret,
|
|
449
|
+
"service_account_key": convert_and_respect_annotation_metadata(
|
|
450
|
+
object_=service_account_key, annotation=ServiceAccountKey, direction="write"
|
|
451
|
+
),
|
|
452
|
+
"credential_expiry": credential_expiry,
|
|
453
|
+
"scopes": scopes,
|
|
454
|
+
},
|
|
455
|
+
headers={
|
|
456
|
+
"content-type": "application/json",
|
|
457
|
+
},
|
|
458
|
+
request_options=request_options,
|
|
459
|
+
omit=OMIT,
|
|
460
|
+
)
|
|
461
|
+
try:
|
|
462
|
+
if 200 <= _response.status_code < 300:
|
|
463
|
+
_data = typing.cast(
|
|
464
|
+
FhirProviderResponse,
|
|
465
|
+
parse_obj_as(
|
|
466
|
+
type_=FhirProviderResponse, # type: ignore
|
|
467
|
+
object_=_response.json(),
|
|
468
|
+
),
|
|
469
|
+
)
|
|
470
|
+
return HttpResponse(response=_response, data=_data)
|
|
471
|
+
if _response.status_code == 400:
|
|
472
|
+
raise BadRequestError(
|
|
473
|
+
headers=dict(_response.headers),
|
|
474
|
+
body=typing.cast(
|
|
475
|
+
typing.Optional[typing.Any],
|
|
476
|
+
parse_obj_as(
|
|
477
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
478
|
+
object_=_response.json(),
|
|
479
|
+
),
|
|
480
|
+
),
|
|
481
|
+
)
|
|
482
|
+
if _response.status_code == 401:
|
|
483
|
+
raise UnauthorizedError(
|
|
484
|
+
headers=dict(_response.headers),
|
|
485
|
+
body=typing.cast(
|
|
486
|
+
typing.Optional[typing.Any],
|
|
487
|
+
parse_obj_as(
|
|
488
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
489
|
+
object_=_response.json(),
|
|
490
|
+
),
|
|
491
|
+
),
|
|
492
|
+
)
|
|
493
|
+
if _response.status_code == 403:
|
|
494
|
+
raise ForbiddenError(
|
|
495
|
+
headers=dict(_response.headers),
|
|
496
|
+
body=typing.cast(
|
|
497
|
+
typing.Optional[typing.Any],
|
|
498
|
+
parse_obj_as(
|
|
499
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
500
|
+
object_=_response.json(),
|
|
501
|
+
),
|
|
502
|
+
),
|
|
503
|
+
)
|
|
504
|
+
if _response.status_code == 404:
|
|
505
|
+
raise NotFoundError(
|
|
506
|
+
headers=dict(_response.headers),
|
|
507
|
+
body=typing.cast(
|
|
508
|
+
typing.Optional[typing.Any],
|
|
509
|
+
parse_obj_as(
|
|
510
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
511
|
+
object_=_response.json(),
|
|
512
|
+
),
|
|
513
|
+
),
|
|
514
|
+
)
|
|
515
|
+
if _response.status_code == 500:
|
|
516
|
+
raise InternalServerError(
|
|
517
|
+
headers=dict(_response.headers),
|
|
518
|
+
body=typing.cast(
|
|
519
|
+
typing.Optional[typing.Any],
|
|
520
|
+
parse_obj_as(
|
|
521
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
522
|
+
object_=_response.json(),
|
|
523
|
+
),
|
|
524
|
+
),
|
|
525
|
+
)
|
|
526
|
+
_response_json = _response.json()
|
|
527
|
+
except JSONDecodeError:
|
|
528
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
529
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
530
|
+
|
|
531
|
+
def set_active_auth_config(
|
|
532
|
+
self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
533
|
+
) -> HttpResponse[FhirProviderSetActiveAuthConfigResponse]:
|
|
534
|
+
"""
|
|
535
|
+
Sets which authentication configuration should be active for a FHIR provider. Only one auth config can be active at a time.
|
|
536
|
+
|
|
537
|
+
Parameters
|
|
538
|
+
----------
|
|
539
|
+
fhir_provider_id : str
|
|
540
|
+
ID of the FHIR provider
|
|
541
|
+
|
|
542
|
+
auth_config_id : str
|
|
543
|
+
ID of the auth configuration to set as active
|
|
544
|
+
|
|
545
|
+
request_options : typing.Optional[RequestOptions]
|
|
546
|
+
Request-specific configuration.
|
|
547
|
+
|
|
548
|
+
Returns
|
|
549
|
+
-------
|
|
550
|
+
HttpResponse[FhirProviderSetActiveAuthConfigResponse]
|
|
551
|
+
Active auth configuration set successfully
|
|
552
|
+
"""
|
|
553
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
554
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}/set-active-auth-config",
|
|
555
|
+
method="PATCH",
|
|
556
|
+
json={
|
|
557
|
+
"auth_config_id": auth_config_id,
|
|
558
|
+
},
|
|
559
|
+
headers={
|
|
560
|
+
"content-type": "application/json",
|
|
561
|
+
},
|
|
562
|
+
request_options=request_options,
|
|
563
|
+
omit=OMIT,
|
|
564
|
+
)
|
|
565
|
+
try:
|
|
566
|
+
if 200 <= _response.status_code < 300:
|
|
567
|
+
_data = typing.cast(
|
|
568
|
+
FhirProviderSetActiveAuthConfigResponse,
|
|
569
|
+
parse_obj_as(
|
|
570
|
+
type_=FhirProviderSetActiveAuthConfigResponse, # type: ignore
|
|
571
|
+
object_=_response.json(),
|
|
572
|
+
),
|
|
573
|
+
)
|
|
574
|
+
return HttpResponse(response=_response, data=_data)
|
|
575
|
+
if _response.status_code == 400:
|
|
576
|
+
raise BadRequestError(
|
|
577
|
+
headers=dict(_response.headers),
|
|
578
|
+
body=typing.cast(
|
|
579
|
+
typing.Optional[typing.Any],
|
|
580
|
+
parse_obj_as(
|
|
581
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
582
|
+
object_=_response.json(),
|
|
583
|
+
),
|
|
584
|
+
),
|
|
585
|
+
)
|
|
586
|
+
if _response.status_code == 401:
|
|
587
|
+
raise UnauthorizedError(
|
|
588
|
+
headers=dict(_response.headers),
|
|
589
|
+
body=typing.cast(
|
|
590
|
+
typing.Optional[typing.Any],
|
|
591
|
+
parse_obj_as(
|
|
592
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
593
|
+
object_=_response.json(),
|
|
594
|
+
),
|
|
595
|
+
),
|
|
596
|
+
)
|
|
597
|
+
if _response.status_code == 403:
|
|
598
|
+
raise ForbiddenError(
|
|
599
|
+
headers=dict(_response.headers),
|
|
600
|
+
body=typing.cast(
|
|
601
|
+
typing.Optional[typing.Any],
|
|
602
|
+
parse_obj_as(
|
|
603
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
604
|
+
object_=_response.json(),
|
|
605
|
+
),
|
|
606
|
+
),
|
|
607
|
+
)
|
|
608
|
+
if _response.status_code == 404:
|
|
609
|
+
raise NotFoundError(
|
|
610
|
+
headers=dict(_response.headers),
|
|
611
|
+
body=typing.cast(
|
|
612
|
+
typing.Optional[typing.Any],
|
|
613
|
+
parse_obj_as(
|
|
614
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
615
|
+
object_=_response.json(),
|
|
616
|
+
),
|
|
617
|
+
),
|
|
618
|
+
)
|
|
619
|
+
if _response.status_code == 500:
|
|
620
|
+
raise InternalServerError(
|
|
621
|
+
headers=dict(_response.headers),
|
|
622
|
+
body=typing.cast(
|
|
623
|
+
typing.Optional[typing.Any],
|
|
624
|
+
parse_obj_as(
|
|
625
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
626
|
+
object_=_response.json(),
|
|
627
|
+
),
|
|
628
|
+
),
|
|
629
|
+
)
|
|
630
|
+
_response_json = _response.json()
|
|
631
|
+
except JSONDecodeError:
|
|
632
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
633
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
634
|
+
|
|
635
|
+
def remove_auth_config(
|
|
636
|
+
self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
637
|
+
) -> HttpResponse[FhirProviderRemoveAuthConfigResponse]:
|
|
638
|
+
"""
|
|
639
|
+
Removes an authentication configuration from a FHIR provider. Cannot remove the currently active auth configuration.
|
|
640
|
+
|
|
641
|
+
Parameters
|
|
642
|
+
----------
|
|
643
|
+
fhir_provider_id : str
|
|
644
|
+
ID of the FHIR provider
|
|
645
|
+
|
|
646
|
+
auth_config_id : str
|
|
647
|
+
ID of the auth configuration to remove
|
|
648
|
+
|
|
649
|
+
request_options : typing.Optional[RequestOptions]
|
|
650
|
+
Request-specific configuration.
|
|
651
|
+
|
|
652
|
+
Returns
|
|
653
|
+
-------
|
|
654
|
+
HttpResponse[FhirProviderRemoveAuthConfigResponse]
|
|
655
|
+
Auth configuration removed successfully
|
|
656
|
+
"""
|
|
657
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
658
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}/remove-auth-config",
|
|
659
|
+
method="PATCH",
|
|
660
|
+
json={
|
|
661
|
+
"auth_config_id": auth_config_id,
|
|
662
|
+
},
|
|
663
|
+
headers={
|
|
664
|
+
"content-type": "application/json",
|
|
665
|
+
},
|
|
666
|
+
request_options=request_options,
|
|
667
|
+
omit=OMIT,
|
|
668
|
+
)
|
|
669
|
+
try:
|
|
670
|
+
if 200 <= _response.status_code < 300:
|
|
671
|
+
_data = typing.cast(
|
|
672
|
+
FhirProviderRemoveAuthConfigResponse,
|
|
673
|
+
parse_obj_as(
|
|
674
|
+
type_=FhirProviderRemoveAuthConfigResponse, # type: ignore
|
|
675
|
+
object_=_response.json(),
|
|
676
|
+
),
|
|
677
|
+
)
|
|
678
|
+
return HttpResponse(response=_response, data=_data)
|
|
679
|
+
if _response.status_code == 400:
|
|
680
|
+
raise BadRequestError(
|
|
681
|
+
headers=dict(_response.headers),
|
|
682
|
+
body=typing.cast(
|
|
683
|
+
typing.Optional[typing.Any],
|
|
684
|
+
parse_obj_as(
|
|
685
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
686
|
+
object_=_response.json(),
|
|
687
|
+
),
|
|
688
|
+
),
|
|
689
|
+
)
|
|
690
|
+
if _response.status_code == 401:
|
|
691
|
+
raise UnauthorizedError(
|
|
692
|
+
headers=dict(_response.headers),
|
|
693
|
+
body=typing.cast(
|
|
694
|
+
typing.Optional[typing.Any],
|
|
695
|
+
parse_obj_as(
|
|
696
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
697
|
+
object_=_response.json(),
|
|
698
|
+
),
|
|
699
|
+
),
|
|
700
|
+
)
|
|
701
|
+
if _response.status_code == 403:
|
|
702
|
+
raise ForbiddenError(
|
|
703
|
+
headers=dict(_response.headers),
|
|
704
|
+
body=typing.cast(
|
|
705
|
+
typing.Optional[typing.Any],
|
|
706
|
+
parse_obj_as(
|
|
707
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
708
|
+
object_=_response.json(),
|
|
709
|
+
),
|
|
710
|
+
),
|
|
711
|
+
)
|
|
712
|
+
if _response.status_code == 404:
|
|
713
|
+
raise NotFoundError(
|
|
714
|
+
headers=dict(_response.headers),
|
|
715
|
+
body=typing.cast(
|
|
716
|
+
typing.Optional[typing.Any],
|
|
717
|
+
parse_obj_as(
|
|
718
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
719
|
+
object_=_response.json(),
|
|
720
|
+
),
|
|
721
|
+
),
|
|
722
|
+
)
|
|
723
|
+
if _response.status_code == 500:
|
|
724
|
+
raise InternalServerError(
|
|
725
|
+
headers=dict(_response.headers),
|
|
726
|
+
body=typing.cast(
|
|
727
|
+
typing.Optional[typing.Any],
|
|
728
|
+
parse_obj_as(
|
|
729
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
730
|
+
object_=_response.json(),
|
|
731
|
+
),
|
|
732
|
+
),
|
|
733
|
+
)
|
|
734
|
+
_response_json = _response.json()
|
|
735
|
+
except JSONDecodeError:
|
|
736
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
737
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
class AsyncRawFhirProviderClient:
|
|
741
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
742
|
+
self._client_wrapper = client_wrapper
|
|
743
|
+
|
|
744
|
+
async def create(
|
|
745
|
+
self,
|
|
746
|
+
*,
|
|
747
|
+
name: str,
|
|
748
|
+
provider: Provider,
|
|
749
|
+
auth_method: AuthMethod,
|
|
750
|
+
base_url: str,
|
|
751
|
+
description: typing.Optional[str] = OMIT,
|
|
752
|
+
client_id: typing.Optional[str] = OMIT,
|
|
753
|
+
client_secret: typing.Optional[str] = OMIT,
|
|
754
|
+
service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
|
|
755
|
+
scopes: typing.Optional[str] = OMIT,
|
|
756
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
757
|
+
) -> AsyncHttpResponse[FhirProviderResponse]:
|
|
758
|
+
"""
|
|
759
|
+
Creates a new FHIR provider configuration with authentication credentials
|
|
760
|
+
|
|
761
|
+
Parameters
|
|
762
|
+
----------
|
|
763
|
+
name : str
|
|
764
|
+
Display name for the FHIR provider
|
|
765
|
+
|
|
766
|
+
provider : Provider
|
|
767
|
+
|
|
768
|
+
auth_method : AuthMethod
|
|
769
|
+
|
|
770
|
+
base_url : str
|
|
771
|
+
Base URL of the FHIR server
|
|
772
|
+
|
|
773
|
+
description : typing.Optional[str]
|
|
774
|
+
Optional description of the FHIR provider
|
|
775
|
+
|
|
776
|
+
client_id : typing.Optional[str]
|
|
777
|
+
OAuth client ID (required for most auth methods)
|
|
778
|
+
|
|
779
|
+
client_secret : typing.Optional[str]
|
|
780
|
+
OAuth client secret (required for client_secret and on_behalf_of auth methods)
|
|
781
|
+
|
|
782
|
+
service_account_key : typing.Optional[ServiceAccountKey]
|
|
783
|
+
|
|
784
|
+
scopes : typing.Optional[str]
|
|
785
|
+
OAuth scopes to request
|
|
786
|
+
|
|
787
|
+
request_options : typing.Optional[RequestOptions]
|
|
788
|
+
Request-specific configuration.
|
|
789
|
+
|
|
790
|
+
Returns
|
|
791
|
+
-------
|
|
792
|
+
AsyncHttpResponse[FhirProviderResponse]
|
|
793
|
+
FHIR provider created successfully
|
|
794
|
+
"""
|
|
795
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
796
|
+
"fhir-provider/create",
|
|
797
|
+
method="POST",
|
|
798
|
+
json={
|
|
799
|
+
"name": name,
|
|
800
|
+
"description": description,
|
|
801
|
+
"provider": provider,
|
|
802
|
+
"auth_method": auth_method,
|
|
803
|
+
"base_url": base_url,
|
|
804
|
+
"client_id": client_id,
|
|
805
|
+
"client_secret": client_secret,
|
|
806
|
+
"service_account_key": convert_and_respect_annotation_metadata(
|
|
807
|
+
object_=service_account_key, annotation=ServiceAccountKey, direction="write"
|
|
808
|
+
),
|
|
809
|
+
"scopes": scopes,
|
|
810
|
+
},
|
|
811
|
+
headers={
|
|
812
|
+
"content-type": "application/json",
|
|
813
|
+
},
|
|
814
|
+
request_options=request_options,
|
|
815
|
+
omit=OMIT,
|
|
816
|
+
)
|
|
817
|
+
try:
|
|
818
|
+
if 200 <= _response.status_code < 300:
|
|
819
|
+
_data = typing.cast(
|
|
820
|
+
FhirProviderResponse,
|
|
821
|
+
parse_obj_as(
|
|
822
|
+
type_=FhirProviderResponse, # type: ignore
|
|
823
|
+
object_=_response.json(),
|
|
824
|
+
),
|
|
825
|
+
)
|
|
826
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
827
|
+
if _response.status_code == 400:
|
|
828
|
+
raise BadRequestError(
|
|
829
|
+
headers=dict(_response.headers),
|
|
830
|
+
body=typing.cast(
|
|
831
|
+
typing.Optional[typing.Any],
|
|
832
|
+
parse_obj_as(
|
|
833
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
834
|
+
object_=_response.json(),
|
|
835
|
+
),
|
|
836
|
+
),
|
|
837
|
+
)
|
|
838
|
+
if _response.status_code == 401:
|
|
839
|
+
raise UnauthorizedError(
|
|
840
|
+
headers=dict(_response.headers),
|
|
841
|
+
body=typing.cast(
|
|
842
|
+
typing.Optional[typing.Any],
|
|
843
|
+
parse_obj_as(
|
|
844
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
845
|
+
object_=_response.json(),
|
|
846
|
+
),
|
|
847
|
+
),
|
|
848
|
+
)
|
|
849
|
+
if _response.status_code == 403:
|
|
850
|
+
raise ForbiddenError(
|
|
851
|
+
headers=dict(_response.headers),
|
|
852
|
+
body=typing.cast(
|
|
853
|
+
typing.Optional[typing.Any],
|
|
854
|
+
parse_obj_as(
|
|
855
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
856
|
+
object_=_response.json(),
|
|
857
|
+
),
|
|
858
|
+
),
|
|
859
|
+
)
|
|
860
|
+
if _response.status_code == 500:
|
|
861
|
+
raise InternalServerError(
|
|
862
|
+
headers=dict(_response.headers),
|
|
863
|
+
body=typing.cast(
|
|
864
|
+
typing.Optional[typing.Any],
|
|
865
|
+
parse_obj_as(
|
|
866
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
867
|
+
object_=_response.json(),
|
|
868
|
+
),
|
|
869
|
+
),
|
|
870
|
+
)
|
|
871
|
+
_response_json = _response.json()
|
|
872
|
+
except JSONDecodeError:
|
|
873
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
874
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
875
|
+
|
|
876
|
+
async def list(
|
|
877
|
+
self, *, request_options: typing.Optional[RequestOptions] = None
|
|
878
|
+
) -> AsyncHttpResponse[FhirProviderListResponse]:
|
|
879
|
+
"""
|
|
880
|
+
Retrieves a list of all active FHIR providers for the authenticated user
|
|
881
|
+
|
|
882
|
+
Parameters
|
|
883
|
+
----------
|
|
884
|
+
request_options : typing.Optional[RequestOptions]
|
|
885
|
+
Request-specific configuration.
|
|
886
|
+
|
|
887
|
+
Returns
|
|
888
|
+
-------
|
|
889
|
+
AsyncHttpResponse[FhirProviderListResponse]
|
|
890
|
+
FHIR providers retrieved successfully
|
|
891
|
+
"""
|
|
892
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
893
|
+
"fhir-provider/list",
|
|
894
|
+
method="GET",
|
|
895
|
+
request_options=request_options,
|
|
896
|
+
)
|
|
897
|
+
try:
|
|
898
|
+
if 200 <= _response.status_code < 300:
|
|
899
|
+
_data = typing.cast(
|
|
900
|
+
FhirProviderListResponse,
|
|
901
|
+
parse_obj_as(
|
|
902
|
+
type_=FhirProviderListResponse, # type: ignore
|
|
903
|
+
object_=_response.json(),
|
|
904
|
+
),
|
|
905
|
+
)
|
|
906
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
907
|
+
if _response.status_code == 401:
|
|
908
|
+
raise UnauthorizedError(
|
|
909
|
+
headers=dict(_response.headers),
|
|
910
|
+
body=typing.cast(
|
|
911
|
+
typing.Optional[typing.Any],
|
|
912
|
+
parse_obj_as(
|
|
913
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
914
|
+
object_=_response.json(),
|
|
915
|
+
),
|
|
916
|
+
),
|
|
917
|
+
)
|
|
918
|
+
if _response.status_code == 403:
|
|
919
|
+
raise ForbiddenError(
|
|
920
|
+
headers=dict(_response.headers),
|
|
921
|
+
body=typing.cast(
|
|
922
|
+
typing.Optional[typing.Any],
|
|
923
|
+
parse_obj_as(
|
|
924
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
925
|
+
object_=_response.json(),
|
|
926
|
+
),
|
|
927
|
+
),
|
|
928
|
+
)
|
|
929
|
+
if _response.status_code == 500:
|
|
930
|
+
raise InternalServerError(
|
|
931
|
+
headers=dict(_response.headers),
|
|
932
|
+
body=typing.cast(
|
|
933
|
+
typing.Optional[typing.Any],
|
|
934
|
+
parse_obj_as(
|
|
935
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
936
|
+
object_=_response.json(),
|
|
937
|
+
),
|
|
938
|
+
),
|
|
939
|
+
)
|
|
940
|
+
_response_json = _response.json()
|
|
941
|
+
except JSONDecodeError:
|
|
942
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
943
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
944
|
+
|
|
945
|
+
async def get(
|
|
946
|
+
self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
947
|
+
) -> AsyncHttpResponse[FhirProviderResponse]:
|
|
948
|
+
"""
|
|
949
|
+
Retrieves a specific FHIR provider configuration by its ID
|
|
950
|
+
|
|
951
|
+
Parameters
|
|
952
|
+
----------
|
|
953
|
+
fhir_provider_id : str
|
|
954
|
+
ID of the FHIR provider to retrieve
|
|
955
|
+
|
|
956
|
+
request_options : typing.Optional[RequestOptions]
|
|
957
|
+
Request-specific configuration.
|
|
958
|
+
|
|
959
|
+
Returns
|
|
960
|
+
-------
|
|
961
|
+
AsyncHttpResponse[FhirProviderResponse]
|
|
962
|
+
FHIR provider retrieved successfully
|
|
963
|
+
"""
|
|
964
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
965
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}",
|
|
966
|
+
method="GET",
|
|
967
|
+
request_options=request_options,
|
|
968
|
+
)
|
|
969
|
+
try:
|
|
970
|
+
if 200 <= _response.status_code < 300:
|
|
971
|
+
_data = typing.cast(
|
|
972
|
+
FhirProviderResponse,
|
|
973
|
+
parse_obj_as(
|
|
974
|
+
type_=FhirProviderResponse, # type: ignore
|
|
975
|
+
object_=_response.json(),
|
|
976
|
+
),
|
|
977
|
+
)
|
|
978
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
979
|
+
if _response.status_code == 401:
|
|
980
|
+
raise UnauthorizedError(
|
|
981
|
+
headers=dict(_response.headers),
|
|
982
|
+
body=typing.cast(
|
|
983
|
+
typing.Optional[typing.Any],
|
|
984
|
+
parse_obj_as(
|
|
985
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
986
|
+
object_=_response.json(),
|
|
987
|
+
),
|
|
988
|
+
),
|
|
989
|
+
)
|
|
990
|
+
if _response.status_code == 403:
|
|
991
|
+
raise ForbiddenError(
|
|
992
|
+
headers=dict(_response.headers),
|
|
993
|
+
body=typing.cast(
|
|
994
|
+
typing.Optional[typing.Any],
|
|
995
|
+
parse_obj_as(
|
|
996
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
997
|
+
object_=_response.json(),
|
|
998
|
+
),
|
|
999
|
+
),
|
|
1000
|
+
)
|
|
1001
|
+
if _response.status_code == 404:
|
|
1002
|
+
raise NotFoundError(
|
|
1003
|
+
headers=dict(_response.headers),
|
|
1004
|
+
body=typing.cast(
|
|
1005
|
+
typing.Optional[typing.Any],
|
|
1006
|
+
parse_obj_as(
|
|
1007
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1008
|
+
object_=_response.json(),
|
|
1009
|
+
),
|
|
1010
|
+
),
|
|
1011
|
+
)
|
|
1012
|
+
if _response.status_code == 500:
|
|
1013
|
+
raise InternalServerError(
|
|
1014
|
+
headers=dict(_response.headers),
|
|
1015
|
+
body=typing.cast(
|
|
1016
|
+
typing.Optional[typing.Any],
|
|
1017
|
+
parse_obj_as(
|
|
1018
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1019
|
+
object_=_response.json(),
|
|
1020
|
+
),
|
|
1021
|
+
),
|
|
1022
|
+
)
|
|
1023
|
+
_response_json = _response.json()
|
|
1024
|
+
except JSONDecodeError:
|
|
1025
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1026
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1027
|
+
|
|
1028
|
+
async def delete(
|
|
1029
|
+
self, fhir_provider_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
|
1030
|
+
) -> AsyncHttpResponse[FhirProviderDeleteResponse]:
|
|
1031
|
+
"""
|
|
1032
|
+
Soft deletes a FHIR provider by setting is_active to false
|
|
1033
|
+
|
|
1034
|
+
Parameters
|
|
1035
|
+
----------
|
|
1036
|
+
fhir_provider_id : str
|
|
1037
|
+
ID of the FHIR provider to delete
|
|
1038
|
+
|
|
1039
|
+
request_options : typing.Optional[RequestOptions]
|
|
1040
|
+
Request-specific configuration.
|
|
1041
|
+
|
|
1042
|
+
Returns
|
|
1043
|
+
-------
|
|
1044
|
+
AsyncHttpResponse[FhirProviderDeleteResponse]
|
|
1045
|
+
FHIR provider deleted successfully
|
|
1046
|
+
"""
|
|
1047
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1048
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}",
|
|
1049
|
+
method="DELETE",
|
|
1050
|
+
request_options=request_options,
|
|
1051
|
+
)
|
|
1052
|
+
try:
|
|
1053
|
+
if 200 <= _response.status_code < 300:
|
|
1054
|
+
_data = typing.cast(
|
|
1055
|
+
FhirProviderDeleteResponse,
|
|
1056
|
+
parse_obj_as(
|
|
1057
|
+
type_=FhirProviderDeleteResponse, # type: ignore
|
|
1058
|
+
object_=_response.json(),
|
|
1059
|
+
),
|
|
1060
|
+
)
|
|
1061
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1062
|
+
if _response.status_code == 401:
|
|
1063
|
+
raise UnauthorizedError(
|
|
1064
|
+
headers=dict(_response.headers),
|
|
1065
|
+
body=typing.cast(
|
|
1066
|
+
typing.Optional[typing.Any],
|
|
1067
|
+
parse_obj_as(
|
|
1068
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1069
|
+
object_=_response.json(),
|
|
1070
|
+
),
|
|
1071
|
+
),
|
|
1072
|
+
)
|
|
1073
|
+
if _response.status_code == 403:
|
|
1074
|
+
raise ForbiddenError(
|
|
1075
|
+
headers=dict(_response.headers),
|
|
1076
|
+
body=typing.cast(
|
|
1077
|
+
typing.Optional[typing.Any],
|
|
1078
|
+
parse_obj_as(
|
|
1079
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1080
|
+
object_=_response.json(),
|
|
1081
|
+
),
|
|
1082
|
+
),
|
|
1083
|
+
)
|
|
1084
|
+
if _response.status_code == 404:
|
|
1085
|
+
raise NotFoundError(
|
|
1086
|
+
headers=dict(_response.headers),
|
|
1087
|
+
body=typing.cast(
|
|
1088
|
+
typing.Optional[typing.Any],
|
|
1089
|
+
parse_obj_as(
|
|
1090
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1091
|
+
object_=_response.json(),
|
|
1092
|
+
),
|
|
1093
|
+
),
|
|
1094
|
+
)
|
|
1095
|
+
if _response.status_code == 500:
|
|
1096
|
+
raise InternalServerError(
|
|
1097
|
+
headers=dict(_response.headers),
|
|
1098
|
+
body=typing.cast(
|
|
1099
|
+
typing.Optional[typing.Any],
|
|
1100
|
+
parse_obj_as(
|
|
1101
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1102
|
+
object_=_response.json(),
|
|
1103
|
+
),
|
|
1104
|
+
),
|
|
1105
|
+
)
|
|
1106
|
+
_response_json = _response.json()
|
|
1107
|
+
except JSONDecodeError:
|
|
1108
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1109
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1110
|
+
|
|
1111
|
+
async def add_auth_config(
|
|
1112
|
+
self,
|
|
1113
|
+
fhir_provider_id: str,
|
|
1114
|
+
*,
|
|
1115
|
+
auth_method: AuthMethod,
|
|
1116
|
+
client_secret: typing.Optional[str] = OMIT,
|
|
1117
|
+
service_account_key: typing.Optional[ServiceAccountKey] = OMIT,
|
|
1118
|
+
credential_expiry: typing.Optional[dt.datetime] = OMIT,
|
|
1119
|
+
scopes: typing.Optional[str] = OMIT,
|
|
1120
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
1121
|
+
) -> AsyncHttpResponse[FhirProviderResponse]:
|
|
1122
|
+
"""
|
|
1123
|
+
Adds a new authentication configuration to an existing FHIR provider. This enables key rotation and multiple auth configurations per provider.
|
|
1124
|
+
|
|
1125
|
+
Parameters
|
|
1126
|
+
----------
|
|
1127
|
+
fhir_provider_id : str
|
|
1128
|
+
ID of the FHIR provider to add auth config to
|
|
1129
|
+
|
|
1130
|
+
auth_method : AuthMethod
|
|
1131
|
+
|
|
1132
|
+
client_secret : typing.Optional[str]
|
|
1133
|
+
OAuth client secret (required for client_secret and on_behalf_of auth methods)
|
|
1134
|
+
|
|
1135
|
+
service_account_key : typing.Optional[ServiceAccountKey]
|
|
1136
|
+
|
|
1137
|
+
credential_expiry : typing.Optional[dt.datetime]
|
|
1138
|
+
Expiry time for JWT credentials (only applicable for JWT auth method)
|
|
1139
|
+
|
|
1140
|
+
scopes : typing.Optional[str]
|
|
1141
|
+
OAuth scopes to request
|
|
1142
|
+
|
|
1143
|
+
request_options : typing.Optional[RequestOptions]
|
|
1144
|
+
Request-specific configuration.
|
|
1145
|
+
|
|
1146
|
+
Returns
|
|
1147
|
+
-------
|
|
1148
|
+
AsyncHttpResponse[FhirProviderResponse]
|
|
1149
|
+
Auth configuration added successfully
|
|
1150
|
+
"""
|
|
1151
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1152
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}/add-auth-config",
|
|
1153
|
+
method="PATCH",
|
|
1154
|
+
json={
|
|
1155
|
+
"auth_method": auth_method,
|
|
1156
|
+
"client_secret": client_secret,
|
|
1157
|
+
"service_account_key": convert_and_respect_annotation_metadata(
|
|
1158
|
+
object_=service_account_key, annotation=ServiceAccountKey, direction="write"
|
|
1159
|
+
),
|
|
1160
|
+
"credential_expiry": credential_expiry,
|
|
1161
|
+
"scopes": scopes,
|
|
1162
|
+
},
|
|
1163
|
+
headers={
|
|
1164
|
+
"content-type": "application/json",
|
|
1165
|
+
},
|
|
1166
|
+
request_options=request_options,
|
|
1167
|
+
omit=OMIT,
|
|
1168
|
+
)
|
|
1169
|
+
try:
|
|
1170
|
+
if 200 <= _response.status_code < 300:
|
|
1171
|
+
_data = typing.cast(
|
|
1172
|
+
FhirProviderResponse,
|
|
1173
|
+
parse_obj_as(
|
|
1174
|
+
type_=FhirProviderResponse, # type: ignore
|
|
1175
|
+
object_=_response.json(),
|
|
1176
|
+
),
|
|
1177
|
+
)
|
|
1178
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1179
|
+
if _response.status_code == 400:
|
|
1180
|
+
raise BadRequestError(
|
|
1181
|
+
headers=dict(_response.headers),
|
|
1182
|
+
body=typing.cast(
|
|
1183
|
+
typing.Optional[typing.Any],
|
|
1184
|
+
parse_obj_as(
|
|
1185
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1186
|
+
object_=_response.json(),
|
|
1187
|
+
),
|
|
1188
|
+
),
|
|
1189
|
+
)
|
|
1190
|
+
if _response.status_code == 401:
|
|
1191
|
+
raise UnauthorizedError(
|
|
1192
|
+
headers=dict(_response.headers),
|
|
1193
|
+
body=typing.cast(
|
|
1194
|
+
typing.Optional[typing.Any],
|
|
1195
|
+
parse_obj_as(
|
|
1196
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1197
|
+
object_=_response.json(),
|
|
1198
|
+
),
|
|
1199
|
+
),
|
|
1200
|
+
)
|
|
1201
|
+
if _response.status_code == 403:
|
|
1202
|
+
raise ForbiddenError(
|
|
1203
|
+
headers=dict(_response.headers),
|
|
1204
|
+
body=typing.cast(
|
|
1205
|
+
typing.Optional[typing.Any],
|
|
1206
|
+
parse_obj_as(
|
|
1207
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1208
|
+
object_=_response.json(),
|
|
1209
|
+
),
|
|
1210
|
+
),
|
|
1211
|
+
)
|
|
1212
|
+
if _response.status_code == 404:
|
|
1213
|
+
raise NotFoundError(
|
|
1214
|
+
headers=dict(_response.headers),
|
|
1215
|
+
body=typing.cast(
|
|
1216
|
+
typing.Optional[typing.Any],
|
|
1217
|
+
parse_obj_as(
|
|
1218
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1219
|
+
object_=_response.json(),
|
|
1220
|
+
),
|
|
1221
|
+
),
|
|
1222
|
+
)
|
|
1223
|
+
if _response.status_code == 500:
|
|
1224
|
+
raise InternalServerError(
|
|
1225
|
+
headers=dict(_response.headers),
|
|
1226
|
+
body=typing.cast(
|
|
1227
|
+
typing.Optional[typing.Any],
|
|
1228
|
+
parse_obj_as(
|
|
1229
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1230
|
+
object_=_response.json(),
|
|
1231
|
+
),
|
|
1232
|
+
),
|
|
1233
|
+
)
|
|
1234
|
+
_response_json = _response.json()
|
|
1235
|
+
except JSONDecodeError:
|
|
1236
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1237
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1238
|
+
|
|
1239
|
+
async def set_active_auth_config(
|
|
1240
|
+
self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
1241
|
+
) -> AsyncHttpResponse[FhirProviderSetActiveAuthConfigResponse]:
|
|
1242
|
+
"""
|
|
1243
|
+
Sets which authentication configuration should be active for a FHIR provider. Only one auth config can be active at a time.
|
|
1244
|
+
|
|
1245
|
+
Parameters
|
|
1246
|
+
----------
|
|
1247
|
+
fhir_provider_id : str
|
|
1248
|
+
ID of the FHIR provider
|
|
1249
|
+
|
|
1250
|
+
auth_config_id : str
|
|
1251
|
+
ID of the auth configuration to set as active
|
|
1252
|
+
|
|
1253
|
+
request_options : typing.Optional[RequestOptions]
|
|
1254
|
+
Request-specific configuration.
|
|
1255
|
+
|
|
1256
|
+
Returns
|
|
1257
|
+
-------
|
|
1258
|
+
AsyncHttpResponse[FhirProviderSetActiveAuthConfigResponse]
|
|
1259
|
+
Active auth configuration set successfully
|
|
1260
|
+
"""
|
|
1261
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1262
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}/set-active-auth-config",
|
|
1263
|
+
method="PATCH",
|
|
1264
|
+
json={
|
|
1265
|
+
"auth_config_id": auth_config_id,
|
|
1266
|
+
},
|
|
1267
|
+
headers={
|
|
1268
|
+
"content-type": "application/json",
|
|
1269
|
+
},
|
|
1270
|
+
request_options=request_options,
|
|
1271
|
+
omit=OMIT,
|
|
1272
|
+
)
|
|
1273
|
+
try:
|
|
1274
|
+
if 200 <= _response.status_code < 300:
|
|
1275
|
+
_data = typing.cast(
|
|
1276
|
+
FhirProviderSetActiveAuthConfigResponse,
|
|
1277
|
+
parse_obj_as(
|
|
1278
|
+
type_=FhirProviderSetActiveAuthConfigResponse, # type: ignore
|
|
1279
|
+
object_=_response.json(),
|
|
1280
|
+
),
|
|
1281
|
+
)
|
|
1282
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1283
|
+
if _response.status_code == 400:
|
|
1284
|
+
raise BadRequestError(
|
|
1285
|
+
headers=dict(_response.headers),
|
|
1286
|
+
body=typing.cast(
|
|
1287
|
+
typing.Optional[typing.Any],
|
|
1288
|
+
parse_obj_as(
|
|
1289
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1290
|
+
object_=_response.json(),
|
|
1291
|
+
),
|
|
1292
|
+
),
|
|
1293
|
+
)
|
|
1294
|
+
if _response.status_code == 401:
|
|
1295
|
+
raise UnauthorizedError(
|
|
1296
|
+
headers=dict(_response.headers),
|
|
1297
|
+
body=typing.cast(
|
|
1298
|
+
typing.Optional[typing.Any],
|
|
1299
|
+
parse_obj_as(
|
|
1300
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1301
|
+
object_=_response.json(),
|
|
1302
|
+
),
|
|
1303
|
+
),
|
|
1304
|
+
)
|
|
1305
|
+
if _response.status_code == 403:
|
|
1306
|
+
raise ForbiddenError(
|
|
1307
|
+
headers=dict(_response.headers),
|
|
1308
|
+
body=typing.cast(
|
|
1309
|
+
typing.Optional[typing.Any],
|
|
1310
|
+
parse_obj_as(
|
|
1311
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1312
|
+
object_=_response.json(),
|
|
1313
|
+
),
|
|
1314
|
+
),
|
|
1315
|
+
)
|
|
1316
|
+
if _response.status_code == 404:
|
|
1317
|
+
raise NotFoundError(
|
|
1318
|
+
headers=dict(_response.headers),
|
|
1319
|
+
body=typing.cast(
|
|
1320
|
+
typing.Optional[typing.Any],
|
|
1321
|
+
parse_obj_as(
|
|
1322
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1323
|
+
object_=_response.json(),
|
|
1324
|
+
),
|
|
1325
|
+
),
|
|
1326
|
+
)
|
|
1327
|
+
if _response.status_code == 500:
|
|
1328
|
+
raise InternalServerError(
|
|
1329
|
+
headers=dict(_response.headers),
|
|
1330
|
+
body=typing.cast(
|
|
1331
|
+
typing.Optional[typing.Any],
|
|
1332
|
+
parse_obj_as(
|
|
1333
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1334
|
+
object_=_response.json(),
|
|
1335
|
+
),
|
|
1336
|
+
),
|
|
1337
|
+
)
|
|
1338
|
+
_response_json = _response.json()
|
|
1339
|
+
except JSONDecodeError:
|
|
1340
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1341
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
|
1342
|
+
|
|
1343
|
+
async def remove_auth_config(
|
|
1344
|
+
self, fhir_provider_id: str, *, auth_config_id: str, request_options: typing.Optional[RequestOptions] = None
|
|
1345
|
+
) -> AsyncHttpResponse[FhirProviderRemoveAuthConfigResponse]:
|
|
1346
|
+
"""
|
|
1347
|
+
Removes an authentication configuration from a FHIR provider. Cannot remove the currently active auth configuration.
|
|
1348
|
+
|
|
1349
|
+
Parameters
|
|
1350
|
+
----------
|
|
1351
|
+
fhir_provider_id : str
|
|
1352
|
+
ID of the FHIR provider
|
|
1353
|
+
|
|
1354
|
+
auth_config_id : str
|
|
1355
|
+
ID of the auth configuration to remove
|
|
1356
|
+
|
|
1357
|
+
request_options : typing.Optional[RequestOptions]
|
|
1358
|
+
Request-specific configuration.
|
|
1359
|
+
|
|
1360
|
+
Returns
|
|
1361
|
+
-------
|
|
1362
|
+
AsyncHttpResponse[FhirProviderRemoveAuthConfigResponse]
|
|
1363
|
+
Auth configuration removed successfully
|
|
1364
|
+
"""
|
|
1365
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
1366
|
+
f"fhir-provider/{jsonable_encoder(fhir_provider_id)}/remove-auth-config",
|
|
1367
|
+
method="PATCH",
|
|
1368
|
+
json={
|
|
1369
|
+
"auth_config_id": auth_config_id,
|
|
1370
|
+
},
|
|
1371
|
+
headers={
|
|
1372
|
+
"content-type": "application/json",
|
|
1373
|
+
},
|
|
1374
|
+
request_options=request_options,
|
|
1375
|
+
omit=OMIT,
|
|
1376
|
+
)
|
|
1377
|
+
try:
|
|
1378
|
+
if 200 <= _response.status_code < 300:
|
|
1379
|
+
_data = typing.cast(
|
|
1380
|
+
FhirProviderRemoveAuthConfigResponse,
|
|
1381
|
+
parse_obj_as(
|
|
1382
|
+
type_=FhirProviderRemoveAuthConfigResponse, # type: ignore
|
|
1383
|
+
object_=_response.json(),
|
|
1384
|
+
),
|
|
1385
|
+
)
|
|
1386
|
+
return AsyncHttpResponse(response=_response, data=_data)
|
|
1387
|
+
if _response.status_code == 400:
|
|
1388
|
+
raise BadRequestError(
|
|
1389
|
+
headers=dict(_response.headers),
|
|
1390
|
+
body=typing.cast(
|
|
1391
|
+
typing.Optional[typing.Any],
|
|
1392
|
+
parse_obj_as(
|
|
1393
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1394
|
+
object_=_response.json(),
|
|
1395
|
+
),
|
|
1396
|
+
),
|
|
1397
|
+
)
|
|
1398
|
+
if _response.status_code == 401:
|
|
1399
|
+
raise UnauthorizedError(
|
|
1400
|
+
headers=dict(_response.headers),
|
|
1401
|
+
body=typing.cast(
|
|
1402
|
+
typing.Optional[typing.Any],
|
|
1403
|
+
parse_obj_as(
|
|
1404
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1405
|
+
object_=_response.json(),
|
|
1406
|
+
),
|
|
1407
|
+
),
|
|
1408
|
+
)
|
|
1409
|
+
if _response.status_code == 403:
|
|
1410
|
+
raise ForbiddenError(
|
|
1411
|
+
headers=dict(_response.headers),
|
|
1412
|
+
body=typing.cast(
|
|
1413
|
+
typing.Optional[typing.Any],
|
|
1414
|
+
parse_obj_as(
|
|
1415
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1416
|
+
object_=_response.json(),
|
|
1417
|
+
),
|
|
1418
|
+
),
|
|
1419
|
+
)
|
|
1420
|
+
if _response.status_code == 404:
|
|
1421
|
+
raise NotFoundError(
|
|
1422
|
+
headers=dict(_response.headers),
|
|
1423
|
+
body=typing.cast(
|
|
1424
|
+
typing.Optional[typing.Any],
|
|
1425
|
+
parse_obj_as(
|
|
1426
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1427
|
+
object_=_response.json(),
|
|
1428
|
+
),
|
|
1429
|
+
),
|
|
1430
|
+
)
|
|
1431
|
+
if _response.status_code == 500:
|
|
1432
|
+
raise InternalServerError(
|
|
1433
|
+
headers=dict(_response.headers),
|
|
1434
|
+
body=typing.cast(
|
|
1435
|
+
typing.Optional[typing.Any],
|
|
1436
|
+
parse_obj_as(
|
|
1437
|
+
type_=typing.Optional[typing.Any], # type: ignore
|
|
1438
|
+
object_=_response.json(),
|
|
1439
|
+
),
|
|
1440
|
+
),
|
|
1441
|
+
)
|
|
1442
|
+
_response_json = _response.json()
|
|
1443
|
+
except JSONDecodeError:
|
|
1444
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
|
1445
|
+
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|