jsonhub-sdk 0.9.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 (133) hide show
  1. jsonhub_sdk/__init__.py +8 -0
  2. jsonhub_sdk/api/__init__.py +1 -0
  3. jsonhub_sdk/api/definition/__init__.py +1 -0
  4. jsonhub_sdk/api/definition/api_definitions_get_collection.py +246 -0
  5. jsonhub_sdk/api/definition/api_definitions_id_delete.py +168 -0
  6. jsonhub_sdk/api/definition/api_definitions_id_get.py +165 -0
  7. jsonhub_sdk/api/definition/api_definitions_id_patch.py +203 -0
  8. jsonhub_sdk/api/definition/api_definitions_post.py +185 -0
  9. jsonhub_sdk/api/entity/__init__.py +1 -0
  10. jsonhub_sdk/api/entity/api_entities_get_collection.py +276 -0
  11. jsonhub_sdk/api/entity/api_entities_id_delete.py +168 -0
  12. jsonhub_sdk/api/entity/api_entities_id_get.py +165 -0
  13. jsonhub_sdk/api/entity/api_entities_id_patch.py +203 -0
  14. jsonhub_sdk/api/entity/api_entities_post.py +185 -0
  15. jsonhub_sdk/api/oauth2/__init__.py +1 -0
  16. jsonhub_sdk/api/oauth2/oauth2_authorize.py +187 -0
  17. jsonhub_sdk/api/oauth2/oauth2_jwks.py +135 -0
  18. jsonhub_sdk/api/oauth2/oauth2_metadata.py +139 -0
  19. jsonhub_sdk/api/oauth2/oauth2_register.py +178 -0
  20. jsonhub_sdk/api/oauth2/oauth2_revoke.py +172 -0
  21. jsonhub_sdk/api/oauth2/oauth2_token.py +184 -0
  22. jsonhub_sdk/api/oauth2/oauth2_token_exchange.py +232 -0
  23. jsonhub_sdk/api/personal_access_token/__init__.py +1 -0
  24. jsonhub_sdk/api/personal_access_token/api_meapi_tokens_get_collection.py +188 -0
  25. jsonhub_sdk/api/personal_access_token/api_meapi_tokens_id_delete.py +168 -0
  26. jsonhub_sdk/api/personal_access_token/api_meapi_tokens_id_patch.py +207 -0
  27. jsonhub_sdk/api/personal_access_token/api_meapi_tokens_post.py +201 -0
  28. jsonhub_sdk/api/user/__init__.py +1 -0
  29. jsonhub_sdk/api/user/api_users_id_delete.py +168 -0
  30. jsonhub_sdk/api/user/api_users_id_patch.py +203 -0
  31. jsonhub_sdk/api/user/api_users_post.py +180 -0
  32. jsonhub_sdk/api/user/api_usersme_get.py +150 -0
  33. jsonhub_sdk/api/user/api_usersresend_activation_post.py +180 -0
  34. jsonhub_sdk/api/user/api_usersreset_password_post.py +180 -0
  35. jsonhub_sdk/api/user/api_userssend_reset_password_post.py +180 -0
  36. jsonhub_sdk/client.py +268 -0
  37. jsonhub_sdk/errors.py +16 -0
  38. jsonhub_sdk/models/__init__.py +199 -0
  39. jsonhub_sdk/models/api_definitions_get_collection_response_200.py +137 -0
  40. jsonhub_sdk/models/api_entities_get_collection_response_200.py +137 -0
  41. jsonhub_sdk/models/api_meapi_tokens_get_collection_response_200.py +137 -0
  42. jsonhub_sdk/models/api_usersme_get_response_200.py +65 -0
  43. jsonhub_sdk/models/constraint_violation.py +143 -0
  44. jsonhub_sdk/models/constraint_violation_violations_item.py +109 -0
  45. jsonhub_sdk/models/constraint_violation_violations_item_payload.py +44 -0
  46. jsonhub_sdk/models/current_user_limit_usage.py +67 -0
  47. jsonhub_sdk/models/current_user_limits.py +81 -0
  48. jsonhub_sdk/models/definition_definition_read.py +161 -0
  49. jsonhub_sdk/models/definition_definition_read_json_schema.py +44 -0
  50. jsonhub_sdk/models/definition_definition_write.py +107 -0
  51. jsonhub_sdk/models/definition_definition_write_json_merge_patch.py +117 -0
  52. jsonhub_sdk/models/definition_definition_write_json_merge_patch_json_schema.py +44 -0
  53. jsonhub_sdk/models/definition_definition_write_json_schema.py +44 -0
  54. jsonhub_sdk/models/definition_entity_read_entity_read_parent.py +102 -0
  55. jsonhub_sdk/models/definition_jsonhal_definition_read.py +179 -0
  56. jsonhub_sdk/models/definition_jsonhal_definition_read_links.py +72 -0
  57. jsonhub_sdk/models/definition_jsonhal_definition_read_links_self.py +59 -0
  58. jsonhub_sdk/models/entity_definition_read.py +102 -0
  59. jsonhub_sdk/models/entity_entity_create.py +142 -0
  60. jsonhub_sdk/models/entity_entity_create_data.py +44 -0
  61. jsonhub_sdk/models/entity_entity_read_entity_read_parent.py +196 -0
  62. jsonhub_sdk/models/entity_entity_read_entity_read_parent_data.py +44 -0
  63. jsonhub_sdk/models/entity_entity_update_json_merge_patch.py +122 -0
  64. jsonhub_sdk/models/entity_entity_update_json_merge_patch_data.py +44 -0
  65. jsonhub_sdk/models/entity_jsonhal_entity_read_entity_read_parent.py +218 -0
  66. jsonhub_sdk/models/entity_jsonhal_entity_read_entity_read_parent_links.py +76 -0
  67. jsonhub_sdk/models/entity_jsonhal_entity_read_entity_read_parent_links_self.py +59 -0
  68. jsonhub_sdk/models/error.py +142 -0
  69. jsonhub_sdk/models/hal_collection_base_schema.py +136 -0
  70. jsonhub_sdk/models/hal_collection_base_schema_links.py +126 -0
  71. jsonhub_sdk/models/hal_collection_base_schema_links_first.py +59 -0
  72. jsonhub_sdk/models/hal_collection_base_schema_links_last.py +59 -0
  73. jsonhub_sdk/models/hal_collection_base_schema_links_next.py +59 -0
  74. jsonhub_sdk/models/hal_collection_base_schema_links_previous.py +59 -0
  75. jsonhub_sdk/models/hal_collection_base_schema_no_pagination.py +127 -0
  76. jsonhub_sdk/models/hal_collection_base_schema_no_pagination_embedded_type_0.py +61 -0
  77. jsonhub_sdk/models/hal_collection_base_schema_no_pagination_embedded_type_1.py +44 -0
  78. jsonhub_sdk/models/hal_collection_base_schema_no_pagination_links.py +76 -0
  79. jsonhub_sdk/models/hal_collection_base_schema_no_pagination_links_self.py +59 -0
  80. jsonhub_sdk/models/oauth_2_authorize_code_challenge_method.py +8 -0
  81. jsonhub_sdk/models/oauth_2_authorize_response_type.py +8 -0
  82. jsonhub_sdk/models/oauth_2_jwks_response_200.py +75 -0
  83. jsonhub_sdk/models/oauth_2_jwks_response_200_keys_item.py +104 -0
  84. jsonhub_sdk/models/oauth_2_metadata_response_200.py +158 -0
  85. jsonhub_sdk/models/oauth_2_register_body.py +118 -0
  86. jsonhub_sdk/models/oauth_2_register_body_token_endpoint_auth_method.py +10 -0
  87. jsonhub_sdk/models/oauth_2_register_response_201.py +119 -0
  88. jsonhub_sdk/models/oauth_2_register_response_400.py +70 -0
  89. jsonhub_sdk/models/oauth_2_revoke_body.py +87 -0
  90. jsonhub_sdk/models/oauth_2_revoke_response_200.py +44 -0
  91. jsonhub_sdk/models/oauth_2_token_body.py +93 -0
  92. jsonhub_sdk/models/oauth_2_token_body_grant_type.py +8 -0
  93. jsonhub_sdk/models/oauth_2_token_exchange_body.py +112 -0
  94. jsonhub_sdk/models/oauth_2_token_exchange_body_audience.py +8 -0
  95. jsonhub_sdk/models/oauth_2_token_exchange_response_200.py +95 -0
  96. jsonhub_sdk/models/oauth_2_token_exchange_response_400.py +70 -0
  97. jsonhub_sdk/models/oauth_2_token_exchange_response_401.py +70 -0
  98. jsonhub_sdk/models/oauth_2_token_exchange_response_403.py +70 -0
  99. jsonhub_sdk/models/oauth_2_token_response_200.py +86 -0
  100. jsonhub_sdk/models/oauth_2_token_response_400.py +70 -0
  101. jsonhub_sdk/models/oauth_2_token_response_401.py +70 -0
  102. jsonhub_sdk/models/personal_access_token_jsonhal_personal_access_token_read.py +210 -0
  103. jsonhub_sdk/models/personal_access_token_jsonhal_personal_access_token_read_links.py +76 -0
  104. jsonhub_sdk/models/personal_access_token_jsonhal_personal_access_token_read_links_self.py +59 -0
  105. jsonhub_sdk/models/personal_access_token_jsonhal_personal_access_token_read_personal_access_token_create_read.py +234 -0
  106. jsonhub_sdk/models/personal_access_token_jsonhal_personal_access_token_read_personal_access_token_create_read_links.py +80 -0
  107. jsonhub_sdk/models/personal_access_token_jsonhal_personal_access_token_read_personal_access_token_create_read_links_self.py +59 -0
  108. jsonhub_sdk/models/personal_access_token_personal_access_token_read.py +184 -0
  109. jsonhub_sdk/models/personal_access_token_personal_access_token_read_personal_access_token_create_read.py +204 -0
  110. jsonhub_sdk/models/personal_access_token_personal_access_token_write.py +103 -0
  111. jsonhub_sdk/models/personal_access_token_personal_access_token_write_json_merge_patch.py +103 -0
  112. jsonhub_sdk/models/user.py +199 -0
  113. jsonhub_sdk/models/user_jsonhal.py +221 -0
  114. jsonhub_sdk/models/user_jsonhal_links.py +72 -0
  115. jsonhub_sdk/models/user_jsonhal_links_self.py +59 -0
  116. jsonhub_sdk/models/user_jsonhal_user_empty.py +73 -0
  117. jsonhub_sdk/models/user_jsonhal_user_empty_links.py +72 -0
  118. jsonhub_sdk/models/user_jsonhal_user_empty_links_self.py +59 -0
  119. jsonhub_sdk/models/user_jsonhal_user_read.py +122 -0
  120. jsonhub_sdk/models/user_jsonhal_user_read_links.py +72 -0
  121. jsonhub_sdk/models/user_jsonhal_user_read_links_self.py +59 -0
  122. jsonhub_sdk/models/user_user_create.py +103 -0
  123. jsonhub_sdk/models/user_user_empty.py +44 -0
  124. jsonhub_sdk/models/user_user_read.py +100 -0
  125. jsonhub_sdk/models/user_user_resend_activation.py +88 -0
  126. jsonhub_sdk/models/user_user_reset_password.py +80 -0
  127. jsonhub_sdk/models/user_user_send_reset_password.py +80 -0
  128. jsonhub_sdk/models/user_user_update_json_merge_patch.py +92 -0
  129. jsonhub_sdk/py.typed +1 -0
  130. jsonhub_sdk/types.py +54 -0
  131. jsonhub_sdk-0.9.1.dist-info/METADATA +148 -0
  132. jsonhub_sdk-0.9.1.dist-info/RECORD +133 -0
  133. jsonhub_sdk-0.9.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,8 @@
1
+ """A client library for accessing JsonHub API"""
2
+
3
+ from .client import AuthenticatedClient, Client
4
+
5
+ __all__ = (
6
+ "AuthenticatedClient",
7
+ "Client",
8
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
@@ -0,0 +1 @@
1
+ """Contains endpoint functions for accessing the API"""
@@ -0,0 +1,246 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.api_definitions_get_collection_response_200 import ApiDefinitionsGetCollectionResponse200
9
+ from ...types import UNSET, Response, Unset
10
+
11
+
12
+ def _get_kwargs(
13
+ *,
14
+ qid: Union[Unset, str] = UNSET,
15
+ owned: Union[Unset, bool] = UNSET,
16
+ page: Union[Unset, int] = 1,
17
+ limit: Union[Unset, int] = 10,
18
+ properties: Union[Unset, list[str]] = UNSET,
19
+ parent_entity: Union[Unset, str] = UNSET,
20
+ ) -> dict[str, Any]:
21
+ params: dict[str, Any] = {}
22
+
23
+ params["qid"] = qid
24
+
25
+ params["owned"] = owned
26
+
27
+ params["page"] = page
28
+
29
+ params["limit"] = limit
30
+
31
+ json_properties: Union[Unset, list[str]] = UNSET
32
+ if not isinstance(properties, Unset):
33
+ json_properties = properties
34
+
35
+ params["properties[]"] = json_properties
36
+
37
+ params["parentEntity"] = parent_entity
38
+
39
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
40
+
41
+ _kwargs: dict[str, Any] = {
42
+ "method": "get",
43
+ "url": "/api/definitions",
44
+ "params": params,
45
+ }
46
+
47
+ return _kwargs
48
+
49
+
50
+ def _parse_response(
51
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
52
+ ) -> Optional[ApiDefinitionsGetCollectionResponse200]:
53
+ if response.status_code == 200:
54
+ response_200 = ApiDefinitionsGetCollectionResponse200.from_dict(response.json())
55
+
56
+ return response_200
57
+
58
+ if client.raise_on_unexpected_status:
59
+ raise errors.UnexpectedStatus(response.status_code, response.content)
60
+ else:
61
+ return None
62
+
63
+
64
+ def _build_response(
65
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
66
+ ) -> Response[ApiDefinitionsGetCollectionResponse200]:
67
+ return Response(
68
+ status_code=HTTPStatus(response.status_code),
69
+ content=response.content,
70
+ headers=response.headers,
71
+ parsed=_parse_response(client=client, response=response),
72
+ )
73
+
74
+
75
+ def sync_detailed(
76
+ *,
77
+ client: Union[AuthenticatedClient, Client],
78
+ qid: Union[Unset, str] = UNSET,
79
+ owned: Union[Unset, bool] = UNSET,
80
+ page: Union[Unset, int] = 1,
81
+ limit: Union[Unset, int] = 10,
82
+ properties: Union[Unset, list[str]] = UNSET,
83
+ parent_entity: Union[Unset, str] = UNSET,
84
+ ) -> Response[ApiDefinitionsGetCollectionResponse200]:
85
+ """Retrieves the collection of definition resources.
86
+
87
+ Retrieves the collection of definition resources.
88
+
89
+ Args:
90
+ qid (Union[Unset, str]):
91
+ owned (Union[Unset, bool]):
92
+ page (Union[Unset, int]): Default: 1.
93
+ limit (Union[Unset, int]): Default: 10.
94
+ properties (Union[Unset, list[str]]):
95
+ parent_entity (Union[Unset, str]):
96
+
97
+ Raises:
98
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
99
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
100
+
101
+ Returns:
102
+ Response[ApiDefinitionsGetCollectionResponse200]
103
+ """
104
+
105
+ kwargs = _get_kwargs(
106
+ qid=qid,
107
+ owned=owned,
108
+ page=page,
109
+ limit=limit,
110
+ properties=properties,
111
+ parent_entity=parent_entity,
112
+ )
113
+
114
+ response = client.get_httpx_client().request(
115
+ **kwargs,
116
+ )
117
+
118
+ return _build_response(client=client, response=response)
119
+
120
+
121
+ def sync(
122
+ *,
123
+ client: Union[AuthenticatedClient, Client],
124
+ qid: Union[Unset, str] = UNSET,
125
+ owned: Union[Unset, bool] = UNSET,
126
+ page: Union[Unset, int] = 1,
127
+ limit: Union[Unset, int] = 10,
128
+ properties: Union[Unset, list[str]] = UNSET,
129
+ parent_entity: Union[Unset, str] = UNSET,
130
+ ) -> Optional[ApiDefinitionsGetCollectionResponse200]:
131
+ """Retrieves the collection of definition resources.
132
+
133
+ Retrieves the collection of definition resources.
134
+
135
+ Args:
136
+ qid (Union[Unset, str]):
137
+ owned (Union[Unset, bool]):
138
+ page (Union[Unset, int]): Default: 1.
139
+ limit (Union[Unset, int]): Default: 10.
140
+ properties (Union[Unset, list[str]]):
141
+ parent_entity (Union[Unset, str]):
142
+
143
+ Raises:
144
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
145
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
146
+
147
+ Returns:
148
+ ApiDefinitionsGetCollectionResponse200
149
+ """
150
+
151
+ return sync_detailed(
152
+ client=client,
153
+ qid=qid,
154
+ owned=owned,
155
+ page=page,
156
+ limit=limit,
157
+ properties=properties,
158
+ parent_entity=parent_entity,
159
+ ).parsed
160
+
161
+
162
+ async def asyncio_detailed(
163
+ *,
164
+ client: Union[AuthenticatedClient, Client],
165
+ qid: Union[Unset, str] = UNSET,
166
+ owned: Union[Unset, bool] = UNSET,
167
+ page: Union[Unset, int] = 1,
168
+ limit: Union[Unset, int] = 10,
169
+ properties: Union[Unset, list[str]] = UNSET,
170
+ parent_entity: Union[Unset, str] = UNSET,
171
+ ) -> Response[ApiDefinitionsGetCollectionResponse200]:
172
+ """Retrieves the collection of definition resources.
173
+
174
+ Retrieves the collection of definition resources.
175
+
176
+ Args:
177
+ qid (Union[Unset, str]):
178
+ owned (Union[Unset, bool]):
179
+ page (Union[Unset, int]): Default: 1.
180
+ limit (Union[Unset, int]): Default: 10.
181
+ properties (Union[Unset, list[str]]):
182
+ parent_entity (Union[Unset, str]):
183
+
184
+ Raises:
185
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
186
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
187
+
188
+ Returns:
189
+ Response[ApiDefinitionsGetCollectionResponse200]
190
+ """
191
+
192
+ kwargs = _get_kwargs(
193
+ qid=qid,
194
+ owned=owned,
195
+ page=page,
196
+ limit=limit,
197
+ properties=properties,
198
+ parent_entity=parent_entity,
199
+ )
200
+
201
+ response = await client.get_async_httpx_client().request(**kwargs)
202
+
203
+ return _build_response(client=client, response=response)
204
+
205
+
206
+ async def asyncio(
207
+ *,
208
+ client: Union[AuthenticatedClient, Client],
209
+ qid: Union[Unset, str] = UNSET,
210
+ owned: Union[Unset, bool] = UNSET,
211
+ page: Union[Unset, int] = 1,
212
+ limit: Union[Unset, int] = 10,
213
+ properties: Union[Unset, list[str]] = UNSET,
214
+ parent_entity: Union[Unset, str] = UNSET,
215
+ ) -> Optional[ApiDefinitionsGetCollectionResponse200]:
216
+ """Retrieves the collection of definition resources.
217
+
218
+ Retrieves the collection of definition resources.
219
+
220
+ Args:
221
+ qid (Union[Unset, str]):
222
+ owned (Union[Unset, bool]):
223
+ page (Union[Unset, int]): Default: 1.
224
+ limit (Union[Unset, int]): Default: 10.
225
+ properties (Union[Unset, list[str]]):
226
+ parent_entity (Union[Unset, str]):
227
+
228
+ Raises:
229
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
230
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
231
+
232
+ Returns:
233
+ ApiDefinitionsGetCollectionResponse200
234
+ """
235
+
236
+ return (
237
+ await asyncio_detailed(
238
+ client=client,
239
+ qid=qid,
240
+ owned=owned,
241
+ page=page,
242
+ limit=limit,
243
+ properties=properties,
244
+ parent_entity=parent_entity,
245
+ )
246
+ ).parsed
@@ -0,0 +1,168 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union, cast
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.error import Error
9
+ from ...types import Response
10
+
11
+
12
+ def _get_kwargs(
13
+ id: str,
14
+ ) -> dict[str, Any]:
15
+ _kwargs: dict[str, Any] = {
16
+ "method": "delete",
17
+ "url": f"/api/definitions/{id}",
18
+ }
19
+
20
+ return _kwargs
21
+
22
+
23
+ def _parse_response(
24
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
25
+ ) -> Optional[Union[Any, Error]]:
26
+ if response.status_code == 204:
27
+ response_204 = cast(Any, None)
28
+ return response_204
29
+
30
+ if response.status_code == 403:
31
+ response_403 = Error.from_dict(response.json())
32
+
33
+ return response_403
34
+
35
+ if response.status_code == 404:
36
+ response_404 = Error.from_dict(response.json())
37
+
38
+ return response_404
39
+
40
+ if client.raise_on_unexpected_status:
41
+ raise errors.UnexpectedStatus(response.status_code, response.content)
42
+ else:
43
+ return None
44
+
45
+
46
+ def _build_response(
47
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
48
+ ) -> Response[Union[Any, Error]]:
49
+ return Response(
50
+ status_code=HTTPStatus(response.status_code),
51
+ content=response.content,
52
+ headers=response.headers,
53
+ parsed=_parse_response(client=client, response=response),
54
+ )
55
+
56
+
57
+ def sync_detailed(
58
+ id: str,
59
+ *,
60
+ client: Union[AuthenticatedClient, Client],
61
+ ) -> Response[Union[Any, Error]]:
62
+ """Removes the definition resource.
63
+
64
+ Removes the definition resource.
65
+
66
+ Args:
67
+ id (str):
68
+
69
+ Raises:
70
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
71
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
72
+
73
+ Returns:
74
+ Response[Union[Any, Error]]
75
+ """
76
+
77
+ kwargs = _get_kwargs(
78
+ id=id,
79
+ )
80
+
81
+ response = client.get_httpx_client().request(
82
+ **kwargs,
83
+ )
84
+
85
+ return _build_response(client=client, response=response)
86
+
87
+
88
+ def sync(
89
+ id: str,
90
+ *,
91
+ client: Union[AuthenticatedClient, Client],
92
+ ) -> Optional[Union[Any, Error]]:
93
+ """Removes the definition resource.
94
+
95
+ Removes the definition resource.
96
+
97
+ Args:
98
+ id (str):
99
+
100
+ Raises:
101
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
102
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
103
+
104
+ Returns:
105
+ Union[Any, Error]
106
+ """
107
+
108
+ return sync_detailed(
109
+ id=id,
110
+ client=client,
111
+ ).parsed
112
+
113
+
114
+ async def asyncio_detailed(
115
+ id: str,
116
+ *,
117
+ client: Union[AuthenticatedClient, Client],
118
+ ) -> Response[Union[Any, Error]]:
119
+ """Removes the definition resource.
120
+
121
+ Removes the definition resource.
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[Union[Any, Error]]
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: Union[AuthenticatedClient, Client],
147
+ ) -> Optional[Union[Any, Error]]:
148
+ """Removes the definition resource.
149
+
150
+ Removes the definition resource.
151
+
152
+ Args:
153
+ id (str):
154
+
155
+ Raises:
156
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
157
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
158
+
159
+ Returns:
160
+ Union[Any, Error]
161
+ """
162
+
163
+ return (
164
+ await asyncio_detailed(
165
+ id=id,
166
+ client=client,
167
+ )
168
+ ).parsed
@@ -0,0 +1,165 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import AuthenticatedClient, Client
8
+ from ...models.definition_jsonhal_definition_read import DefinitionJsonhalDefinitionRead
9
+ from ...models.error import Error
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ id: str,
15
+ ) -> dict[str, Any]:
16
+ _kwargs: dict[str, Any] = {
17
+ "method": "get",
18
+ "url": f"/api/definitions/{id}",
19
+ }
20
+
21
+ return _kwargs
22
+
23
+
24
+ def _parse_response(
25
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
26
+ ) -> Optional[Union[DefinitionJsonhalDefinitionRead, Error]]:
27
+ if response.status_code == 200:
28
+ response_200 = DefinitionJsonhalDefinitionRead.from_dict(response.json())
29
+
30
+ return response_200
31
+
32
+ if response.status_code == 404:
33
+ response_404 = Error.from_dict(response.json())
34
+
35
+ return response_404
36
+
37
+ if client.raise_on_unexpected_status:
38
+ raise errors.UnexpectedStatus(response.status_code, response.content)
39
+ else:
40
+ return None
41
+
42
+
43
+ def _build_response(
44
+ *, client: Union[AuthenticatedClient, Client], response: httpx.Response
45
+ ) -> Response[Union[DefinitionJsonhalDefinitionRead, Error]]:
46
+ return Response(
47
+ status_code=HTTPStatus(response.status_code),
48
+ content=response.content,
49
+ headers=response.headers,
50
+ parsed=_parse_response(client=client, response=response),
51
+ )
52
+
53
+
54
+ def sync_detailed(
55
+ id: str,
56
+ *,
57
+ client: Union[AuthenticatedClient, Client],
58
+ ) -> Response[Union[DefinitionJsonhalDefinitionRead, Error]]:
59
+ """Retrieves a definition resource.
60
+
61
+ Retrieves a definition resource.
62
+
63
+ Args:
64
+ id (str):
65
+
66
+ Raises:
67
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
68
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
69
+
70
+ Returns:
71
+ Response[Union[DefinitionJsonhalDefinitionRead, Error]]
72
+ """
73
+
74
+ kwargs = _get_kwargs(
75
+ id=id,
76
+ )
77
+
78
+ response = client.get_httpx_client().request(
79
+ **kwargs,
80
+ )
81
+
82
+ return _build_response(client=client, response=response)
83
+
84
+
85
+ def sync(
86
+ id: str,
87
+ *,
88
+ client: Union[AuthenticatedClient, Client],
89
+ ) -> Optional[Union[DefinitionJsonhalDefinitionRead, Error]]:
90
+ """Retrieves a definition resource.
91
+
92
+ Retrieves a definition resource.
93
+
94
+ Args:
95
+ id (str):
96
+
97
+ Raises:
98
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
99
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
100
+
101
+ Returns:
102
+ Union[DefinitionJsonhalDefinitionRead, Error]
103
+ """
104
+
105
+ return sync_detailed(
106
+ id=id,
107
+ client=client,
108
+ ).parsed
109
+
110
+
111
+ async def asyncio_detailed(
112
+ id: str,
113
+ *,
114
+ client: Union[AuthenticatedClient, Client],
115
+ ) -> Response[Union[DefinitionJsonhalDefinitionRead, Error]]:
116
+ """Retrieves a definition resource.
117
+
118
+ Retrieves a definition resource.
119
+
120
+ Args:
121
+ id (str):
122
+
123
+ Raises:
124
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
125
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
126
+
127
+ Returns:
128
+ Response[Union[DefinitionJsonhalDefinitionRead, Error]]
129
+ """
130
+
131
+ kwargs = _get_kwargs(
132
+ id=id,
133
+ )
134
+
135
+ response = await client.get_async_httpx_client().request(**kwargs)
136
+
137
+ return _build_response(client=client, response=response)
138
+
139
+
140
+ async def asyncio(
141
+ id: str,
142
+ *,
143
+ client: Union[AuthenticatedClient, Client],
144
+ ) -> Optional[Union[DefinitionJsonhalDefinitionRead, Error]]:
145
+ """Retrieves a definition resource.
146
+
147
+ Retrieves a definition resource.
148
+
149
+ Args:
150
+ id (str):
151
+
152
+ Raises:
153
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
154
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
155
+
156
+ Returns:
157
+ Union[DefinitionJsonhalDefinitionRead, Error]
158
+ """
159
+
160
+ return (
161
+ await asyncio_detailed(
162
+ id=id,
163
+ client=client,
164
+ )
165
+ ).parsed