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,281 @@
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.fhir_resource import FhirResource
10
+ from ...models.operation_outcome import OperationOutcome
11
+ from ...models.resource_type import ResourceType
12
+ from ...types import UNSET, Response, Unset
13
+
14
+
15
+ def _get_kwargs(
16
+ tenant_id: str,
17
+ store_id: str,
18
+ resource_type: ResourceType,
19
+ id: str,
20
+ *,
21
+ body: FhirResource,
22
+ if_match: str | Unset = UNSET,
23
+ ) -> dict[str, Any]:
24
+ headers: dict[str, Any] = {}
25
+ if not isinstance(if_match, Unset):
26
+ headers["If-Match"] = if_match
27
+
28
+ _kwargs: dict[str, Any] = {
29
+ "method": "put",
30
+ "url": "/v1/tenants/{tenant_id}/stores/{store_id}/{resource_type}/{id}".format(
31
+ tenant_id=quote(str(tenant_id), safe=""),
32
+ store_id=quote(str(store_id), safe=""),
33
+ resource_type=quote(str(resource_type), safe=""),
34
+ id=quote(str(id), safe=""),
35
+ ),
36
+ }
37
+
38
+ _kwargs["json"] = body.to_dict()
39
+
40
+ headers["Content-Type"] = "application/fhir+json"
41
+
42
+ _kwargs["headers"] = headers
43
+ return _kwargs
44
+
45
+
46
+ def _parse_response(
47
+ *, client: AuthenticatedClient | Client, response: httpx.Response
48
+ ) -> FhirResource | OperationOutcome | None:
49
+ if response.status_code == 200:
50
+ response_200 = FhirResource.from_dict(response.json())
51
+
52
+ return response_200
53
+
54
+ if response.status_code == 201:
55
+ response_201 = FhirResource.from_dict(response.json())
56
+
57
+ return response_201
58
+
59
+ if response.status_code == 400:
60
+ response_400 = OperationOutcome.from_dict(response.json())
61
+
62
+ return response_400
63
+
64
+ if response.status_code == 403:
65
+ response_403 = OperationOutcome.from_dict(response.json())
66
+
67
+ return response_403
68
+
69
+ if response.status_code == 404:
70
+ response_404 = OperationOutcome.from_dict(response.json())
71
+
72
+ return response_404
73
+
74
+ if response.status_code == 410:
75
+ response_410 = OperationOutcome.from_dict(response.json())
76
+
77
+ return response_410
78
+
79
+ if response.status_code == 412:
80
+ response_412 = OperationOutcome.from_dict(response.json())
81
+
82
+ return response_412
83
+
84
+ if response.status_code == 422:
85
+ response_422 = OperationOutcome.from_dict(response.json())
86
+
87
+ return response_422
88
+
89
+ if client.raise_on_unexpected_status:
90
+ raise errors.UnexpectedStatus(response.status_code, response.content)
91
+ else:
92
+ return None
93
+
94
+
95
+ def _build_response(
96
+ *, client: AuthenticatedClient | Client, response: httpx.Response
97
+ ) -> Response[FhirResource | OperationOutcome]:
98
+ return Response(
99
+ status_code=HTTPStatus(response.status_code),
100
+ content=response.content,
101
+ headers=response.headers,
102
+ parsed=_parse_response(client=client, response=response),
103
+ )
104
+
105
+
106
+ def sync_detailed(
107
+ tenant_id: str,
108
+ store_id: str,
109
+ resource_type: ResourceType,
110
+ id: str,
111
+ *,
112
+ client: AuthenticatedClient | Client,
113
+ body: FhirResource,
114
+ if_match: str | Unset = UNSET,
115
+ ) -> Response[FhirResource | OperationOutcome]:
116
+ """Update or upsert a FHIR resource
117
+
118
+ Updates an existing resource or creates it if it doesn't exist (upsert).
119
+ Supports conditional update via the If-Match header for optimistic locking.
120
+
121
+ Args:
122
+ tenant_id (str):
123
+ store_id (str):
124
+ resource_type (ResourceType): FHIR resource type
125
+ id (str):
126
+ if_match (str | Unset):
127
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
128
+
129
+ Raises:
130
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
131
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
132
+
133
+ Returns:
134
+ Response[FhirResource | OperationOutcome]
135
+ """
136
+
137
+ kwargs = _get_kwargs(
138
+ tenant_id=tenant_id,
139
+ store_id=store_id,
140
+ resource_type=resource_type,
141
+ id=id,
142
+ body=body,
143
+ if_match=if_match,
144
+ )
145
+
146
+ response = client.get_httpx_client().request(
147
+ **kwargs,
148
+ )
149
+
150
+ return _build_response(client=client, response=response)
151
+
152
+
153
+ def sync(
154
+ tenant_id: str,
155
+ store_id: str,
156
+ resource_type: ResourceType,
157
+ id: str,
158
+ *,
159
+ client: AuthenticatedClient | Client,
160
+ body: FhirResource,
161
+ if_match: str | Unset = UNSET,
162
+ ) -> FhirResource | OperationOutcome | None:
163
+ """Update or upsert a FHIR resource
164
+
165
+ Updates an existing resource or creates it if it doesn't exist (upsert).
166
+ Supports conditional update via the If-Match header for optimistic locking.
167
+
168
+ Args:
169
+ tenant_id (str):
170
+ store_id (str):
171
+ resource_type (ResourceType): FHIR resource type
172
+ id (str):
173
+ if_match (str | Unset):
174
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
175
+
176
+ Raises:
177
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
178
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
179
+
180
+ Returns:
181
+ FhirResource | OperationOutcome
182
+ """
183
+
184
+ return sync_detailed(
185
+ tenant_id=tenant_id,
186
+ store_id=store_id,
187
+ resource_type=resource_type,
188
+ id=id,
189
+ client=client,
190
+ body=body,
191
+ if_match=if_match,
192
+ ).parsed
193
+
194
+
195
+ async def asyncio_detailed(
196
+ tenant_id: str,
197
+ store_id: str,
198
+ resource_type: ResourceType,
199
+ id: str,
200
+ *,
201
+ client: AuthenticatedClient | Client,
202
+ body: FhirResource,
203
+ if_match: str | Unset = UNSET,
204
+ ) -> Response[FhirResource | OperationOutcome]:
205
+ """Update or upsert a FHIR resource
206
+
207
+ Updates an existing resource or creates it if it doesn't exist (upsert).
208
+ Supports conditional update via the If-Match header for optimistic locking.
209
+
210
+ Args:
211
+ tenant_id (str):
212
+ store_id (str):
213
+ resource_type (ResourceType): FHIR resource type
214
+ id (str):
215
+ if_match (str | Unset):
216
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
217
+
218
+ Raises:
219
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
220
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
221
+
222
+ Returns:
223
+ Response[FhirResource | OperationOutcome]
224
+ """
225
+
226
+ kwargs = _get_kwargs(
227
+ tenant_id=tenant_id,
228
+ store_id=store_id,
229
+ resource_type=resource_type,
230
+ id=id,
231
+ body=body,
232
+ if_match=if_match,
233
+ )
234
+
235
+ response = await client.get_async_httpx_client().request(**kwargs)
236
+
237
+ return _build_response(client=client, response=response)
238
+
239
+
240
+ async def asyncio(
241
+ tenant_id: str,
242
+ store_id: str,
243
+ resource_type: ResourceType,
244
+ id: str,
245
+ *,
246
+ client: AuthenticatedClient | Client,
247
+ body: FhirResource,
248
+ if_match: str | Unset = UNSET,
249
+ ) -> FhirResource | OperationOutcome | None:
250
+ """Update or upsert a FHIR resource
251
+
252
+ Updates an existing resource or creates it if it doesn't exist (upsert).
253
+ Supports conditional update via the If-Match header for optimistic locking.
254
+
255
+ Args:
256
+ tenant_id (str):
257
+ store_id (str):
258
+ resource_type (ResourceType): FHIR resource type
259
+ id (str):
260
+ if_match (str | Unset):
261
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
262
+
263
+ Raises:
264
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
265
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
266
+
267
+ Returns:
268
+ FhirResource | OperationOutcome
269
+ """
270
+
271
+ return (
272
+ await asyncio_detailed(
273
+ tenant_id=tenant_id,
274
+ store_id=store_id,
275
+ resource_type=resource_type,
276
+ id=id,
277
+ client=client,
278
+ body=body,
279
+ if_match=if_match,
280
+ )
281
+ ).parsed
@@ -0,0 +1,217 @@
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.fhir_resource import FhirResource
10
+ from ...models.operation_outcome import OperationOutcome
11
+ from ...models.resource_type import ResourceType
12
+ from ...types import Response
13
+
14
+
15
+ def _get_kwargs(
16
+ tenant_id: str,
17
+ store_id: str,
18
+ resource_type: ResourceType,
19
+ *,
20
+ body: FhirResource,
21
+ ) -> dict[str, Any]:
22
+ headers: dict[str, Any] = {}
23
+
24
+ _kwargs: dict[str, Any] = {
25
+ "method": "post",
26
+ "url": "/v1/tenants/{tenant_id}/stores/{store_id}/{resource_type}/$validate".format(
27
+ tenant_id=quote(str(tenant_id), safe=""),
28
+ store_id=quote(str(store_id), safe=""),
29
+ resource_type=quote(str(resource_type), safe=""),
30
+ ),
31
+ }
32
+
33
+ _kwargs["json"] = body.to_dict()
34
+
35
+ headers["Content-Type"] = "application/fhir+json"
36
+
37
+ _kwargs["headers"] = headers
38
+ return _kwargs
39
+
40
+
41
+ def _parse_response(
42
+ *, client: AuthenticatedClient | Client, response: httpx.Response
43
+ ) -> OperationOutcome | None:
44
+ if response.status_code == 200:
45
+ response_200 = OperationOutcome.from_dict(response.json())
46
+
47
+ return response_200
48
+
49
+ if client.raise_on_unexpected_status:
50
+ raise errors.UnexpectedStatus(response.status_code, response.content)
51
+ else:
52
+ return None
53
+
54
+
55
+ def _build_response(
56
+ *, client: AuthenticatedClient | Client, response: httpx.Response
57
+ ) -> Response[OperationOutcome]:
58
+ return Response(
59
+ status_code=HTTPStatus(response.status_code),
60
+ content=response.content,
61
+ headers=response.headers,
62
+ parsed=_parse_response(client=client, response=response),
63
+ )
64
+
65
+
66
+ def sync_detailed(
67
+ tenant_id: str,
68
+ store_id: str,
69
+ resource_type: ResourceType,
70
+ *,
71
+ client: AuthenticatedClient | Client,
72
+ body: FhirResource,
73
+ ) -> Response[OperationOutcome]:
74
+ """Validate a FHIR resource
75
+
76
+ Returns an OperationOutcome with validation results. Always returns
77
+ HTTP 200 regardless of whether the resource is valid.
78
+
79
+ Args:
80
+ tenant_id (str):
81
+ store_id (str):
82
+ resource_type (ResourceType): FHIR resource type
83
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
84
+
85
+ Raises:
86
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
87
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
88
+
89
+ Returns:
90
+ Response[OperationOutcome]
91
+ """
92
+
93
+ kwargs = _get_kwargs(
94
+ tenant_id=tenant_id,
95
+ store_id=store_id,
96
+ resource_type=resource_type,
97
+ body=body,
98
+ )
99
+
100
+ response = client.get_httpx_client().request(
101
+ **kwargs,
102
+ )
103
+
104
+ return _build_response(client=client, response=response)
105
+
106
+
107
+ def sync(
108
+ tenant_id: str,
109
+ store_id: str,
110
+ resource_type: ResourceType,
111
+ *,
112
+ client: AuthenticatedClient | Client,
113
+ body: FhirResource,
114
+ ) -> OperationOutcome | None:
115
+ """Validate a FHIR resource
116
+
117
+ Returns an OperationOutcome with validation results. Always returns
118
+ HTTP 200 regardless of whether the resource is valid.
119
+
120
+ Args:
121
+ tenant_id (str):
122
+ store_id (str):
123
+ resource_type (ResourceType): FHIR resource type
124
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
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
+ OperationOutcome
132
+ """
133
+
134
+ return sync_detailed(
135
+ tenant_id=tenant_id,
136
+ store_id=store_id,
137
+ resource_type=resource_type,
138
+ client=client,
139
+ body=body,
140
+ ).parsed
141
+
142
+
143
+ async def asyncio_detailed(
144
+ tenant_id: str,
145
+ store_id: str,
146
+ resource_type: ResourceType,
147
+ *,
148
+ client: AuthenticatedClient | Client,
149
+ body: FhirResource,
150
+ ) -> Response[OperationOutcome]:
151
+ """Validate a FHIR resource
152
+
153
+ Returns an OperationOutcome with validation results. Always returns
154
+ HTTP 200 regardless of whether the resource is valid.
155
+
156
+ Args:
157
+ tenant_id (str):
158
+ store_id (str):
159
+ resource_type (ResourceType): FHIR resource type
160
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
161
+
162
+ Raises:
163
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
164
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
165
+
166
+ Returns:
167
+ Response[OperationOutcome]
168
+ """
169
+
170
+ kwargs = _get_kwargs(
171
+ tenant_id=tenant_id,
172
+ store_id=store_id,
173
+ resource_type=resource_type,
174
+ body=body,
175
+ )
176
+
177
+ response = await client.get_async_httpx_client().request(**kwargs)
178
+
179
+ return _build_response(client=client, response=response)
180
+
181
+
182
+ async def asyncio(
183
+ tenant_id: str,
184
+ store_id: str,
185
+ resource_type: ResourceType,
186
+ *,
187
+ client: AuthenticatedClient | Client,
188
+ body: FhirResource,
189
+ ) -> OperationOutcome | None:
190
+ """Validate a FHIR resource
191
+
192
+ Returns an OperationOutcome with validation results. Always returns
193
+ HTTP 200 regardless of whether the resource is valid.
194
+
195
+ Args:
196
+ tenant_id (str):
197
+ store_id (str):
198
+ resource_type (ResourceType): FHIR resource type
199
+ body (FhirResource): An arbitrary FHIR resource stored as raw JSON.
200
+
201
+ Raises:
202
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
203
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
204
+
205
+ Returns:
206
+ OperationOutcome
207
+ """
208
+
209
+ return (
210
+ await asyncio_detailed(
211
+ tenant_id=tenant_id,
212
+ store_id=store_id,
213
+ resource_type=resource_type,
214
+ client=client,
215
+ body=body,
216
+ )
217
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,186 @@
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.issue_token_body import IssueTokenBody
9
+ from ...models.o_auth_error import OAuthError
10
+ from ...models.token_response import TokenResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ *,
16
+ body: IssueTokenBody,
17
+ ) -> dict[str, Any]:
18
+ headers: dict[str, Any] = {}
19
+
20
+ _kwargs: dict[str, Any] = {
21
+ "method": "post",
22
+ "url": "/oauth/token",
23
+ }
24
+
25
+ _kwargs["data"] = body.to_dict()
26
+ headers["Content-Type"] = "application/x-www-form-urlencoded"
27
+
28
+ _kwargs["headers"] = headers
29
+ return _kwargs
30
+
31
+
32
+ def _parse_response(
33
+ *, client: AuthenticatedClient | Client, response: httpx.Response
34
+ ) -> OAuthError | TokenResponse | None:
35
+ if response.status_code == 200:
36
+ response_200 = TokenResponse.from_dict(response.json())
37
+
38
+ return response_200
39
+
40
+ if response.status_code == 400:
41
+ response_400 = OAuthError.from_dict(response.json())
42
+
43
+ return response_400
44
+
45
+ if response.status_code == 401:
46
+ response_401 = OAuthError.from_dict(response.json())
47
+
48
+ return response_401
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[OAuthError | TokenResponse]:
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 | Client,
70
+ body: IssueTokenBody,
71
+ ) -> Response[OAuthError | TokenResponse]:
72
+ """Issue an OAuth2 access token via client credentials
73
+
74
+ Exchanges OAuth2 client credentials for an access token.
75
+ Supports both `client_secret_post` (send `client_id` and `client_secret`
76
+ in the form body) and `client_secret_basic` (send them via HTTP Basic auth).
77
+
78
+ Args:
79
+ body (IssueTokenBody):
80
+
81
+ Raises:
82
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
83
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
84
+
85
+ Returns:
86
+ Response[OAuthError | TokenResponse]
87
+ """
88
+
89
+ kwargs = _get_kwargs(
90
+ body=body,
91
+ )
92
+
93
+ response = client.get_httpx_client().request(
94
+ **kwargs,
95
+ )
96
+
97
+ return _build_response(client=client, response=response)
98
+
99
+
100
+ def sync(
101
+ *,
102
+ client: AuthenticatedClient | Client,
103
+ body: IssueTokenBody,
104
+ ) -> OAuthError | TokenResponse | None:
105
+ """Issue an OAuth2 access token via client credentials
106
+
107
+ Exchanges OAuth2 client credentials for an access token.
108
+ Supports both `client_secret_post` (send `client_id` and `client_secret`
109
+ in the form body) and `client_secret_basic` (send them via HTTP Basic auth).
110
+
111
+ Args:
112
+ body (IssueTokenBody):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ OAuthError | TokenResponse
120
+ """
121
+
122
+ return sync_detailed(
123
+ client=client,
124
+ body=body,
125
+ ).parsed
126
+
127
+
128
+ async def asyncio_detailed(
129
+ *,
130
+ client: AuthenticatedClient | Client,
131
+ body: IssueTokenBody,
132
+ ) -> Response[OAuthError | TokenResponse]:
133
+ """Issue an OAuth2 access token via client credentials
134
+
135
+ Exchanges OAuth2 client credentials for an access token.
136
+ Supports both `client_secret_post` (send `client_id` and `client_secret`
137
+ in the form body) and `client_secret_basic` (send them via HTTP Basic auth).
138
+
139
+ Args:
140
+ body (IssueTokenBody):
141
+
142
+ Raises:
143
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
145
+
146
+ Returns:
147
+ Response[OAuthError | TokenResponse]
148
+ """
149
+
150
+ kwargs = _get_kwargs(
151
+ body=body,
152
+ )
153
+
154
+ response = await client.get_async_httpx_client().request(**kwargs)
155
+
156
+ return _build_response(client=client, response=response)
157
+
158
+
159
+ async def asyncio(
160
+ *,
161
+ client: AuthenticatedClient | Client,
162
+ body: IssueTokenBody,
163
+ ) -> OAuthError | TokenResponse | None:
164
+ """Issue an OAuth2 access token via client credentials
165
+
166
+ Exchanges OAuth2 client credentials for an access token.
167
+ Supports both `client_secret_post` (send `client_id` and `client_secret`
168
+ in the form body) and `client_secret_basic` (send them via HTTP Basic auth).
169
+
170
+ Args:
171
+ body (IssueTokenBody):
172
+
173
+ Raises:
174
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
175
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
176
+
177
+ Returns:
178
+ OAuthError | TokenResponse
179
+ """
180
+
181
+ return (
182
+ await asyncio_detailed(
183
+ client=client,
184
+ body=body,
185
+ )
186
+ ).parsed
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""