phenostore-sdk-python 0.1.1__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 (72) hide show
  1. phenostore/__init__.py +26 -0
  2. phenostore/_auth.py +94 -0
  3. phenostore/client.py +276 -0
  4. phenostore/errors.py +93 -0
  5. phenostore/gen/__init__.py +8 -0
  6. phenostore/gen/api/__init__.py +1 -0
  7. phenostore/gen/api/bulk/__init__.py +1 -0
  8. phenostore/gen/api/bulk/get_bulk_status.py +194 -0
  9. phenostore/gen/api/bulk/submit_bulk.py +223 -0
  10. phenostore/gen/api/fhir/__init__.py +1 -0
  11. phenostore/gen/api/fhir/conditional_delete_resource.py +277 -0
  12. phenostore/gen/api/fhir/create_resource.py +257 -0
  13. phenostore/gen/api/fhir/delete_resource.py +212 -0
  14. phenostore/gen/api/fhir/get_docref.py +281 -0
  15. phenostore/gen/api/fhir/get_metadata.py +185 -0
  16. phenostore/gen/api/fhir/get_resource_history.py +240 -0
  17. phenostore/gen/api/fhir/get_smart_configuration.py +169 -0
  18. phenostore/gen/api/fhir/patch_resource.py +282 -0
  19. phenostore/gen/api/fhir/post_docref.py +200 -0
  20. phenostore/gen/api/fhir/process_bundle.py +201 -0
  21. phenostore/gen/api/fhir/read_resource.py +214 -0
  22. phenostore/gen/api/fhir/read_resource_version.py +228 -0
  23. phenostore/gen/api/fhir/search_resources.py +390 -0
  24. phenostore/gen/api/fhir/search_resources_post.py +228 -0
  25. phenostore/gen/api/fhir/update_resource.py +281 -0
  26. phenostore/gen/api/fhir/validate_resource.py +217 -0
  27. phenostore/gen/api/o_auth/__init__.py +1 -0
  28. phenostore/gen/api/o_auth/issue_token.py +186 -0
  29. phenostore/gen/api/system/__init__.py +1 -0
  30. phenostore/gen/api/system/get_health.py +128 -0
  31. phenostore/gen/client.py +280 -0
  32. phenostore/gen/errors.py +16 -0
  33. phenostore/gen/models/__init__.py +71 -0
  34. phenostore/gen/models/bulk_operation_accepted.py +79 -0
  35. phenostore/gen/models/bulk_operation_accepted_status.py +8 -0
  36. phenostore/gen/models/bulk_operation_status.py +122 -0
  37. phenostore/gen/models/bulk_operation_status_code.py +11 -0
  38. phenostore/gen/models/bundle.py +132 -0
  39. phenostore/gen/models/bundle_entry.py +128 -0
  40. phenostore/gen/models/bundle_entry_request.py +70 -0
  41. phenostore/gen/models/bundle_entry_response.py +97 -0
  42. phenostore/gen/models/bundle_entry_search.py +69 -0
  43. phenostore/gen/models/bundle_entry_search_mode.py +9 -0
  44. phenostore/gen/models/bundle_link.py +69 -0
  45. phenostore/gen/models/bundle_resource_type.py +8 -0
  46. phenostore/gen/models/bundle_type.py +11 -0
  47. phenostore/gen/models/fhir_resource.py +47 -0
  48. phenostore/gen/models/health_response.py +63 -0
  49. phenostore/gen/models/health_response_status.py +8 -0
  50. phenostore/gen/models/issue_severity.py +11 -0
  51. phenostore/gen/models/issue_token_body.py +91 -0
  52. phenostore/gen/models/issue_token_body_grant_type.py +8 -0
  53. phenostore/gen/models/json_patch_item.py +90 -0
  54. phenostore/gen/models/json_patch_op.py +13 -0
  55. phenostore/gen/models/o_auth_error.py +69 -0
  56. phenostore/gen/models/operation_outcome.py +85 -0
  57. phenostore/gen/models/operation_outcome_issue.py +92 -0
  58. phenostore/gen/models/operation_outcome_resource_type.py +8 -0
  59. phenostore/gen/models/post_docref_body.py +124 -0
  60. phenostore/gen/models/resource_type.py +47 -0
  61. phenostore/gen/models/search_resources_post_body.py +155 -0
  62. phenostore/gen/models/search_summary_mode.py +12 -0
  63. phenostore/gen/models/search_total_mode.py +10 -0
  64. phenostore/gen/models/smart_configuration.py +111 -0
  65. phenostore/gen/models/token_response.py +87 -0
  66. phenostore/gen/models/token_response_token_type.py +8 -0
  67. phenostore/gen/types.py +54 -0
  68. phenostore/py.typed +0 -0
  69. phenostore_sdk_python-0.1.1.dist-info/METADATA +196 -0
  70. phenostore_sdk_python-0.1.1.dist-info/RECORD +72 -0
  71. phenostore_sdk_python-0.1.1.dist-info/WHEEL +4 -0
  72. phenostore_sdk_python-0.1.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,128 @@
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.health_response import HealthResponse
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs() -> dict[str, Any]:
13
+
14
+ _kwargs: dict[str, Any] = {
15
+ "method": "get",
16
+ "url": "/health",
17
+ }
18
+
19
+ return _kwargs
20
+
21
+
22
+ def _parse_response(
23
+ *, client: AuthenticatedClient | Client, response: httpx.Response
24
+ ) -> HealthResponse | None:
25
+ if response.status_code == 200:
26
+ response_200 = HealthResponse.from_dict(response.json())
27
+
28
+ return response_200
29
+
30
+ if client.raise_on_unexpected_status:
31
+ raise errors.UnexpectedStatus(response.status_code, response.content)
32
+ else:
33
+ return None
34
+
35
+
36
+ def _build_response(
37
+ *, client: AuthenticatedClient | Client, response: httpx.Response
38
+ ) -> Response[HealthResponse]:
39
+ return Response(
40
+ status_code=HTTPStatus(response.status_code),
41
+ content=response.content,
42
+ headers=response.headers,
43
+ parsed=_parse_response(client=client, response=response),
44
+ )
45
+
46
+
47
+ def sync_detailed(
48
+ *,
49
+ client: AuthenticatedClient | Client,
50
+ ) -> Response[HealthResponse]:
51
+ """Health check
52
+
53
+ Raises:
54
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
55
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
56
+
57
+ Returns:
58
+ Response[HealthResponse]
59
+ """
60
+
61
+ kwargs = _get_kwargs()
62
+
63
+ response = client.get_httpx_client().request(
64
+ **kwargs,
65
+ )
66
+
67
+ return _build_response(client=client, response=response)
68
+
69
+
70
+ def sync(
71
+ *,
72
+ client: AuthenticatedClient | Client,
73
+ ) -> HealthResponse | None:
74
+ """Health check
75
+
76
+ Raises:
77
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
78
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
79
+
80
+ Returns:
81
+ HealthResponse
82
+ """
83
+
84
+ return sync_detailed(
85
+ client=client,
86
+ ).parsed
87
+
88
+
89
+ async def asyncio_detailed(
90
+ *,
91
+ client: AuthenticatedClient | Client,
92
+ ) -> Response[HealthResponse]:
93
+ """Health check
94
+
95
+ Raises:
96
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
97
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
98
+
99
+ Returns:
100
+ Response[HealthResponse]
101
+ """
102
+
103
+ kwargs = _get_kwargs()
104
+
105
+ response = await client.get_async_httpx_client().request(**kwargs)
106
+
107
+ return _build_response(client=client, response=response)
108
+
109
+
110
+ async def asyncio(
111
+ *,
112
+ client: AuthenticatedClient | Client,
113
+ ) -> HealthResponse | None:
114
+ """Health check
115
+
116
+ Raises:
117
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
118
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
119
+
120
+ Returns:
121
+ HealthResponse
122
+ """
123
+
124
+ return (
125
+ await asyncio_detailed(
126
+ client=client,
127
+ )
128
+ ).parsed
@@ -0,0 +1,280 @@
1
+ import ssl
2
+ from typing import Any, Self
3
+
4
+ import httpx
5
+ from attrs import define, evolve, field
6
+
7
+
8
+ @define
9
+ class Client:
10
+ """A class for keeping track of data related to the API
11
+
12
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
13
+
14
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
15
+
16
+ ``cookies``: A dictionary of cookies to be sent with every request
17
+
18
+ ``headers``: A dictionary of headers to be sent with every request
19
+
20
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
21
+ httpx.TimeoutException if this is exceeded.
22
+
23
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
24
+ but can be set to False for testing purposes.
25
+
26
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
27
+
28
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
29
+
30
+
31
+ Attributes:
32
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
33
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
34
+ argument to the constructor.
35
+ """
36
+
37
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
38
+ _base_url: str = field(alias="base_url")
39
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
40
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
41
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
42
+ _verify_ssl: str | bool | ssl.SSLContext = field(
43
+ default=True, kw_only=True, alias="verify_ssl"
44
+ )
45
+ _follow_redirects: bool = field(
46
+ default=False, kw_only=True, alias="follow_redirects"
47
+ )
48
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
49
+ _client: httpx.Client | None = field(default=None, init=False)
50
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
51
+
52
+ def with_headers(self, headers: dict[str, str]) -> "Client":
53
+ """Get a new client matching this one with additional headers"""
54
+ if self._client is not None:
55
+ self._client.headers.update(headers)
56
+ if self._async_client is not None:
57
+ self._async_client.headers.update(headers)
58
+ return evolve(self, headers={**self._headers, **headers})
59
+
60
+ def with_cookies(self, cookies: dict[str, str]) -> "Client":
61
+ """Get a new client matching this one with additional cookies"""
62
+ if self._client is not None:
63
+ self._client.cookies.update(cookies)
64
+ if self._async_client is not None:
65
+ self._async_client.cookies.update(cookies)
66
+ return evolve(self, cookies={**self._cookies, **cookies})
67
+
68
+ def with_timeout(self, timeout: httpx.Timeout) -> "Client":
69
+ """Get a new client matching this one with a new timeout configuration"""
70
+ if self._client is not None:
71
+ self._client.timeout = timeout
72
+ if self._async_client is not None:
73
+ self._async_client.timeout = timeout
74
+ return evolve(self, timeout=timeout)
75
+
76
+ def set_httpx_client(self, client: httpx.Client) -> Self:
77
+ """Manually set the underlying httpx.Client
78
+
79
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
80
+ """
81
+ self._client = client
82
+ return self
83
+
84
+ def get_httpx_client(self) -> httpx.Client:
85
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
86
+ if self._client is None:
87
+ self._client = httpx.Client(
88
+ base_url=self._base_url,
89
+ cookies=self._cookies,
90
+ headers=self._headers,
91
+ timeout=self._timeout,
92
+ verify=self._verify_ssl,
93
+ follow_redirects=self._follow_redirects,
94
+ **self._httpx_args,
95
+ )
96
+ return self._client
97
+
98
+ def __enter__(self) -> Self:
99
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
100
+ self.get_httpx_client().__enter__()
101
+ return self
102
+
103
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
104
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
105
+ self.get_httpx_client().__exit__(*args, **kwargs)
106
+
107
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self:
108
+ """Manually set the underlying httpx.AsyncClient
109
+
110
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
111
+ """
112
+ self._async_client = async_client
113
+ return self
114
+
115
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
116
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
117
+ if self._async_client is None:
118
+ self._async_client = httpx.AsyncClient(
119
+ base_url=self._base_url,
120
+ cookies=self._cookies,
121
+ headers=self._headers,
122
+ timeout=self._timeout,
123
+ verify=self._verify_ssl,
124
+ follow_redirects=self._follow_redirects,
125
+ **self._httpx_args,
126
+ )
127
+ return self._async_client
128
+
129
+ async def __aenter__(self) -> Self:
130
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
131
+ await self.get_async_httpx_client().__aenter__()
132
+ return self
133
+
134
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
135
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
136
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
137
+
138
+
139
+ @define
140
+ class AuthenticatedClient:
141
+ """A Client which has been authenticated for use on secured endpoints
142
+
143
+ The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
144
+
145
+ ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
146
+
147
+ ``cookies``: A dictionary of cookies to be sent with every request
148
+
149
+ ``headers``: A dictionary of headers to be sent with every request
150
+
151
+ ``timeout``: The maximum amount of a time a request can take. API functions will raise
152
+ httpx.TimeoutException if this is exceeded.
153
+
154
+ ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
155
+ but can be set to False for testing purposes.
156
+
157
+ ``follow_redirects``: Whether or not to follow redirects. Default value is False.
158
+
159
+ ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
160
+
161
+
162
+ Attributes:
163
+ raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
164
+ status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
165
+ argument to the constructor.
166
+ token: The token to use for authentication
167
+ prefix: The prefix to use for the Authorization header
168
+ auth_header_name: The name of the Authorization header
169
+ """
170
+
171
+ raise_on_unexpected_status: bool = field(default=False, kw_only=True)
172
+ _base_url: str = field(alias="base_url")
173
+ _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
174
+ _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
175
+ _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout")
176
+ _verify_ssl: str | bool | ssl.SSLContext = field(
177
+ default=True, kw_only=True, alias="verify_ssl"
178
+ )
179
+ _follow_redirects: bool = field(
180
+ default=False, kw_only=True, alias="follow_redirects"
181
+ )
182
+ _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
183
+ _client: httpx.Client | None = field(default=None, init=False)
184
+ _async_client: httpx.AsyncClient | None = field(default=None, init=False)
185
+
186
+ token: str
187
+ prefix: str = "Bearer"
188
+ auth_header_name: str = "Authorization"
189
+
190
+ def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
191
+ """Get a new client matching this one with additional headers"""
192
+ if self._client is not None:
193
+ self._client.headers.update(headers)
194
+ if self._async_client is not None:
195
+ self._async_client.headers.update(headers)
196
+ return evolve(self, headers={**self._headers, **headers})
197
+
198
+ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
199
+ """Get a new client matching this one with additional cookies"""
200
+ if self._client is not None:
201
+ self._client.cookies.update(cookies)
202
+ if self._async_client is not None:
203
+ self._async_client.cookies.update(cookies)
204
+ return evolve(self, cookies={**self._cookies, **cookies})
205
+
206
+ def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
207
+ """Get a new client matching this one with a new timeout configuration"""
208
+ if self._client is not None:
209
+ self._client.timeout = timeout
210
+ if self._async_client is not None:
211
+ self._async_client.timeout = timeout
212
+ return evolve(self, timeout=timeout)
213
+
214
+ def set_httpx_client(self, client: httpx.Client) -> Self:
215
+ """Manually set the underlying httpx.Client
216
+
217
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
218
+ """
219
+ self._client = client
220
+ return self
221
+
222
+ def get_httpx_client(self) -> httpx.Client:
223
+ """Get the underlying httpx.Client, constructing a new one if not previously set"""
224
+ if self._client is None:
225
+ self._headers[self.auth_header_name] = (
226
+ f"{self.prefix} {self.token}" if self.prefix else self.token
227
+ )
228
+ self._client = httpx.Client(
229
+ base_url=self._base_url,
230
+ cookies=self._cookies,
231
+ headers=self._headers,
232
+ timeout=self._timeout,
233
+ verify=self._verify_ssl,
234
+ follow_redirects=self._follow_redirects,
235
+ **self._httpx_args,
236
+ )
237
+ return self._client
238
+
239
+ def __enter__(self) -> Self:
240
+ """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
241
+ self.get_httpx_client().__enter__()
242
+ return self
243
+
244
+ def __exit__(self, *args: Any, **kwargs: Any) -> None:
245
+ """Exit a context manager for internal httpx.Client (see httpx docs)"""
246
+ self.get_httpx_client().__exit__(*args, **kwargs)
247
+
248
+ def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> Self:
249
+ """Manually set the underlying httpx.AsyncClient
250
+
251
+ **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
252
+ """
253
+ self._async_client = async_client
254
+ return self
255
+
256
+ def get_async_httpx_client(self) -> httpx.AsyncClient:
257
+ """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
258
+ if self._async_client is None:
259
+ self._headers[self.auth_header_name] = (
260
+ f"{self.prefix} {self.token}" if self.prefix else self.token
261
+ )
262
+ self._async_client = httpx.AsyncClient(
263
+ base_url=self._base_url,
264
+ cookies=self._cookies,
265
+ headers=self._headers,
266
+ timeout=self._timeout,
267
+ verify=self._verify_ssl,
268
+ follow_redirects=self._follow_redirects,
269
+ **self._httpx_args,
270
+ )
271
+ return self._async_client
272
+
273
+ async def __aenter__(self) -> Self:
274
+ """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
275
+ await self.get_async_httpx_client().__aenter__()
276
+ return self
277
+
278
+ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
279
+ """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
280
+ await self.get_async_httpx_client().__aexit__(*args, **kwargs)
@@ -0,0 +1,16 @@
1
+ """Contains shared errors types that can be raised from API functions"""
2
+
3
+
4
+ class UnexpectedStatus(Exception):
5
+ """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6
+
7
+ def __init__(self, status_code: int, content: bytes):
8
+ self.status_code = status_code
9
+ self.content = content
10
+
11
+ super().__init__(
12
+ f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13
+ )
14
+
15
+
16
+ __all__ = ["UnexpectedStatus"]
@@ -0,0 +1,71 @@
1
+ """Contains all the data models used in inputs/outputs"""
2
+
3
+ from .bulk_operation_accepted import BulkOperationAccepted
4
+ from .bulk_operation_accepted_status import BulkOperationAcceptedStatus
5
+ from .bulk_operation_status import BulkOperationStatus
6
+ from .bulk_operation_status_code import BulkOperationStatusCode
7
+ from .bundle import Bundle
8
+ from .bundle_entry import BundleEntry
9
+ from .bundle_entry_request import BundleEntryRequest
10
+ from .bundle_entry_response import BundleEntryResponse
11
+ from .bundle_entry_search import BundleEntrySearch
12
+ from .bundle_entry_search_mode import BundleEntrySearchMode
13
+ from .bundle_link import BundleLink
14
+ from .bundle_resource_type import BundleResourceType
15
+ from .bundle_type import BundleType
16
+ from .fhir_resource import FhirResource
17
+ from .health_response import HealthResponse
18
+ from .health_response_status import HealthResponseStatus
19
+ from .issue_severity import IssueSeverity
20
+ from .issue_token_body import IssueTokenBody
21
+ from .issue_token_body_grant_type import IssueTokenBodyGrantType
22
+ from .json_patch_item import JsonPatchItem
23
+ from .json_patch_op import JsonPatchOp
24
+ from .o_auth_error import OAuthError
25
+ from .operation_outcome import OperationOutcome
26
+ from .operation_outcome_issue import OperationOutcomeIssue
27
+ from .operation_outcome_resource_type import OperationOutcomeResourceType
28
+ from .post_docref_body import PostDocrefBody
29
+ from .resource_type import ResourceType
30
+ from .search_resources_post_body import SearchResourcesPostBody
31
+ from .search_summary_mode import SearchSummaryMode
32
+ from .search_total_mode import SearchTotalMode
33
+ from .smart_configuration import SmartConfiguration
34
+ from .token_response import TokenResponse
35
+ from .token_response_token_type import TokenResponseTokenType
36
+
37
+ __all__ = (
38
+ "BulkOperationAccepted",
39
+ "BulkOperationAcceptedStatus",
40
+ "BulkOperationStatus",
41
+ "BulkOperationStatusCode",
42
+ "Bundle",
43
+ "BundleEntry",
44
+ "BundleEntryRequest",
45
+ "BundleEntryResponse",
46
+ "BundleEntrySearch",
47
+ "BundleEntrySearchMode",
48
+ "BundleLink",
49
+ "BundleResourceType",
50
+ "BundleType",
51
+ "FhirResource",
52
+ "HealthResponse",
53
+ "HealthResponseStatus",
54
+ "IssueSeverity",
55
+ "IssueTokenBody",
56
+ "IssueTokenBodyGrantType",
57
+ "JsonPatchItem",
58
+ "JsonPatchOp",
59
+ "OAuthError",
60
+ "OperationOutcome",
61
+ "OperationOutcomeIssue",
62
+ "OperationOutcomeResourceType",
63
+ "PostDocrefBody",
64
+ "ResourceType",
65
+ "SearchResourcesPostBody",
66
+ "SearchSummaryMode",
67
+ "SearchTotalMode",
68
+ "SmartConfiguration",
69
+ "TokenResponse",
70
+ "TokenResponseTokenType",
71
+ )
@@ -0,0 +1,79 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from ..models.bulk_operation_accepted_status import BulkOperationAcceptedStatus
10
+
11
+ T = TypeVar("T", bound="BulkOperationAccepted")
12
+
13
+
14
+ @_attrs_define
15
+ class BulkOperationAccepted:
16
+ """
17
+ Attributes:
18
+ id (str):
19
+ status (BulkOperationAcceptedStatus):
20
+ total (int):
21
+ """
22
+
23
+ id: str
24
+ status: BulkOperationAcceptedStatus
25
+ total: int
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ id = self.id
30
+
31
+ status = self.status.value
32
+
33
+ total = self.total
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "id": id,
40
+ "status": status,
41
+ "total": total,
42
+ }
43
+ )
44
+
45
+ return field_dict
46
+
47
+ @classmethod
48
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
49
+ d = dict(src_dict)
50
+ id = d.pop("id")
51
+
52
+ status = BulkOperationAcceptedStatus(d.pop("status"))
53
+
54
+ total = d.pop("total")
55
+
56
+ bulk_operation_accepted = cls(
57
+ id=id,
58
+ status=status,
59
+ total=total,
60
+ )
61
+
62
+ bulk_operation_accepted.additional_properties = d
63
+ return bulk_operation_accepted
64
+
65
+ @property
66
+ def additional_keys(self) -> list[str]:
67
+ return list(self.additional_properties.keys())
68
+
69
+ def __getitem__(self, key: str) -> Any:
70
+ return self.additional_properties[key]
71
+
72
+ def __setitem__(self, key: str, value: Any) -> None:
73
+ self.additional_properties[key] = value
74
+
75
+ def __delitem__(self, key: str) -> None:
76
+ del self.additional_properties[key]
77
+
78
+ def __contains__(self, key: str) -> bool:
79
+ return key in self.additional_properties
@@ -0,0 +1,8 @@
1
+ from enum import StrEnum
2
+
3
+
4
+ class BulkOperationAcceptedStatus(StrEnum):
5
+ PENDING = "pending"
6
+
7
+ def __str__(self) -> str:
8
+ return str(self.value)