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.
Files changed (46) hide show
  1. hubble_sdk/__init__.py +43 -0
  2. hubble_sdk/_generated/__init__.py +8 -0
  3. hubble_sdk/_generated/api/__init__.py +1 -0
  4. hubble_sdk/_generated/api/default/__init__.py +1 -0
  5. hubble_sdk/_generated/api/default/attach_client_authorization.py +220 -0
  6. hubble_sdk/_generated/api/default/create_consent_link.py +197 -0
  7. hubble_sdk/_generated/api/default/exchange_token.py +186 -0
  8. hubble_sdk/_generated/api/default/export_patient_pdf.py +194 -0
  9. hubble_sdk/_generated/api/default/get_consent.py +166 -0
  10. hubble_sdk/_generated/api/default/list_consents.py +191 -0
  11. hubble_sdk/_generated/api/default/read_fhir.py +182 -0
  12. hubble_sdk/_generated/api/default/revoke_consent.py +167 -0
  13. hubble_sdk/_generated/client.py +282 -0
  14. hubble_sdk/_generated/errors.py +16 -0
  15. hubble_sdk/_generated/models/__init__.py +59 -0
  16. hubble_sdk/_generated/models/api_error.py +42 -0
  17. hubble_sdk/_generated/models/attach_client_authorization_body.py +112 -0
  18. hubble_sdk/_generated/models/attach_client_authorization_response_201.py +100 -0
  19. hubble_sdk/_generated/models/attach_client_authorization_response_201_status.py +8 -0
  20. hubble_sdk/_generated/models/consent.py +160 -0
  21. hubble_sdk/_generated/models/consent_error.py +50 -0
  22. hubble_sdk/_generated/models/consent_link_request.py +88 -0
  23. hubble_sdk/_generated/models/consent_list.py +56 -0
  24. hubble_sdk/_generated/models/consent_source.py +63 -0
  25. hubble_sdk/_generated/models/consent_source_status.py +10 -0
  26. hubble_sdk/_generated/models/consent_source_type.py +9 -0
  27. hubble_sdk/_generated/models/consent_status.py +12 -0
  28. hubble_sdk/_generated/models/device_authorization_request.py +142 -0
  29. hubble_sdk/_generated/models/device_authorization_response.py +90 -0
  30. hubble_sdk/_generated/models/fhir_resource.py +62 -0
  31. hubble_sdk/_generated/models/o_auth_error.py +54 -0
  32. hubble_sdk/_generated/models/o_auth_error_error.py +16 -0
  33. hubble_sdk/_generated/models/operation_outcome.py +75 -0
  34. hubble_sdk/_generated/models/operation_outcome_issue_item.py +61 -0
  35. hubble_sdk/_generated/models/patient_address.py +69 -0
  36. hubble_sdk/_generated/models/patient_demographics.py +109 -0
  37. hubble_sdk/_generated/models/provider_seed.py +53 -0
  38. hubble_sdk/_generated/models/token_request.py +81 -0
  39. hubble_sdk/_generated/models/token_request_grant_type.py +12 -0
  40. hubble_sdk/_generated/models/token_response.py +84 -0
  41. hubble_sdk/_generated/types.py +54 -0
  42. hubble_sdk/_hubble.py +379 -0
  43. hubble_sdk_python-0.0.2.dist-info/METADATA +89 -0
  44. hubble_sdk_python-0.0.2.dist-info/RECORD +46 -0
  45. hubble_sdk_python-0.0.2.dist-info/WHEEL +4 -0
  46. hubble_sdk_python-0.0.2.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,194 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.operation_outcome import OperationOutcome
9
+ from ...types import UNSET, Response, Unset
10
+
11
+
12
+ def _get_kwargs(
13
+ *,
14
+ connection: str | Unset = UNSET,
15
+ ) -> dict[str, Any]:
16
+
17
+ params: dict[str, Any] = {}
18
+
19
+ params["connection"] = connection
20
+
21
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
22
+
23
+ _kwargs: dict[str, Any] = {
24
+ "method": "get",
25
+ "url": "/api/v1/fhir/Patient/$pdf",
26
+ "params": params,
27
+ }
28
+
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: AuthenticatedClient | Client, response: httpx.Response
34
+ ) -> OperationOutcome | None:
35
+ if response.status_code == 401:
36
+ response_401 = OperationOutcome.from_dict(response.json())
37
+
38
+ return response_401
39
+
40
+ if response.status_code == 403:
41
+ response_403 = OperationOutcome.from_dict(response.json())
42
+
43
+ return response_403
44
+
45
+ if response.status_code == 404:
46
+ response_404 = OperationOutcome.from_dict(response.json())
47
+
48
+ return response_404
49
+
50
+ if client.raise_on_unexpected_status:
51
+ raise errors.UnexpectedStatus(response.status_code, response.content)
52
+ else:
53
+ return None
54
+
55
+
56
+ def _build_response(
57
+ *, client: AuthenticatedClient | Client, response: httpx.Response
58
+ ) -> Response[OperationOutcome]:
59
+ return Response(
60
+ status_code=HTTPStatus(response.status_code),
61
+ content=response.content,
62
+ headers=response.headers,
63
+ parsed=_parse_response(client=client, response=response),
64
+ )
65
+
66
+
67
+ def sync_detailed(
68
+ *,
69
+ client: AuthenticatedClient,
70
+ connection: str | Unset = UNSET,
71
+ ) -> Response[OperationOutcome]:
72
+ """Export records as PDF (one per source)
73
+
74
+ A branded PDF of the patient's records, one per connected source (facility). By default returns a
75
+ zip with a PDF per source plus a `manifest.json` naming each file and reporting its completeness
76
+ (complete / partial / failed); pass `connection=<id>` to get that single source's PDF. The
77
+ `X-Hubble-Sources-Total`, `X-Hubble-Sources-Failed`, and `X-Hubble-Resource-Count` response headers
78
+ report how many sources were exported, how many were incomplete, and the total resource count.
79
+
80
+ Args:
81
+ connection (str | Unset):
82
+
83
+ Raises:
84
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
85
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
86
+
87
+ Returns:
88
+ Response[OperationOutcome]
89
+ """
90
+
91
+ kwargs = _get_kwargs(
92
+ connection=connection,
93
+ )
94
+
95
+ response = client.get_httpx_client().request(
96
+ **kwargs,
97
+ )
98
+
99
+ return _build_response(client=client, response=response)
100
+
101
+
102
+ def sync(
103
+ *,
104
+ client: AuthenticatedClient,
105
+ connection: str | Unset = UNSET,
106
+ ) -> OperationOutcome | None:
107
+ """Export records as PDF (one per source)
108
+
109
+ A branded PDF of the patient's records, one per connected source (facility). By default returns a
110
+ zip with a PDF per source plus a `manifest.json` naming each file and reporting its completeness
111
+ (complete / partial / failed); pass `connection=<id>` to get that single source's PDF. The
112
+ `X-Hubble-Sources-Total`, `X-Hubble-Sources-Failed`, and `X-Hubble-Resource-Count` response headers
113
+ report how many sources were exported, how many were incomplete, and the total resource count.
114
+
115
+ Args:
116
+ connection (str | Unset):
117
+
118
+ Raises:
119
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
121
+
122
+ Returns:
123
+ OperationOutcome
124
+ """
125
+
126
+ return sync_detailed(
127
+ client=client,
128
+ connection=connection,
129
+ ).parsed
130
+
131
+
132
+ async def asyncio_detailed(
133
+ *,
134
+ client: AuthenticatedClient,
135
+ connection: str | Unset = UNSET,
136
+ ) -> Response[OperationOutcome]:
137
+ """Export records as PDF (one per source)
138
+
139
+ A branded PDF of the patient's records, one per connected source (facility). By default returns a
140
+ zip with a PDF per source plus a `manifest.json` naming each file and reporting its completeness
141
+ (complete / partial / failed); pass `connection=<id>` to get that single source's PDF. The
142
+ `X-Hubble-Sources-Total`, `X-Hubble-Sources-Failed`, and `X-Hubble-Resource-Count` response headers
143
+ report how many sources were exported, how many were incomplete, and the total resource count.
144
+
145
+ Args:
146
+ connection (str | Unset):
147
+
148
+ Raises:
149
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
150
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
151
+
152
+ Returns:
153
+ Response[OperationOutcome]
154
+ """
155
+
156
+ kwargs = _get_kwargs(
157
+ connection=connection,
158
+ )
159
+
160
+ response = await client.get_async_httpx_client().request(**kwargs)
161
+
162
+ return _build_response(client=client, response=response)
163
+
164
+
165
+ async def asyncio(
166
+ *,
167
+ client: AuthenticatedClient,
168
+ connection: str | Unset = UNSET,
169
+ ) -> OperationOutcome | None:
170
+ """Export records as PDF (one per source)
171
+
172
+ A branded PDF of the patient's records, one per connected source (facility). By default returns a
173
+ zip with a PDF per source plus a `manifest.json` naming each file and reporting its completeness
174
+ (complete / partial / failed); pass `connection=<id>` to get that single source's PDF. The
175
+ `X-Hubble-Sources-Total`, `X-Hubble-Sources-Failed`, and `X-Hubble-Resource-Count` response headers
176
+ report how many sources were exported, how many were incomplete, and the total resource count.
177
+
178
+ Args:
179
+ connection (str | Unset):
180
+
181
+ Raises:
182
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
183
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
184
+
185
+ Returns:
186
+ OperationOutcome
187
+ """
188
+
189
+ return (
190
+ await asyncio_detailed(
191
+ client=client,
192
+ connection=connection,
193
+ )
194
+ ).parsed
@@ -0,0 +1,166 @@
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.consent import Consent
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ id: str,
16
+ ) -> dict[str, Any]:
17
+
18
+ _kwargs: dict[str, Any] = {
19
+ "method": "get",
20
+ "url": "/api/v1/consents/{id}".format(
21
+ id=quote(str(id), safe=""),
22
+ ),
23
+ }
24
+
25
+ return _kwargs
26
+
27
+
28
+ def _parse_response(
29
+ *, client: AuthenticatedClient | Client, response: httpx.Response
30
+ ) -> ApiError | Consent | None:
31
+ if response.status_code == 200:
32
+ response_200 = Consent.from_dict(response.json())
33
+
34
+ return response_200
35
+
36
+ if response.status_code == 401:
37
+ response_401 = ApiError.from_dict(response.json())
38
+
39
+ return response_401
40
+
41
+ if response.status_code == 404:
42
+ response_404 = ApiError.from_dict(response.json())
43
+
44
+ return response_404
45
+
46
+ if client.raise_on_unexpected_status:
47
+ raise errors.UnexpectedStatus(response.status_code, response.content)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _build_response(
53
+ *, client: AuthenticatedClient | Client, response: httpx.Response
54
+ ) -> Response[ApiError | Consent]:
55
+ return Response(
56
+ status_code=HTTPStatus(response.status_code),
57
+ content=response.content,
58
+ headers=response.headers,
59
+ parsed=_parse_response(client=client, response=response),
60
+ )
61
+
62
+
63
+ def sync_detailed(
64
+ id: str,
65
+ *,
66
+ client: AuthenticatedClient,
67
+ ) -> Response[ApiError | Consent]:
68
+ """Get a consent
69
+
70
+ Args:
71
+ id (str):
72
+
73
+ Raises:
74
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
76
+
77
+ Returns:
78
+ Response[ApiError | Consent]
79
+ """
80
+
81
+ kwargs = _get_kwargs(
82
+ id=id,
83
+ )
84
+
85
+ response = client.get_httpx_client().request(
86
+ **kwargs,
87
+ )
88
+
89
+ return _build_response(client=client, response=response)
90
+
91
+
92
+ def sync(
93
+ id: str,
94
+ *,
95
+ client: AuthenticatedClient,
96
+ ) -> ApiError | Consent | None:
97
+ """Get a consent
98
+
99
+ Args:
100
+ id (str):
101
+
102
+ Raises:
103
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
104
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
105
+
106
+ Returns:
107
+ ApiError | Consent
108
+ """
109
+
110
+ return sync_detailed(
111
+ id=id,
112
+ client=client,
113
+ ).parsed
114
+
115
+
116
+ async def asyncio_detailed(
117
+ id: str,
118
+ *,
119
+ client: AuthenticatedClient,
120
+ ) -> Response[ApiError | Consent]:
121
+ """Get a consent
122
+
123
+ Args:
124
+ id (str):
125
+
126
+ Raises:
127
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
128
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
129
+
130
+ Returns:
131
+ Response[ApiError | Consent]
132
+ """
133
+
134
+ kwargs = _get_kwargs(
135
+ id=id,
136
+ )
137
+
138
+ response = await client.get_async_httpx_client().request(**kwargs)
139
+
140
+ return _build_response(client=client, response=response)
141
+
142
+
143
+ async def asyncio(
144
+ id: str,
145
+ *,
146
+ client: AuthenticatedClient,
147
+ ) -> ApiError | Consent | None:
148
+ """Get a consent
149
+
150
+ Args:
151
+ id (str):
152
+
153
+ Raises:
154
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
155
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
156
+
157
+ Returns:
158
+ ApiError | Consent
159
+ """
160
+
161
+ return (
162
+ await asyncio_detailed(
163
+ id=id,
164
+ client=client,
165
+ )
166
+ ).parsed
@@ -0,0 +1,191 @@
1
+ from http import HTTPStatus
2
+ from typing import Any
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.api_error import ApiError
9
+ from ...models.consent_list import ConsentList
10
+ from ...models.consent_status import ConsentStatus
11
+ from ...types import UNSET, Response, Unset
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ status: ConsentStatus | Unset = UNSET,
17
+ patient_ref: str | Unset = UNSET,
18
+ ) -> dict[str, Any]:
19
+
20
+ params: dict[str, Any] = {}
21
+
22
+ json_status: str | Unset = UNSET
23
+ if not isinstance(status, Unset):
24
+ json_status = status.value
25
+
26
+ params["status"] = json_status
27
+
28
+ params["patient_ref"] = patient_ref
29
+
30
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
31
+
32
+ _kwargs: dict[str, Any] = {
33
+ "method": "get",
34
+ "url": "/api/v1/consents",
35
+ "params": params,
36
+ }
37
+
38
+ return _kwargs
39
+
40
+
41
+ def _parse_response(
42
+ *, client: AuthenticatedClient | Client, response: httpx.Response
43
+ ) -> ApiError | ConsentList | None:
44
+ if response.status_code == 200:
45
+ response_200 = ConsentList.from_dict(response.json())
46
+
47
+ return response_200
48
+
49
+ if response.status_code == 400:
50
+ response_400 = ApiError.from_dict(response.json())
51
+
52
+ return response_400
53
+
54
+ if response.status_code == 401:
55
+ response_401 = ApiError.from_dict(response.json())
56
+
57
+ return response_401
58
+
59
+ if client.raise_on_unexpected_status:
60
+ raise errors.UnexpectedStatus(response.status_code, response.content)
61
+ else:
62
+ return None
63
+
64
+
65
+ def _build_response(
66
+ *, client: AuthenticatedClient | Client, response: httpx.Response
67
+ ) -> Response[ApiError | ConsentList]:
68
+ return Response(
69
+ status_code=HTTPStatus(response.status_code),
70
+ content=response.content,
71
+ headers=response.headers,
72
+ parsed=_parse_response(client=client, response=response),
73
+ )
74
+
75
+
76
+ def sync_detailed(
77
+ *,
78
+ client: AuthenticatedClient,
79
+ status: ConsentStatus | Unset = UNSET,
80
+ patient_ref: str | Unset = UNSET,
81
+ ) -> Response[ApiError | ConsentList]:
82
+ """List consents
83
+
84
+ Args:
85
+ status (ConsentStatus | Unset):
86
+ patient_ref (str | Unset):
87
+
88
+ Raises:
89
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
90
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
91
+
92
+ Returns:
93
+ Response[ApiError | ConsentList]
94
+ """
95
+
96
+ kwargs = _get_kwargs(
97
+ status=status,
98
+ patient_ref=patient_ref,
99
+ )
100
+
101
+ response = client.get_httpx_client().request(
102
+ **kwargs,
103
+ )
104
+
105
+ return _build_response(client=client, response=response)
106
+
107
+
108
+ def sync(
109
+ *,
110
+ client: AuthenticatedClient,
111
+ status: ConsentStatus | Unset = UNSET,
112
+ patient_ref: str | Unset = UNSET,
113
+ ) -> ApiError | ConsentList | None:
114
+ """List consents
115
+
116
+ Args:
117
+ status (ConsentStatus | Unset):
118
+ patient_ref (str | Unset):
119
+
120
+ Raises:
121
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
122
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
123
+
124
+ Returns:
125
+ ApiError | ConsentList
126
+ """
127
+
128
+ return sync_detailed(
129
+ client=client,
130
+ status=status,
131
+ patient_ref=patient_ref,
132
+ ).parsed
133
+
134
+
135
+ async def asyncio_detailed(
136
+ *,
137
+ client: AuthenticatedClient,
138
+ status: ConsentStatus | Unset = UNSET,
139
+ patient_ref: str | Unset = UNSET,
140
+ ) -> Response[ApiError | ConsentList]:
141
+ """List consents
142
+
143
+ Args:
144
+ status (ConsentStatus | Unset):
145
+ patient_ref (str | Unset):
146
+
147
+ Raises:
148
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
149
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
150
+
151
+ Returns:
152
+ Response[ApiError | ConsentList]
153
+ """
154
+
155
+ kwargs = _get_kwargs(
156
+ status=status,
157
+ patient_ref=patient_ref,
158
+ )
159
+
160
+ response = await client.get_async_httpx_client().request(**kwargs)
161
+
162
+ return _build_response(client=client, response=response)
163
+
164
+
165
+ async def asyncio(
166
+ *,
167
+ client: AuthenticatedClient,
168
+ status: ConsentStatus | Unset = UNSET,
169
+ patient_ref: str | Unset = UNSET,
170
+ ) -> ApiError | ConsentList | None:
171
+ """List consents
172
+
173
+ Args:
174
+ status (ConsentStatus | Unset):
175
+ patient_ref (str | Unset):
176
+
177
+ Raises:
178
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
179
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
180
+
181
+ Returns:
182
+ ApiError | ConsentList
183
+ """
184
+
185
+ return (
186
+ await asyncio_detailed(
187
+ client=client,
188
+ status=status,
189
+ patient_ref=patient_ref,
190
+ )
191
+ ).parsed