hubble-sdk-python 0.0.2__tar.gz
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.
- hubble_sdk_python-0.0.2/.gitignore +18 -0
- hubble_sdk_python-0.0.2/CHANGELOG.md +39 -0
- hubble_sdk_python-0.0.2/LICENSE +21 -0
- hubble_sdk_python-0.0.2/PKG-INFO +89 -0
- hubble_sdk_python-0.0.2/README.md +57 -0
- hubble_sdk_python-0.0.2/config.yaml +4 -0
- hubble_sdk_python-0.0.2/hubble_sdk/__init__.py +43 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/__init__.py +8 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/__init__.py +1 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/__init__.py +1 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/attach_client_authorization.py +220 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/create_consent_link.py +197 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/exchange_token.py +186 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/export_patient_pdf.py +194 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/get_consent.py +166 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/list_consents.py +191 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/read_fhir.py +182 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/api/default/revoke_consent.py +167 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/client.py +282 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/errors.py +16 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/__init__.py +59 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/api_error.py +42 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/attach_client_authorization_body.py +112 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/attach_client_authorization_response_201.py +100 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/attach_client_authorization_response_201_status.py +8 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent.py +160 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_error.py +50 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_link_request.py +88 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_list.py +56 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_source.py +63 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_source_status.py +10 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_source_type.py +9 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/consent_status.py +12 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/device_authorization_request.py +142 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/device_authorization_response.py +90 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/fhir_resource.py +62 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/o_auth_error.py +54 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/o_auth_error_error.py +16 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/operation_outcome.py +75 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/operation_outcome_issue_item.py +61 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/patient_address.py +69 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/patient_demographics.py +109 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/provider_seed.py +53 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/token_request.py +81 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/token_request_grant_type.py +12 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/models/token_response.py +84 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_generated/types.py +54 -0
- hubble_sdk_python-0.0.2/hubble_sdk/_hubble.py +379 -0
- hubble_sdk_python-0.0.2/pydoc-markdown.yml +24 -0
- hubble_sdk_python-0.0.2/pyproject.toml +46 -0
- hubble_sdk_python-0.0.2/tests/test_hubble.py +400 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Node
|
|
2
|
+
node_modules/
|
|
3
|
+
packages/typescript/dist/
|
|
4
|
+
|
|
5
|
+
# Python
|
|
6
|
+
.venv/
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.egg-info/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
.pytest_cache/
|
|
11
|
+
packages/python/dist/
|
|
12
|
+
|
|
13
|
+
# Generated API reference (synced into the docs site, not committed)
|
|
14
|
+
docs/
|
|
15
|
+
|
|
16
|
+
# misc
|
|
17
|
+
.DS_Store
|
|
18
|
+
.env
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.2](https://github.com/hubble-dot-ai/hubble-sdks/compare/hubble-sdk-python-v0.0.1...hubble-sdk-python-v0.0.2) (2026-08-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### ⚠ BREAKING CHANGES
|
|
7
|
+
|
|
8
|
+
* PatientSession no longer exposes `patient`; Consent no longer has `patient`/`scope`/`vendor` and TokenResponse no longer has `patient`/`scope`.
|
|
9
|
+
|
|
10
|
+
### Features
|
|
11
|
+
|
|
12
|
+
* sync spec — add Patient/$pdf export, drop patient from token/consent ([#20](https://github.com/hubble-dot-ai/hubble-sdks/issues/20)) ([c9bd44e](https://github.com/hubble-dot-ai/hubble-sdks/commit/c9bd44eac38914ff85b1c243a6ec59f496136b5d))
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **ci:** bump pypi-publish action for Metadata-Version 2.5; re-cut python 0.0.2 ([#26](https://github.com/hubble-dot-ai/hubble-sdks/issues/26)) ([f784753](https://github.com/hubble-dot-ai/hubble-sdks/commit/f78475349bb48a4b8e86e8a062038af758b5a474))
|
|
18
|
+
* **ci:** pin pypi-publish action to the v1.14.2 commit SHA ([#28](https://github.com/hubble-dot-ai/hubble-sdks/issues/28)) ([003b145](https://github.com/hubble-dot-ai/hubble-sdks/commit/003b14573ba660c9ff7ac14ab2249b344b78f890))
|
|
19
|
+
* repair release-please manifest and re-cut python 0.0.2 ([#24](https://github.com/hubble-dot-ai/hubble-sdks/issues/24)) ([2cd613b](https://github.com/hubble-dot-ai/hubble-sdks/commit/2cd613b40c0c3aede191d122d891a1fbcbc60bed))
|
|
20
|
+
|
|
21
|
+
## 0.0.1 (2026-08-07)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### ⚠ BREAKING CHANGES
|
|
25
|
+
|
|
26
|
+
* published package names and the Python import path change.
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
* notify callers when a session rotates its tokens ([#13](https://github.com/hubble-dot-ai/hubble-sdks/issues/13)) ([8cb478c](https://github.com/hubble-dot-ai/hubble-sdks/commit/8cb478ce6a21430b928df824d5eaf47679d1477b))
|
|
31
|
+
* rename packages to @hubbleai/hubble-sdk + hubble-sdk-python, sync spec ([#17](https://github.com/hubble-dot-ai/hubble-sdks/issues/17)) ([20be457](https://github.com/hubble-dot-ai/hubble-sdks/commit/20be457c16a544418bf7a0c5ec8e1cc785c7d4d4))
|
|
32
|
+
* type FHIR responses in both SDKs ([99e8f2a](https://github.com/hubble-dot-ai/hubble-sdks/commit/99e8f2aecff16daf65c6ad4d062bd907cbcb510a))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
### Documentation
|
|
36
|
+
|
|
37
|
+
* add Markdown API-reference generators for both SDKs ([#12](https://github.com/hubble-dot-ai/hubble-sdks/issues/12)) ([2e48919](https://github.com/hubble-dot-ai/hubble-sdks/commit/2e48919cde7db06c899d35a6656973778774fbcf))
|
|
38
|
+
* cleaner generated SDK reference ([#16](https://github.com/hubble-dot-ai/hubble-sdks/issues/16)) ([4061a6a](https://github.com/hubble-dot-ai/hubble-sdks/commit/4061a6a8dff6e99981ae9c8999e7e3214b067e64))
|
|
39
|
+
* use Markdown, not Sphinx roles, in Python docstrings ([#15](https://github.com/hubble-dot-ai/hubble-sdks/issues/15)) ([a625723](https://github.com/hubble-dot-ai/hubble-sdks/commit/a625723349de3d389c07082ae3265c6aae644aba))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hubble
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: hubble-sdk-python
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: Python client for the Hubble Patient Access API.
|
|
5
|
+
Project-URL: Homepage, https://github.com/hubble-dot-ai/hubble-sdks
|
|
6
|
+
Project-URL: Repository, https://github.com/hubble-dot-ai/hubble-sdks
|
|
7
|
+
Project-URL: Issues, https://github.com/hubble-dot-ai/hubble-sdks/issues
|
|
8
|
+
Author: Hubble
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: health records,hubble,medical records,patient
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Healthcare Industry
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Requires-Dist: attrs>=22.2.0
|
|
24
|
+
Requires-Dist: httpx<0.29.0,>=0.23.1
|
|
25
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
26
|
+
Provides-Extra: docs
|
|
27
|
+
Requires-Dist: pydoc-markdown<5,>=4.8; extra == 'docs'
|
|
28
|
+
Provides-Extra: test
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == 'test'
|
|
30
|
+
Requires-Dist: respx>=0.21; extra == 'test'
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# hubble-sdk-python
|
|
34
|
+
|
|
35
|
+
Python client for the Hubble Patient Access API: create patient authorization
|
|
36
|
+
links, exchange them for consent-scoped access tokens, and read FHIR R4 data.
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install hubble-sdk-python
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
from hubble_sdk import Hubble
|
|
44
|
+
|
|
45
|
+
hub = Hubble(client_id="hbl_client_prod_...", client_secret="hbl_prod_...")
|
|
46
|
+
|
|
47
|
+
# 1. Create a patient link and send the patient to it. Optionally prefill with
|
|
48
|
+
# patient={"first_name": ...} demographics and providers=[{"name": ...}].
|
|
49
|
+
link = hub.create_link(patient_ref="abc123")
|
|
50
|
+
print(link.verification_uri_complete)
|
|
51
|
+
|
|
52
|
+
# 2. Wait for the patient to authorize (polls the token endpoint for you).
|
|
53
|
+
session = hub.wait_for_authorization(link)
|
|
54
|
+
|
|
55
|
+
# 3. Read the patient's FHIR data (Bearer token + auto-refresh handled for you).
|
|
56
|
+
bundle = session.everything()
|
|
57
|
+
observations = session.fhir("Observation", params={"category": "vital-signs"})
|
|
58
|
+
export = session.export_pdf() # export.content bytes; export.sources_failed counts failed sources
|
|
59
|
+
|
|
60
|
+
# Consent management
|
|
61
|
+
for consent in hub.list_consents(status="active"):
|
|
62
|
+
print(consent.id, consent.patient_ref)
|
|
63
|
+
hub.revoke_consent(session.consent_id)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## What the client handles for you
|
|
67
|
+
|
|
68
|
+
- **Auth per plane** — HTTP Basic (your app credentials) for consent management
|
|
69
|
+
and the token endpoint; Bearer (the consent token) for FHIR reads. You never
|
|
70
|
+
wire the schemes yourself.
|
|
71
|
+
- **Default base URL** — `https://api.hubble.ai`. Override only with a trusted
|
|
72
|
+
value; your access token is sent to it.
|
|
73
|
+
- **Device-flow polling** — `wait_for_authorization` honors the server's
|
|
74
|
+
`interval` and `slow_down`.
|
|
75
|
+
- **Correct FHIR paths** — operation and sub-resource paths like
|
|
76
|
+
`Patient/$everything` are sent unencoded.
|
|
77
|
+
- **Transparent refresh** — FHIR reads refresh and retry once on a 401.
|
|
78
|
+
- **FHIR responses** — reads return the raw FHIR R4 resource as a dict. For typed
|
|
79
|
+
models, parse with the optional [`fhir.resources`](https://pypi.org/project/fhir.resources/)
|
|
80
|
+
package: `from fhir.resources.bundle import Bundle; Bundle.model_validate(session.everything())`.
|
|
81
|
+
|
|
82
|
+
## Layout
|
|
83
|
+
|
|
84
|
+
`Hubble` / `PatientSession` are hand-written. The low-level client generated
|
|
85
|
+
from the OpenAPI contract with
|
|
86
|
+
[openapi-python-client](https://github.com/openapi-generators/openapi-python-client)
|
|
87
|
+
lives under `hubble_sdk._generated` (regenerated on every spec change;
|
|
88
|
+
never edited by hand). Reach into it only if you need raw operations. See the
|
|
89
|
+
repo root README for how to regenerate.
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# hubble-sdk-python
|
|
2
|
+
|
|
3
|
+
Python client for the Hubble Patient Access API: create patient authorization
|
|
4
|
+
links, exchange them for consent-scoped access tokens, and read FHIR R4 data.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install hubble-sdk-python
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
```python
|
|
11
|
+
from hubble_sdk import Hubble
|
|
12
|
+
|
|
13
|
+
hub = Hubble(client_id="hbl_client_prod_...", client_secret="hbl_prod_...")
|
|
14
|
+
|
|
15
|
+
# 1. Create a patient link and send the patient to it. Optionally prefill with
|
|
16
|
+
# patient={"first_name": ...} demographics and providers=[{"name": ...}].
|
|
17
|
+
link = hub.create_link(patient_ref="abc123")
|
|
18
|
+
print(link.verification_uri_complete)
|
|
19
|
+
|
|
20
|
+
# 2. Wait for the patient to authorize (polls the token endpoint for you).
|
|
21
|
+
session = hub.wait_for_authorization(link)
|
|
22
|
+
|
|
23
|
+
# 3. Read the patient's FHIR data (Bearer token + auto-refresh handled for you).
|
|
24
|
+
bundle = session.everything()
|
|
25
|
+
observations = session.fhir("Observation", params={"category": "vital-signs"})
|
|
26
|
+
export = session.export_pdf() # export.content bytes; export.sources_failed counts failed sources
|
|
27
|
+
|
|
28
|
+
# Consent management
|
|
29
|
+
for consent in hub.list_consents(status="active"):
|
|
30
|
+
print(consent.id, consent.patient_ref)
|
|
31
|
+
hub.revoke_consent(session.consent_id)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## What the client handles for you
|
|
35
|
+
|
|
36
|
+
- **Auth per plane** — HTTP Basic (your app credentials) for consent management
|
|
37
|
+
and the token endpoint; Bearer (the consent token) for FHIR reads. You never
|
|
38
|
+
wire the schemes yourself.
|
|
39
|
+
- **Default base URL** — `https://api.hubble.ai`. Override only with a trusted
|
|
40
|
+
value; your access token is sent to it.
|
|
41
|
+
- **Device-flow polling** — `wait_for_authorization` honors the server's
|
|
42
|
+
`interval` and `slow_down`.
|
|
43
|
+
- **Correct FHIR paths** — operation and sub-resource paths like
|
|
44
|
+
`Patient/$everything` are sent unencoded.
|
|
45
|
+
- **Transparent refresh** — FHIR reads refresh and retry once on a 401.
|
|
46
|
+
- **FHIR responses** — reads return the raw FHIR R4 resource as a dict. For typed
|
|
47
|
+
models, parse with the optional [`fhir.resources`](https://pypi.org/project/fhir.resources/)
|
|
48
|
+
package: `from fhir.resources.bundle import Bundle; Bundle.model_validate(session.everything())`.
|
|
49
|
+
|
|
50
|
+
## Layout
|
|
51
|
+
|
|
52
|
+
`Hubble` / `PatientSession` are hand-written. The low-level client generated
|
|
53
|
+
from the OpenAPI contract with
|
|
54
|
+
[openapi-python-client](https://github.com/openapi-generators/openapi-python-client)
|
|
55
|
+
lives under `hubble_sdk._generated` (regenerated on every spec change;
|
|
56
|
+
never edited by hand). Reach into it only if you need raw operations. See the
|
|
57
|
+
repo root README for how to regenerate.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Python client for the Hubble Patient Access API.
|
|
2
|
+
|
|
3
|
+
Import the high-level client from here:
|
|
4
|
+
|
|
5
|
+
from hubble_sdk import Hubble
|
|
6
|
+
|
|
7
|
+
hub = Hubble(client_id="hbl_client_...", client_secret="hbl_prod_...")
|
|
8
|
+
link = hub.create_link(patient_ref="abc123")
|
|
9
|
+
print(link.verification_uri_complete) # send the patient here
|
|
10
|
+
session = hub.wait_for_authorization(link)
|
|
11
|
+
bundle = session.everything() # reads FHIR with the consent token
|
|
12
|
+
|
|
13
|
+
The generated low-level client lives under ``hubble_sdk._generated``
|
|
14
|
+
if you need direct access to raw operations and models.
|
|
15
|
+
"""
|
|
16
|
+
|
|
17
|
+
from ._generated.models import (
|
|
18
|
+
Consent,
|
|
19
|
+
ConsentStatus,
|
|
20
|
+
DeviceAuthorizationResponse,
|
|
21
|
+
TokenResponse,
|
|
22
|
+
)
|
|
23
|
+
from ._hubble import (
|
|
24
|
+
ConsentTimeout,
|
|
25
|
+
Hubble,
|
|
26
|
+
HubbleError,
|
|
27
|
+
PatientSession,
|
|
28
|
+
PdfExport,
|
|
29
|
+
TokenSet,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"Hubble",
|
|
34
|
+
"PatientSession",
|
|
35
|
+
"HubbleError",
|
|
36
|
+
"ConsentTimeout",
|
|
37
|
+
"TokenSet",
|
|
38
|
+
"PdfExport",
|
|
39
|
+
"Consent",
|
|
40
|
+
"ConsentStatus",
|
|
41
|
+
"DeviceAuthorizationResponse",
|
|
42
|
+
"TokenResponse",
|
|
43
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains methods for accessing the API"""
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...models.api_error import ApiError
|
|
10
|
+
from ...models.attach_client_authorization_body import AttachClientAuthorizationBody
|
|
11
|
+
from ...models.attach_client_authorization_response_201 import (
|
|
12
|
+
AttachClientAuthorizationResponse201,
|
|
13
|
+
)
|
|
14
|
+
from ...types import Response
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _get_kwargs(
|
|
18
|
+
id: str,
|
|
19
|
+
*,
|
|
20
|
+
body: AttachClientAuthorizationBody,
|
|
21
|
+
) -> dict[str, Any]:
|
|
22
|
+
headers: dict[str, Any] = {}
|
|
23
|
+
|
|
24
|
+
_kwargs: dict[str, Any] = {
|
|
25
|
+
"method": "post",
|
|
26
|
+
"url": "/api/v1/consents/{id}/authorization".format(
|
|
27
|
+
id=quote(str(id), safe=""),
|
|
28
|
+
),
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
_kwargs["files"] = body.to_multipart()
|
|
32
|
+
|
|
33
|
+
headers["Content-Type"] = "multipart/form-data; boundary=+++"
|
|
34
|
+
|
|
35
|
+
_kwargs["headers"] = headers
|
|
36
|
+
return _kwargs
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _parse_response(
|
|
40
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
41
|
+
) -> ApiError | AttachClientAuthorizationResponse201 | None:
|
|
42
|
+
if response.status_code == 201:
|
|
43
|
+
response_201 = AttachClientAuthorizationResponse201.from_dict(response.json())
|
|
44
|
+
|
|
45
|
+
return response_201
|
|
46
|
+
|
|
47
|
+
if response.status_code == 400:
|
|
48
|
+
response_400 = ApiError.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_400
|
|
51
|
+
|
|
52
|
+
if response.status_code == 401:
|
|
53
|
+
response_401 = ApiError.from_dict(response.json())
|
|
54
|
+
|
|
55
|
+
return response_401
|
|
56
|
+
|
|
57
|
+
if response.status_code == 403:
|
|
58
|
+
response_403 = ApiError.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_403
|
|
61
|
+
|
|
62
|
+
if response.status_code == 404:
|
|
63
|
+
response_404 = ApiError.from_dict(response.json())
|
|
64
|
+
|
|
65
|
+
return response_404
|
|
66
|
+
|
|
67
|
+
if response.status_code == 413:
|
|
68
|
+
response_413 = ApiError.from_dict(response.json())
|
|
69
|
+
|
|
70
|
+
return response_413
|
|
71
|
+
|
|
72
|
+
if client.raise_on_unexpected_status:
|
|
73
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
74
|
+
else:
|
|
75
|
+
return None
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def _build_response(
|
|
79
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
80
|
+
) -> Response[ApiError | AttachClientAuthorizationResponse201]:
|
|
81
|
+
return Response(
|
|
82
|
+
status_code=HTTPStatus(response.status_code),
|
|
83
|
+
content=response.content,
|
|
84
|
+
headers=response.headers,
|
|
85
|
+
parsed=_parse_response(client=client, response=response),
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def sync_detailed(
|
|
90
|
+
id: str,
|
|
91
|
+
*,
|
|
92
|
+
client: AuthenticatedClient,
|
|
93
|
+
body: AttachClientAuthorizationBody,
|
|
94
|
+
) -> Response[ApiError | AttachClientAuthorizationResponse201]:
|
|
95
|
+
"""Attach a customer-supplied HIPAA authorization
|
|
96
|
+
|
|
97
|
+
Upload an already-signed HIPAA authorization for a consent and grant delegated retrieval from the
|
|
98
|
+
providers it names. The artifact IS the evidence, so the consent is granted at once with no patient
|
|
99
|
+
step. Requires the `byo_hipaa_authorization` entitlement on your organization.
|
|
100
|
+
|
|
101
|
+
Args:
|
|
102
|
+
id (str):
|
|
103
|
+
body (AttachClientAuthorizationBody):
|
|
104
|
+
|
|
105
|
+
Raises:
|
|
106
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
107
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
108
|
+
|
|
109
|
+
Returns:
|
|
110
|
+
Response[ApiError | AttachClientAuthorizationResponse201]
|
|
111
|
+
"""
|
|
112
|
+
|
|
113
|
+
kwargs = _get_kwargs(
|
|
114
|
+
id=id,
|
|
115
|
+
body=body,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
response = client.get_httpx_client().request(
|
|
119
|
+
**kwargs,
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
return _build_response(client=client, response=response)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
def sync(
|
|
126
|
+
id: str,
|
|
127
|
+
*,
|
|
128
|
+
client: AuthenticatedClient,
|
|
129
|
+
body: AttachClientAuthorizationBody,
|
|
130
|
+
) -> ApiError | AttachClientAuthorizationResponse201 | None:
|
|
131
|
+
"""Attach a customer-supplied HIPAA authorization
|
|
132
|
+
|
|
133
|
+
Upload an already-signed HIPAA authorization for a consent and grant delegated retrieval from the
|
|
134
|
+
providers it names. The artifact IS the evidence, so the consent is granted at once with no patient
|
|
135
|
+
step. Requires the `byo_hipaa_authorization` entitlement on your organization.
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
id (str):
|
|
139
|
+
body (AttachClientAuthorizationBody):
|
|
140
|
+
|
|
141
|
+
Raises:
|
|
142
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
143
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
ApiError | AttachClientAuthorizationResponse201
|
|
147
|
+
"""
|
|
148
|
+
|
|
149
|
+
return sync_detailed(
|
|
150
|
+
id=id,
|
|
151
|
+
client=client,
|
|
152
|
+
body=body,
|
|
153
|
+
).parsed
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
async def asyncio_detailed(
|
|
157
|
+
id: str,
|
|
158
|
+
*,
|
|
159
|
+
client: AuthenticatedClient,
|
|
160
|
+
body: AttachClientAuthorizationBody,
|
|
161
|
+
) -> Response[ApiError | AttachClientAuthorizationResponse201]:
|
|
162
|
+
"""Attach a customer-supplied HIPAA authorization
|
|
163
|
+
|
|
164
|
+
Upload an already-signed HIPAA authorization for a consent and grant delegated retrieval from the
|
|
165
|
+
providers it names. The artifact IS the evidence, so the consent is granted at once with no patient
|
|
166
|
+
step. Requires the `byo_hipaa_authorization` entitlement on your organization.
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
id (str):
|
|
170
|
+
body (AttachClientAuthorizationBody):
|
|
171
|
+
|
|
172
|
+
Raises:
|
|
173
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
174
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
Response[ApiError | AttachClientAuthorizationResponse201]
|
|
178
|
+
"""
|
|
179
|
+
|
|
180
|
+
kwargs = _get_kwargs(
|
|
181
|
+
id=id,
|
|
182
|
+
body=body,
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
186
|
+
|
|
187
|
+
return _build_response(client=client, response=response)
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
async def asyncio(
|
|
191
|
+
id: str,
|
|
192
|
+
*,
|
|
193
|
+
client: AuthenticatedClient,
|
|
194
|
+
body: AttachClientAuthorizationBody,
|
|
195
|
+
) -> ApiError | AttachClientAuthorizationResponse201 | None:
|
|
196
|
+
"""Attach a customer-supplied HIPAA authorization
|
|
197
|
+
|
|
198
|
+
Upload an already-signed HIPAA authorization for a consent and grant delegated retrieval from the
|
|
199
|
+
providers it names. The artifact IS the evidence, so the consent is granted at once with no patient
|
|
200
|
+
step. Requires the `byo_hipaa_authorization` entitlement on your organization.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
id (str):
|
|
204
|
+
body (AttachClientAuthorizationBody):
|
|
205
|
+
|
|
206
|
+
Raises:
|
|
207
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
208
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
ApiError | AttachClientAuthorizationResponse201
|
|
212
|
+
"""
|
|
213
|
+
|
|
214
|
+
return (
|
|
215
|
+
await asyncio_detailed(
|
|
216
|
+
id=id,
|
|
217
|
+
client=client,
|
|
218
|
+
body=body,
|
|
219
|
+
)
|
|
220
|
+
).parsed
|