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,808 @@
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.pydantic_utilities import parse_obj_as
11
+ from ...core.request_options import RequestOptions
12
+ from ...core.serialization import convert_and_respect_annotation_metadata
13
+ from ...errors.bad_request_error import BadRequestError
14
+ from ...errors.forbidden_error import ForbiddenError
15
+ from ...errors.not_found_error import NotFoundError
16
+ from ...errors.unauthorized_error import UnauthorizedError
17
+ from ...types.authenticate_three_ds_session_request import AuthenticateThreeDsSessionRequest
18
+ from ...types.create_three_ds_session_response import CreateThreeDsSessionResponse
19
+ from ...types.problem_details import ProblemDetails
20
+ from ...types.three_ds_authentication import ThreeDsAuthentication
21
+ from ...types.three_ds_callback_urls import ThreeDsCallbackUrls
22
+ from ...types.three_ds_cardholder_info import ThreeDsCardholderInfo
23
+ from ...types.three_ds_device_info import ThreeDsDeviceInfo
24
+ from ...types.three_ds_merchant_info import ThreeDsMerchantInfo
25
+ from ...types.three_ds_message_extension import ThreeDsMessageExtension
26
+ from ...types.three_ds_purchase_info import ThreeDsPurchaseInfo
27
+ from ...types.three_ds_requestor_info import ThreeDsRequestorInfo
28
+ from ...types.three_ds_session import ThreeDsSession
29
+ from ...types.validation_problem_details import ValidationProblemDetails
30
+
31
+ # this is used as the default value for optional parameters
32
+ OMIT = typing.cast(typing.Any, ...)
33
+
34
+
35
+ class RawSessionsClient:
36
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
37
+ self._client_wrapper = client_wrapper
38
+
39
+ def create(
40
+ self,
41
+ *,
42
+ pan: typing.Optional[str] = OMIT,
43
+ token_id: typing.Optional[str] = OMIT,
44
+ token_intent_id: typing.Optional[str] = OMIT,
45
+ type: typing.Optional[str] = OMIT,
46
+ device: typing.Optional[str] = OMIT,
47
+ web_challenge_mode: typing.Optional[str] = OMIT,
48
+ device_info: typing.Optional[ThreeDsDeviceInfo] = OMIT,
49
+ authentication_request: typing.Optional[AuthenticateThreeDsSessionRequest] = OMIT,
50
+ callback_urls: typing.Optional[ThreeDsCallbackUrls] = OMIT,
51
+ request_options: typing.Optional[RequestOptions] = None,
52
+ ) -> HttpResponse[CreateThreeDsSessionResponse]:
53
+ """
54
+ Parameters
55
+ ----------
56
+ pan : typing.Optional[str]
57
+
58
+ token_id : typing.Optional[str]
59
+
60
+ token_intent_id : typing.Optional[str]
61
+
62
+ type : typing.Optional[str]
63
+
64
+ device : typing.Optional[str]
65
+
66
+ web_challenge_mode : typing.Optional[str]
67
+
68
+ device_info : typing.Optional[ThreeDsDeviceInfo]
69
+
70
+ authentication_request : typing.Optional[AuthenticateThreeDsSessionRequest]
71
+
72
+ callback_urls : typing.Optional[ThreeDsCallbackUrls]
73
+
74
+ request_options : typing.Optional[RequestOptions]
75
+ Request-specific configuration.
76
+
77
+ Returns
78
+ -------
79
+ HttpResponse[CreateThreeDsSessionResponse]
80
+ Created
81
+ """
82
+ _response = self._client_wrapper.httpx_client.request(
83
+ "3ds/sessions",
84
+ method="POST",
85
+ json={
86
+ "pan": pan,
87
+ "token_id": token_id,
88
+ "token_intent_id": token_intent_id,
89
+ "type": type,
90
+ "device": device,
91
+ "web_challenge_mode": web_challenge_mode,
92
+ "device_info": convert_and_respect_annotation_metadata(
93
+ object_=device_info, annotation=ThreeDsDeviceInfo, direction="write"
94
+ ),
95
+ "authentication_request": convert_and_respect_annotation_metadata(
96
+ object_=authentication_request, annotation=AuthenticateThreeDsSessionRequest, direction="write"
97
+ ),
98
+ "callback_urls": convert_and_respect_annotation_metadata(
99
+ object_=callback_urls, annotation=ThreeDsCallbackUrls, direction="write"
100
+ ),
101
+ },
102
+ headers={
103
+ "content-type": "application/json",
104
+ },
105
+ request_options=request_options,
106
+ omit=OMIT,
107
+ )
108
+ try:
109
+ if 200 <= _response.status_code < 300:
110
+ _data = typing.cast(
111
+ CreateThreeDsSessionResponse,
112
+ parse_obj_as(
113
+ type_=CreateThreeDsSessionResponse, # type: ignore
114
+ object_=_response.json(),
115
+ ),
116
+ )
117
+ return HttpResponse(response=_response, data=_data)
118
+ if _response.status_code == 400:
119
+ raise BadRequestError(
120
+ headers=dict(_response.headers),
121
+ body=typing.cast(
122
+ ValidationProblemDetails,
123
+ parse_obj_as(
124
+ type_=ValidationProblemDetails, # type: ignore
125
+ object_=_response.json(),
126
+ ),
127
+ ),
128
+ )
129
+ if _response.status_code == 401:
130
+ raise UnauthorizedError(
131
+ headers=dict(_response.headers),
132
+ body=typing.cast(
133
+ ProblemDetails,
134
+ parse_obj_as(
135
+ type_=ProblemDetails, # type: ignore
136
+ object_=_response.json(),
137
+ ),
138
+ ),
139
+ )
140
+ if _response.status_code == 403:
141
+ raise ForbiddenError(
142
+ headers=dict(_response.headers),
143
+ body=typing.cast(
144
+ ProblemDetails,
145
+ parse_obj_as(
146
+ type_=ProblemDetails, # type: ignore
147
+ object_=_response.json(),
148
+ ),
149
+ ),
150
+ )
151
+ _response_json = _response.json()
152
+ except JSONDecodeError:
153
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
154
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
155
+
156
+ def authenticate(
157
+ self,
158
+ session_id: str,
159
+ *,
160
+ authentication_category: str,
161
+ authentication_type: str,
162
+ card_brand: typing.Optional[str] = OMIT,
163
+ challenge_preference: typing.Optional[str] = OMIT,
164
+ request_decoupled_challenge: typing.Optional[bool] = OMIT,
165
+ decoupled_challenge_max_time: typing.Optional[int] = OMIT,
166
+ purchase_info: typing.Optional[ThreeDsPurchaseInfo] = OMIT,
167
+ merchant_info: typing.Optional[ThreeDsMerchantInfo] = OMIT,
168
+ requestor_info: typing.Optional[ThreeDsRequestorInfo] = OMIT,
169
+ cardholder_info: typing.Optional[ThreeDsCardholderInfo] = OMIT,
170
+ broadcast_info: typing.Optional[typing.Optional[typing.Any]] = OMIT,
171
+ message_extensions: typing.Optional[typing.Sequence[ThreeDsMessageExtension]] = OMIT,
172
+ idempotency_key: typing.Optional[str] = None,
173
+ request_options: typing.Optional[RequestOptions] = None,
174
+ ) -> HttpResponse[ThreeDsAuthentication]:
175
+ """
176
+ Parameters
177
+ ----------
178
+ session_id : str
179
+
180
+ authentication_category : str
181
+
182
+ authentication_type : str
183
+
184
+ card_brand : typing.Optional[str]
185
+
186
+ challenge_preference : typing.Optional[str]
187
+
188
+ request_decoupled_challenge : typing.Optional[bool]
189
+
190
+ decoupled_challenge_max_time : typing.Optional[int]
191
+
192
+ purchase_info : typing.Optional[ThreeDsPurchaseInfo]
193
+
194
+ merchant_info : typing.Optional[ThreeDsMerchantInfo]
195
+
196
+ requestor_info : typing.Optional[ThreeDsRequestorInfo]
197
+
198
+ cardholder_info : typing.Optional[ThreeDsCardholderInfo]
199
+
200
+ broadcast_info : typing.Optional[typing.Optional[typing.Any]]
201
+
202
+ message_extensions : typing.Optional[typing.Sequence[ThreeDsMessageExtension]]
203
+
204
+ idempotency_key : typing.Optional[str]
205
+
206
+ request_options : typing.Optional[RequestOptions]
207
+ Request-specific configuration.
208
+
209
+ Returns
210
+ -------
211
+ HttpResponse[ThreeDsAuthentication]
212
+ Success
213
+ """
214
+ _response = self._client_wrapper.httpx_client.request(
215
+ f"3ds/sessions/{jsonable_encoder(session_id)}/authenticate",
216
+ method="POST",
217
+ json={
218
+ "authentication_category": authentication_category,
219
+ "authentication_type": authentication_type,
220
+ "card_brand": card_brand,
221
+ "challenge_preference": challenge_preference,
222
+ "request_decoupled_challenge": request_decoupled_challenge,
223
+ "decoupled_challenge_max_time": decoupled_challenge_max_time,
224
+ "purchase_info": convert_and_respect_annotation_metadata(
225
+ object_=purchase_info, annotation=ThreeDsPurchaseInfo, direction="write"
226
+ ),
227
+ "merchant_info": convert_and_respect_annotation_metadata(
228
+ object_=merchant_info, annotation=ThreeDsMerchantInfo, direction="write"
229
+ ),
230
+ "requestor_info": convert_and_respect_annotation_metadata(
231
+ object_=requestor_info, annotation=ThreeDsRequestorInfo, direction="write"
232
+ ),
233
+ "cardholder_info": convert_and_respect_annotation_metadata(
234
+ object_=cardholder_info, annotation=ThreeDsCardholderInfo, direction="write"
235
+ ),
236
+ "broadcast_info": broadcast_info,
237
+ "message_extensions": convert_and_respect_annotation_metadata(
238
+ object_=message_extensions, annotation=typing.Sequence[ThreeDsMessageExtension], direction="write"
239
+ ),
240
+ },
241
+ headers={
242
+ "content-type": "application/json",
243
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
244
+ },
245
+ request_options=request_options,
246
+ omit=OMIT,
247
+ )
248
+ try:
249
+ if 200 <= _response.status_code < 300:
250
+ _data = typing.cast(
251
+ ThreeDsAuthentication,
252
+ parse_obj_as(
253
+ type_=ThreeDsAuthentication, # type: ignore
254
+ object_=_response.json(),
255
+ ),
256
+ )
257
+ return HttpResponse(response=_response, data=_data)
258
+ if _response.status_code == 401:
259
+ raise UnauthorizedError(
260
+ headers=dict(_response.headers),
261
+ body=typing.cast(
262
+ ProblemDetails,
263
+ parse_obj_as(
264
+ type_=ProblemDetails, # type: ignore
265
+ object_=_response.json(),
266
+ ),
267
+ ),
268
+ )
269
+ if _response.status_code == 403:
270
+ raise ForbiddenError(
271
+ headers=dict(_response.headers),
272
+ body=typing.cast(
273
+ ProblemDetails,
274
+ parse_obj_as(
275
+ type_=ProblemDetails, # type: ignore
276
+ object_=_response.json(),
277
+ ),
278
+ ),
279
+ )
280
+ if _response.status_code == 404:
281
+ raise NotFoundError(
282
+ headers=dict(_response.headers),
283
+ body=typing.cast(
284
+ typing.Optional[typing.Any],
285
+ parse_obj_as(
286
+ type_=typing.Optional[typing.Any], # type: ignore
287
+ object_=_response.json(),
288
+ ),
289
+ ),
290
+ )
291
+ _response_json = _response.json()
292
+ except JSONDecodeError:
293
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
294
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
295
+
296
+ def get_challenge_result(
297
+ self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
298
+ ) -> HttpResponse[ThreeDsAuthentication]:
299
+ """
300
+ Parameters
301
+ ----------
302
+ session_id : str
303
+
304
+ request_options : typing.Optional[RequestOptions]
305
+ Request-specific configuration.
306
+
307
+ Returns
308
+ -------
309
+ HttpResponse[ThreeDsAuthentication]
310
+ Success
311
+ """
312
+ _response = self._client_wrapper.httpx_client.request(
313
+ f"3ds/sessions/{jsonable_encoder(session_id)}/challenge-result",
314
+ method="GET",
315
+ request_options=request_options,
316
+ )
317
+ try:
318
+ if 200 <= _response.status_code < 300:
319
+ _data = typing.cast(
320
+ ThreeDsAuthentication,
321
+ parse_obj_as(
322
+ type_=ThreeDsAuthentication, # type: ignore
323
+ object_=_response.json(),
324
+ ),
325
+ )
326
+ return HttpResponse(response=_response, data=_data)
327
+ if _response.status_code == 401:
328
+ raise UnauthorizedError(
329
+ headers=dict(_response.headers),
330
+ body=typing.cast(
331
+ ProblemDetails,
332
+ parse_obj_as(
333
+ type_=ProblemDetails, # type: ignore
334
+ object_=_response.json(),
335
+ ),
336
+ ),
337
+ )
338
+ if _response.status_code == 403:
339
+ raise ForbiddenError(
340
+ headers=dict(_response.headers),
341
+ body=typing.cast(
342
+ ProblemDetails,
343
+ parse_obj_as(
344
+ type_=ProblemDetails, # type: ignore
345
+ object_=_response.json(),
346
+ ),
347
+ ),
348
+ )
349
+ if _response.status_code == 404:
350
+ raise NotFoundError(
351
+ headers=dict(_response.headers),
352
+ body=typing.cast(
353
+ typing.Optional[typing.Any],
354
+ parse_obj_as(
355
+ type_=typing.Optional[typing.Any], # type: ignore
356
+ object_=_response.json(),
357
+ ),
358
+ ),
359
+ )
360
+ _response_json = _response.json()
361
+ except JSONDecodeError:
362
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
363
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
364
+
365
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[ThreeDsSession]:
366
+ """
367
+ Parameters
368
+ ----------
369
+ id : str
370
+
371
+ request_options : typing.Optional[RequestOptions]
372
+ Request-specific configuration.
373
+
374
+ Returns
375
+ -------
376
+ HttpResponse[ThreeDsSession]
377
+ Success
378
+ """
379
+ _response = self._client_wrapper.httpx_client.request(
380
+ f"3ds/sessions/{jsonable_encoder(id)}",
381
+ method="GET",
382
+ request_options=request_options,
383
+ )
384
+ try:
385
+ if 200 <= _response.status_code < 300:
386
+ _data = typing.cast(
387
+ ThreeDsSession,
388
+ parse_obj_as(
389
+ type_=ThreeDsSession, # type: ignore
390
+ object_=_response.json(),
391
+ ),
392
+ )
393
+ return HttpResponse(response=_response, data=_data)
394
+ if _response.status_code == 401:
395
+ raise UnauthorizedError(
396
+ headers=dict(_response.headers),
397
+ body=typing.cast(
398
+ ProblemDetails,
399
+ parse_obj_as(
400
+ type_=ProblemDetails, # type: ignore
401
+ object_=_response.json(),
402
+ ),
403
+ ),
404
+ )
405
+ if _response.status_code == 404:
406
+ raise NotFoundError(
407
+ headers=dict(_response.headers),
408
+ body=typing.cast(
409
+ typing.Optional[typing.Any],
410
+ parse_obj_as(
411
+ type_=typing.Optional[typing.Any], # type: ignore
412
+ object_=_response.json(),
413
+ ),
414
+ ),
415
+ )
416
+ _response_json = _response.json()
417
+ except JSONDecodeError:
418
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
419
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
420
+
421
+
422
+ class AsyncRawSessionsClient:
423
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
424
+ self._client_wrapper = client_wrapper
425
+
426
+ async def create(
427
+ self,
428
+ *,
429
+ pan: typing.Optional[str] = OMIT,
430
+ token_id: typing.Optional[str] = OMIT,
431
+ token_intent_id: typing.Optional[str] = OMIT,
432
+ type: typing.Optional[str] = OMIT,
433
+ device: typing.Optional[str] = OMIT,
434
+ web_challenge_mode: typing.Optional[str] = OMIT,
435
+ device_info: typing.Optional[ThreeDsDeviceInfo] = OMIT,
436
+ authentication_request: typing.Optional[AuthenticateThreeDsSessionRequest] = OMIT,
437
+ callback_urls: typing.Optional[ThreeDsCallbackUrls] = OMIT,
438
+ request_options: typing.Optional[RequestOptions] = None,
439
+ ) -> AsyncHttpResponse[CreateThreeDsSessionResponse]:
440
+ """
441
+ Parameters
442
+ ----------
443
+ pan : typing.Optional[str]
444
+
445
+ token_id : typing.Optional[str]
446
+
447
+ token_intent_id : typing.Optional[str]
448
+
449
+ type : typing.Optional[str]
450
+
451
+ device : typing.Optional[str]
452
+
453
+ web_challenge_mode : typing.Optional[str]
454
+
455
+ device_info : typing.Optional[ThreeDsDeviceInfo]
456
+
457
+ authentication_request : typing.Optional[AuthenticateThreeDsSessionRequest]
458
+
459
+ callback_urls : typing.Optional[ThreeDsCallbackUrls]
460
+
461
+ request_options : typing.Optional[RequestOptions]
462
+ Request-specific configuration.
463
+
464
+ Returns
465
+ -------
466
+ AsyncHttpResponse[CreateThreeDsSessionResponse]
467
+ Created
468
+ """
469
+ _response = await self._client_wrapper.httpx_client.request(
470
+ "3ds/sessions",
471
+ method="POST",
472
+ json={
473
+ "pan": pan,
474
+ "token_id": token_id,
475
+ "token_intent_id": token_intent_id,
476
+ "type": type,
477
+ "device": device,
478
+ "web_challenge_mode": web_challenge_mode,
479
+ "device_info": convert_and_respect_annotation_metadata(
480
+ object_=device_info, annotation=ThreeDsDeviceInfo, direction="write"
481
+ ),
482
+ "authentication_request": convert_and_respect_annotation_metadata(
483
+ object_=authentication_request, annotation=AuthenticateThreeDsSessionRequest, direction="write"
484
+ ),
485
+ "callback_urls": convert_and_respect_annotation_metadata(
486
+ object_=callback_urls, annotation=ThreeDsCallbackUrls, direction="write"
487
+ ),
488
+ },
489
+ headers={
490
+ "content-type": "application/json",
491
+ },
492
+ request_options=request_options,
493
+ omit=OMIT,
494
+ )
495
+ try:
496
+ if 200 <= _response.status_code < 300:
497
+ _data = typing.cast(
498
+ CreateThreeDsSessionResponse,
499
+ parse_obj_as(
500
+ type_=CreateThreeDsSessionResponse, # type: ignore
501
+ object_=_response.json(),
502
+ ),
503
+ )
504
+ return AsyncHttpResponse(response=_response, data=_data)
505
+ if _response.status_code == 400:
506
+ raise BadRequestError(
507
+ headers=dict(_response.headers),
508
+ body=typing.cast(
509
+ ValidationProblemDetails,
510
+ parse_obj_as(
511
+ type_=ValidationProblemDetails, # type: ignore
512
+ object_=_response.json(),
513
+ ),
514
+ ),
515
+ )
516
+ if _response.status_code == 401:
517
+ raise UnauthorizedError(
518
+ headers=dict(_response.headers),
519
+ body=typing.cast(
520
+ ProblemDetails,
521
+ parse_obj_as(
522
+ type_=ProblemDetails, # type: ignore
523
+ object_=_response.json(),
524
+ ),
525
+ ),
526
+ )
527
+ if _response.status_code == 403:
528
+ raise ForbiddenError(
529
+ headers=dict(_response.headers),
530
+ body=typing.cast(
531
+ ProblemDetails,
532
+ parse_obj_as(
533
+ type_=ProblemDetails, # type: ignore
534
+ object_=_response.json(),
535
+ ),
536
+ ),
537
+ )
538
+ _response_json = _response.json()
539
+ except JSONDecodeError:
540
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
541
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
542
+
543
+ async def authenticate(
544
+ self,
545
+ session_id: str,
546
+ *,
547
+ authentication_category: str,
548
+ authentication_type: str,
549
+ card_brand: typing.Optional[str] = OMIT,
550
+ challenge_preference: typing.Optional[str] = OMIT,
551
+ request_decoupled_challenge: typing.Optional[bool] = OMIT,
552
+ decoupled_challenge_max_time: typing.Optional[int] = OMIT,
553
+ purchase_info: typing.Optional[ThreeDsPurchaseInfo] = OMIT,
554
+ merchant_info: typing.Optional[ThreeDsMerchantInfo] = OMIT,
555
+ requestor_info: typing.Optional[ThreeDsRequestorInfo] = OMIT,
556
+ cardholder_info: typing.Optional[ThreeDsCardholderInfo] = OMIT,
557
+ broadcast_info: typing.Optional[typing.Optional[typing.Any]] = OMIT,
558
+ message_extensions: typing.Optional[typing.Sequence[ThreeDsMessageExtension]] = OMIT,
559
+ idempotency_key: typing.Optional[str] = None,
560
+ request_options: typing.Optional[RequestOptions] = None,
561
+ ) -> AsyncHttpResponse[ThreeDsAuthentication]:
562
+ """
563
+ Parameters
564
+ ----------
565
+ session_id : str
566
+
567
+ authentication_category : str
568
+
569
+ authentication_type : str
570
+
571
+ card_brand : typing.Optional[str]
572
+
573
+ challenge_preference : typing.Optional[str]
574
+
575
+ request_decoupled_challenge : typing.Optional[bool]
576
+
577
+ decoupled_challenge_max_time : typing.Optional[int]
578
+
579
+ purchase_info : typing.Optional[ThreeDsPurchaseInfo]
580
+
581
+ merchant_info : typing.Optional[ThreeDsMerchantInfo]
582
+
583
+ requestor_info : typing.Optional[ThreeDsRequestorInfo]
584
+
585
+ cardholder_info : typing.Optional[ThreeDsCardholderInfo]
586
+
587
+ broadcast_info : typing.Optional[typing.Optional[typing.Any]]
588
+
589
+ message_extensions : typing.Optional[typing.Sequence[ThreeDsMessageExtension]]
590
+
591
+ idempotency_key : typing.Optional[str]
592
+
593
+ request_options : typing.Optional[RequestOptions]
594
+ Request-specific configuration.
595
+
596
+ Returns
597
+ -------
598
+ AsyncHttpResponse[ThreeDsAuthentication]
599
+ Success
600
+ """
601
+ _response = await self._client_wrapper.httpx_client.request(
602
+ f"3ds/sessions/{jsonable_encoder(session_id)}/authenticate",
603
+ method="POST",
604
+ json={
605
+ "authentication_category": authentication_category,
606
+ "authentication_type": authentication_type,
607
+ "card_brand": card_brand,
608
+ "challenge_preference": challenge_preference,
609
+ "request_decoupled_challenge": request_decoupled_challenge,
610
+ "decoupled_challenge_max_time": decoupled_challenge_max_time,
611
+ "purchase_info": convert_and_respect_annotation_metadata(
612
+ object_=purchase_info, annotation=ThreeDsPurchaseInfo, direction="write"
613
+ ),
614
+ "merchant_info": convert_and_respect_annotation_metadata(
615
+ object_=merchant_info, annotation=ThreeDsMerchantInfo, direction="write"
616
+ ),
617
+ "requestor_info": convert_and_respect_annotation_metadata(
618
+ object_=requestor_info, annotation=ThreeDsRequestorInfo, direction="write"
619
+ ),
620
+ "cardholder_info": convert_and_respect_annotation_metadata(
621
+ object_=cardholder_info, annotation=ThreeDsCardholderInfo, direction="write"
622
+ ),
623
+ "broadcast_info": broadcast_info,
624
+ "message_extensions": convert_and_respect_annotation_metadata(
625
+ object_=message_extensions, annotation=typing.Sequence[ThreeDsMessageExtension], direction="write"
626
+ ),
627
+ },
628
+ headers={
629
+ "content-type": "application/json",
630
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
631
+ },
632
+ request_options=request_options,
633
+ omit=OMIT,
634
+ )
635
+ try:
636
+ if 200 <= _response.status_code < 300:
637
+ _data = typing.cast(
638
+ ThreeDsAuthentication,
639
+ parse_obj_as(
640
+ type_=ThreeDsAuthentication, # type: ignore
641
+ object_=_response.json(),
642
+ ),
643
+ )
644
+ return AsyncHttpResponse(response=_response, data=_data)
645
+ if _response.status_code == 401:
646
+ raise UnauthorizedError(
647
+ headers=dict(_response.headers),
648
+ body=typing.cast(
649
+ ProblemDetails,
650
+ parse_obj_as(
651
+ type_=ProblemDetails, # type: ignore
652
+ object_=_response.json(),
653
+ ),
654
+ ),
655
+ )
656
+ if _response.status_code == 403:
657
+ raise ForbiddenError(
658
+ headers=dict(_response.headers),
659
+ body=typing.cast(
660
+ ProblemDetails,
661
+ parse_obj_as(
662
+ type_=ProblemDetails, # type: ignore
663
+ object_=_response.json(),
664
+ ),
665
+ ),
666
+ )
667
+ if _response.status_code == 404:
668
+ raise NotFoundError(
669
+ headers=dict(_response.headers),
670
+ body=typing.cast(
671
+ typing.Optional[typing.Any],
672
+ parse_obj_as(
673
+ type_=typing.Optional[typing.Any], # type: ignore
674
+ object_=_response.json(),
675
+ ),
676
+ ),
677
+ )
678
+ _response_json = _response.json()
679
+ except JSONDecodeError:
680
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
681
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
682
+
683
+ async def get_challenge_result(
684
+ self, session_id: str, *, request_options: typing.Optional[RequestOptions] = None
685
+ ) -> AsyncHttpResponse[ThreeDsAuthentication]:
686
+ """
687
+ Parameters
688
+ ----------
689
+ session_id : str
690
+
691
+ request_options : typing.Optional[RequestOptions]
692
+ Request-specific configuration.
693
+
694
+ Returns
695
+ -------
696
+ AsyncHttpResponse[ThreeDsAuthentication]
697
+ Success
698
+ """
699
+ _response = await self._client_wrapper.httpx_client.request(
700
+ f"3ds/sessions/{jsonable_encoder(session_id)}/challenge-result",
701
+ method="GET",
702
+ request_options=request_options,
703
+ )
704
+ try:
705
+ if 200 <= _response.status_code < 300:
706
+ _data = typing.cast(
707
+ ThreeDsAuthentication,
708
+ parse_obj_as(
709
+ type_=ThreeDsAuthentication, # type: ignore
710
+ object_=_response.json(),
711
+ ),
712
+ )
713
+ return AsyncHttpResponse(response=_response, data=_data)
714
+ if _response.status_code == 401:
715
+ raise UnauthorizedError(
716
+ headers=dict(_response.headers),
717
+ body=typing.cast(
718
+ ProblemDetails,
719
+ parse_obj_as(
720
+ type_=ProblemDetails, # type: ignore
721
+ object_=_response.json(),
722
+ ),
723
+ ),
724
+ )
725
+ if _response.status_code == 403:
726
+ raise ForbiddenError(
727
+ headers=dict(_response.headers),
728
+ body=typing.cast(
729
+ ProblemDetails,
730
+ parse_obj_as(
731
+ type_=ProblemDetails, # type: ignore
732
+ object_=_response.json(),
733
+ ),
734
+ ),
735
+ )
736
+ if _response.status_code == 404:
737
+ raise NotFoundError(
738
+ headers=dict(_response.headers),
739
+ body=typing.cast(
740
+ typing.Optional[typing.Any],
741
+ parse_obj_as(
742
+ type_=typing.Optional[typing.Any], # type: ignore
743
+ object_=_response.json(),
744
+ ),
745
+ ),
746
+ )
747
+ _response_json = _response.json()
748
+ except JSONDecodeError:
749
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
750
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
751
+
752
+ async def get(
753
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
754
+ ) -> AsyncHttpResponse[ThreeDsSession]:
755
+ """
756
+ Parameters
757
+ ----------
758
+ id : str
759
+
760
+ request_options : typing.Optional[RequestOptions]
761
+ Request-specific configuration.
762
+
763
+ Returns
764
+ -------
765
+ AsyncHttpResponse[ThreeDsSession]
766
+ Success
767
+ """
768
+ _response = await self._client_wrapper.httpx_client.request(
769
+ f"3ds/sessions/{jsonable_encoder(id)}",
770
+ method="GET",
771
+ request_options=request_options,
772
+ )
773
+ try:
774
+ if 200 <= _response.status_code < 300:
775
+ _data = typing.cast(
776
+ ThreeDsSession,
777
+ parse_obj_as(
778
+ type_=ThreeDsSession, # type: ignore
779
+ object_=_response.json(),
780
+ ),
781
+ )
782
+ return AsyncHttpResponse(response=_response, data=_data)
783
+ if _response.status_code == 401:
784
+ raise UnauthorizedError(
785
+ headers=dict(_response.headers),
786
+ body=typing.cast(
787
+ ProblemDetails,
788
+ parse_obj_as(
789
+ type_=ProblemDetails, # type: ignore
790
+ object_=_response.json(),
791
+ ),
792
+ ),
793
+ )
794
+ if _response.status_code == 404:
795
+ raise NotFoundError(
796
+ headers=dict(_response.headers),
797
+ body=typing.cast(
798
+ typing.Optional[typing.Any],
799
+ parse_obj_as(
800
+ type_=typing.Optional[typing.Any], # type: ignore
801
+ object_=_response.json(),
802
+ ),
803
+ ),
804
+ )
805
+ _response_json = _response.json()
806
+ except JSONDecodeError:
807
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
808
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)