hubble-sdk-python 0.0.2__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.
- hubble_sdk/__init__.py +43 -0
- hubble_sdk/_generated/__init__.py +8 -0
- hubble_sdk/_generated/api/__init__.py +1 -0
- hubble_sdk/_generated/api/default/__init__.py +1 -0
- hubble_sdk/_generated/api/default/attach_client_authorization.py +220 -0
- hubble_sdk/_generated/api/default/create_consent_link.py +197 -0
- hubble_sdk/_generated/api/default/exchange_token.py +186 -0
- hubble_sdk/_generated/api/default/export_patient_pdf.py +194 -0
- hubble_sdk/_generated/api/default/get_consent.py +166 -0
- hubble_sdk/_generated/api/default/list_consents.py +191 -0
- hubble_sdk/_generated/api/default/read_fhir.py +182 -0
- hubble_sdk/_generated/api/default/revoke_consent.py +167 -0
- hubble_sdk/_generated/client.py +282 -0
- hubble_sdk/_generated/errors.py +16 -0
- hubble_sdk/_generated/models/__init__.py +59 -0
- hubble_sdk/_generated/models/api_error.py +42 -0
- hubble_sdk/_generated/models/attach_client_authorization_body.py +112 -0
- hubble_sdk/_generated/models/attach_client_authorization_response_201.py +100 -0
- hubble_sdk/_generated/models/attach_client_authorization_response_201_status.py +8 -0
- hubble_sdk/_generated/models/consent.py +160 -0
- hubble_sdk/_generated/models/consent_error.py +50 -0
- hubble_sdk/_generated/models/consent_link_request.py +88 -0
- hubble_sdk/_generated/models/consent_list.py +56 -0
- hubble_sdk/_generated/models/consent_source.py +63 -0
- hubble_sdk/_generated/models/consent_source_status.py +10 -0
- hubble_sdk/_generated/models/consent_source_type.py +9 -0
- hubble_sdk/_generated/models/consent_status.py +12 -0
- hubble_sdk/_generated/models/device_authorization_request.py +142 -0
- hubble_sdk/_generated/models/device_authorization_response.py +90 -0
- hubble_sdk/_generated/models/fhir_resource.py +62 -0
- hubble_sdk/_generated/models/o_auth_error.py +54 -0
- hubble_sdk/_generated/models/o_auth_error_error.py +16 -0
- hubble_sdk/_generated/models/operation_outcome.py +75 -0
- hubble_sdk/_generated/models/operation_outcome_issue_item.py +61 -0
- hubble_sdk/_generated/models/patient_address.py +69 -0
- hubble_sdk/_generated/models/patient_demographics.py +109 -0
- hubble_sdk/_generated/models/provider_seed.py +53 -0
- hubble_sdk/_generated/models/token_request.py +81 -0
- hubble_sdk/_generated/models/token_request_grant_type.py +12 -0
- hubble_sdk/_generated/models/token_response.py +84 -0
- hubble_sdk/_generated/types.py +54 -0
- hubble_sdk/_hubble.py +379 -0
- hubble_sdk_python-0.0.2.dist-info/METADATA +89 -0
- hubble_sdk_python-0.0.2.dist-info/RECORD +46 -0
- hubble_sdk_python-0.0.2.dist-info/WHEEL +4 -0
- hubble_sdk_python-0.0.2.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"""Contains all the data models used in inputs/outputs"""
|
|
2
|
+
|
|
3
|
+
from .api_error import ApiError
|
|
4
|
+
from .attach_client_authorization_body import AttachClientAuthorizationBody
|
|
5
|
+
from .attach_client_authorization_response_201 import (
|
|
6
|
+
AttachClientAuthorizationResponse201,
|
|
7
|
+
)
|
|
8
|
+
from .attach_client_authorization_response_201_status import (
|
|
9
|
+
AttachClientAuthorizationResponse201Status,
|
|
10
|
+
)
|
|
11
|
+
from .consent import Consent
|
|
12
|
+
from .consent_error import ConsentError
|
|
13
|
+
from .consent_link_request import ConsentLinkRequest
|
|
14
|
+
from .consent_list import ConsentList
|
|
15
|
+
from .consent_source import ConsentSource
|
|
16
|
+
from .consent_source_status import ConsentSourceStatus
|
|
17
|
+
from .consent_source_type import ConsentSourceType
|
|
18
|
+
from .consent_status import ConsentStatus
|
|
19
|
+
from .device_authorization_request import DeviceAuthorizationRequest
|
|
20
|
+
from .device_authorization_response import DeviceAuthorizationResponse
|
|
21
|
+
from .fhir_resource import FhirResource
|
|
22
|
+
from .o_auth_error import OAuthError
|
|
23
|
+
from .o_auth_error_error import OAuthErrorError
|
|
24
|
+
from .operation_outcome import OperationOutcome
|
|
25
|
+
from .operation_outcome_issue_item import OperationOutcomeIssueItem
|
|
26
|
+
from .patient_address import PatientAddress
|
|
27
|
+
from .patient_demographics import PatientDemographics
|
|
28
|
+
from .provider_seed import ProviderSeed
|
|
29
|
+
from .token_request import TokenRequest
|
|
30
|
+
from .token_request_grant_type import TokenRequestGrantType
|
|
31
|
+
from .token_response import TokenResponse
|
|
32
|
+
|
|
33
|
+
__all__ = (
|
|
34
|
+
"ApiError",
|
|
35
|
+
"AttachClientAuthorizationBody",
|
|
36
|
+
"AttachClientAuthorizationResponse201",
|
|
37
|
+
"AttachClientAuthorizationResponse201Status",
|
|
38
|
+
"Consent",
|
|
39
|
+
"ConsentError",
|
|
40
|
+
"ConsentLinkRequest",
|
|
41
|
+
"ConsentList",
|
|
42
|
+
"ConsentSource",
|
|
43
|
+
"ConsentSourceStatus",
|
|
44
|
+
"ConsentSourceType",
|
|
45
|
+
"ConsentStatus",
|
|
46
|
+
"DeviceAuthorizationRequest",
|
|
47
|
+
"DeviceAuthorizationResponse",
|
|
48
|
+
"FhirResource",
|
|
49
|
+
"OAuthError",
|
|
50
|
+
"OAuthErrorError",
|
|
51
|
+
"OperationOutcome",
|
|
52
|
+
"OperationOutcomeIssueItem",
|
|
53
|
+
"PatientAddress",
|
|
54
|
+
"PatientDemographics",
|
|
55
|
+
"ProviderSeed",
|
|
56
|
+
"TokenRequest",
|
|
57
|
+
"TokenRequestGrantType",
|
|
58
|
+
"TokenResponse",
|
|
59
|
+
)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="ApiError")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class ApiError:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
error (str): Human-readable error message.
|
|
16
|
+
"""
|
|
17
|
+
|
|
18
|
+
error: str
|
|
19
|
+
|
|
20
|
+
def to_dict(self) -> dict[str, Any]:
|
|
21
|
+
error = self.error
|
|
22
|
+
|
|
23
|
+
field_dict: dict[str, Any] = {}
|
|
24
|
+
|
|
25
|
+
field_dict.update(
|
|
26
|
+
{
|
|
27
|
+
"error": error,
|
|
28
|
+
}
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
return field_dict
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
35
|
+
d = dict(src_dict)
|
|
36
|
+
error = d.pop("error")
|
|
37
|
+
|
|
38
|
+
api_error = cls(
|
|
39
|
+
error=error,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return api_error
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from io import BytesIO
|
|
6
|
+
from typing import Any, Self, TypeVar
|
|
7
|
+
|
|
8
|
+
from attrs import define as _attrs_define
|
|
9
|
+
from attrs import field as _attrs_field
|
|
10
|
+
|
|
11
|
+
from .. import types
|
|
12
|
+
from ..types import UNSET, File, Unset
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="AttachClientAuthorizationBody")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class AttachClientAuthorizationBody:
|
|
19
|
+
"""
|
|
20
|
+
Attributes:
|
|
21
|
+
authorization (File): The signed authorization file.
|
|
22
|
+
disclosers (str): A JSON array of the providers to disclose from; each item an object `{ "name": "…" }`.
|
|
23
|
+
expires_at (datetime.datetime | Unset): The authorization's asserted expiration (ISO 8601).
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
authorization: File
|
|
27
|
+
disclosers: str
|
|
28
|
+
expires_at: datetime.datetime | Unset = UNSET
|
|
29
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
30
|
+
|
|
31
|
+
def to_dict(self) -> dict[str, Any]:
|
|
32
|
+
authorization = self.authorization.to_tuple()
|
|
33
|
+
|
|
34
|
+
disclosers = self.disclosers
|
|
35
|
+
|
|
36
|
+
expires_at: str | Unset = UNSET
|
|
37
|
+
if not isinstance(self.expires_at, Unset):
|
|
38
|
+
expires_at = self.expires_at.isoformat()
|
|
39
|
+
|
|
40
|
+
field_dict: dict[str, Any] = {}
|
|
41
|
+
field_dict.update(self.additional_properties)
|
|
42
|
+
field_dict.update(
|
|
43
|
+
{
|
|
44
|
+
"authorization": authorization,
|
|
45
|
+
"disclosers": disclosers,
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
if expires_at is not UNSET:
|
|
49
|
+
field_dict["expires_at"] = expires_at
|
|
50
|
+
|
|
51
|
+
return field_dict
|
|
52
|
+
|
|
53
|
+
def to_multipart(self) -> types.RequestFiles:
|
|
54
|
+
files: types.RequestFiles = []
|
|
55
|
+
|
|
56
|
+
files.append(("authorization", self.authorization.to_tuple()))
|
|
57
|
+
|
|
58
|
+
files.append(
|
|
59
|
+
("disclosers", (None, str(self.disclosers).encode(), "text/plain"))
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
if not isinstance(self.expires_at, Unset):
|
|
63
|
+
files.append(
|
|
64
|
+
(
|
|
65
|
+
"expires_at",
|
|
66
|
+
(None, self.expires_at.isoformat().encode(), "text/plain"),
|
|
67
|
+
)
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
for prop_name, prop in self.additional_properties.items():
|
|
71
|
+
files.append((prop_name, (None, str(prop).encode(), "text/plain")))
|
|
72
|
+
|
|
73
|
+
return files
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
77
|
+
d = dict(src_dict)
|
|
78
|
+
authorization = File(payload=BytesIO(d.pop("authorization")))
|
|
79
|
+
|
|
80
|
+
disclosers = d.pop("disclosers")
|
|
81
|
+
|
|
82
|
+
_expires_at = d.pop("expires_at", UNSET)
|
|
83
|
+
expires_at: datetime.datetime | Unset
|
|
84
|
+
if isinstance(_expires_at, Unset):
|
|
85
|
+
expires_at = UNSET
|
|
86
|
+
else:
|
|
87
|
+
expires_at = datetime.datetime.fromisoformat(_expires_at)
|
|
88
|
+
|
|
89
|
+
attach_client_authorization_body = cls(
|
|
90
|
+
authorization=authorization,
|
|
91
|
+
disclosers=disclosers,
|
|
92
|
+
expires_at=expires_at,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
attach_client_authorization_body.additional_properties = d
|
|
96
|
+
return attach_client_authorization_body
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def additional_keys(self) -> list[str]:
|
|
100
|
+
return list(self.additional_properties.keys())
|
|
101
|
+
|
|
102
|
+
def __getitem__(self, key: str) -> Any:
|
|
103
|
+
return self.additional_properties[key]
|
|
104
|
+
|
|
105
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
106
|
+
self.additional_properties[key] = value
|
|
107
|
+
|
|
108
|
+
def __delitem__(self, key: str) -> None:
|
|
109
|
+
del self.additional_properties[key]
|
|
110
|
+
|
|
111
|
+
def __contains__(self, key: str) -> bool:
|
|
112
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Self, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from ..models.attach_client_authorization_response_201_status import (
|
|
10
|
+
AttachClientAuthorizationResponse201Status,
|
|
11
|
+
)
|
|
12
|
+
from ..types import UNSET, Unset
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="AttachClientAuthorizationResponse201")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class AttachClientAuthorizationResponse201:
|
|
19
|
+
"""
|
|
20
|
+
Attributes:
|
|
21
|
+
consent_id (str | Unset):
|
|
22
|
+
status (AttachClientAuthorizationResponse201Status | Unset):
|
|
23
|
+
authorization_id (str | Unset):
|
|
24
|
+
requests (list[str] | Unset):
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
consent_id: str | Unset = UNSET
|
|
28
|
+
status: AttachClientAuthorizationResponse201Status | Unset = UNSET
|
|
29
|
+
authorization_id: str | Unset = UNSET
|
|
30
|
+
requests: list[str] | Unset = UNSET
|
|
31
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
32
|
+
|
|
33
|
+
def to_dict(self) -> dict[str, Any]:
|
|
34
|
+
consent_id = self.consent_id
|
|
35
|
+
|
|
36
|
+
status: str | Unset = UNSET
|
|
37
|
+
if not isinstance(self.status, Unset):
|
|
38
|
+
status = self.status.value
|
|
39
|
+
|
|
40
|
+
authorization_id = self.authorization_id
|
|
41
|
+
|
|
42
|
+
requests: list[str] | Unset = UNSET
|
|
43
|
+
if not isinstance(self.requests, Unset):
|
|
44
|
+
requests = self.requests
|
|
45
|
+
|
|
46
|
+
field_dict: dict[str, Any] = {}
|
|
47
|
+
field_dict.update(self.additional_properties)
|
|
48
|
+
field_dict.update({})
|
|
49
|
+
if consent_id is not UNSET:
|
|
50
|
+
field_dict["consent_id"] = consent_id
|
|
51
|
+
if status is not UNSET:
|
|
52
|
+
field_dict["status"] = status
|
|
53
|
+
if authorization_id is not UNSET:
|
|
54
|
+
field_dict["authorization_id"] = authorization_id
|
|
55
|
+
if requests is not UNSET:
|
|
56
|
+
field_dict["requests"] = requests
|
|
57
|
+
|
|
58
|
+
return field_dict
|
|
59
|
+
|
|
60
|
+
@classmethod
|
|
61
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
62
|
+
d = dict(src_dict)
|
|
63
|
+
consent_id = d.pop("consent_id", UNSET)
|
|
64
|
+
|
|
65
|
+
_status = d.pop("status", UNSET)
|
|
66
|
+
status: AttachClientAuthorizationResponse201Status | Unset
|
|
67
|
+
if isinstance(_status, Unset):
|
|
68
|
+
status = UNSET
|
|
69
|
+
else:
|
|
70
|
+
status = AttachClientAuthorizationResponse201Status(_status)
|
|
71
|
+
|
|
72
|
+
authorization_id = d.pop("authorization_id", UNSET)
|
|
73
|
+
|
|
74
|
+
requests = cast(list[str], d.pop("requests", UNSET))
|
|
75
|
+
|
|
76
|
+
attach_client_authorization_response_201 = cls(
|
|
77
|
+
consent_id=consent_id,
|
|
78
|
+
status=status,
|
|
79
|
+
authorization_id=authorization_id,
|
|
80
|
+
requests=requests,
|
|
81
|
+
)
|
|
82
|
+
|
|
83
|
+
attach_client_authorization_response_201.additional_properties = d
|
|
84
|
+
return attach_client_authorization_response_201
|
|
85
|
+
|
|
86
|
+
@property
|
|
87
|
+
def additional_keys(self) -> list[str]:
|
|
88
|
+
return list(self.additional_properties.keys())
|
|
89
|
+
|
|
90
|
+
def __getitem__(self, key: str) -> Any:
|
|
91
|
+
return self.additional_properties[key]
|
|
92
|
+
|
|
93
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
94
|
+
self.additional_properties[key] = value
|
|
95
|
+
|
|
96
|
+
def __delitem__(self, key: str) -> None:
|
|
97
|
+
del self.additional_properties[key]
|
|
98
|
+
|
|
99
|
+
def __contains__(self, key: str) -> bool:
|
|
100
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import TYPE_CHECKING, Any, Self, TypeVar, cast
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
|
|
9
|
+
from ..models.consent_status import ConsentStatus
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from ..models.consent_error import ConsentError
|
|
13
|
+
from ..models.consent_source import ConsentSource
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
T = TypeVar("T", bound="Consent")
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@_attrs_define
|
|
20
|
+
class Consent:
|
|
21
|
+
"""
|
|
22
|
+
Attributes:
|
|
23
|
+
id (str): Stable consent id. Present from creation through the whole lifecycle.
|
|
24
|
+
status (ConsentStatus):
|
|
25
|
+
patient_ref (None | str): Your own reference for the patient, echoed back from consent creation.
|
|
26
|
+
created_at (datetime.datetime): When the consent was created.
|
|
27
|
+
granted_at (datetime.datetime | None): When the patient authorized. Null until active.
|
|
28
|
+
expires_at (datetime.datetime): When a pending link expires, or when the grant lapses.
|
|
29
|
+
sources (list[ConsentSource]): Each source on the consent and its progress (live vs one-time,
|
|
30
|
+
available/pending/failed).
|
|
31
|
+
error (ConsentError | None): Populated only when status is error.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
id: str
|
|
35
|
+
status: ConsentStatus
|
|
36
|
+
patient_ref: None | str
|
|
37
|
+
created_at: datetime.datetime
|
|
38
|
+
granted_at: datetime.datetime | None
|
|
39
|
+
expires_at: datetime.datetime
|
|
40
|
+
sources: list[ConsentSource]
|
|
41
|
+
error: ConsentError | None
|
|
42
|
+
|
|
43
|
+
def to_dict(self) -> dict[str, Any]:
|
|
44
|
+
from ..models.consent_error import ConsentError
|
|
45
|
+
|
|
46
|
+
id = self.id
|
|
47
|
+
|
|
48
|
+
status = self.status.value
|
|
49
|
+
|
|
50
|
+
patient_ref: None | str
|
|
51
|
+
patient_ref = self.patient_ref
|
|
52
|
+
|
|
53
|
+
created_at = self.created_at.isoformat()
|
|
54
|
+
|
|
55
|
+
granted_at: None | str
|
|
56
|
+
if isinstance(self.granted_at, datetime.datetime):
|
|
57
|
+
granted_at = self.granted_at.isoformat()
|
|
58
|
+
else:
|
|
59
|
+
granted_at = self.granted_at
|
|
60
|
+
|
|
61
|
+
expires_at = self.expires_at.isoformat()
|
|
62
|
+
|
|
63
|
+
sources = []
|
|
64
|
+
for sources_item_data in self.sources:
|
|
65
|
+
sources_item = sources_item_data.to_dict()
|
|
66
|
+
sources.append(sources_item)
|
|
67
|
+
|
|
68
|
+
error: dict[str, Any] | None
|
|
69
|
+
if isinstance(self.error, ConsentError):
|
|
70
|
+
error = self.error.to_dict()
|
|
71
|
+
else:
|
|
72
|
+
error = self.error
|
|
73
|
+
|
|
74
|
+
field_dict: dict[str, Any] = {}
|
|
75
|
+
|
|
76
|
+
field_dict.update(
|
|
77
|
+
{
|
|
78
|
+
"id": id,
|
|
79
|
+
"status": status,
|
|
80
|
+
"patient_ref": patient_ref,
|
|
81
|
+
"created_at": created_at,
|
|
82
|
+
"granted_at": granted_at,
|
|
83
|
+
"expires_at": expires_at,
|
|
84
|
+
"sources": sources,
|
|
85
|
+
"error": error,
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
return field_dict
|
|
90
|
+
|
|
91
|
+
@classmethod
|
|
92
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
93
|
+
from ..models.consent_error import ConsentError
|
|
94
|
+
from ..models.consent_source import ConsentSource
|
|
95
|
+
|
|
96
|
+
d = dict(src_dict)
|
|
97
|
+
id = d.pop("id")
|
|
98
|
+
|
|
99
|
+
status = ConsentStatus(d.pop("status"))
|
|
100
|
+
|
|
101
|
+
def _parse_patient_ref(data: object) -> None | str:
|
|
102
|
+
if data is None:
|
|
103
|
+
return data
|
|
104
|
+
return cast(None | str, data)
|
|
105
|
+
|
|
106
|
+
patient_ref = _parse_patient_ref(d.pop("patient_ref"))
|
|
107
|
+
|
|
108
|
+
created_at = datetime.datetime.fromisoformat(d.pop("created_at"))
|
|
109
|
+
|
|
110
|
+
def _parse_granted_at(data: object) -> datetime.datetime | None:
|
|
111
|
+
if data is None:
|
|
112
|
+
return data
|
|
113
|
+
try:
|
|
114
|
+
if not isinstance(data, str):
|
|
115
|
+
raise TypeError()
|
|
116
|
+
granted_at_type_0 = datetime.datetime.fromisoformat(data)
|
|
117
|
+
|
|
118
|
+
return granted_at_type_0
|
|
119
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
120
|
+
pass
|
|
121
|
+
return cast(datetime.datetime | None, data)
|
|
122
|
+
|
|
123
|
+
granted_at = _parse_granted_at(d.pop("granted_at"))
|
|
124
|
+
|
|
125
|
+
expires_at = datetime.datetime.fromisoformat(d.pop("expires_at"))
|
|
126
|
+
|
|
127
|
+
sources = []
|
|
128
|
+
_sources = d.pop("sources")
|
|
129
|
+
for sources_item_data in _sources:
|
|
130
|
+
sources_item = ConsentSource.from_dict(sources_item_data)
|
|
131
|
+
|
|
132
|
+
sources.append(sources_item)
|
|
133
|
+
|
|
134
|
+
def _parse_error(data: object) -> ConsentError | None:
|
|
135
|
+
if data is None:
|
|
136
|
+
return data
|
|
137
|
+
try:
|
|
138
|
+
if not isinstance(data, dict):
|
|
139
|
+
raise TypeError()
|
|
140
|
+
error_type_0 = ConsentError.from_dict(data)
|
|
141
|
+
|
|
142
|
+
return error_type_0
|
|
143
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
144
|
+
pass
|
|
145
|
+
return cast(ConsentError | None, data)
|
|
146
|
+
|
|
147
|
+
error = _parse_error(d.pop("error"))
|
|
148
|
+
|
|
149
|
+
consent = cls(
|
|
150
|
+
id=id,
|
|
151
|
+
status=status,
|
|
152
|
+
patient_ref=patient_ref,
|
|
153
|
+
created_at=created_at,
|
|
154
|
+
granted_at=granted_at,
|
|
155
|
+
expires_at=expires_at,
|
|
156
|
+
sources=sources,
|
|
157
|
+
error=error,
|
|
158
|
+
)
|
|
159
|
+
|
|
160
|
+
return consent
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="ConsentError")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class ConsentError:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
code (str): Machine-readable failure code, e.g. authorization_failed.
|
|
16
|
+
message (str): Human-readable description of the failure.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
code: str
|
|
20
|
+
message: str
|
|
21
|
+
|
|
22
|
+
def to_dict(self) -> dict[str, Any]:
|
|
23
|
+
code = self.code
|
|
24
|
+
|
|
25
|
+
message = self.message
|
|
26
|
+
|
|
27
|
+
field_dict: dict[str, Any] = {}
|
|
28
|
+
|
|
29
|
+
field_dict.update(
|
|
30
|
+
{
|
|
31
|
+
"code": code,
|
|
32
|
+
"message": message,
|
|
33
|
+
}
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return field_dict
|
|
37
|
+
|
|
38
|
+
@classmethod
|
|
39
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
40
|
+
d = dict(src_dict)
|
|
41
|
+
code = d.pop("code")
|
|
42
|
+
|
|
43
|
+
message = d.pop("message")
|
|
44
|
+
|
|
45
|
+
consent_error = cls(
|
|
46
|
+
code=code,
|
|
47
|
+
message=message,
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return consent_error
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
from ..types import UNSET, Unset
|
|
9
|
+
|
|
10
|
+
if TYPE_CHECKING:
|
|
11
|
+
from ..models.patient_demographics import PatientDemographics
|
|
12
|
+
from ..models.provider_seed import ProviderSeed
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="ConsentLinkRequest")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class ConsentLinkRequest:
|
|
20
|
+
"""
|
|
21
|
+
Attributes:
|
|
22
|
+
patient_ref (str | Unset): Your own reference for the patient, echoed back on the consent.
|
|
23
|
+
patient (PatientDemographics | Unset):
|
|
24
|
+
providers (list[ProviderSeed] | Unset): Provider seeds to prefill the patient's list. Seeded by name (freeform);
|
|
25
|
+
the patient can add, change, or remove them on the link page.
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
patient_ref: str | Unset = UNSET
|
|
29
|
+
patient: PatientDemographics | Unset = UNSET
|
|
30
|
+
providers: list[ProviderSeed] | Unset = UNSET
|
|
31
|
+
|
|
32
|
+
def to_dict(self) -> dict[str, Any]:
|
|
33
|
+
patient_ref = self.patient_ref
|
|
34
|
+
|
|
35
|
+
patient: dict[str, Any] | Unset = UNSET
|
|
36
|
+
if not isinstance(self.patient, Unset):
|
|
37
|
+
patient = self.patient.to_dict()
|
|
38
|
+
|
|
39
|
+
providers: list[dict[str, Any]] | Unset = UNSET
|
|
40
|
+
if not isinstance(self.providers, Unset):
|
|
41
|
+
providers = []
|
|
42
|
+
for providers_item_data in self.providers:
|
|
43
|
+
providers_item = providers_item_data.to_dict()
|
|
44
|
+
providers.append(providers_item)
|
|
45
|
+
|
|
46
|
+
field_dict: dict[str, Any] = {}
|
|
47
|
+
|
|
48
|
+
field_dict.update({})
|
|
49
|
+
if patient_ref is not UNSET:
|
|
50
|
+
field_dict["patient_ref"] = patient_ref
|
|
51
|
+
if patient is not UNSET:
|
|
52
|
+
field_dict["patient"] = patient
|
|
53
|
+
if providers is not UNSET:
|
|
54
|
+
field_dict["providers"] = providers
|
|
55
|
+
|
|
56
|
+
return field_dict
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
60
|
+
from ..models.patient_demographics import PatientDemographics
|
|
61
|
+
from ..models.provider_seed import ProviderSeed
|
|
62
|
+
|
|
63
|
+
d = dict(src_dict)
|
|
64
|
+
patient_ref = d.pop("patient_ref", UNSET)
|
|
65
|
+
|
|
66
|
+
_patient = d.pop("patient", UNSET)
|
|
67
|
+
patient: PatientDemographics | Unset
|
|
68
|
+
if isinstance(_patient, Unset):
|
|
69
|
+
patient = UNSET
|
|
70
|
+
else:
|
|
71
|
+
patient = PatientDemographics.from_dict(_patient)
|
|
72
|
+
|
|
73
|
+
_providers = d.pop("providers", UNSET)
|
|
74
|
+
providers: list[ProviderSeed] | Unset = UNSET
|
|
75
|
+
if _providers is not UNSET:
|
|
76
|
+
providers = []
|
|
77
|
+
for providers_item_data in _providers:
|
|
78
|
+
providers_item = ProviderSeed.from_dict(providers_item_data)
|
|
79
|
+
|
|
80
|
+
providers.append(providers_item)
|
|
81
|
+
|
|
82
|
+
consent_link_request = cls(
|
|
83
|
+
patient_ref=patient_ref,
|
|
84
|
+
patient=patient,
|
|
85
|
+
providers=providers,
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
return consent_link_request
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import TYPE_CHECKING, Any, Self, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from ..models.consent import Consent
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
T = TypeVar("T", bound="ConsentList")
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@_attrs_define
|
|
16
|
+
class ConsentList:
|
|
17
|
+
"""
|
|
18
|
+
Attributes:
|
|
19
|
+
consents (list[Consent]):
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
consents: list[Consent]
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
consents = []
|
|
26
|
+
for consents_item_data in self.consents:
|
|
27
|
+
consents_item = consents_item_data.to_dict()
|
|
28
|
+
consents.append(consents_item)
|
|
29
|
+
|
|
30
|
+
field_dict: dict[str, Any] = {}
|
|
31
|
+
|
|
32
|
+
field_dict.update(
|
|
33
|
+
{
|
|
34
|
+
"consents": consents,
|
|
35
|
+
}
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
return field_dict
|
|
39
|
+
|
|
40
|
+
@classmethod
|
|
41
|
+
def from_dict(cls, src_dict: Mapping[str, Any]) -> Self:
|
|
42
|
+
from ..models.consent import Consent
|
|
43
|
+
|
|
44
|
+
d = dict(src_dict)
|
|
45
|
+
consents = []
|
|
46
|
+
_consents = d.pop("consents")
|
|
47
|
+
for consents_item_data in _consents:
|
|
48
|
+
consents_item = Consent.from_dict(consents_item_data)
|
|
49
|
+
|
|
50
|
+
consents.append(consents_item)
|
|
51
|
+
|
|
52
|
+
consent_list = cls(
|
|
53
|
+
consents=consents,
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
return consent_list
|