BasisTheoryClient 0.0.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 (283) hide show
  1. basis_theory/__init__.py +350 -0
  2. basis_theory/account_updater/__init__.py +7 -0
  3. basis_theory/account_updater/client.py +44 -0
  4. basis_theory/account_updater/jobs/__init__.py +4 -0
  5. basis_theory/account_updater/jobs/client.py +259 -0
  6. basis_theory/account_updater/jobs/raw_client.py +450 -0
  7. basis_theory/account_updater/raw_client.py +13 -0
  8. basis_theory/account_updater/real_time/__init__.py +4 -0
  9. basis_theory/account_updater/real_time/client.py +161 -0
  10. basis_theory/account_updater/real_time/raw_client.py +246 -0
  11. basis_theory/apple_pay/__init__.py +7 -0
  12. basis_theory/apple_pay/client.py +267 -0
  13. basis_theory/apple_pay/domain/__init__.py +4 -0
  14. basis_theory/apple_pay/domain/client.py +309 -0
  15. basis_theory/apple_pay/domain/raw_client.py +631 -0
  16. basis_theory/apple_pay/raw_client.py +499 -0
  17. basis_theory/apple_pay/session/__init__.py +4 -0
  18. basis_theory/apple_pay/session/client.py +130 -0
  19. basis_theory/apple_pay/session/raw_client.py +225 -0
  20. basis_theory/application_keys/__init__.py +4 -0
  21. basis_theory/application_keys/client.py +354 -0
  22. basis_theory/application_keys/raw_client.py +615 -0
  23. basis_theory/application_templates/__init__.py +4 -0
  24. basis_theory/application_templates/client.py +166 -0
  25. basis_theory/application_templates/raw_client.py +253 -0
  26. basis_theory/applications/__init__.py +4 -0
  27. basis_theory/applications/client.py +582 -0
  28. basis_theory/applications/raw_client.py +1030 -0
  29. basis_theory/client.py +230 -0
  30. basis_theory/connection/__init__.py +7 -0
  31. basis_theory/connection/apple_pay/__init__.py +7 -0
  32. basis_theory/connection/apple_pay/client.py +128 -0
  33. basis_theory/connection/apple_pay/domain/__init__.py +4 -0
  34. basis_theory/connection/apple_pay/domain/client.py +309 -0
  35. basis_theory/connection/apple_pay/domain/raw_client.py +631 -0
  36. basis_theory/connection/apple_pay/raw_client.py +216 -0
  37. basis_theory/connection/apple_pay/session/__init__.py +4 -0
  38. basis_theory/connection/apple_pay/session/client.py +130 -0
  39. basis_theory/connection/apple_pay/session/raw_client.py +225 -0
  40. basis_theory/connection/client.py +39 -0
  41. basis_theory/connection/raw_client.py +13 -0
  42. basis_theory/core/__init__.py +55 -0
  43. basis_theory/core/api_error.py +23 -0
  44. basis_theory/core/client_wrapper.py +89 -0
  45. basis_theory/core/datetime_utils.py +28 -0
  46. basis_theory/core/file.py +67 -0
  47. basis_theory/core/force_multipart.py +16 -0
  48. basis_theory/core/http_client.py +543 -0
  49. basis_theory/core/http_response.py +55 -0
  50. basis_theory/core/jsonable_encoder.py +100 -0
  51. basis_theory/core/pagination.py +82 -0
  52. basis_theory/core/pydantic_utilities.py +255 -0
  53. basis_theory/core/query_encoder.py +58 -0
  54. basis_theory/core/remove_none_from_dict.py +11 -0
  55. basis_theory/core/request_options.py +35 -0
  56. basis_theory/core/serialization.py +276 -0
  57. basis_theory/documents/__init__.py +7 -0
  58. basis_theory/documents/client.py +258 -0
  59. basis_theory/documents/data/__init__.py +4 -0
  60. basis_theory/documents/data/client.py +78 -0
  61. basis_theory/documents/data/raw_client.py +173 -0
  62. basis_theory/documents/raw_client.py +442 -0
  63. basis_theory/enrichments/__init__.py +4 -0
  64. basis_theory/enrichments/client.py +135 -0
  65. basis_theory/enrichments/raw_client.py +203 -0
  66. basis_theory/environment.py +7 -0
  67. basis_theory/errors/__init__.py +23 -0
  68. basis_theory/errors/bad_request_error.py +11 -0
  69. basis_theory/errors/conflict_error.py +11 -0
  70. basis_theory/errors/forbidden_error.py +11 -0
  71. basis_theory/errors/internal_server_error.py +11 -0
  72. basis_theory/errors/not_found_error.py +10 -0
  73. basis_theory/errors/service_unavailable_error.py +11 -0
  74. basis_theory/errors/unauthorized_error.py +11 -0
  75. basis_theory/errors/unprocessable_entity_error.py +11 -0
  76. basis_theory/googlepay/__init__.py +4 -0
  77. basis_theory/googlepay/client.py +120 -0
  78. basis_theory/googlepay/raw_client.py +239 -0
  79. basis_theory/keys/__init__.py +4 -0
  80. basis_theory/keys/client.py +313 -0
  81. basis_theory/keys/raw_client.py +673 -0
  82. basis_theory/logs/__init__.py +4 -0
  83. basis_theory/logs/client.py +240 -0
  84. basis_theory/logs/raw_client.py +376 -0
  85. basis_theory/network_tokens/__init__.py +4 -0
  86. basis_theory/network_tokens/client.py +478 -0
  87. basis_theory/network_tokens/raw_client.py +1113 -0
  88. basis_theory/permissions/__init__.py +4 -0
  89. basis_theory/permissions/client.py +106 -0
  90. basis_theory/permissions/raw_client.py +170 -0
  91. basis_theory/proxies/__init__.py +4 -0
  92. basis_theory/proxies/client.py +751 -0
  93. basis_theory/proxies/raw_client.py +1255 -0
  94. basis_theory/py.typed +0 -0
  95. basis_theory/reactors/__init__.py +7 -0
  96. basis_theory/reactors/client.py +823 -0
  97. basis_theory/reactors/raw_client.py +1553 -0
  98. basis_theory/reactors/results/__init__.py +4 -0
  99. basis_theory/reactors/results/client.py +115 -0
  100. basis_theory/reactors/results/raw_client.py +194 -0
  101. basis_theory/roles/__init__.py +4 -0
  102. basis_theory/roles/client.py +98 -0
  103. basis_theory/roles/raw_client.py +134 -0
  104. basis_theory/sessions/__init__.py +4 -0
  105. basis_theory/sessions/client.py +222 -0
  106. basis_theory/sessions/raw_client.py +399 -0
  107. basis_theory/tenants/__init__.py +7 -0
  108. basis_theory/tenants/client.py +59 -0
  109. basis_theory/tenants/connections/__init__.py +4 -0
  110. basis_theory/tenants/connections/client.py +198 -0
  111. basis_theory/tenants/connections/raw_client.py +344 -0
  112. basis_theory/tenants/invitations/__init__.py +4 -0
  113. basis_theory/tenants/invitations/client.py +458 -0
  114. basis_theory/tenants/invitations/raw_client.py +805 -0
  115. basis_theory/tenants/members/__init__.py +4 -0
  116. basis_theory/tenants/members/client.py +296 -0
  117. basis_theory/tenants/members/raw_client.py +497 -0
  118. basis_theory/tenants/owner/__init__.py +4 -0
  119. basis_theory/tenants/owner/client.py +98 -0
  120. basis_theory/tenants/owner/raw_client.py +157 -0
  121. basis_theory/tenants/raw_client.py +13 -0
  122. basis_theory/tenants/self_/__init__.py +4 -0
  123. basis_theory/tenants/self_/client.py +308 -0
  124. basis_theory/tenants/self_/raw_client.py +605 -0
  125. basis_theory/threeds/__init__.py +7 -0
  126. basis_theory/threeds/client.py +39 -0
  127. basis_theory/threeds/raw_client.py +13 -0
  128. basis_theory/threeds/sessions/__init__.py +4 -0
  129. basis_theory/threeds/sessions/client.py +521 -0
  130. basis_theory/threeds/sessions/raw_client.py +808 -0
  131. basis_theory/token_intents/__init__.py +4 -0
  132. basis_theory/token_intents/client.py +258 -0
  133. basis_theory/token_intents/raw_client.py +454 -0
  134. basis_theory/tokens/__init__.py +4 -0
  135. basis_theory/tokens/client.py +1015 -0
  136. basis_theory/tokens/raw_client.py +1861 -0
  137. basis_theory/types/__init__.py +277 -0
  138. basis_theory/types/access_rule.py +25 -0
  139. basis_theory/types/account_updater_job.py +55 -0
  140. basis_theory/types/account_updater_job_list.py +22 -0
  141. basis_theory/types/account_updater_job_list_pagination.py +20 -0
  142. basis_theory/types/account_updater_job_status.py +5 -0
  143. basis_theory/types/account_updater_real_time_response.py +24 -0
  144. basis_theory/types/additional_card_details.py +23 -0
  145. basis_theory/types/address.py +25 -0
  146. basis_theory/types/apple_pay_create_response.py +20 -0
  147. basis_theory/types/apple_pay_create_token_response.py +28 -0
  148. basis_theory/types/apple_pay_domain_deregistration_request.py +19 -0
  149. basis_theory/types/apple_pay_domain_registration_list_request.py +19 -0
  150. basis_theory/types/apple_pay_domain_registration_request.py +19 -0
  151. basis_theory/types/apple_pay_domain_registration_response.py +20 -0
  152. basis_theory/types/apple_pay_method_token.py +25 -0
  153. basis_theory/types/apple_pay_session_request.py +21 -0
  154. basis_theory/types/apple_pay_token.py +33 -0
  155. basis_theory/types/apple_pay_tokenize_response.py +20 -0
  156. basis_theory/types/application.py +33 -0
  157. basis_theory/types/application_key.py +24 -0
  158. basis_theory/types/application_paginated_list.py +22 -0
  159. basis_theory/types/application_template.py +27 -0
  160. basis_theory/types/assurance_details.py +20 -0
  161. basis_theory/types/async_react_response.py +23 -0
  162. basis_theory/types/authenticate_three_ds_session_request.py +35 -0
  163. basis_theory/types/authentication.py +22 -0
  164. basis_theory/types/authentication_response.py +21 -0
  165. basis_theory/types/bank_details.py +20 -0
  166. basis_theory/types/bank_verification_response.py +19 -0
  167. basis_theory/types/bin_details.py +41 -0
  168. basis_theory/types/bin_details_bank.py +22 -0
  169. basis_theory/types/bin_details_country.py +21 -0
  170. basis_theory/types/bin_details_product.py +20 -0
  171. basis_theory/types/card.py +22 -0
  172. basis_theory/types/card_details.py +32 -0
  173. basis_theory/types/card_issuer.py +20 -0
  174. basis_theory/types/card_issuer_country.py +21 -0
  175. basis_theory/types/cardholder_info.py +21 -0
  176. basis_theory/types/client_encryption_key_metadata_response.py +23 -0
  177. basis_theory/types/client_encryption_key_response.py +24 -0
  178. basis_theory/types/condition.py +21 -0
  179. basis_theory/types/create_account_updater_job_request.py +22 -0
  180. basis_theory/types/create_document_request.py +19 -0
  181. basis_theory/types/create_reactor_formula_request.py +28 -0
  182. basis_theory/types/create_session_response.py +22 -0
  183. basis_theory/types/create_tenant_connection_response.py +19 -0
  184. basis_theory/types/create_three_ds_session_response.py +29 -0
  185. basis_theory/types/create_token_intent_response.py +36 -0
  186. basis_theory/types/cursor_pagination.py +20 -0
  187. basis_theory/types/document.py +25 -0
  188. basis_theory/types/domain_registration_response.py +20 -0
  189. basis_theory/types/event_types.py +5 -0
  190. basis_theory/types/get_applications.py +23 -0
  191. basis_theory/types/get_logs.py +26 -0
  192. basis_theory/types/get_permissions.py +19 -0
  193. basis_theory/types/get_proxies.py +23 -0
  194. basis_theory/types/get_reactor_formulas.py +22 -0
  195. basis_theory/types/get_reactors.py +23 -0
  196. basis_theory/types/get_tenant_invitations.py +23 -0
  197. basis_theory/types/get_tenant_members.py +22 -0
  198. basis_theory/types/get_tokens.py +23 -0
  199. basis_theory/types/get_tokens_v2.py +24 -0
  200. basis_theory/types/google_pay_tokenize_response.py +20 -0
  201. basis_theory/types/google_payment_method_token.py +27 -0
  202. basis_theory/types/header.py +26 -0
  203. basis_theory/types/intermediate_signing_key.py +22 -0
  204. basis_theory/types/log.py +28 -0
  205. basis_theory/types/log_entity_type.py +20 -0
  206. basis_theory/types/log_paginated_list.py +22 -0
  207. basis_theory/types/network_token.py +38 -0
  208. basis_theory/types/network_token_cryptogram.py +20 -0
  209. basis_theory/types/network_token_extras.py +19 -0
  210. basis_theory/types/pagination.py +24 -0
  211. basis_theory/types/payment_data.py +23 -0
  212. basis_theory/types/permission.py +21 -0
  213. basis_theory/types/privacy.py +21 -0
  214. basis_theory/types/problem_details.py +23 -0
  215. basis_theory/types/proxy.py +39 -0
  216. basis_theory/types/proxy_paginated_list.py +22 -0
  217. basis_theory/types/proxy_transform.py +23 -0
  218. basis_theory/types/public_key.py +3 -0
  219. basis_theory/types/react_response.py +22 -0
  220. basis_theory/types/reactor.py +32 -0
  221. basis_theory/types/reactor_formula.py +34 -0
  222. basis_theory/types/reactor_formula_configuration.py +21 -0
  223. basis_theory/types/reactor_formula_paginated_list.py +22 -0
  224. basis_theory/types/reactor_formula_request_parameter.py +22 -0
  225. basis_theory/types/reactor_paginated_list.py +22 -0
  226. basis_theory/types/role.py +19 -0
  227. basis_theory/types/string_string_key_value_pair.py +20 -0
  228. basis_theory/types/submerchant_authentication_response.py +21 -0
  229. basis_theory/types/tenant.py +28 -0
  230. basis_theory/types/tenant_connection_options.py +19 -0
  231. basis_theory/types/tenant_invitation_response.py +30 -0
  232. basis_theory/types/tenant_invitation_response_paginated_list.py +22 -0
  233. basis_theory/types/tenant_invitation_status.py +5 -0
  234. basis_theory/types/tenant_member_response.py +28 -0
  235. basis_theory/types/tenant_member_response_paginated_list.py +22 -0
  236. basis_theory/types/tenant_usage_report.py +19 -0
  237. basis_theory/types/three_ds_acs_rendering_type.py +22 -0
  238. basis_theory/types/three_ds_address.py +25 -0
  239. basis_theory/types/three_ds_authentication.py +53 -0
  240. basis_theory/types/three_ds_callback_urls.py +20 -0
  241. basis_theory/types/three_ds_cardholder_account_info.py +33 -0
  242. basis_theory/types/three_ds_cardholder_authentication_info.py +21 -0
  243. basis_theory/types/three_ds_cardholder_info.py +36 -0
  244. basis_theory/types/three_ds_cardholder_phone_number.py +20 -0
  245. basis_theory/types/three_ds_device_info.py +36 -0
  246. basis_theory/types/three_ds_merchant_info.py +26 -0
  247. basis_theory/types/three_ds_merchant_risk_info.py +27 -0
  248. basis_theory/types/three_ds_message_extension.py +22 -0
  249. basis_theory/types/three_ds_method.py +20 -0
  250. basis_theory/types/three_ds_mobile_sdk_render_options.py +20 -0
  251. basis_theory/types/three_ds_prior_authentication_info.py +22 -0
  252. basis_theory/types/three_ds_purchase_info.py +26 -0
  253. basis_theory/types/three_ds_requestor_info.py +25 -0
  254. basis_theory/types/three_ds_session.py +42 -0
  255. basis_theory/types/three_ds_version.py +25 -0
  256. basis_theory/types/token.py +49 -0
  257. basis_theory/types/token_cursor_paginated_list.py +22 -0
  258. basis_theory/types/token_enrichments.py +22 -0
  259. basis_theory/types/token_enrichments_card_details.py +20 -0
  260. basis_theory/types/token_extras.py +24 -0
  261. basis_theory/types/token_intent.py +36 -0
  262. basis_theory/types/token_intent_extras.py +21 -0
  263. basis_theory/types/token_paginated_list.py +22 -0
  264. basis_theory/types/token_service_provider_details.py +34 -0
  265. basis_theory/types/update_privacy.py +20 -0
  266. basis_theory/types/update_reactor_formula_request.py +27 -0
  267. basis_theory/types/user.py +25 -0
  268. basis_theory/types/validation_problem_details.py +24 -0
  269. basis_theory/types/webhook.py +35 -0
  270. basis_theory/types/webhook_list.py +22 -0
  271. basis_theory/types/webhook_list_pagination.py +20 -0
  272. basis_theory/types/webhook_status.py +5 -0
  273. basis_theory/version.py +3 -0
  274. basis_theory/webhooks/__init__.py +7 -0
  275. basis_theory/webhooks/client.py +543 -0
  276. basis_theory/webhooks/events/__init__.py +4 -0
  277. basis_theory/webhooks/events/client.py +102 -0
  278. basis_theory/webhooks/events/raw_client.py +136 -0
  279. basis_theory/webhooks/raw_client.py +943 -0
  280. basistheoryclient-0.0.1.dist-info/LICENSE +201 -0
  281. basistheoryclient-0.0.1.dist-info/METADATA +213 -0
  282. basistheoryclient-0.0.1.dist-info/RECORD +283 -0
  283. basistheoryclient-0.0.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,1030 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..core.serialization import convert_and_respect_annotation_metadata
14
+ from ..errors.bad_request_error import BadRequestError
15
+ from ..errors.forbidden_error import ForbiddenError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..types.access_rule import AccessRule
19
+ from ..types.application import Application
20
+ from ..types.application_paginated_list import ApplicationPaginatedList
21
+ from ..types.problem_details import ProblemDetails
22
+ from ..types.validation_problem_details import ValidationProblemDetails
23
+
24
+ # this is used as the default value for optional parameters
25
+ OMIT = typing.cast(typing.Any, ...)
26
+
27
+
28
+ class RawApplicationsClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
31
+
32
+ def list(
33
+ self,
34
+ *,
35
+ id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
36
+ type: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
37
+ page: typing.Optional[int] = None,
38
+ start: typing.Optional[str] = None,
39
+ size: typing.Optional[int] = None,
40
+ request_options: typing.Optional[RequestOptions] = None,
41
+ ) -> SyncPager[Application]:
42
+ """
43
+ Parameters
44
+ ----------
45
+ id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
46
+
47
+ type : typing.Optional[typing.Union[str, typing.Sequence[str]]]
48
+
49
+ page : typing.Optional[int]
50
+
51
+ start : typing.Optional[str]
52
+
53
+ size : typing.Optional[int]
54
+
55
+ request_options : typing.Optional[RequestOptions]
56
+ Request-specific configuration.
57
+
58
+ Returns
59
+ -------
60
+ SyncPager[Application]
61
+ Success
62
+ """
63
+ page = page if page is not None else 1
64
+
65
+ _response = self._client_wrapper.httpx_client.request(
66
+ "applications",
67
+ method="GET",
68
+ params={
69
+ "id": id,
70
+ "type": type,
71
+ "page": page,
72
+ "start": start,
73
+ "size": size,
74
+ },
75
+ request_options=request_options,
76
+ )
77
+ try:
78
+ if 200 <= _response.status_code < 300:
79
+ _parsed_response = typing.cast(
80
+ ApplicationPaginatedList,
81
+ parse_obj_as(
82
+ type_=ApplicationPaginatedList, # type: ignore
83
+ object_=_response.json(),
84
+ ),
85
+ )
86
+ _items = _parsed_response.data
87
+ _has_next = True
88
+ _get_next = lambda: self.list(
89
+ id=id,
90
+ type=type,
91
+ page=page + 1,
92
+ start=start,
93
+ size=size,
94
+ request_options=request_options,
95
+ )
96
+ return SyncPager(
97
+ has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
98
+ )
99
+ if _response.status_code == 401:
100
+ raise UnauthorizedError(
101
+ headers=dict(_response.headers),
102
+ body=typing.cast(
103
+ ProblemDetails,
104
+ parse_obj_as(
105
+ type_=ProblemDetails, # type: ignore
106
+ object_=_response.json(),
107
+ ),
108
+ ),
109
+ )
110
+ if _response.status_code == 403:
111
+ raise ForbiddenError(
112
+ headers=dict(_response.headers),
113
+ body=typing.cast(
114
+ ProblemDetails,
115
+ parse_obj_as(
116
+ type_=ProblemDetails, # type: ignore
117
+ object_=_response.json(),
118
+ ),
119
+ ),
120
+ )
121
+ if _response.status_code == 404:
122
+ raise NotFoundError(
123
+ headers=dict(_response.headers),
124
+ body=typing.cast(
125
+ typing.Optional[typing.Any],
126
+ parse_obj_as(
127
+ type_=typing.Optional[typing.Any], # type: ignore
128
+ object_=_response.json(),
129
+ ),
130
+ ),
131
+ )
132
+ _response_json = _response.json()
133
+ except JSONDecodeError:
134
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
135
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
136
+
137
+ def create(
138
+ self,
139
+ *,
140
+ name: str,
141
+ type: str,
142
+ permissions: typing.Optional[typing.Sequence[str]] = OMIT,
143
+ rules: typing.Optional[typing.Sequence[AccessRule]] = OMIT,
144
+ create_key: typing.Optional[bool] = OMIT,
145
+ idempotency_key: typing.Optional[str] = None,
146
+ request_options: typing.Optional[RequestOptions] = None,
147
+ ) -> HttpResponse[Application]:
148
+ """
149
+ Parameters
150
+ ----------
151
+ name : str
152
+
153
+ type : str
154
+
155
+ permissions : typing.Optional[typing.Sequence[str]]
156
+
157
+ rules : typing.Optional[typing.Sequence[AccessRule]]
158
+
159
+ create_key : typing.Optional[bool]
160
+
161
+ idempotency_key : typing.Optional[str]
162
+
163
+ request_options : typing.Optional[RequestOptions]
164
+ Request-specific configuration.
165
+
166
+ Returns
167
+ -------
168
+ HttpResponse[Application]
169
+ Created
170
+ """
171
+ _response = self._client_wrapper.httpx_client.request(
172
+ "applications",
173
+ method="POST",
174
+ json={
175
+ "name": name,
176
+ "type": type,
177
+ "permissions": permissions,
178
+ "rules": convert_and_respect_annotation_metadata(
179
+ object_=rules, annotation=typing.Sequence[AccessRule], direction="write"
180
+ ),
181
+ "create_key": create_key,
182
+ },
183
+ headers={
184
+ "content-type": "application/json",
185
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
186
+ },
187
+ request_options=request_options,
188
+ omit=OMIT,
189
+ )
190
+ try:
191
+ if 200 <= _response.status_code < 300:
192
+ _data = typing.cast(
193
+ Application,
194
+ parse_obj_as(
195
+ type_=Application, # type: ignore
196
+ object_=_response.json(),
197
+ ),
198
+ )
199
+ return HttpResponse(response=_response, data=_data)
200
+ if _response.status_code == 400:
201
+ raise BadRequestError(
202
+ headers=dict(_response.headers),
203
+ body=typing.cast(
204
+ ValidationProblemDetails,
205
+ parse_obj_as(
206
+ type_=ValidationProblemDetails, # type: ignore
207
+ object_=_response.json(),
208
+ ),
209
+ ),
210
+ )
211
+ if _response.status_code == 401:
212
+ raise UnauthorizedError(
213
+ headers=dict(_response.headers),
214
+ body=typing.cast(
215
+ ProblemDetails,
216
+ parse_obj_as(
217
+ type_=ProblemDetails, # type: ignore
218
+ object_=_response.json(),
219
+ ),
220
+ ),
221
+ )
222
+ if _response.status_code == 403:
223
+ raise ForbiddenError(
224
+ headers=dict(_response.headers),
225
+ body=typing.cast(
226
+ ProblemDetails,
227
+ parse_obj_as(
228
+ type_=ProblemDetails, # type: ignore
229
+ object_=_response.json(),
230
+ ),
231
+ ),
232
+ )
233
+ _response_json = _response.json()
234
+ except JSONDecodeError:
235
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
236
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
237
+
238
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Application]:
239
+ """
240
+ Parameters
241
+ ----------
242
+ id : str
243
+
244
+ request_options : typing.Optional[RequestOptions]
245
+ Request-specific configuration.
246
+
247
+ Returns
248
+ -------
249
+ HttpResponse[Application]
250
+ Success
251
+ """
252
+ _response = self._client_wrapper.httpx_client.request(
253
+ f"applications/{jsonable_encoder(id)}",
254
+ method="GET",
255
+ request_options=request_options,
256
+ )
257
+ try:
258
+ if 200 <= _response.status_code < 300:
259
+ _data = typing.cast(
260
+ Application,
261
+ parse_obj_as(
262
+ type_=Application, # type: ignore
263
+ object_=_response.json(),
264
+ ),
265
+ )
266
+ return HttpResponse(response=_response, data=_data)
267
+ if _response.status_code == 401:
268
+ raise UnauthorizedError(
269
+ headers=dict(_response.headers),
270
+ body=typing.cast(
271
+ ProblemDetails,
272
+ parse_obj_as(
273
+ type_=ProblemDetails, # type: ignore
274
+ object_=_response.json(),
275
+ ),
276
+ ),
277
+ )
278
+ if _response.status_code == 403:
279
+ raise ForbiddenError(
280
+ headers=dict(_response.headers),
281
+ body=typing.cast(
282
+ ProblemDetails,
283
+ parse_obj_as(
284
+ type_=ProblemDetails, # type: ignore
285
+ object_=_response.json(),
286
+ ),
287
+ ),
288
+ )
289
+ if _response.status_code == 404:
290
+ raise NotFoundError(
291
+ headers=dict(_response.headers),
292
+ body=typing.cast(
293
+ typing.Optional[typing.Any],
294
+ parse_obj_as(
295
+ type_=typing.Optional[typing.Any], # type: ignore
296
+ object_=_response.json(),
297
+ ),
298
+ ),
299
+ )
300
+ _response_json = _response.json()
301
+ except JSONDecodeError:
302
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
303
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
304
+
305
+ def update(
306
+ self,
307
+ id: str,
308
+ *,
309
+ name: str,
310
+ permissions: typing.Optional[typing.Sequence[str]] = OMIT,
311
+ rules: typing.Optional[typing.Sequence[AccessRule]] = OMIT,
312
+ idempotency_key: typing.Optional[str] = None,
313
+ request_options: typing.Optional[RequestOptions] = None,
314
+ ) -> HttpResponse[Application]:
315
+ """
316
+ Parameters
317
+ ----------
318
+ id : str
319
+
320
+ name : str
321
+
322
+ permissions : typing.Optional[typing.Sequence[str]]
323
+
324
+ rules : typing.Optional[typing.Sequence[AccessRule]]
325
+
326
+ idempotency_key : typing.Optional[str]
327
+
328
+ request_options : typing.Optional[RequestOptions]
329
+ Request-specific configuration.
330
+
331
+ Returns
332
+ -------
333
+ HttpResponse[Application]
334
+ Success
335
+ """
336
+ _response = self._client_wrapper.httpx_client.request(
337
+ f"applications/{jsonable_encoder(id)}",
338
+ method="PUT",
339
+ json={
340
+ "name": name,
341
+ "permissions": permissions,
342
+ "rules": convert_and_respect_annotation_metadata(
343
+ object_=rules, annotation=typing.Sequence[AccessRule], direction="write"
344
+ ),
345
+ },
346
+ headers={
347
+ "content-type": "application/json",
348
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
349
+ },
350
+ request_options=request_options,
351
+ omit=OMIT,
352
+ )
353
+ try:
354
+ if 200 <= _response.status_code < 300:
355
+ _data = typing.cast(
356
+ Application,
357
+ parse_obj_as(
358
+ type_=Application, # type: ignore
359
+ object_=_response.json(),
360
+ ),
361
+ )
362
+ return HttpResponse(response=_response, data=_data)
363
+ if _response.status_code == 400:
364
+ raise BadRequestError(
365
+ headers=dict(_response.headers),
366
+ body=typing.cast(
367
+ ValidationProblemDetails,
368
+ parse_obj_as(
369
+ type_=ValidationProblemDetails, # type: ignore
370
+ object_=_response.json(),
371
+ ),
372
+ ),
373
+ )
374
+ if _response.status_code == 401:
375
+ raise UnauthorizedError(
376
+ headers=dict(_response.headers),
377
+ body=typing.cast(
378
+ ProblemDetails,
379
+ parse_obj_as(
380
+ type_=ProblemDetails, # type: ignore
381
+ object_=_response.json(),
382
+ ),
383
+ ),
384
+ )
385
+ if _response.status_code == 403:
386
+ raise ForbiddenError(
387
+ headers=dict(_response.headers),
388
+ body=typing.cast(
389
+ ProblemDetails,
390
+ parse_obj_as(
391
+ type_=ProblemDetails, # type: ignore
392
+ object_=_response.json(),
393
+ ),
394
+ ),
395
+ )
396
+ if _response.status_code == 404:
397
+ raise NotFoundError(
398
+ headers=dict(_response.headers),
399
+ body=typing.cast(
400
+ typing.Optional[typing.Any],
401
+ parse_obj_as(
402
+ type_=typing.Optional[typing.Any], # type: ignore
403
+ object_=_response.json(),
404
+ ),
405
+ ),
406
+ )
407
+ _response_json = _response.json()
408
+ except JSONDecodeError:
409
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
410
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
411
+
412
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
413
+ """
414
+ Parameters
415
+ ----------
416
+ id : str
417
+
418
+ request_options : typing.Optional[RequestOptions]
419
+ Request-specific configuration.
420
+
421
+ Returns
422
+ -------
423
+ HttpResponse[None]
424
+ """
425
+ _response = self._client_wrapper.httpx_client.request(
426
+ f"applications/{jsonable_encoder(id)}",
427
+ method="DELETE",
428
+ request_options=request_options,
429
+ )
430
+ try:
431
+ if 200 <= _response.status_code < 300:
432
+ return HttpResponse(response=_response, data=None)
433
+ if _response.status_code == 401:
434
+ raise UnauthorizedError(
435
+ headers=dict(_response.headers),
436
+ body=typing.cast(
437
+ ProblemDetails,
438
+ parse_obj_as(
439
+ type_=ProblemDetails, # type: ignore
440
+ object_=_response.json(),
441
+ ),
442
+ ),
443
+ )
444
+ if _response.status_code == 403:
445
+ raise ForbiddenError(
446
+ headers=dict(_response.headers),
447
+ body=typing.cast(
448
+ ProblemDetails,
449
+ parse_obj_as(
450
+ type_=ProblemDetails, # type: ignore
451
+ object_=_response.json(),
452
+ ),
453
+ ),
454
+ )
455
+ if _response.status_code == 404:
456
+ raise NotFoundError(
457
+ headers=dict(_response.headers),
458
+ body=typing.cast(
459
+ typing.Optional[typing.Any],
460
+ parse_obj_as(
461
+ type_=typing.Optional[typing.Any], # type: ignore
462
+ object_=_response.json(),
463
+ ),
464
+ ),
465
+ )
466
+ _response_json = _response.json()
467
+ except JSONDecodeError:
468
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
469
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
470
+
471
+ def get_by_key(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Application]:
472
+ """
473
+ Parameters
474
+ ----------
475
+ request_options : typing.Optional[RequestOptions]
476
+ Request-specific configuration.
477
+
478
+ Returns
479
+ -------
480
+ HttpResponse[Application]
481
+ Success
482
+ """
483
+ _response = self._client_wrapper.httpx_client.request(
484
+ "applications/key",
485
+ method="GET",
486
+ request_options=request_options,
487
+ )
488
+ try:
489
+ if 200 <= _response.status_code < 300:
490
+ _data = typing.cast(
491
+ Application,
492
+ parse_obj_as(
493
+ type_=Application, # type: ignore
494
+ object_=_response.json(),
495
+ ),
496
+ )
497
+ return HttpResponse(response=_response, data=_data)
498
+ if _response.status_code == 401:
499
+ raise UnauthorizedError(
500
+ headers=dict(_response.headers),
501
+ body=typing.cast(
502
+ ProblemDetails,
503
+ parse_obj_as(
504
+ type_=ProblemDetails, # type: ignore
505
+ object_=_response.json(),
506
+ ),
507
+ ),
508
+ )
509
+ if _response.status_code == 404:
510
+ raise NotFoundError(
511
+ headers=dict(_response.headers),
512
+ body=typing.cast(
513
+ typing.Optional[typing.Any],
514
+ parse_obj_as(
515
+ type_=typing.Optional[typing.Any], # type: ignore
516
+ object_=_response.json(),
517
+ ),
518
+ ),
519
+ )
520
+ _response_json = _response.json()
521
+ except JSONDecodeError:
522
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
523
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
524
+
525
+
526
+ class AsyncRawApplicationsClient:
527
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
528
+ self._client_wrapper = client_wrapper
529
+
530
+ async def list(
531
+ self,
532
+ *,
533
+ id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
534
+ type: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
535
+ page: typing.Optional[int] = None,
536
+ start: typing.Optional[str] = None,
537
+ size: typing.Optional[int] = None,
538
+ request_options: typing.Optional[RequestOptions] = None,
539
+ ) -> AsyncPager[Application]:
540
+ """
541
+ Parameters
542
+ ----------
543
+ id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
544
+
545
+ type : typing.Optional[typing.Union[str, typing.Sequence[str]]]
546
+
547
+ page : typing.Optional[int]
548
+
549
+ start : typing.Optional[str]
550
+
551
+ size : typing.Optional[int]
552
+
553
+ request_options : typing.Optional[RequestOptions]
554
+ Request-specific configuration.
555
+
556
+ Returns
557
+ -------
558
+ AsyncPager[Application]
559
+ Success
560
+ """
561
+ page = page if page is not None else 1
562
+
563
+ _response = await self._client_wrapper.httpx_client.request(
564
+ "applications",
565
+ method="GET",
566
+ params={
567
+ "id": id,
568
+ "type": type,
569
+ "page": page,
570
+ "start": start,
571
+ "size": size,
572
+ },
573
+ request_options=request_options,
574
+ )
575
+ try:
576
+ if 200 <= _response.status_code < 300:
577
+ _parsed_response = typing.cast(
578
+ ApplicationPaginatedList,
579
+ parse_obj_as(
580
+ type_=ApplicationPaginatedList, # type: ignore
581
+ object_=_response.json(),
582
+ ),
583
+ )
584
+ _items = _parsed_response.data
585
+ _has_next = True
586
+
587
+ async def _get_next():
588
+ return await self.list(
589
+ id=id,
590
+ type=type,
591
+ page=page + 1,
592
+ start=start,
593
+ size=size,
594
+ request_options=request_options,
595
+ )
596
+
597
+ return AsyncPager(
598
+ has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
599
+ )
600
+ if _response.status_code == 401:
601
+ raise UnauthorizedError(
602
+ headers=dict(_response.headers),
603
+ body=typing.cast(
604
+ ProblemDetails,
605
+ parse_obj_as(
606
+ type_=ProblemDetails, # type: ignore
607
+ object_=_response.json(),
608
+ ),
609
+ ),
610
+ )
611
+ if _response.status_code == 403:
612
+ raise ForbiddenError(
613
+ headers=dict(_response.headers),
614
+ body=typing.cast(
615
+ ProblemDetails,
616
+ parse_obj_as(
617
+ type_=ProblemDetails, # type: ignore
618
+ object_=_response.json(),
619
+ ),
620
+ ),
621
+ )
622
+ if _response.status_code == 404:
623
+ raise NotFoundError(
624
+ headers=dict(_response.headers),
625
+ body=typing.cast(
626
+ typing.Optional[typing.Any],
627
+ parse_obj_as(
628
+ type_=typing.Optional[typing.Any], # type: ignore
629
+ object_=_response.json(),
630
+ ),
631
+ ),
632
+ )
633
+ _response_json = _response.json()
634
+ except JSONDecodeError:
635
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
636
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
637
+
638
+ async def create(
639
+ self,
640
+ *,
641
+ name: str,
642
+ type: str,
643
+ permissions: typing.Optional[typing.Sequence[str]] = OMIT,
644
+ rules: typing.Optional[typing.Sequence[AccessRule]] = OMIT,
645
+ create_key: typing.Optional[bool] = OMIT,
646
+ idempotency_key: typing.Optional[str] = None,
647
+ request_options: typing.Optional[RequestOptions] = None,
648
+ ) -> AsyncHttpResponse[Application]:
649
+ """
650
+ Parameters
651
+ ----------
652
+ name : str
653
+
654
+ type : str
655
+
656
+ permissions : typing.Optional[typing.Sequence[str]]
657
+
658
+ rules : typing.Optional[typing.Sequence[AccessRule]]
659
+
660
+ create_key : typing.Optional[bool]
661
+
662
+ idempotency_key : typing.Optional[str]
663
+
664
+ request_options : typing.Optional[RequestOptions]
665
+ Request-specific configuration.
666
+
667
+ Returns
668
+ -------
669
+ AsyncHttpResponse[Application]
670
+ Created
671
+ """
672
+ _response = await self._client_wrapper.httpx_client.request(
673
+ "applications",
674
+ method="POST",
675
+ json={
676
+ "name": name,
677
+ "type": type,
678
+ "permissions": permissions,
679
+ "rules": convert_and_respect_annotation_metadata(
680
+ object_=rules, annotation=typing.Sequence[AccessRule], direction="write"
681
+ ),
682
+ "create_key": create_key,
683
+ },
684
+ headers={
685
+ "content-type": "application/json",
686
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
687
+ },
688
+ request_options=request_options,
689
+ omit=OMIT,
690
+ )
691
+ try:
692
+ if 200 <= _response.status_code < 300:
693
+ _data = typing.cast(
694
+ Application,
695
+ parse_obj_as(
696
+ type_=Application, # type: ignore
697
+ object_=_response.json(),
698
+ ),
699
+ )
700
+ return AsyncHttpResponse(response=_response, data=_data)
701
+ if _response.status_code == 400:
702
+ raise BadRequestError(
703
+ headers=dict(_response.headers),
704
+ body=typing.cast(
705
+ ValidationProblemDetails,
706
+ parse_obj_as(
707
+ type_=ValidationProblemDetails, # type: ignore
708
+ object_=_response.json(),
709
+ ),
710
+ ),
711
+ )
712
+ if _response.status_code == 401:
713
+ raise UnauthorizedError(
714
+ headers=dict(_response.headers),
715
+ body=typing.cast(
716
+ ProblemDetails,
717
+ parse_obj_as(
718
+ type_=ProblemDetails, # type: ignore
719
+ object_=_response.json(),
720
+ ),
721
+ ),
722
+ )
723
+ if _response.status_code == 403:
724
+ raise ForbiddenError(
725
+ headers=dict(_response.headers),
726
+ body=typing.cast(
727
+ ProblemDetails,
728
+ parse_obj_as(
729
+ type_=ProblemDetails, # type: ignore
730
+ object_=_response.json(),
731
+ ),
732
+ ),
733
+ )
734
+ _response_json = _response.json()
735
+ except JSONDecodeError:
736
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
737
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
738
+
739
+ async def get(
740
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
741
+ ) -> AsyncHttpResponse[Application]:
742
+ """
743
+ Parameters
744
+ ----------
745
+ id : str
746
+
747
+ request_options : typing.Optional[RequestOptions]
748
+ Request-specific configuration.
749
+
750
+ Returns
751
+ -------
752
+ AsyncHttpResponse[Application]
753
+ Success
754
+ """
755
+ _response = await self._client_wrapper.httpx_client.request(
756
+ f"applications/{jsonable_encoder(id)}",
757
+ method="GET",
758
+ request_options=request_options,
759
+ )
760
+ try:
761
+ if 200 <= _response.status_code < 300:
762
+ _data = typing.cast(
763
+ Application,
764
+ parse_obj_as(
765
+ type_=Application, # type: ignore
766
+ object_=_response.json(),
767
+ ),
768
+ )
769
+ return AsyncHttpResponse(response=_response, data=_data)
770
+ if _response.status_code == 401:
771
+ raise UnauthorizedError(
772
+ headers=dict(_response.headers),
773
+ body=typing.cast(
774
+ ProblemDetails,
775
+ parse_obj_as(
776
+ type_=ProblemDetails, # type: ignore
777
+ object_=_response.json(),
778
+ ),
779
+ ),
780
+ )
781
+ if _response.status_code == 403:
782
+ raise ForbiddenError(
783
+ headers=dict(_response.headers),
784
+ body=typing.cast(
785
+ ProblemDetails,
786
+ parse_obj_as(
787
+ type_=ProblemDetails, # type: ignore
788
+ object_=_response.json(),
789
+ ),
790
+ ),
791
+ )
792
+ if _response.status_code == 404:
793
+ raise NotFoundError(
794
+ headers=dict(_response.headers),
795
+ body=typing.cast(
796
+ typing.Optional[typing.Any],
797
+ parse_obj_as(
798
+ type_=typing.Optional[typing.Any], # type: ignore
799
+ object_=_response.json(),
800
+ ),
801
+ ),
802
+ )
803
+ _response_json = _response.json()
804
+ except JSONDecodeError:
805
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
806
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
807
+
808
+ async def update(
809
+ self,
810
+ id: str,
811
+ *,
812
+ name: str,
813
+ permissions: typing.Optional[typing.Sequence[str]] = OMIT,
814
+ rules: typing.Optional[typing.Sequence[AccessRule]] = OMIT,
815
+ idempotency_key: typing.Optional[str] = None,
816
+ request_options: typing.Optional[RequestOptions] = None,
817
+ ) -> AsyncHttpResponse[Application]:
818
+ """
819
+ Parameters
820
+ ----------
821
+ id : str
822
+
823
+ name : str
824
+
825
+ permissions : typing.Optional[typing.Sequence[str]]
826
+
827
+ rules : typing.Optional[typing.Sequence[AccessRule]]
828
+
829
+ idempotency_key : typing.Optional[str]
830
+
831
+ request_options : typing.Optional[RequestOptions]
832
+ Request-specific configuration.
833
+
834
+ Returns
835
+ -------
836
+ AsyncHttpResponse[Application]
837
+ Success
838
+ """
839
+ _response = await self._client_wrapper.httpx_client.request(
840
+ f"applications/{jsonable_encoder(id)}",
841
+ method="PUT",
842
+ json={
843
+ "name": name,
844
+ "permissions": permissions,
845
+ "rules": convert_and_respect_annotation_metadata(
846
+ object_=rules, annotation=typing.Sequence[AccessRule], direction="write"
847
+ ),
848
+ },
849
+ headers={
850
+ "content-type": "application/json",
851
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
852
+ },
853
+ request_options=request_options,
854
+ omit=OMIT,
855
+ )
856
+ try:
857
+ if 200 <= _response.status_code < 300:
858
+ _data = typing.cast(
859
+ Application,
860
+ parse_obj_as(
861
+ type_=Application, # type: ignore
862
+ object_=_response.json(),
863
+ ),
864
+ )
865
+ return AsyncHttpResponse(response=_response, data=_data)
866
+ if _response.status_code == 400:
867
+ raise BadRequestError(
868
+ headers=dict(_response.headers),
869
+ body=typing.cast(
870
+ ValidationProblemDetails,
871
+ parse_obj_as(
872
+ type_=ValidationProblemDetails, # type: ignore
873
+ object_=_response.json(),
874
+ ),
875
+ ),
876
+ )
877
+ if _response.status_code == 401:
878
+ raise UnauthorizedError(
879
+ headers=dict(_response.headers),
880
+ body=typing.cast(
881
+ ProblemDetails,
882
+ parse_obj_as(
883
+ type_=ProblemDetails, # type: ignore
884
+ object_=_response.json(),
885
+ ),
886
+ ),
887
+ )
888
+ if _response.status_code == 403:
889
+ raise ForbiddenError(
890
+ headers=dict(_response.headers),
891
+ body=typing.cast(
892
+ ProblemDetails,
893
+ parse_obj_as(
894
+ type_=ProblemDetails, # type: ignore
895
+ object_=_response.json(),
896
+ ),
897
+ ),
898
+ )
899
+ if _response.status_code == 404:
900
+ raise NotFoundError(
901
+ headers=dict(_response.headers),
902
+ body=typing.cast(
903
+ typing.Optional[typing.Any],
904
+ parse_obj_as(
905
+ type_=typing.Optional[typing.Any], # type: ignore
906
+ object_=_response.json(),
907
+ ),
908
+ ),
909
+ )
910
+ _response_json = _response.json()
911
+ except JSONDecodeError:
912
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
913
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
914
+
915
+ async def delete(
916
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
917
+ ) -> AsyncHttpResponse[None]:
918
+ """
919
+ Parameters
920
+ ----------
921
+ id : str
922
+
923
+ request_options : typing.Optional[RequestOptions]
924
+ Request-specific configuration.
925
+
926
+ Returns
927
+ -------
928
+ AsyncHttpResponse[None]
929
+ """
930
+ _response = await self._client_wrapper.httpx_client.request(
931
+ f"applications/{jsonable_encoder(id)}",
932
+ method="DELETE",
933
+ request_options=request_options,
934
+ )
935
+ try:
936
+ if 200 <= _response.status_code < 300:
937
+ return AsyncHttpResponse(response=_response, data=None)
938
+ if _response.status_code == 401:
939
+ raise UnauthorizedError(
940
+ headers=dict(_response.headers),
941
+ body=typing.cast(
942
+ ProblemDetails,
943
+ parse_obj_as(
944
+ type_=ProblemDetails, # type: ignore
945
+ object_=_response.json(),
946
+ ),
947
+ ),
948
+ )
949
+ if _response.status_code == 403:
950
+ raise ForbiddenError(
951
+ headers=dict(_response.headers),
952
+ body=typing.cast(
953
+ ProblemDetails,
954
+ parse_obj_as(
955
+ type_=ProblemDetails, # type: ignore
956
+ object_=_response.json(),
957
+ ),
958
+ ),
959
+ )
960
+ if _response.status_code == 404:
961
+ raise NotFoundError(
962
+ headers=dict(_response.headers),
963
+ body=typing.cast(
964
+ typing.Optional[typing.Any],
965
+ parse_obj_as(
966
+ type_=typing.Optional[typing.Any], # type: ignore
967
+ object_=_response.json(),
968
+ ),
969
+ ),
970
+ )
971
+ _response_json = _response.json()
972
+ except JSONDecodeError:
973
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
974
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
975
+
976
+ async def get_by_key(
977
+ self, *, request_options: typing.Optional[RequestOptions] = None
978
+ ) -> AsyncHttpResponse[Application]:
979
+ """
980
+ Parameters
981
+ ----------
982
+ request_options : typing.Optional[RequestOptions]
983
+ Request-specific configuration.
984
+
985
+ Returns
986
+ -------
987
+ AsyncHttpResponse[Application]
988
+ Success
989
+ """
990
+ _response = await self._client_wrapper.httpx_client.request(
991
+ "applications/key",
992
+ method="GET",
993
+ request_options=request_options,
994
+ )
995
+ try:
996
+ if 200 <= _response.status_code < 300:
997
+ _data = typing.cast(
998
+ Application,
999
+ parse_obj_as(
1000
+ type_=Application, # type: ignore
1001
+ object_=_response.json(),
1002
+ ),
1003
+ )
1004
+ return AsyncHttpResponse(response=_response, data=_data)
1005
+ if _response.status_code == 401:
1006
+ raise UnauthorizedError(
1007
+ headers=dict(_response.headers),
1008
+ body=typing.cast(
1009
+ ProblemDetails,
1010
+ parse_obj_as(
1011
+ type_=ProblemDetails, # type: ignore
1012
+ object_=_response.json(),
1013
+ ),
1014
+ ),
1015
+ )
1016
+ if _response.status_code == 404:
1017
+ raise NotFoundError(
1018
+ headers=dict(_response.headers),
1019
+ body=typing.cast(
1020
+ typing.Optional[typing.Any],
1021
+ parse_obj_as(
1022
+ type_=typing.Optional[typing.Any], # type: ignore
1023
+ object_=_response.json(),
1024
+ ),
1025
+ ),
1026
+ )
1027
+ _response_json = _response.json()
1028
+ except JSONDecodeError:
1029
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1030
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)