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,943 @@
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 ..errors.bad_request_error import BadRequestError
13
+ from ..errors.forbidden_error import ForbiddenError
14
+ from ..errors.not_found_error import NotFoundError
15
+ from ..errors.unauthorized_error import UnauthorizedError
16
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
17
+ from ..types.problem_details import ProblemDetails
18
+ from ..types.validation_problem_details import ValidationProblemDetails
19
+ from ..types.webhook import Webhook
20
+ from ..types.webhook_list import WebhookList
21
+
22
+ # this is used as the default value for optional parameters
23
+ OMIT = typing.cast(typing.Any, ...)
24
+
25
+
26
+ class RawWebhooksClient:
27
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
28
+ self._client_wrapper = client_wrapper
29
+
30
+ def ping(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
31
+ """
32
+ Simple endpoint that can be utilized to verify the application is running
33
+
34
+ Parameters
35
+ ----------
36
+ request_options : typing.Optional[RequestOptions]
37
+ Request-specific configuration.
38
+
39
+ Returns
40
+ -------
41
+ HttpResponse[None]
42
+ """
43
+ _response = self._client_wrapper.httpx_client.request(
44
+ "ping",
45
+ method="GET",
46
+ request_options=request_options,
47
+ )
48
+ try:
49
+ if 200 <= _response.status_code < 300:
50
+ return HttpResponse(response=_response, data=None)
51
+ _response_json = _response.json()
52
+ except JSONDecodeError:
53
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
54
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
55
+
56
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Webhook]:
57
+ """
58
+ Returns the webhook
59
+
60
+ Parameters
61
+ ----------
62
+ id : str
63
+
64
+ request_options : typing.Optional[RequestOptions]
65
+ Request-specific configuration.
66
+
67
+ Returns
68
+ -------
69
+ HttpResponse[Webhook]
70
+ Success
71
+ """
72
+ _response = self._client_wrapper.httpx_client.request(
73
+ f"webhooks/{jsonable_encoder(id)}",
74
+ method="GET",
75
+ request_options=request_options,
76
+ )
77
+ try:
78
+ if 200 <= _response.status_code < 300:
79
+ _data = typing.cast(
80
+ Webhook,
81
+ parse_obj_as(
82
+ type_=Webhook, # type: ignore
83
+ object_=_response.json(),
84
+ ),
85
+ )
86
+ return HttpResponse(response=_response, data=_data)
87
+ if _response.status_code == 401:
88
+ raise UnauthorizedError(
89
+ headers=dict(_response.headers),
90
+ body=typing.cast(
91
+ ProblemDetails,
92
+ parse_obj_as(
93
+ type_=ProblemDetails, # type: ignore
94
+ object_=_response.json(),
95
+ ),
96
+ ),
97
+ )
98
+ if _response.status_code == 403:
99
+ raise ForbiddenError(
100
+ headers=dict(_response.headers),
101
+ body=typing.cast(
102
+ ProblemDetails,
103
+ parse_obj_as(
104
+ type_=ProblemDetails, # type: ignore
105
+ object_=_response.json(),
106
+ ),
107
+ ),
108
+ )
109
+ if _response.status_code == 404:
110
+ raise NotFoundError(
111
+ headers=dict(_response.headers),
112
+ body=typing.cast(
113
+ typing.Optional[typing.Any],
114
+ parse_obj_as(
115
+ type_=typing.Optional[typing.Any], # type: ignore
116
+ object_=_response.json(),
117
+ ),
118
+ ),
119
+ )
120
+ _response_json = _response.json()
121
+ except JSONDecodeError:
122
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
123
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
124
+
125
+ def update(
126
+ self,
127
+ id: str,
128
+ *,
129
+ name: str,
130
+ url: str,
131
+ events: typing.Sequence[str],
132
+ notify_email: typing.Optional[str] = OMIT,
133
+ request_options: typing.Optional[RequestOptions] = None,
134
+ ) -> HttpResponse[Webhook]:
135
+ """
136
+ Update a new webhook
137
+
138
+ Parameters
139
+ ----------
140
+ id : str
141
+
142
+ name : str
143
+ The name of the webhook
144
+
145
+ url : str
146
+ The URL to which the webhook will send events
147
+
148
+ events : typing.Sequence[str]
149
+ An array of event types that the webhook will listen for
150
+
151
+ notify_email : typing.Optional[str]
152
+ The email address to use for management notification events. Ie: webhook disabled
153
+
154
+ request_options : typing.Optional[RequestOptions]
155
+ Request-specific configuration.
156
+
157
+ Returns
158
+ -------
159
+ HttpResponse[Webhook]
160
+ Success
161
+ """
162
+ _response = self._client_wrapper.httpx_client.request(
163
+ f"webhooks/{jsonable_encoder(id)}",
164
+ method="PUT",
165
+ json={
166
+ "name": name,
167
+ "url": url,
168
+ "notify_email": notify_email,
169
+ "events": events,
170
+ },
171
+ headers={
172
+ "content-type": "application/json",
173
+ },
174
+ request_options=request_options,
175
+ omit=OMIT,
176
+ )
177
+ try:
178
+ if 200 <= _response.status_code < 300:
179
+ _data = typing.cast(
180
+ Webhook,
181
+ parse_obj_as(
182
+ type_=Webhook, # type: ignore
183
+ object_=_response.json(),
184
+ ),
185
+ )
186
+ return HttpResponse(response=_response, data=_data)
187
+ if _response.status_code == 400:
188
+ raise BadRequestError(
189
+ headers=dict(_response.headers),
190
+ body=typing.cast(
191
+ ValidationProblemDetails,
192
+ parse_obj_as(
193
+ type_=ValidationProblemDetails, # type: ignore
194
+ object_=_response.json(),
195
+ ),
196
+ ),
197
+ )
198
+ if _response.status_code == 401:
199
+ raise UnauthorizedError(
200
+ headers=dict(_response.headers),
201
+ body=typing.cast(
202
+ ProblemDetails,
203
+ parse_obj_as(
204
+ type_=ProblemDetails, # type: ignore
205
+ object_=_response.json(),
206
+ ),
207
+ ),
208
+ )
209
+ if _response.status_code == 403:
210
+ raise ForbiddenError(
211
+ headers=dict(_response.headers),
212
+ body=typing.cast(
213
+ ProblemDetails,
214
+ parse_obj_as(
215
+ type_=ProblemDetails, # type: ignore
216
+ object_=_response.json(),
217
+ ),
218
+ ),
219
+ )
220
+ if _response.status_code == 404:
221
+ raise NotFoundError(
222
+ headers=dict(_response.headers),
223
+ body=typing.cast(
224
+ typing.Optional[typing.Any],
225
+ parse_obj_as(
226
+ type_=typing.Optional[typing.Any], # type: ignore
227
+ object_=_response.json(),
228
+ ),
229
+ ),
230
+ )
231
+ _response_json = _response.json()
232
+ except JSONDecodeError:
233
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
234
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
235
+
236
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
237
+ """
238
+ Delete a new webhook
239
+
240
+ Parameters
241
+ ----------
242
+ id : str
243
+
244
+ request_options : typing.Optional[RequestOptions]
245
+ Request-specific configuration.
246
+
247
+ Returns
248
+ -------
249
+ HttpResponse[None]
250
+ """
251
+ _response = self._client_wrapper.httpx_client.request(
252
+ f"webhooks/{jsonable_encoder(id)}",
253
+ method="DELETE",
254
+ request_options=request_options,
255
+ )
256
+ try:
257
+ if 200 <= _response.status_code < 300:
258
+ return HttpResponse(response=_response, data=None)
259
+ if _response.status_code == 400:
260
+ raise BadRequestError(
261
+ headers=dict(_response.headers),
262
+ body=typing.cast(
263
+ ValidationProblemDetails,
264
+ parse_obj_as(
265
+ type_=ValidationProblemDetails, # type: ignore
266
+ object_=_response.json(),
267
+ ),
268
+ ),
269
+ )
270
+ if _response.status_code == 401:
271
+ raise UnauthorizedError(
272
+ headers=dict(_response.headers),
273
+ body=typing.cast(
274
+ ProblemDetails,
275
+ parse_obj_as(
276
+ type_=ProblemDetails, # type: ignore
277
+ object_=_response.json(),
278
+ ),
279
+ ),
280
+ )
281
+ if _response.status_code == 403:
282
+ raise ForbiddenError(
283
+ headers=dict(_response.headers),
284
+ body=typing.cast(
285
+ ProblemDetails,
286
+ parse_obj_as(
287
+ type_=ProblemDetails, # type: ignore
288
+ object_=_response.json(),
289
+ ),
290
+ ),
291
+ )
292
+ if _response.status_code == 404:
293
+ raise NotFoundError(
294
+ headers=dict(_response.headers),
295
+ body=typing.cast(
296
+ typing.Optional[typing.Any],
297
+ parse_obj_as(
298
+ type_=typing.Optional[typing.Any], # type: ignore
299
+ object_=_response.json(),
300
+ ),
301
+ ),
302
+ )
303
+ _response_json = _response.json()
304
+ except JSONDecodeError:
305
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
306
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
307
+
308
+ def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[WebhookList]:
309
+ """
310
+ Returns the configured webhooks
311
+
312
+ Parameters
313
+ ----------
314
+ request_options : typing.Optional[RequestOptions]
315
+ Request-specific configuration.
316
+
317
+ Returns
318
+ -------
319
+ HttpResponse[WebhookList]
320
+ Success
321
+ """
322
+ _response = self._client_wrapper.httpx_client.request(
323
+ "webhooks",
324
+ method="GET",
325
+ request_options=request_options,
326
+ )
327
+ try:
328
+ if 200 <= _response.status_code < 300:
329
+ _data = typing.cast(
330
+ WebhookList,
331
+ parse_obj_as(
332
+ type_=WebhookList, # type: ignore
333
+ object_=_response.json(),
334
+ ),
335
+ )
336
+ return HttpResponse(response=_response, data=_data)
337
+ if _response.status_code == 400:
338
+ raise BadRequestError(
339
+ headers=dict(_response.headers),
340
+ body=typing.cast(
341
+ ValidationProblemDetails,
342
+ parse_obj_as(
343
+ type_=ValidationProblemDetails, # type: ignore
344
+ object_=_response.json(),
345
+ ),
346
+ ),
347
+ )
348
+ if _response.status_code == 401:
349
+ raise UnauthorizedError(
350
+ headers=dict(_response.headers),
351
+ body=typing.cast(
352
+ ProblemDetails,
353
+ parse_obj_as(
354
+ type_=ProblemDetails, # type: ignore
355
+ object_=_response.json(),
356
+ ),
357
+ ),
358
+ )
359
+ if _response.status_code == 403:
360
+ raise ForbiddenError(
361
+ headers=dict(_response.headers),
362
+ body=typing.cast(
363
+ ProblemDetails,
364
+ parse_obj_as(
365
+ type_=ProblemDetails, # type: ignore
366
+ object_=_response.json(),
367
+ ),
368
+ ),
369
+ )
370
+ _response_json = _response.json()
371
+ except JSONDecodeError:
372
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
373
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
374
+
375
+ def create(
376
+ self,
377
+ *,
378
+ name: str,
379
+ url: str,
380
+ events: typing.Sequence[str],
381
+ notify_email: typing.Optional[str] = OMIT,
382
+ request_options: typing.Optional[RequestOptions] = None,
383
+ ) -> HttpResponse[Webhook]:
384
+ """
385
+ Create a new webhook
386
+
387
+ Parameters
388
+ ----------
389
+ name : str
390
+ The name of the webhook
391
+
392
+ url : str
393
+ The URL to which the webhook will send events
394
+
395
+ events : typing.Sequence[str]
396
+ An array of event types that the webhook will listen for
397
+
398
+ notify_email : typing.Optional[str]
399
+ The email address to use for management notification events. Ie: webhook disabled
400
+
401
+ request_options : typing.Optional[RequestOptions]
402
+ Request-specific configuration.
403
+
404
+ Returns
405
+ -------
406
+ HttpResponse[Webhook]
407
+ Success
408
+ """
409
+ _response = self._client_wrapper.httpx_client.request(
410
+ "webhooks",
411
+ method="POST",
412
+ json={
413
+ "name": name,
414
+ "url": url,
415
+ "notify_email": notify_email,
416
+ "events": events,
417
+ },
418
+ headers={
419
+ "content-type": "application/json",
420
+ },
421
+ request_options=request_options,
422
+ omit=OMIT,
423
+ )
424
+ try:
425
+ if 200 <= _response.status_code < 300:
426
+ _data = typing.cast(
427
+ Webhook,
428
+ parse_obj_as(
429
+ type_=Webhook, # type: ignore
430
+ object_=_response.json(),
431
+ ),
432
+ )
433
+ return HttpResponse(response=_response, data=_data)
434
+ if _response.status_code == 400:
435
+ raise BadRequestError(
436
+ headers=dict(_response.headers),
437
+ body=typing.cast(
438
+ ValidationProblemDetails,
439
+ parse_obj_as(
440
+ type_=ValidationProblemDetails, # type: ignore
441
+ object_=_response.json(),
442
+ ),
443
+ ),
444
+ )
445
+ if _response.status_code == 401:
446
+ raise UnauthorizedError(
447
+ headers=dict(_response.headers),
448
+ body=typing.cast(
449
+ ProblemDetails,
450
+ parse_obj_as(
451
+ type_=ProblemDetails, # type: ignore
452
+ object_=_response.json(),
453
+ ),
454
+ ),
455
+ )
456
+ if _response.status_code == 403:
457
+ raise ForbiddenError(
458
+ headers=dict(_response.headers),
459
+ body=typing.cast(
460
+ ProblemDetails,
461
+ parse_obj_as(
462
+ type_=ProblemDetails, # type: ignore
463
+ object_=_response.json(),
464
+ ),
465
+ ),
466
+ )
467
+ if _response.status_code == 422:
468
+ raise UnprocessableEntityError(
469
+ headers=dict(_response.headers),
470
+ body=typing.cast(
471
+ ProblemDetails,
472
+ parse_obj_as(
473
+ type_=ProblemDetails, # type: ignore
474
+ object_=_response.json(),
475
+ ),
476
+ ),
477
+ )
478
+ _response_json = _response.json()
479
+ except JSONDecodeError:
480
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
481
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
482
+
483
+
484
+ class AsyncRawWebhooksClient:
485
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
486
+ self._client_wrapper = client_wrapper
487
+
488
+ async def ping(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[None]:
489
+ """
490
+ Simple endpoint that can be utilized to verify the application is running
491
+
492
+ Parameters
493
+ ----------
494
+ request_options : typing.Optional[RequestOptions]
495
+ Request-specific configuration.
496
+
497
+ Returns
498
+ -------
499
+ AsyncHttpResponse[None]
500
+ """
501
+ _response = await self._client_wrapper.httpx_client.request(
502
+ "ping",
503
+ method="GET",
504
+ request_options=request_options,
505
+ )
506
+ try:
507
+ if 200 <= _response.status_code < 300:
508
+ return AsyncHttpResponse(response=_response, data=None)
509
+ _response_json = _response.json()
510
+ except JSONDecodeError:
511
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
512
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
513
+
514
+ async def get(
515
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
516
+ ) -> AsyncHttpResponse[Webhook]:
517
+ """
518
+ Returns the webhook
519
+
520
+ Parameters
521
+ ----------
522
+ id : str
523
+
524
+ request_options : typing.Optional[RequestOptions]
525
+ Request-specific configuration.
526
+
527
+ Returns
528
+ -------
529
+ AsyncHttpResponse[Webhook]
530
+ Success
531
+ """
532
+ _response = await self._client_wrapper.httpx_client.request(
533
+ f"webhooks/{jsonable_encoder(id)}",
534
+ method="GET",
535
+ request_options=request_options,
536
+ )
537
+ try:
538
+ if 200 <= _response.status_code < 300:
539
+ _data = typing.cast(
540
+ Webhook,
541
+ parse_obj_as(
542
+ type_=Webhook, # type: ignore
543
+ object_=_response.json(),
544
+ ),
545
+ )
546
+ return AsyncHttpResponse(response=_response, data=_data)
547
+ if _response.status_code == 401:
548
+ raise UnauthorizedError(
549
+ headers=dict(_response.headers),
550
+ body=typing.cast(
551
+ ProblemDetails,
552
+ parse_obj_as(
553
+ type_=ProblemDetails, # type: ignore
554
+ object_=_response.json(),
555
+ ),
556
+ ),
557
+ )
558
+ if _response.status_code == 403:
559
+ raise ForbiddenError(
560
+ headers=dict(_response.headers),
561
+ body=typing.cast(
562
+ ProblemDetails,
563
+ parse_obj_as(
564
+ type_=ProblemDetails, # type: ignore
565
+ object_=_response.json(),
566
+ ),
567
+ ),
568
+ )
569
+ if _response.status_code == 404:
570
+ raise NotFoundError(
571
+ headers=dict(_response.headers),
572
+ body=typing.cast(
573
+ typing.Optional[typing.Any],
574
+ parse_obj_as(
575
+ type_=typing.Optional[typing.Any], # type: ignore
576
+ object_=_response.json(),
577
+ ),
578
+ ),
579
+ )
580
+ _response_json = _response.json()
581
+ except JSONDecodeError:
582
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
583
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
584
+
585
+ async def update(
586
+ self,
587
+ id: str,
588
+ *,
589
+ name: str,
590
+ url: str,
591
+ events: typing.Sequence[str],
592
+ notify_email: typing.Optional[str] = OMIT,
593
+ request_options: typing.Optional[RequestOptions] = None,
594
+ ) -> AsyncHttpResponse[Webhook]:
595
+ """
596
+ Update a new webhook
597
+
598
+ Parameters
599
+ ----------
600
+ id : str
601
+
602
+ name : str
603
+ The name of the webhook
604
+
605
+ url : str
606
+ The URL to which the webhook will send events
607
+
608
+ events : typing.Sequence[str]
609
+ An array of event types that the webhook will listen for
610
+
611
+ notify_email : typing.Optional[str]
612
+ The email address to use for management notification events. Ie: webhook disabled
613
+
614
+ request_options : typing.Optional[RequestOptions]
615
+ Request-specific configuration.
616
+
617
+ Returns
618
+ -------
619
+ AsyncHttpResponse[Webhook]
620
+ Success
621
+ """
622
+ _response = await self._client_wrapper.httpx_client.request(
623
+ f"webhooks/{jsonable_encoder(id)}",
624
+ method="PUT",
625
+ json={
626
+ "name": name,
627
+ "url": url,
628
+ "notify_email": notify_email,
629
+ "events": events,
630
+ },
631
+ headers={
632
+ "content-type": "application/json",
633
+ },
634
+ request_options=request_options,
635
+ omit=OMIT,
636
+ )
637
+ try:
638
+ if 200 <= _response.status_code < 300:
639
+ _data = typing.cast(
640
+ Webhook,
641
+ parse_obj_as(
642
+ type_=Webhook, # type: ignore
643
+ object_=_response.json(),
644
+ ),
645
+ )
646
+ return AsyncHttpResponse(response=_response, data=_data)
647
+ if _response.status_code == 400:
648
+ raise BadRequestError(
649
+ headers=dict(_response.headers),
650
+ body=typing.cast(
651
+ ValidationProblemDetails,
652
+ parse_obj_as(
653
+ type_=ValidationProblemDetails, # type: ignore
654
+ object_=_response.json(),
655
+ ),
656
+ ),
657
+ )
658
+ if _response.status_code == 401:
659
+ raise UnauthorizedError(
660
+ headers=dict(_response.headers),
661
+ body=typing.cast(
662
+ ProblemDetails,
663
+ parse_obj_as(
664
+ type_=ProblemDetails, # type: ignore
665
+ object_=_response.json(),
666
+ ),
667
+ ),
668
+ )
669
+ if _response.status_code == 403:
670
+ raise ForbiddenError(
671
+ headers=dict(_response.headers),
672
+ body=typing.cast(
673
+ ProblemDetails,
674
+ parse_obj_as(
675
+ type_=ProblemDetails, # type: ignore
676
+ object_=_response.json(),
677
+ ),
678
+ ),
679
+ )
680
+ if _response.status_code == 404:
681
+ raise NotFoundError(
682
+ headers=dict(_response.headers),
683
+ body=typing.cast(
684
+ typing.Optional[typing.Any],
685
+ parse_obj_as(
686
+ type_=typing.Optional[typing.Any], # type: ignore
687
+ object_=_response.json(),
688
+ ),
689
+ ),
690
+ )
691
+ _response_json = _response.json()
692
+ except JSONDecodeError:
693
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
694
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
695
+
696
+ async def delete(
697
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
698
+ ) -> AsyncHttpResponse[None]:
699
+ """
700
+ Delete a new webhook
701
+
702
+ Parameters
703
+ ----------
704
+ id : str
705
+
706
+ request_options : typing.Optional[RequestOptions]
707
+ Request-specific configuration.
708
+
709
+ Returns
710
+ -------
711
+ AsyncHttpResponse[None]
712
+ """
713
+ _response = await self._client_wrapper.httpx_client.request(
714
+ f"webhooks/{jsonable_encoder(id)}",
715
+ method="DELETE",
716
+ request_options=request_options,
717
+ )
718
+ try:
719
+ if 200 <= _response.status_code < 300:
720
+ return AsyncHttpResponse(response=_response, data=None)
721
+ if _response.status_code == 400:
722
+ raise BadRequestError(
723
+ headers=dict(_response.headers),
724
+ body=typing.cast(
725
+ ValidationProblemDetails,
726
+ parse_obj_as(
727
+ type_=ValidationProblemDetails, # type: ignore
728
+ object_=_response.json(),
729
+ ),
730
+ ),
731
+ )
732
+ if _response.status_code == 401:
733
+ raise UnauthorizedError(
734
+ headers=dict(_response.headers),
735
+ body=typing.cast(
736
+ ProblemDetails,
737
+ parse_obj_as(
738
+ type_=ProblemDetails, # type: ignore
739
+ object_=_response.json(),
740
+ ),
741
+ ),
742
+ )
743
+ if _response.status_code == 403:
744
+ raise ForbiddenError(
745
+ headers=dict(_response.headers),
746
+ body=typing.cast(
747
+ ProblemDetails,
748
+ parse_obj_as(
749
+ type_=ProblemDetails, # type: ignore
750
+ object_=_response.json(),
751
+ ),
752
+ ),
753
+ )
754
+ if _response.status_code == 404:
755
+ raise NotFoundError(
756
+ headers=dict(_response.headers),
757
+ body=typing.cast(
758
+ typing.Optional[typing.Any],
759
+ parse_obj_as(
760
+ type_=typing.Optional[typing.Any], # type: ignore
761
+ object_=_response.json(),
762
+ ),
763
+ ),
764
+ )
765
+ _response_json = _response.json()
766
+ except JSONDecodeError:
767
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
768
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
769
+
770
+ async def list(self, *, request_options: typing.Optional[RequestOptions] = None) -> AsyncHttpResponse[WebhookList]:
771
+ """
772
+ Returns the configured webhooks
773
+
774
+ Parameters
775
+ ----------
776
+ request_options : typing.Optional[RequestOptions]
777
+ Request-specific configuration.
778
+
779
+ Returns
780
+ -------
781
+ AsyncHttpResponse[WebhookList]
782
+ Success
783
+ """
784
+ _response = await self._client_wrapper.httpx_client.request(
785
+ "webhooks",
786
+ method="GET",
787
+ request_options=request_options,
788
+ )
789
+ try:
790
+ if 200 <= _response.status_code < 300:
791
+ _data = typing.cast(
792
+ WebhookList,
793
+ parse_obj_as(
794
+ type_=WebhookList, # type: ignore
795
+ object_=_response.json(),
796
+ ),
797
+ )
798
+ return AsyncHttpResponse(response=_response, data=_data)
799
+ if _response.status_code == 400:
800
+ raise BadRequestError(
801
+ headers=dict(_response.headers),
802
+ body=typing.cast(
803
+ ValidationProblemDetails,
804
+ parse_obj_as(
805
+ type_=ValidationProblemDetails, # type: ignore
806
+ object_=_response.json(),
807
+ ),
808
+ ),
809
+ )
810
+ if _response.status_code == 401:
811
+ raise UnauthorizedError(
812
+ headers=dict(_response.headers),
813
+ body=typing.cast(
814
+ ProblemDetails,
815
+ parse_obj_as(
816
+ type_=ProblemDetails, # type: ignore
817
+ object_=_response.json(),
818
+ ),
819
+ ),
820
+ )
821
+ if _response.status_code == 403:
822
+ raise ForbiddenError(
823
+ headers=dict(_response.headers),
824
+ body=typing.cast(
825
+ ProblemDetails,
826
+ parse_obj_as(
827
+ type_=ProblemDetails, # type: ignore
828
+ object_=_response.json(),
829
+ ),
830
+ ),
831
+ )
832
+ _response_json = _response.json()
833
+ except JSONDecodeError:
834
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
835
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
836
+
837
+ async def create(
838
+ self,
839
+ *,
840
+ name: str,
841
+ url: str,
842
+ events: typing.Sequence[str],
843
+ notify_email: typing.Optional[str] = OMIT,
844
+ request_options: typing.Optional[RequestOptions] = None,
845
+ ) -> AsyncHttpResponse[Webhook]:
846
+ """
847
+ Create a new webhook
848
+
849
+ Parameters
850
+ ----------
851
+ name : str
852
+ The name of the webhook
853
+
854
+ url : str
855
+ The URL to which the webhook will send events
856
+
857
+ events : typing.Sequence[str]
858
+ An array of event types that the webhook will listen for
859
+
860
+ notify_email : typing.Optional[str]
861
+ The email address to use for management notification events. Ie: webhook disabled
862
+
863
+ request_options : typing.Optional[RequestOptions]
864
+ Request-specific configuration.
865
+
866
+ Returns
867
+ -------
868
+ AsyncHttpResponse[Webhook]
869
+ Success
870
+ """
871
+ _response = await self._client_wrapper.httpx_client.request(
872
+ "webhooks",
873
+ method="POST",
874
+ json={
875
+ "name": name,
876
+ "url": url,
877
+ "notify_email": notify_email,
878
+ "events": events,
879
+ },
880
+ headers={
881
+ "content-type": "application/json",
882
+ },
883
+ request_options=request_options,
884
+ omit=OMIT,
885
+ )
886
+ try:
887
+ if 200 <= _response.status_code < 300:
888
+ _data = typing.cast(
889
+ Webhook,
890
+ parse_obj_as(
891
+ type_=Webhook, # type: ignore
892
+ object_=_response.json(),
893
+ ),
894
+ )
895
+ return AsyncHttpResponse(response=_response, data=_data)
896
+ if _response.status_code == 400:
897
+ raise BadRequestError(
898
+ headers=dict(_response.headers),
899
+ body=typing.cast(
900
+ ValidationProblemDetails,
901
+ parse_obj_as(
902
+ type_=ValidationProblemDetails, # type: ignore
903
+ object_=_response.json(),
904
+ ),
905
+ ),
906
+ )
907
+ if _response.status_code == 401:
908
+ raise UnauthorizedError(
909
+ headers=dict(_response.headers),
910
+ body=typing.cast(
911
+ ProblemDetails,
912
+ parse_obj_as(
913
+ type_=ProblemDetails, # type: ignore
914
+ object_=_response.json(),
915
+ ),
916
+ ),
917
+ )
918
+ if _response.status_code == 403:
919
+ raise ForbiddenError(
920
+ headers=dict(_response.headers),
921
+ body=typing.cast(
922
+ ProblemDetails,
923
+ parse_obj_as(
924
+ type_=ProblemDetails, # type: ignore
925
+ object_=_response.json(),
926
+ ),
927
+ ),
928
+ )
929
+ if _response.status_code == 422:
930
+ raise UnprocessableEntityError(
931
+ headers=dict(_response.headers),
932
+ body=typing.cast(
933
+ ProblemDetails,
934
+ parse_obj_as(
935
+ type_=ProblemDetails, # type: ignore
936
+ object_=_response.json(),
937
+ ),
938
+ ),
939
+ )
940
+ _response_json = _response.json()
941
+ except JSONDecodeError:
942
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
943
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)