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,673 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import datetime as dt
4
+ import typing
5
+ from json.decoder import JSONDecodeError
6
+
7
+ from ..core.api_error import ApiError
8
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
9
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
10
+ from ..core.jsonable_encoder import jsonable_encoder
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..errors.bad_request_error import BadRequestError
14
+ from ..errors.forbidden_error import ForbiddenError
15
+ from ..errors.internal_server_error import InternalServerError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
19
+ from ..types.client_encryption_key_metadata_response import ClientEncryptionKeyMetadataResponse
20
+ from ..types.client_encryption_key_response import ClientEncryptionKeyResponse
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 RawKeysClient:
29
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
30
+ self._client_wrapper = client_wrapper
31
+
32
+ def list(
33
+ self, *, request_options: typing.Optional[RequestOptions] = None
34
+ ) -> HttpResponse[typing.List[ClientEncryptionKeyMetadataResponse]]:
35
+ """
36
+ Parameters
37
+ ----------
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ HttpResponse[typing.List[ClientEncryptionKeyMetadataResponse]]
44
+ Success
45
+ """
46
+ _response = self._client_wrapper.httpx_client.request(
47
+ "keys",
48
+ method="GET",
49
+ request_options=request_options,
50
+ )
51
+ try:
52
+ if 200 <= _response.status_code < 300:
53
+ _data = typing.cast(
54
+ typing.List[ClientEncryptionKeyMetadataResponse],
55
+ parse_obj_as(
56
+ type_=typing.List[ClientEncryptionKeyMetadataResponse], # type: ignore
57
+ object_=_response.json(),
58
+ ),
59
+ )
60
+ return HttpResponse(response=_response, data=_data)
61
+ if _response.status_code == 401:
62
+ raise UnauthorizedError(
63
+ headers=dict(_response.headers),
64
+ body=typing.cast(
65
+ ProblemDetails,
66
+ parse_obj_as(
67
+ type_=ProblemDetails, # type: ignore
68
+ object_=_response.json(),
69
+ ),
70
+ ),
71
+ )
72
+ if _response.status_code == 403:
73
+ raise ForbiddenError(
74
+ headers=dict(_response.headers),
75
+ body=typing.cast(
76
+ ProblemDetails,
77
+ parse_obj_as(
78
+ type_=ProblemDetails, # type: ignore
79
+ object_=_response.json(),
80
+ ),
81
+ ),
82
+ )
83
+ if _response.status_code == 500:
84
+ raise InternalServerError(
85
+ headers=dict(_response.headers),
86
+ body=typing.cast(
87
+ ProblemDetails,
88
+ parse_obj_as(
89
+ type_=ProblemDetails, # type: ignore
90
+ object_=_response.json(),
91
+ ),
92
+ ),
93
+ )
94
+ _response_json = _response.json()
95
+ except JSONDecodeError:
96
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
97
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
98
+
99
+ def create(
100
+ self,
101
+ *,
102
+ expires_at: typing.Optional[dt.datetime] = OMIT,
103
+ request_options: typing.Optional[RequestOptions] = None,
104
+ ) -> HttpResponse[ClientEncryptionKeyResponse]:
105
+ """
106
+ Parameters
107
+ ----------
108
+ expires_at : typing.Optional[dt.datetime]
109
+
110
+ request_options : typing.Optional[RequestOptions]
111
+ Request-specific configuration.
112
+
113
+ Returns
114
+ -------
115
+ HttpResponse[ClientEncryptionKeyResponse]
116
+ Created
117
+ """
118
+ _response = self._client_wrapper.httpx_client.request(
119
+ "keys",
120
+ method="POST",
121
+ json={
122
+ "expires_at": expires_at,
123
+ },
124
+ headers={
125
+ "content-type": "application/json-patch+json",
126
+ },
127
+ request_options=request_options,
128
+ omit=OMIT,
129
+ )
130
+ try:
131
+ if 200 <= _response.status_code < 300:
132
+ _data = typing.cast(
133
+ ClientEncryptionKeyResponse,
134
+ parse_obj_as(
135
+ type_=ClientEncryptionKeyResponse, # type: ignore
136
+ object_=_response.json(),
137
+ ),
138
+ )
139
+ return HttpResponse(response=_response, data=_data)
140
+ if _response.status_code == 400:
141
+ raise BadRequestError(
142
+ headers=dict(_response.headers),
143
+ body=typing.cast(
144
+ ValidationProblemDetails,
145
+ parse_obj_as(
146
+ type_=ValidationProblemDetails, # type: ignore
147
+ object_=_response.json(),
148
+ ),
149
+ ),
150
+ )
151
+ if _response.status_code == 401:
152
+ raise UnauthorizedError(
153
+ headers=dict(_response.headers),
154
+ body=typing.cast(
155
+ ProblemDetails,
156
+ parse_obj_as(
157
+ type_=ProblemDetails, # type: ignore
158
+ object_=_response.json(),
159
+ ),
160
+ ),
161
+ )
162
+ if _response.status_code == 403:
163
+ raise ForbiddenError(
164
+ headers=dict(_response.headers),
165
+ body=typing.cast(
166
+ ProblemDetails,
167
+ parse_obj_as(
168
+ type_=ProblemDetails, # type: ignore
169
+ object_=_response.json(),
170
+ ),
171
+ ),
172
+ )
173
+ if _response.status_code == 422:
174
+ raise UnprocessableEntityError(
175
+ headers=dict(_response.headers),
176
+ body=typing.cast(
177
+ ProblemDetails,
178
+ parse_obj_as(
179
+ type_=ProblemDetails, # type: ignore
180
+ object_=_response.json(),
181
+ ),
182
+ ),
183
+ )
184
+ if _response.status_code == 500:
185
+ raise InternalServerError(
186
+ headers=dict(_response.headers),
187
+ body=typing.cast(
188
+ ProblemDetails,
189
+ parse_obj_as(
190
+ type_=ProblemDetails, # type: ignore
191
+ object_=_response.json(),
192
+ ),
193
+ ),
194
+ )
195
+ _response_json = _response.json()
196
+ except JSONDecodeError:
197
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
198
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
199
+
200
+ def get(
201
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
202
+ ) -> HttpResponse[ClientEncryptionKeyMetadataResponse]:
203
+ """
204
+ Parameters
205
+ ----------
206
+ id : str
207
+
208
+ request_options : typing.Optional[RequestOptions]
209
+ Request-specific configuration.
210
+
211
+ Returns
212
+ -------
213
+ HttpResponse[ClientEncryptionKeyMetadataResponse]
214
+ Success
215
+ """
216
+ _response = self._client_wrapper.httpx_client.request(
217
+ f"keys/{jsonable_encoder(id)}",
218
+ method="GET",
219
+ request_options=request_options,
220
+ )
221
+ try:
222
+ if 200 <= _response.status_code < 300:
223
+ _data = typing.cast(
224
+ ClientEncryptionKeyMetadataResponse,
225
+ parse_obj_as(
226
+ type_=ClientEncryptionKeyMetadataResponse, # type: ignore
227
+ object_=_response.json(),
228
+ ),
229
+ )
230
+ return HttpResponse(response=_response, data=_data)
231
+ if _response.status_code == 401:
232
+ raise UnauthorizedError(
233
+ headers=dict(_response.headers),
234
+ body=typing.cast(
235
+ ProblemDetails,
236
+ parse_obj_as(
237
+ type_=ProblemDetails, # type: ignore
238
+ object_=_response.json(),
239
+ ),
240
+ ),
241
+ )
242
+ if _response.status_code == 403:
243
+ raise ForbiddenError(
244
+ headers=dict(_response.headers),
245
+ body=typing.cast(
246
+ ProblemDetails,
247
+ parse_obj_as(
248
+ type_=ProblemDetails, # type: ignore
249
+ object_=_response.json(),
250
+ ),
251
+ ),
252
+ )
253
+ if _response.status_code == 404:
254
+ raise NotFoundError(
255
+ headers=dict(_response.headers),
256
+ body=typing.cast(
257
+ typing.Optional[typing.Any],
258
+ parse_obj_as(
259
+ type_=typing.Optional[typing.Any], # type: ignore
260
+ object_=_response.json(),
261
+ ),
262
+ ),
263
+ )
264
+ if _response.status_code == 500:
265
+ raise InternalServerError(
266
+ headers=dict(_response.headers),
267
+ body=typing.cast(
268
+ ProblemDetails,
269
+ parse_obj_as(
270
+ type_=ProblemDetails, # type: ignore
271
+ object_=_response.json(),
272
+ ),
273
+ ),
274
+ )
275
+ _response_json = _response.json()
276
+ except JSONDecodeError:
277
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
278
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
279
+
280
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
281
+ """
282
+ Parameters
283
+ ----------
284
+ id : str
285
+
286
+ request_options : typing.Optional[RequestOptions]
287
+ Request-specific configuration.
288
+
289
+ Returns
290
+ -------
291
+ HttpResponse[None]
292
+ """
293
+ _response = self._client_wrapper.httpx_client.request(
294
+ f"keys/{jsonable_encoder(id)}",
295
+ method="DELETE",
296
+ request_options=request_options,
297
+ )
298
+ try:
299
+ if 200 <= _response.status_code < 300:
300
+ return HttpResponse(response=_response, data=None)
301
+ if _response.status_code == 401:
302
+ raise UnauthorizedError(
303
+ headers=dict(_response.headers),
304
+ body=typing.cast(
305
+ ProblemDetails,
306
+ parse_obj_as(
307
+ type_=ProblemDetails, # type: ignore
308
+ object_=_response.json(),
309
+ ),
310
+ ),
311
+ )
312
+ if _response.status_code == 403:
313
+ raise ForbiddenError(
314
+ headers=dict(_response.headers),
315
+ body=typing.cast(
316
+ ProblemDetails,
317
+ parse_obj_as(
318
+ type_=ProblemDetails, # type: ignore
319
+ object_=_response.json(),
320
+ ),
321
+ ),
322
+ )
323
+ if _response.status_code == 404:
324
+ raise NotFoundError(
325
+ headers=dict(_response.headers),
326
+ body=typing.cast(
327
+ typing.Optional[typing.Any],
328
+ parse_obj_as(
329
+ type_=typing.Optional[typing.Any], # type: ignore
330
+ object_=_response.json(),
331
+ ),
332
+ ),
333
+ )
334
+ if _response.status_code == 500:
335
+ raise InternalServerError(
336
+ headers=dict(_response.headers),
337
+ body=typing.cast(
338
+ ProblemDetails,
339
+ parse_obj_as(
340
+ type_=ProblemDetails, # type: ignore
341
+ object_=_response.json(),
342
+ ),
343
+ ),
344
+ )
345
+ _response_json = _response.json()
346
+ except JSONDecodeError:
347
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
348
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
349
+
350
+
351
+ class AsyncRawKeysClient:
352
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
353
+ self._client_wrapper = client_wrapper
354
+
355
+ async def list(
356
+ self, *, request_options: typing.Optional[RequestOptions] = None
357
+ ) -> AsyncHttpResponse[typing.List[ClientEncryptionKeyMetadataResponse]]:
358
+ """
359
+ Parameters
360
+ ----------
361
+ request_options : typing.Optional[RequestOptions]
362
+ Request-specific configuration.
363
+
364
+ Returns
365
+ -------
366
+ AsyncHttpResponse[typing.List[ClientEncryptionKeyMetadataResponse]]
367
+ Success
368
+ """
369
+ _response = await self._client_wrapper.httpx_client.request(
370
+ "keys",
371
+ method="GET",
372
+ request_options=request_options,
373
+ )
374
+ try:
375
+ if 200 <= _response.status_code < 300:
376
+ _data = typing.cast(
377
+ typing.List[ClientEncryptionKeyMetadataResponse],
378
+ parse_obj_as(
379
+ type_=typing.List[ClientEncryptionKeyMetadataResponse], # type: ignore
380
+ object_=_response.json(),
381
+ ),
382
+ )
383
+ return AsyncHttpResponse(response=_response, data=_data)
384
+ if _response.status_code == 401:
385
+ raise UnauthorizedError(
386
+ headers=dict(_response.headers),
387
+ body=typing.cast(
388
+ ProblemDetails,
389
+ parse_obj_as(
390
+ type_=ProblemDetails, # type: ignore
391
+ object_=_response.json(),
392
+ ),
393
+ ),
394
+ )
395
+ if _response.status_code == 403:
396
+ raise ForbiddenError(
397
+ headers=dict(_response.headers),
398
+ body=typing.cast(
399
+ ProblemDetails,
400
+ parse_obj_as(
401
+ type_=ProblemDetails, # type: ignore
402
+ object_=_response.json(),
403
+ ),
404
+ ),
405
+ )
406
+ if _response.status_code == 500:
407
+ raise InternalServerError(
408
+ headers=dict(_response.headers),
409
+ body=typing.cast(
410
+ ProblemDetails,
411
+ parse_obj_as(
412
+ type_=ProblemDetails, # type: ignore
413
+ object_=_response.json(),
414
+ ),
415
+ ),
416
+ )
417
+ _response_json = _response.json()
418
+ except JSONDecodeError:
419
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
420
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
421
+
422
+ async def create(
423
+ self,
424
+ *,
425
+ expires_at: typing.Optional[dt.datetime] = OMIT,
426
+ request_options: typing.Optional[RequestOptions] = None,
427
+ ) -> AsyncHttpResponse[ClientEncryptionKeyResponse]:
428
+ """
429
+ Parameters
430
+ ----------
431
+ expires_at : typing.Optional[dt.datetime]
432
+
433
+ request_options : typing.Optional[RequestOptions]
434
+ Request-specific configuration.
435
+
436
+ Returns
437
+ -------
438
+ AsyncHttpResponse[ClientEncryptionKeyResponse]
439
+ Created
440
+ """
441
+ _response = await self._client_wrapper.httpx_client.request(
442
+ "keys",
443
+ method="POST",
444
+ json={
445
+ "expires_at": expires_at,
446
+ },
447
+ headers={
448
+ "content-type": "application/json-patch+json",
449
+ },
450
+ request_options=request_options,
451
+ omit=OMIT,
452
+ )
453
+ try:
454
+ if 200 <= _response.status_code < 300:
455
+ _data = typing.cast(
456
+ ClientEncryptionKeyResponse,
457
+ parse_obj_as(
458
+ type_=ClientEncryptionKeyResponse, # type: ignore
459
+ object_=_response.json(),
460
+ ),
461
+ )
462
+ return AsyncHttpResponse(response=_response, data=_data)
463
+ if _response.status_code == 400:
464
+ raise BadRequestError(
465
+ headers=dict(_response.headers),
466
+ body=typing.cast(
467
+ ValidationProblemDetails,
468
+ parse_obj_as(
469
+ type_=ValidationProblemDetails, # type: ignore
470
+ object_=_response.json(),
471
+ ),
472
+ ),
473
+ )
474
+ if _response.status_code == 401:
475
+ raise UnauthorizedError(
476
+ headers=dict(_response.headers),
477
+ body=typing.cast(
478
+ ProblemDetails,
479
+ parse_obj_as(
480
+ type_=ProblemDetails, # type: ignore
481
+ object_=_response.json(),
482
+ ),
483
+ ),
484
+ )
485
+ if _response.status_code == 403:
486
+ raise ForbiddenError(
487
+ headers=dict(_response.headers),
488
+ body=typing.cast(
489
+ ProblemDetails,
490
+ parse_obj_as(
491
+ type_=ProblemDetails, # type: ignore
492
+ object_=_response.json(),
493
+ ),
494
+ ),
495
+ )
496
+ if _response.status_code == 422:
497
+ raise UnprocessableEntityError(
498
+ headers=dict(_response.headers),
499
+ body=typing.cast(
500
+ ProblemDetails,
501
+ parse_obj_as(
502
+ type_=ProblemDetails, # type: ignore
503
+ object_=_response.json(),
504
+ ),
505
+ ),
506
+ )
507
+ if _response.status_code == 500:
508
+ raise InternalServerError(
509
+ headers=dict(_response.headers),
510
+ body=typing.cast(
511
+ ProblemDetails,
512
+ parse_obj_as(
513
+ type_=ProblemDetails, # type: ignore
514
+ object_=_response.json(),
515
+ ),
516
+ ),
517
+ )
518
+ _response_json = _response.json()
519
+ except JSONDecodeError:
520
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
521
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
522
+
523
+ async def get(
524
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
525
+ ) -> AsyncHttpResponse[ClientEncryptionKeyMetadataResponse]:
526
+ """
527
+ Parameters
528
+ ----------
529
+ id : str
530
+
531
+ request_options : typing.Optional[RequestOptions]
532
+ Request-specific configuration.
533
+
534
+ Returns
535
+ -------
536
+ AsyncHttpResponse[ClientEncryptionKeyMetadataResponse]
537
+ Success
538
+ """
539
+ _response = await self._client_wrapper.httpx_client.request(
540
+ f"keys/{jsonable_encoder(id)}",
541
+ method="GET",
542
+ request_options=request_options,
543
+ )
544
+ try:
545
+ if 200 <= _response.status_code < 300:
546
+ _data = typing.cast(
547
+ ClientEncryptionKeyMetadataResponse,
548
+ parse_obj_as(
549
+ type_=ClientEncryptionKeyMetadataResponse, # type: ignore
550
+ object_=_response.json(),
551
+ ),
552
+ )
553
+ return AsyncHttpResponse(response=_response, data=_data)
554
+ if _response.status_code == 401:
555
+ raise UnauthorizedError(
556
+ headers=dict(_response.headers),
557
+ body=typing.cast(
558
+ ProblemDetails,
559
+ parse_obj_as(
560
+ type_=ProblemDetails, # type: ignore
561
+ object_=_response.json(),
562
+ ),
563
+ ),
564
+ )
565
+ if _response.status_code == 403:
566
+ raise ForbiddenError(
567
+ headers=dict(_response.headers),
568
+ body=typing.cast(
569
+ ProblemDetails,
570
+ parse_obj_as(
571
+ type_=ProblemDetails, # type: ignore
572
+ object_=_response.json(),
573
+ ),
574
+ ),
575
+ )
576
+ if _response.status_code == 404:
577
+ raise NotFoundError(
578
+ headers=dict(_response.headers),
579
+ body=typing.cast(
580
+ typing.Optional[typing.Any],
581
+ parse_obj_as(
582
+ type_=typing.Optional[typing.Any], # type: ignore
583
+ object_=_response.json(),
584
+ ),
585
+ ),
586
+ )
587
+ if _response.status_code == 500:
588
+ raise InternalServerError(
589
+ headers=dict(_response.headers),
590
+ body=typing.cast(
591
+ ProblemDetails,
592
+ parse_obj_as(
593
+ type_=ProblemDetails, # type: ignore
594
+ object_=_response.json(),
595
+ ),
596
+ ),
597
+ )
598
+ _response_json = _response.json()
599
+ except JSONDecodeError:
600
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
601
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
602
+
603
+ async def delete(
604
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
605
+ ) -> AsyncHttpResponse[None]:
606
+ """
607
+ Parameters
608
+ ----------
609
+ id : str
610
+
611
+ request_options : typing.Optional[RequestOptions]
612
+ Request-specific configuration.
613
+
614
+ Returns
615
+ -------
616
+ AsyncHttpResponse[None]
617
+ """
618
+ _response = await self._client_wrapper.httpx_client.request(
619
+ f"keys/{jsonable_encoder(id)}",
620
+ method="DELETE",
621
+ request_options=request_options,
622
+ )
623
+ try:
624
+ if 200 <= _response.status_code < 300:
625
+ return AsyncHttpResponse(response=_response, data=None)
626
+ if _response.status_code == 401:
627
+ raise UnauthorizedError(
628
+ headers=dict(_response.headers),
629
+ body=typing.cast(
630
+ ProblemDetails,
631
+ parse_obj_as(
632
+ type_=ProblemDetails, # type: ignore
633
+ object_=_response.json(),
634
+ ),
635
+ ),
636
+ )
637
+ if _response.status_code == 403:
638
+ raise ForbiddenError(
639
+ headers=dict(_response.headers),
640
+ body=typing.cast(
641
+ ProblemDetails,
642
+ parse_obj_as(
643
+ type_=ProblemDetails, # type: ignore
644
+ object_=_response.json(),
645
+ ),
646
+ ),
647
+ )
648
+ if _response.status_code == 404:
649
+ raise NotFoundError(
650
+ headers=dict(_response.headers),
651
+ body=typing.cast(
652
+ typing.Optional[typing.Any],
653
+ parse_obj_as(
654
+ type_=typing.Optional[typing.Any], # type: ignore
655
+ object_=_response.json(),
656
+ ),
657
+ ),
658
+ )
659
+ if _response.status_code == 500:
660
+ raise InternalServerError(
661
+ headers=dict(_response.headers),
662
+ body=typing.cast(
663
+ ProblemDetails,
664
+ parse_obj_as(
665
+ type_=ProblemDetails, # type: ignore
666
+ object_=_response.json(),
667
+ ),
668
+ ),
669
+ )
670
+ _response_json = _response.json()
671
+ except JSONDecodeError:
672
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
673
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
@@ -0,0 +1,4 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ # isort: skip_file
4
+