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,1553 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pagination import AsyncPager, BaseHttpResponse, SyncPager
11
+ from ..core.pydantic_utilities import parse_obj_as
12
+ from ..core.request_options import RequestOptions
13
+ from ..core.serialization import convert_and_respect_annotation_metadata
14
+ from ..errors.bad_request_error import BadRequestError
15
+ from ..errors.forbidden_error import ForbiddenError
16
+ from ..errors.not_found_error import NotFoundError
17
+ from ..errors.unauthorized_error import UnauthorizedError
18
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
19
+ from ..types.application import Application
20
+ from ..types.async_react_response import AsyncReactResponse
21
+ from ..types.problem_details import ProblemDetails
22
+ from ..types.react_response import ReactResponse
23
+ from ..types.reactor import Reactor
24
+ from ..types.reactor_paginated_list import ReactorPaginatedList
25
+ from ..types.validation_problem_details import ValidationProblemDetails
26
+
27
+ # this is used as the default value for optional parameters
28
+ OMIT = typing.cast(typing.Any, ...)
29
+
30
+
31
+ class RawReactorsClient:
32
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
33
+ self._client_wrapper = client_wrapper
34
+
35
+ def list(
36
+ self,
37
+ *,
38
+ id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
39
+ name: typing.Optional[str] = None,
40
+ page: typing.Optional[int] = None,
41
+ start: typing.Optional[str] = None,
42
+ size: typing.Optional[int] = None,
43
+ request_options: typing.Optional[RequestOptions] = None,
44
+ ) -> SyncPager[Reactor]:
45
+ """
46
+ Parameters
47
+ ----------
48
+ id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
49
+
50
+ name : typing.Optional[str]
51
+
52
+ page : typing.Optional[int]
53
+
54
+ start : typing.Optional[str]
55
+
56
+ size : typing.Optional[int]
57
+
58
+ request_options : typing.Optional[RequestOptions]
59
+ Request-specific configuration.
60
+
61
+ Returns
62
+ -------
63
+ SyncPager[Reactor]
64
+ Success
65
+ """
66
+ page = page if page is not None else 1
67
+
68
+ _response = self._client_wrapper.httpx_client.request(
69
+ "reactors",
70
+ method="GET",
71
+ params={
72
+ "id": id,
73
+ "name": name,
74
+ "page": page,
75
+ "start": start,
76
+ "size": size,
77
+ },
78
+ request_options=request_options,
79
+ )
80
+ try:
81
+ if 200 <= _response.status_code < 300:
82
+ _parsed_response = typing.cast(
83
+ ReactorPaginatedList,
84
+ parse_obj_as(
85
+ type_=ReactorPaginatedList, # type: ignore
86
+ object_=_response.json(),
87
+ ),
88
+ )
89
+ _items = _parsed_response.data
90
+ _has_next = True
91
+ _get_next = lambda: self.list(
92
+ id=id,
93
+ name=name,
94
+ page=page + 1,
95
+ start=start,
96
+ size=size,
97
+ request_options=request_options,
98
+ )
99
+ return SyncPager(
100
+ has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
101
+ )
102
+ if _response.status_code == 401:
103
+ raise UnauthorizedError(
104
+ headers=dict(_response.headers),
105
+ body=typing.cast(
106
+ ProblemDetails,
107
+ parse_obj_as(
108
+ type_=ProblemDetails, # type: ignore
109
+ object_=_response.json(),
110
+ ),
111
+ ),
112
+ )
113
+ if _response.status_code == 403:
114
+ raise ForbiddenError(
115
+ headers=dict(_response.headers),
116
+ body=typing.cast(
117
+ ProblemDetails,
118
+ parse_obj_as(
119
+ type_=ProblemDetails, # type: ignore
120
+ object_=_response.json(),
121
+ ),
122
+ ),
123
+ )
124
+ if _response.status_code == 404:
125
+ raise NotFoundError(
126
+ headers=dict(_response.headers),
127
+ body=typing.cast(
128
+ typing.Optional[typing.Any],
129
+ parse_obj_as(
130
+ type_=typing.Optional[typing.Any], # type: ignore
131
+ object_=_response.json(),
132
+ ),
133
+ ),
134
+ )
135
+ _response_json = _response.json()
136
+ except JSONDecodeError:
137
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
138
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
139
+
140
+ def create(
141
+ self,
142
+ *,
143
+ name: str,
144
+ code: str,
145
+ application: typing.Optional[Application] = OMIT,
146
+ configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
147
+ idempotency_key: typing.Optional[str] = None,
148
+ request_options: typing.Optional[RequestOptions] = None,
149
+ ) -> HttpResponse[Reactor]:
150
+ """
151
+ Parameters
152
+ ----------
153
+ name : str
154
+
155
+ code : str
156
+
157
+ application : typing.Optional[Application]
158
+
159
+ configuration : typing.Optional[typing.Dict[str, typing.Optional[str]]]
160
+
161
+ idempotency_key : typing.Optional[str]
162
+
163
+ request_options : typing.Optional[RequestOptions]
164
+ Request-specific configuration.
165
+
166
+ Returns
167
+ -------
168
+ HttpResponse[Reactor]
169
+ Created
170
+ """
171
+ _response = self._client_wrapper.httpx_client.request(
172
+ "reactors",
173
+ method="POST",
174
+ json={
175
+ "name": name,
176
+ "code": code,
177
+ "application": convert_and_respect_annotation_metadata(
178
+ object_=application, annotation=Application, direction="write"
179
+ ),
180
+ "configuration": configuration,
181
+ },
182
+ headers={
183
+ "content-type": "application/json",
184
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
185
+ },
186
+ request_options=request_options,
187
+ omit=OMIT,
188
+ )
189
+ try:
190
+ if 200 <= _response.status_code < 300:
191
+ _data = typing.cast(
192
+ Reactor,
193
+ parse_obj_as(
194
+ type_=Reactor, # type: ignore
195
+ object_=_response.json(),
196
+ ),
197
+ )
198
+ return HttpResponse(response=_response, data=_data)
199
+ if _response.status_code == 400:
200
+ raise BadRequestError(
201
+ headers=dict(_response.headers),
202
+ body=typing.cast(
203
+ ValidationProblemDetails,
204
+ parse_obj_as(
205
+ type_=ValidationProblemDetails, # type: ignore
206
+ object_=_response.json(),
207
+ ),
208
+ ),
209
+ )
210
+ if _response.status_code == 401:
211
+ raise UnauthorizedError(
212
+ headers=dict(_response.headers),
213
+ body=typing.cast(
214
+ ProblemDetails,
215
+ parse_obj_as(
216
+ type_=ProblemDetails, # type: ignore
217
+ object_=_response.json(),
218
+ ),
219
+ ),
220
+ )
221
+ if _response.status_code == 403:
222
+ raise ForbiddenError(
223
+ headers=dict(_response.headers),
224
+ body=typing.cast(
225
+ ProblemDetails,
226
+ parse_obj_as(
227
+ type_=ProblemDetails, # type: ignore
228
+ object_=_response.json(),
229
+ ),
230
+ ),
231
+ )
232
+ _response_json = _response.json()
233
+ except JSONDecodeError:
234
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
235
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
236
+
237
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[Reactor]:
238
+ """
239
+ Parameters
240
+ ----------
241
+ id : str
242
+
243
+ request_options : typing.Optional[RequestOptions]
244
+ Request-specific configuration.
245
+
246
+ Returns
247
+ -------
248
+ HttpResponse[Reactor]
249
+ Success
250
+ """
251
+ _response = self._client_wrapper.httpx_client.request(
252
+ f"reactors/{jsonable_encoder(id)}",
253
+ method="GET",
254
+ request_options=request_options,
255
+ )
256
+ try:
257
+ if 200 <= _response.status_code < 300:
258
+ _data = typing.cast(
259
+ Reactor,
260
+ parse_obj_as(
261
+ type_=Reactor, # type: ignore
262
+ object_=_response.json(),
263
+ ),
264
+ )
265
+ return HttpResponse(response=_response, data=_data)
266
+ if _response.status_code == 401:
267
+ raise UnauthorizedError(
268
+ headers=dict(_response.headers),
269
+ body=typing.cast(
270
+ ProblemDetails,
271
+ parse_obj_as(
272
+ type_=ProblemDetails, # type: ignore
273
+ object_=_response.json(),
274
+ ),
275
+ ),
276
+ )
277
+ if _response.status_code == 403:
278
+ raise ForbiddenError(
279
+ headers=dict(_response.headers),
280
+ body=typing.cast(
281
+ ProblemDetails,
282
+ parse_obj_as(
283
+ type_=ProblemDetails, # type: ignore
284
+ object_=_response.json(),
285
+ ),
286
+ ),
287
+ )
288
+ if _response.status_code == 404:
289
+ raise NotFoundError(
290
+ headers=dict(_response.headers),
291
+ body=typing.cast(
292
+ typing.Optional[typing.Any],
293
+ parse_obj_as(
294
+ type_=typing.Optional[typing.Any], # type: ignore
295
+ object_=_response.json(),
296
+ ),
297
+ ),
298
+ )
299
+ _response_json = _response.json()
300
+ except JSONDecodeError:
301
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
302
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
303
+
304
+ def update(
305
+ self,
306
+ id: str,
307
+ *,
308
+ name: str,
309
+ code: str,
310
+ application: typing.Optional[Application] = OMIT,
311
+ configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
312
+ idempotency_key: typing.Optional[str] = None,
313
+ request_options: typing.Optional[RequestOptions] = None,
314
+ ) -> HttpResponse[Reactor]:
315
+ """
316
+ Parameters
317
+ ----------
318
+ id : str
319
+
320
+ name : str
321
+
322
+ code : str
323
+
324
+ application : typing.Optional[Application]
325
+
326
+ configuration : typing.Optional[typing.Dict[str, typing.Optional[str]]]
327
+
328
+ idempotency_key : typing.Optional[str]
329
+
330
+ request_options : typing.Optional[RequestOptions]
331
+ Request-specific configuration.
332
+
333
+ Returns
334
+ -------
335
+ HttpResponse[Reactor]
336
+ Success
337
+ """
338
+ _response = self._client_wrapper.httpx_client.request(
339
+ f"reactors/{jsonable_encoder(id)}",
340
+ method="PUT",
341
+ json={
342
+ "name": name,
343
+ "application": convert_and_respect_annotation_metadata(
344
+ object_=application, annotation=Application, direction="write"
345
+ ),
346
+ "code": code,
347
+ "configuration": configuration,
348
+ },
349
+ headers={
350
+ "content-type": "application/json",
351
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
352
+ },
353
+ request_options=request_options,
354
+ omit=OMIT,
355
+ )
356
+ try:
357
+ if 200 <= _response.status_code < 300:
358
+ _data = typing.cast(
359
+ Reactor,
360
+ parse_obj_as(
361
+ type_=Reactor, # type: ignore
362
+ object_=_response.json(),
363
+ ),
364
+ )
365
+ return HttpResponse(response=_response, data=_data)
366
+ if _response.status_code == 400:
367
+ raise BadRequestError(
368
+ headers=dict(_response.headers),
369
+ body=typing.cast(
370
+ ValidationProblemDetails,
371
+ parse_obj_as(
372
+ type_=ValidationProblemDetails, # type: ignore
373
+ object_=_response.json(),
374
+ ),
375
+ ),
376
+ )
377
+ if _response.status_code == 401:
378
+ raise UnauthorizedError(
379
+ headers=dict(_response.headers),
380
+ body=typing.cast(
381
+ ProblemDetails,
382
+ parse_obj_as(
383
+ type_=ProblemDetails, # type: ignore
384
+ object_=_response.json(),
385
+ ),
386
+ ),
387
+ )
388
+ if _response.status_code == 403:
389
+ raise ForbiddenError(
390
+ headers=dict(_response.headers),
391
+ body=typing.cast(
392
+ ProblemDetails,
393
+ parse_obj_as(
394
+ type_=ProblemDetails, # type: ignore
395
+ object_=_response.json(),
396
+ ),
397
+ ),
398
+ )
399
+ if _response.status_code == 404:
400
+ raise NotFoundError(
401
+ headers=dict(_response.headers),
402
+ body=typing.cast(
403
+ typing.Optional[typing.Any],
404
+ parse_obj_as(
405
+ type_=typing.Optional[typing.Any], # type: ignore
406
+ object_=_response.json(),
407
+ ),
408
+ ),
409
+ )
410
+ _response_json = _response.json()
411
+ except JSONDecodeError:
412
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
413
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
414
+
415
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
416
+ """
417
+ Parameters
418
+ ----------
419
+ id : str
420
+
421
+ request_options : typing.Optional[RequestOptions]
422
+ Request-specific configuration.
423
+
424
+ Returns
425
+ -------
426
+ HttpResponse[None]
427
+ """
428
+ _response = self._client_wrapper.httpx_client.request(
429
+ f"reactors/{jsonable_encoder(id)}",
430
+ method="DELETE",
431
+ request_options=request_options,
432
+ )
433
+ try:
434
+ if 200 <= _response.status_code < 300:
435
+ return HttpResponse(response=_response, data=None)
436
+ if _response.status_code == 401:
437
+ raise UnauthorizedError(
438
+ headers=dict(_response.headers),
439
+ body=typing.cast(
440
+ ProblemDetails,
441
+ parse_obj_as(
442
+ type_=ProblemDetails, # type: ignore
443
+ object_=_response.json(),
444
+ ),
445
+ ),
446
+ )
447
+ if _response.status_code == 403:
448
+ raise ForbiddenError(
449
+ headers=dict(_response.headers),
450
+ body=typing.cast(
451
+ ProblemDetails,
452
+ parse_obj_as(
453
+ type_=ProblemDetails, # type: ignore
454
+ object_=_response.json(),
455
+ ),
456
+ ),
457
+ )
458
+ if _response.status_code == 404:
459
+ raise NotFoundError(
460
+ headers=dict(_response.headers),
461
+ body=typing.cast(
462
+ typing.Optional[typing.Any],
463
+ parse_obj_as(
464
+ type_=typing.Optional[typing.Any], # type: ignore
465
+ object_=_response.json(),
466
+ ),
467
+ ),
468
+ )
469
+ _response_json = _response.json()
470
+ except JSONDecodeError:
471
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
472
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
473
+
474
+ def patch(
475
+ self,
476
+ id: str,
477
+ *,
478
+ name: typing.Optional[str] = OMIT,
479
+ application: typing.Optional[Application] = OMIT,
480
+ code: typing.Optional[str] = OMIT,
481
+ configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
482
+ idempotency_key: typing.Optional[str] = None,
483
+ request_options: typing.Optional[RequestOptions] = None,
484
+ ) -> HttpResponse[None]:
485
+ """
486
+ Parameters
487
+ ----------
488
+ id : str
489
+
490
+ name : typing.Optional[str]
491
+
492
+ application : typing.Optional[Application]
493
+
494
+ code : typing.Optional[str]
495
+
496
+ configuration : typing.Optional[typing.Dict[str, typing.Optional[str]]]
497
+
498
+ idempotency_key : typing.Optional[str]
499
+
500
+ request_options : typing.Optional[RequestOptions]
501
+ Request-specific configuration.
502
+
503
+ Returns
504
+ -------
505
+ HttpResponse[None]
506
+ """
507
+ _response = self._client_wrapper.httpx_client.request(
508
+ f"reactors/{jsonable_encoder(id)}",
509
+ method="PATCH",
510
+ json={
511
+ "name": name,
512
+ "application": convert_and_respect_annotation_metadata(
513
+ object_=application, annotation=Application, direction="write"
514
+ ),
515
+ "code": code,
516
+ "configuration": configuration,
517
+ },
518
+ headers={
519
+ "content-type": "application/merge-patch+json",
520
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
521
+ },
522
+ request_options=request_options,
523
+ omit=OMIT,
524
+ )
525
+ try:
526
+ if 200 <= _response.status_code < 300:
527
+ return HttpResponse(response=_response, data=None)
528
+ if _response.status_code == 400:
529
+ raise BadRequestError(
530
+ headers=dict(_response.headers),
531
+ body=typing.cast(
532
+ ValidationProblemDetails,
533
+ parse_obj_as(
534
+ type_=ValidationProblemDetails, # type: ignore
535
+ object_=_response.json(),
536
+ ),
537
+ ),
538
+ )
539
+ if _response.status_code == 401:
540
+ raise UnauthorizedError(
541
+ headers=dict(_response.headers),
542
+ body=typing.cast(
543
+ ProblemDetails,
544
+ parse_obj_as(
545
+ type_=ProblemDetails, # type: ignore
546
+ object_=_response.json(),
547
+ ),
548
+ ),
549
+ )
550
+ if _response.status_code == 403:
551
+ raise ForbiddenError(
552
+ headers=dict(_response.headers),
553
+ body=typing.cast(
554
+ ProblemDetails,
555
+ parse_obj_as(
556
+ type_=ProblemDetails, # type: ignore
557
+ object_=_response.json(),
558
+ ),
559
+ ),
560
+ )
561
+ if _response.status_code == 404:
562
+ raise NotFoundError(
563
+ headers=dict(_response.headers),
564
+ body=typing.cast(
565
+ typing.Optional[typing.Any],
566
+ parse_obj_as(
567
+ type_=typing.Optional[typing.Any], # type: ignore
568
+ object_=_response.json(),
569
+ ),
570
+ ),
571
+ )
572
+ _response_json = _response.json()
573
+ except JSONDecodeError:
574
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
575
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
576
+
577
+ def react(
578
+ self,
579
+ id: str,
580
+ *,
581
+ args: typing.Optional[typing.Optional[typing.Any]] = OMIT,
582
+ callback_url: typing.Optional[str] = OMIT,
583
+ request_options: typing.Optional[RequestOptions] = None,
584
+ ) -> HttpResponse[ReactResponse]:
585
+ """
586
+ Parameters
587
+ ----------
588
+ id : str
589
+
590
+ args : typing.Optional[typing.Optional[typing.Any]]
591
+
592
+ callback_url : typing.Optional[str]
593
+
594
+ request_options : typing.Optional[RequestOptions]
595
+ Request-specific configuration.
596
+
597
+ Returns
598
+ -------
599
+ HttpResponse[ReactResponse]
600
+ Success
601
+ """
602
+ _response = self._client_wrapper.httpx_client.request(
603
+ f"reactors/{jsonable_encoder(id)}/react",
604
+ method="POST",
605
+ json={
606
+ "args": args,
607
+ "callback_url": callback_url,
608
+ },
609
+ headers={
610
+ "content-type": "application/json",
611
+ },
612
+ request_options=request_options,
613
+ omit=OMIT,
614
+ )
615
+ try:
616
+ if 200 <= _response.status_code < 300:
617
+ _data = typing.cast(
618
+ ReactResponse,
619
+ parse_obj_as(
620
+ type_=ReactResponse, # type: ignore
621
+ object_=_response.json(),
622
+ ),
623
+ )
624
+ return HttpResponse(response=_response, data=_data)
625
+ if _response.status_code == 400:
626
+ raise BadRequestError(
627
+ headers=dict(_response.headers),
628
+ body=typing.cast(
629
+ ValidationProblemDetails,
630
+ parse_obj_as(
631
+ type_=ValidationProblemDetails, # type: ignore
632
+ object_=_response.json(),
633
+ ),
634
+ ),
635
+ )
636
+ if _response.status_code == 401:
637
+ raise UnauthorizedError(
638
+ headers=dict(_response.headers),
639
+ body=typing.cast(
640
+ ProblemDetails,
641
+ parse_obj_as(
642
+ type_=ProblemDetails, # type: ignore
643
+ object_=_response.json(),
644
+ ),
645
+ ),
646
+ )
647
+ if _response.status_code == 403:
648
+ raise ForbiddenError(
649
+ headers=dict(_response.headers),
650
+ body=typing.cast(
651
+ ProblemDetails,
652
+ parse_obj_as(
653
+ type_=ProblemDetails, # type: ignore
654
+ object_=_response.json(),
655
+ ),
656
+ ),
657
+ )
658
+ if _response.status_code == 404:
659
+ raise NotFoundError(
660
+ headers=dict(_response.headers),
661
+ body=typing.cast(
662
+ typing.Optional[typing.Any],
663
+ parse_obj_as(
664
+ type_=typing.Optional[typing.Any], # type: ignore
665
+ object_=_response.json(),
666
+ ),
667
+ ),
668
+ )
669
+ if _response.status_code == 422:
670
+ raise UnprocessableEntityError(
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
+ _response_json = _response.json()
681
+ except JSONDecodeError:
682
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
683
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
684
+
685
+ def react_async(
686
+ self,
687
+ id: str,
688
+ *,
689
+ args: typing.Optional[typing.Optional[typing.Any]] = OMIT,
690
+ request_options: typing.Optional[RequestOptions] = None,
691
+ ) -> HttpResponse[AsyncReactResponse]:
692
+ """
693
+ Parameters
694
+ ----------
695
+ id : str
696
+
697
+ args : typing.Optional[typing.Optional[typing.Any]]
698
+
699
+ request_options : typing.Optional[RequestOptions]
700
+ Request-specific configuration.
701
+
702
+ Returns
703
+ -------
704
+ HttpResponse[AsyncReactResponse]
705
+ Accepted
706
+ """
707
+ _response = self._client_wrapper.httpx_client.request(
708
+ f"reactors/{jsonable_encoder(id)}/react-async",
709
+ method="POST",
710
+ json={
711
+ "args": args,
712
+ },
713
+ headers={
714
+ "content-type": "application/json",
715
+ },
716
+ request_options=request_options,
717
+ omit=OMIT,
718
+ )
719
+ try:
720
+ if 200 <= _response.status_code < 300:
721
+ _data = typing.cast(
722
+ AsyncReactResponse,
723
+ parse_obj_as(
724
+ type_=AsyncReactResponse, # type: ignore
725
+ object_=_response.json(),
726
+ ),
727
+ )
728
+ return HttpResponse(response=_response, data=_data)
729
+ if _response.status_code == 400:
730
+ raise BadRequestError(
731
+ headers=dict(_response.headers),
732
+ body=typing.cast(
733
+ ValidationProblemDetails,
734
+ parse_obj_as(
735
+ type_=ValidationProblemDetails, # type: ignore
736
+ object_=_response.json(),
737
+ ),
738
+ ),
739
+ )
740
+ if _response.status_code == 401:
741
+ raise UnauthorizedError(
742
+ headers=dict(_response.headers),
743
+ body=typing.cast(
744
+ ProblemDetails,
745
+ parse_obj_as(
746
+ type_=ProblemDetails, # type: ignore
747
+ object_=_response.json(),
748
+ ),
749
+ ),
750
+ )
751
+ if _response.status_code == 403:
752
+ raise ForbiddenError(
753
+ headers=dict(_response.headers),
754
+ body=typing.cast(
755
+ ProblemDetails,
756
+ parse_obj_as(
757
+ type_=ProblemDetails, # type: ignore
758
+ object_=_response.json(),
759
+ ),
760
+ ),
761
+ )
762
+ if _response.status_code == 404:
763
+ raise NotFoundError(
764
+ headers=dict(_response.headers),
765
+ body=typing.cast(
766
+ typing.Optional[typing.Any],
767
+ parse_obj_as(
768
+ type_=typing.Optional[typing.Any], # type: ignore
769
+ object_=_response.json(),
770
+ ),
771
+ ),
772
+ )
773
+ if _response.status_code == 422:
774
+ raise UnprocessableEntityError(
775
+ headers=dict(_response.headers),
776
+ body=typing.cast(
777
+ ProblemDetails,
778
+ parse_obj_as(
779
+ type_=ProblemDetails, # type: ignore
780
+ object_=_response.json(),
781
+ ),
782
+ ),
783
+ )
784
+ _response_json = _response.json()
785
+ except JSONDecodeError:
786
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
787
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
788
+
789
+
790
+ class AsyncRawReactorsClient:
791
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
792
+ self._client_wrapper = client_wrapper
793
+
794
+ async def list(
795
+ self,
796
+ *,
797
+ id: typing.Optional[typing.Union[str, typing.Sequence[str]]] = None,
798
+ name: typing.Optional[str] = None,
799
+ page: typing.Optional[int] = None,
800
+ start: typing.Optional[str] = None,
801
+ size: typing.Optional[int] = None,
802
+ request_options: typing.Optional[RequestOptions] = None,
803
+ ) -> AsyncPager[Reactor]:
804
+ """
805
+ Parameters
806
+ ----------
807
+ id : typing.Optional[typing.Union[str, typing.Sequence[str]]]
808
+
809
+ name : typing.Optional[str]
810
+
811
+ page : typing.Optional[int]
812
+
813
+ start : typing.Optional[str]
814
+
815
+ size : typing.Optional[int]
816
+
817
+ request_options : typing.Optional[RequestOptions]
818
+ Request-specific configuration.
819
+
820
+ Returns
821
+ -------
822
+ AsyncPager[Reactor]
823
+ Success
824
+ """
825
+ page = page if page is not None else 1
826
+
827
+ _response = await self._client_wrapper.httpx_client.request(
828
+ "reactors",
829
+ method="GET",
830
+ params={
831
+ "id": id,
832
+ "name": name,
833
+ "page": page,
834
+ "start": start,
835
+ "size": size,
836
+ },
837
+ request_options=request_options,
838
+ )
839
+ try:
840
+ if 200 <= _response.status_code < 300:
841
+ _parsed_response = typing.cast(
842
+ ReactorPaginatedList,
843
+ parse_obj_as(
844
+ type_=ReactorPaginatedList, # type: ignore
845
+ object_=_response.json(),
846
+ ),
847
+ )
848
+ _items = _parsed_response.data
849
+ _has_next = True
850
+
851
+ async def _get_next():
852
+ return await self.list(
853
+ id=id,
854
+ name=name,
855
+ page=page + 1,
856
+ start=start,
857
+ size=size,
858
+ request_options=request_options,
859
+ )
860
+
861
+ return AsyncPager(
862
+ has_next=_has_next, items=_items, get_next=_get_next, response=BaseHttpResponse(response=_response)
863
+ )
864
+ if _response.status_code == 401:
865
+ raise UnauthorizedError(
866
+ headers=dict(_response.headers),
867
+ body=typing.cast(
868
+ ProblemDetails,
869
+ parse_obj_as(
870
+ type_=ProblemDetails, # type: ignore
871
+ object_=_response.json(),
872
+ ),
873
+ ),
874
+ )
875
+ if _response.status_code == 403:
876
+ raise ForbiddenError(
877
+ headers=dict(_response.headers),
878
+ body=typing.cast(
879
+ ProblemDetails,
880
+ parse_obj_as(
881
+ type_=ProblemDetails, # type: ignore
882
+ object_=_response.json(),
883
+ ),
884
+ ),
885
+ )
886
+ if _response.status_code == 404:
887
+ raise NotFoundError(
888
+ headers=dict(_response.headers),
889
+ body=typing.cast(
890
+ typing.Optional[typing.Any],
891
+ parse_obj_as(
892
+ type_=typing.Optional[typing.Any], # type: ignore
893
+ object_=_response.json(),
894
+ ),
895
+ ),
896
+ )
897
+ _response_json = _response.json()
898
+ except JSONDecodeError:
899
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
900
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
901
+
902
+ async def create(
903
+ self,
904
+ *,
905
+ name: str,
906
+ code: str,
907
+ application: typing.Optional[Application] = OMIT,
908
+ configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
909
+ idempotency_key: typing.Optional[str] = None,
910
+ request_options: typing.Optional[RequestOptions] = None,
911
+ ) -> AsyncHttpResponse[Reactor]:
912
+ """
913
+ Parameters
914
+ ----------
915
+ name : str
916
+
917
+ code : str
918
+
919
+ application : typing.Optional[Application]
920
+
921
+ configuration : typing.Optional[typing.Dict[str, typing.Optional[str]]]
922
+
923
+ idempotency_key : typing.Optional[str]
924
+
925
+ request_options : typing.Optional[RequestOptions]
926
+ Request-specific configuration.
927
+
928
+ Returns
929
+ -------
930
+ AsyncHttpResponse[Reactor]
931
+ Created
932
+ """
933
+ _response = await self._client_wrapper.httpx_client.request(
934
+ "reactors",
935
+ method="POST",
936
+ json={
937
+ "name": name,
938
+ "code": code,
939
+ "application": convert_and_respect_annotation_metadata(
940
+ object_=application, annotation=Application, direction="write"
941
+ ),
942
+ "configuration": configuration,
943
+ },
944
+ headers={
945
+ "content-type": "application/json",
946
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
947
+ },
948
+ request_options=request_options,
949
+ omit=OMIT,
950
+ )
951
+ try:
952
+ if 200 <= _response.status_code < 300:
953
+ _data = typing.cast(
954
+ Reactor,
955
+ parse_obj_as(
956
+ type_=Reactor, # type: ignore
957
+ object_=_response.json(),
958
+ ),
959
+ )
960
+ return AsyncHttpResponse(response=_response, data=_data)
961
+ if _response.status_code == 400:
962
+ raise BadRequestError(
963
+ headers=dict(_response.headers),
964
+ body=typing.cast(
965
+ ValidationProblemDetails,
966
+ parse_obj_as(
967
+ type_=ValidationProblemDetails, # type: ignore
968
+ object_=_response.json(),
969
+ ),
970
+ ),
971
+ )
972
+ if _response.status_code == 401:
973
+ raise UnauthorizedError(
974
+ headers=dict(_response.headers),
975
+ body=typing.cast(
976
+ ProblemDetails,
977
+ parse_obj_as(
978
+ type_=ProblemDetails, # type: ignore
979
+ object_=_response.json(),
980
+ ),
981
+ ),
982
+ )
983
+ if _response.status_code == 403:
984
+ raise ForbiddenError(
985
+ headers=dict(_response.headers),
986
+ body=typing.cast(
987
+ ProblemDetails,
988
+ parse_obj_as(
989
+ type_=ProblemDetails, # type: ignore
990
+ object_=_response.json(),
991
+ ),
992
+ ),
993
+ )
994
+ _response_json = _response.json()
995
+ except JSONDecodeError:
996
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
997
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
998
+
999
+ async def get(
1000
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1001
+ ) -> AsyncHttpResponse[Reactor]:
1002
+ """
1003
+ Parameters
1004
+ ----------
1005
+ id : str
1006
+
1007
+ request_options : typing.Optional[RequestOptions]
1008
+ Request-specific configuration.
1009
+
1010
+ Returns
1011
+ -------
1012
+ AsyncHttpResponse[Reactor]
1013
+ Success
1014
+ """
1015
+ _response = await self._client_wrapper.httpx_client.request(
1016
+ f"reactors/{jsonable_encoder(id)}",
1017
+ method="GET",
1018
+ request_options=request_options,
1019
+ )
1020
+ try:
1021
+ if 200 <= _response.status_code < 300:
1022
+ _data = typing.cast(
1023
+ Reactor,
1024
+ parse_obj_as(
1025
+ type_=Reactor, # type: ignore
1026
+ object_=_response.json(),
1027
+ ),
1028
+ )
1029
+ return AsyncHttpResponse(response=_response, data=_data)
1030
+ if _response.status_code == 401:
1031
+ raise UnauthorizedError(
1032
+ headers=dict(_response.headers),
1033
+ body=typing.cast(
1034
+ ProblemDetails,
1035
+ parse_obj_as(
1036
+ type_=ProblemDetails, # type: ignore
1037
+ object_=_response.json(),
1038
+ ),
1039
+ ),
1040
+ )
1041
+ if _response.status_code == 403:
1042
+ raise ForbiddenError(
1043
+ headers=dict(_response.headers),
1044
+ body=typing.cast(
1045
+ ProblemDetails,
1046
+ parse_obj_as(
1047
+ type_=ProblemDetails, # type: ignore
1048
+ object_=_response.json(),
1049
+ ),
1050
+ ),
1051
+ )
1052
+ if _response.status_code == 404:
1053
+ raise NotFoundError(
1054
+ headers=dict(_response.headers),
1055
+ body=typing.cast(
1056
+ typing.Optional[typing.Any],
1057
+ parse_obj_as(
1058
+ type_=typing.Optional[typing.Any], # type: ignore
1059
+ object_=_response.json(),
1060
+ ),
1061
+ ),
1062
+ )
1063
+ _response_json = _response.json()
1064
+ except JSONDecodeError:
1065
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1066
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1067
+
1068
+ async def update(
1069
+ self,
1070
+ id: str,
1071
+ *,
1072
+ name: str,
1073
+ code: str,
1074
+ application: typing.Optional[Application] = OMIT,
1075
+ configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1076
+ idempotency_key: typing.Optional[str] = None,
1077
+ request_options: typing.Optional[RequestOptions] = None,
1078
+ ) -> AsyncHttpResponse[Reactor]:
1079
+ """
1080
+ Parameters
1081
+ ----------
1082
+ id : str
1083
+
1084
+ name : str
1085
+
1086
+ code : str
1087
+
1088
+ application : typing.Optional[Application]
1089
+
1090
+ configuration : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1091
+
1092
+ idempotency_key : typing.Optional[str]
1093
+
1094
+ request_options : typing.Optional[RequestOptions]
1095
+ Request-specific configuration.
1096
+
1097
+ Returns
1098
+ -------
1099
+ AsyncHttpResponse[Reactor]
1100
+ Success
1101
+ """
1102
+ _response = await self._client_wrapper.httpx_client.request(
1103
+ f"reactors/{jsonable_encoder(id)}",
1104
+ method="PUT",
1105
+ json={
1106
+ "name": name,
1107
+ "application": convert_and_respect_annotation_metadata(
1108
+ object_=application, annotation=Application, direction="write"
1109
+ ),
1110
+ "code": code,
1111
+ "configuration": configuration,
1112
+ },
1113
+ headers={
1114
+ "content-type": "application/json",
1115
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
1116
+ },
1117
+ request_options=request_options,
1118
+ omit=OMIT,
1119
+ )
1120
+ try:
1121
+ if 200 <= _response.status_code < 300:
1122
+ _data = typing.cast(
1123
+ Reactor,
1124
+ parse_obj_as(
1125
+ type_=Reactor, # type: ignore
1126
+ object_=_response.json(),
1127
+ ),
1128
+ )
1129
+ return AsyncHttpResponse(response=_response, data=_data)
1130
+ if _response.status_code == 400:
1131
+ raise BadRequestError(
1132
+ headers=dict(_response.headers),
1133
+ body=typing.cast(
1134
+ ValidationProblemDetails,
1135
+ parse_obj_as(
1136
+ type_=ValidationProblemDetails, # type: ignore
1137
+ object_=_response.json(),
1138
+ ),
1139
+ ),
1140
+ )
1141
+ if _response.status_code == 401:
1142
+ raise UnauthorizedError(
1143
+ headers=dict(_response.headers),
1144
+ body=typing.cast(
1145
+ ProblemDetails,
1146
+ parse_obj_as(
1147
+ type_=ProblemDetails, # type: ignore
1148
+ object_=_response.json(),
1149
+ ),
1150
+ ),
1151
+ )
1152
+ if _response.status_code == 403:
1153
+ raise ForbiddenError(
1154
+ headers=dict(_response.headers),
1155
+ body=typing.cast(
1156
+ ProblemDetails,
1157
+ parse_obj_as(
1158
+ type_=ProblemDetails, # type: ignore
1159
+ object_=_response.json(),
1160
+ ),
1161
+ ),
1162
+ )
1163
+ if _response.status_code == 404:
1164
+ raise NotFoundError(
1165
+ headers=dict(_response.headers),
1166
+ body=typing.cast(
1167
+ typing.Optional[typing.Any],
1168
+ parse_obj_as(
1169
+ type_=typing.Optional[typing.Any], # type: ignore
1170
+ object_=_response.json(),
1171
+ ),
1172
+ ),
1173
+ )
1174
+ _response_json = _response.json()
1175
+ except JSONDecodeError:
1176
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1177
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1178
+
1179
+ async def delete(
1180
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1181
+ ) -> AsyncHttpResponse[None]:
1182
+ """
1183
+ Parameters
1184
+ ----------
1185
+ id : str
1186
+
1187
+ request_options : typing.Optional[RequestOptions]
1188
+ Request-specific configuration.
1189
+
1190
+ Returns
1191
+ -------
1192
+ AsyncHttpResponse[None]
1193
+ """
1194
+ _response = await self._client_wrapper.httpx_client.request(
1195
+ f"reactors/{jsonable_encoder(id)}",
1196
+ method="DELETE",
1197
+ request_options=request_options,
1198
+ )
1199
+ try:
1200
+ if 200 <= _response.status_code < 300:
1201
+ return AsyncHttpResponse(response=_response, data=None)
1202
+ if _response.status_code == 401:
1203
+ raise UnauthorizedError(
1204
+ headers=dict(_response.headers),
1205
+ body=typing.cast(
1206
+ ProblemDetails,
1207
+ parse_obj_as(
1208
+ type_=ProblemDetails, # type: ignore
1209
+ object_=_response.json(),
1210
+ ),
1211
+ ),
1212
+ )
1213
+ if _response.status_code == 403:
1214
+ raise ForbiddenError(
1215
+ headers=dict(_response.headers),
1216
+ body=typing.cast(
1217
+ ProblemDetails,
1218
+ parse_obj_as(
1219
+ type_=ProblemDetails, # type: ignore
1220
+ object_=_response.json(),
1221
+ ),
1222
+ ),
1223
+ )
1224
+ if _response.status_code == 404:
1225
+ raise NotFoundError(
1226
+ headers=dict(_response.headers),
1227
+ body=typing.cast(
1228
+ typing.Optional[typing.Any],
1229
+ parse_obj_as(
1230
+ type_=typing.Optional[typing.Any], # type: ignore
1231
+ object_=_response.json(),
1232
+ ),
1233
+ ),
1234
+ )
1235
+ _response_json = _response.json()
1236
+ except JSONDecodeError:
1237
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1238
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1239
+
1240
+ async def patch(
1241
+ self,
1242
+ id: str,
1243
+ *,
1244
+ name: typing.Optional[str] = OMIT,
1245
+ application: typing.Optional[Application] = OMIT,
1246
+ code: typing.Optional[str] = OMIT,
1247
+ configuration: typing.Optional[typing.Dict[str, typing.Optional[str]]] = OMIT,
1248
+ idempotency_key: typing.Optional[str] = None,
1249
+ request_options: typing.Optional[RequestOptions] = None,
1250
+ ) -> AsyncHttpResponse[None]:
1251
+ """
1252
+ Parameters
1253
+ ----------
1254
+ id : str
1255
+
1256
+ name : typing.Optional[str]
1257
+
1258
+ application : typing.Optional[Application]
1259
+
1260
+ code : typing.Optional[str]
1261
+
1262
+ configuration : typing.Optional[typing.Dict[str, typing.Optional[str]]]
1263
+
1264
+ idempotency_key : typing.Optional[str]
1265
+
1266
+ request_options : typing.Optional[RequestOptions]
1267
+ Request-specific configuration.
1268
+
1269
+ Returns
1270
+ -------
1271
+ AsyncHttpResponse[None]
1272
+ """
1273
+ _response = await self._client_wrapper.httpx_client.request(
1274
+ f"reactors/{jsonable_encoder(id)}",
1275
+ method="PATCH",
1276
+ json={
1277
+ "name": name,
1278
+ "application": convert_and_respect_annotation_metadata(
1279
+ object_=application, annotation=Application, direction="write"
1280
+ ),
1281
+ "code": code,
1282
+ "configuration": configuration,
1283
+ },
1284
+ headers={
1285
+ "content-type": "application/merge-patch+json",
1286
+ "BT-IDEMPOTENCY-KEY": str(idempotency_key) if idempotency_key is not None else None,
1287
+ },
1288
+ request_options=request_options,
1289
+ omit=OMIT,
1290
+ )
1291
+ try:
1292
+ if 200 <= _response.status_code < 300:
1293
+ return AsyncHttpResponse(response=_response, data=None)
1294
+ if _response.status_code == 400:
1295
+ raise BadRequestError(
1296
+ headers=dict(_response.headers),
1297
+ body=typing.cast(
1298
+ ValidationProblemDetails,
1299
+ parse_obj_as(
1300
+ type_=ValidationProblemDetails, # type: ignore
1301
+ object_=_response.json(),
1302
+ ),
1303
+ ),
1304
+ )
1305
+ if _response.status_code == 401:
1306
+ raise UnauthorizedError(
1307
+ headers=dict(_response.headers),
1308
+ body=typing.cast(
1309
+ ProblemDetails,
1310
+ parse_obj_as(
1311
+ type_=ProblemDetails, # type: ignore
1312
+ object_=_response.json(),
1313
+ ),
1314
+ ),
1315
+ )
1316
+ if _response.status_code == 403:
1317
+ raise ForbiddenError(
1318
+ headers=dict(_response.headers),
1319
+ body=typing.cast(
1320
+ ProblemDetails,
1321
+ parse_obj_as(
1322
+ type_=ProblemDetails, # type: ignore
1323
+ object_=_response.json(),
1324
+ ),
1325
+ ),
1326
+ )
1327
+ if _response.status_code == 404:
1328
+ raise NotFoundError(
1329
+ headers=dict(_response.headers),
1330
+ body=typing.cast(
1331
+ typing.Optional[typing.Any],
1332
+ parse_obj_as(
1333
+ type_=typing.Optional[typing.Any], # type: ignore
1334
+ object_=_response.json(),
1335
+ ),
1336
+ ),
1337
+ )
1338
+ _response_json = _response.json()
1339
+ except JSONDecodeError:
1340
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1341
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1342
+
1343
+ async def react(
1344
+ self,
1345
+ id: str,
1346
+ *,
1347
+ args: typing.Optional[typing.Optional[typing.Any]] = OMIT,
1348
+ callback_url: typing.Optional[str] = OMIT,
1349
+ request_options: typing.Optional[RequestOptions] = None,
1350
+ ) -> AsyncHttpResponse[ReactResponse]:
1351
+ """
1352
+ Parameters
1353
+ ----------
1354
+ id : str
1355
+
1356
+ args : typing.Optional[typing.Optional[typing.Any]]
1357
+
1358
+ callback_url : typing.Optional[str]
1359
+
1360
+ request_options : typing.Optional[RequestOptions]
1361
+ Request-specific configuration.
1362
+
1363
+ Returns
1364
+ -------
1365
+ AsyncHttpResponse[ReactResponse]
1366
+ Success
1367
+ """
1368
+ _response = await self._client_wrapper.httpx_client.request(
1369
+ f"reactors/{jsonable_encoder(id)}/react",
1370
+ method="POST",
1371
+ json={
1372
+ "args": args,
1373
+ "callback_url": callback_url,
1374
+ },
1375
+ headers={
1376
+ "content-type": "application/json",
1377
+ },
1378
+ request_options=request_options,
1379
+ omit=OMIT,
1380
+ )
1381
+ try:
1382
+ if 200 <= _response.status_code < 300:
1383
+ _data = typing.cast(
1384
+ ReactResponse,
1385
+ parse_obj_as(
1386
+ type_=ReactResponse, # type: ignore
1387
+ object_=_response.json(),
1388
+ ),
1389
+ )
1390
+ return AsyncHttpResponse(response=_response, data=_data)
1391
+ if _response.status_code == 400:
1392
+ raise BadRequestError(
1393
+ headers=dict(_response.headers),
1394
+ body=typing.cast(
1395
+ ValidationProblemDetails,
1396
+ parse_obj_as(
1397
+ type_=ValidationProblemDetails, # type: ignore
1398
+ object_=_response.json(),
1399
+ ),
1400
+ ),
1401
+ )
1402
+ if _response.status_code == 401:
1403
+ raise UnauthorizedError(
1404
+ headers=dict(_response.headers),
1405
+ body=typing.cast(
1406
+ ProblemDetails,
1407
+ parse_obj_as(
1408
+ type_=ProblemDetails, # type: ignore
1409
+ object_=_response.json(),
1410
+ ),
1411
+ ),
1412
+ )
1413
+ if _response.status_code == 403:
1414
+ raise ForbiddenError(
1415
+ headers=dict(_response.headers),
1416
+ body=typing.cast(
1417
+ ProblemDetails,
1418
+ parse_obj_as(
1419
+ type_=ProblemDetails, # type: ignore
1420
+ object_=_response.json(),
1421
+ ),
1422
+ ),
1423
+ )
1424
+ if _response.status_code == 404:
1425
+ raise NotFoundError(
1426
+ headers=dict(_response.headers),
1427
+ body=typing.cast(
1428
+ typing.Optional[typing.Any],
1429
+ parse_obj_as(
1430
+ type_=typing.Optional[typing.Any], # type: ignore
1431
+ object_=_response.json(),
1432
+ ),
1433
+ ),
1434
+ )
1435
+ if _response.status_code == 422:
1436
+ raise UnprocessableEntityError(
1437
+ headers=dict(_response.headers),
1438
+ body=typing.cast(
1439
+ ProblemDetails,
1440
+ parse_obj_as(
1441
+ type_=ProblemDetails, # type: ignore
1442
+ object_=_response.json(),
1443
+ ),
1444
+ ),
1445
+ )
1446
+ _response_json = _response.json()
1447
+ except JSONDecodeError:
1448
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1449
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1450
+
1451
+ async def react_async(
1452
+ self,
1453
+ id: str,
1454
+ *,
1455
+ args: typing.Optional[typing.Optional[typing.Any]] = OMIT,
1456
+ request_options: typing.Optional[RequestOptions] = None,
1457
+ ) -> AsyncHttpResponse[AsyncReactResponse]:
1458
+ """
1459
+ Parameters
1460
+ ----------
1461
+ id : str
1462
+
1463
+ args : typing.Optional[typing.Optional[typing.Any]]
1464
+
1465
+ request_options : typing.Optional[RequestOptions]
1466
+ Request-specific configuration.
1467
+
1468
+ Returns
1469
+ -------
1470
+ AsyncHttpResponse[AsyncReactResponse]
1471
+ Accepted
1472
+ """
1473
+ _response = await self._client_wrapper.httpx_client.request(
1474
+ f"reactors/{jsonable_encoder(id)}/react-async",
1475
+ method="POST",
1476
+ json={
1477
+ "args": args,
1478
+ },
1479
+ headers={
1480
+ "content-type": "application/json",
1481
+ },
1482
+ request_options=request_options,
1483
+ omit=OMIT,
1484
+ )
1485
+ try:
1486
+ if 200 <= _response.status_code < 300:
1487
+ _data = typing.cast(
1488
+ AsyncReactResponse,
1489
+ parse_obj_as(
1490
+ type_=AsyncReactResponse, # type: ignore
1491
+ object_=_response.json(),
1492
+ ),
1493
+ )
1494
+ return AsyncHttpResponse(response=_response, data=_data)
1495
+ if _response.status_code == 400:
1496
+ raise BadRequestError(
1497
+ headers=dict(_response.headers),
1498
+ body=typing.cast(
1499
+ ValidationProblemDetails,
1500
+ parse_obj_as(
1501
+ type_=ValidationProblemDetails, # type: ignore
1502
+ object_=_response.json(),
1503
+ ),
1504
+ ),
1505
+ )
1506
+ if _response.status_code == 401:
1507
+ raise UnauthorizedError(
1508
+ headers=dict(_response.headers),
1509
+ body=typing.cast(
1510
+ ProblemDetails,
1511
+ parse_obj_as(
1512
+ type_=ProblemDetails, # type: ignore
1513
+ object_=_response.json(),
1514
+ ),
1515
+ ),
1516
+ )
1517
+ if _response.status_code == 403:
1518
+ raise ForbiddenError(
1519
+ headers=dict(_response.headers),
1520
+ body=typing.cast(
1521
+ ProblemDetails,
1522
+ parse_obj_as(
1523
+ type_=ProblemDetails, # type: ignore
1524
+ object_=_response.json(),
1525
+ ),
1526
+ ),
1527
+ )
1528
+ if _response.status_code == 404:
1529
+ raise NotFoundError(
1530
+ headers=dict(_response.headers),
1531
+ body=typing.cast(
1532
+ typing.Optional[typing.Any],
1533
+ parse_obj_as(
1534
+ type_=typing.Optional[typing.Any], # type: ignore
1535
+ object_=_response.json(),
1536
+ ),
1537
+ ),
1538
+ )
1539
+ if _response.status_code == 422:
1540
+ raise UnprocessableEntityError(
1541
+ headers=dict(_response.headers),
1542
+ body=typing.cast(
1543
+ ProblemDetails,
1544
+ parse_obj_as(
1545
+ type_=ProblemDetails, # type: ignore
1546
+ object_=_response.json(),
1547
+ ),
1548
+ ),
1549
+ )
1550
+ _response_json = _response.json()
1551
+ except JSONDecodeError:
1552
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1553
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)