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,1113 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.http_response import AsyncHttpResponse, HttpResponse
9
+ from ..core.jsonable_encoder import jsonable_encoder
10
+ from ..core.pydantic_utilities import parse_obj_as
11
+ from ..core.request_options import RequestOptions
12
+ from ..core.serialization import convert_and_respect_annotation_metadata
13
+ from ..errors.bad_request_error import BadRequestError
14
+ from ..errors.conflict_error import ConflictError
15
+ from ..errors.forbidden_error import ForbiddenError
16
+ from ..errors.internal_server_error import InternalServerError
17
+ from ..errors.not_found_error import NotFoundError
18
+ from ..errors.service_unavailable_error import ServiceUnavailableError
19
+ from ..errors.unauthorized_error import UnauthorizedError
20
+ from ..errors.unprocessable_entity_error import UnprocessableEntityError
21
+ from ..types.card import Card
22
+ from ..types.cardholder_info import CardholderInfo
23
+ from ..types.network_token import NetworkToken
24
+ from ..types.network_token_cryptogram import NetworkTokenCryptogram
25
+ from ..types.problem_details import ProblemDetails
26
+ from ..types.validation_problem_details import ValidationProblemDetails
27
+
28
+ # this is used as the default value for optional parameters
29
+ OMIT = typing.cast(typing.Any, ...)
30
+
31
+
32
+ class RawNetworkTokensClient:
33
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
34
+ self._client_wrapper = client_wrapper
35
+
36
+ def create(
37
+ self,
38
+ *,
39
+ data: typing.Optional[Card] = OMIT,
40
+ token_id: typing.Optional[str] = OMIT,
41
+ token_intent_id: typing.Optional[str] = OMIT,
42
+ cardholder_info: typing.Optional[CardholderInfo] = OMIT,
43
+ request_options: typing.Optional[RequestOptions] = None,
44
+ ) -> HttpResponse[NetworkToken]:
45
+ """
46
+ Parameters
47
+ ----------
48
+ data : typing.Optional[Card]
49
+
50
+ token_id : typing.Optional[str]
51
+
52
+ token_intent_id : typing.Optional[str]
53
+
54
+ cardholder_info : typing.Optional[CardholderInfo]
55
+
56
+ request_options : typing.Optional[RequestOptions]
57
+ Request-specific configuration.
58
+
59
+ Returns
60
+ -------
61
+ HttpResponse[NetworkToken]
62
+ Created
63
+ """
64
+ _response = self._client_wrapper.httpx_client.request(
65
+ "network-tokens",
66
+ method="POST",
67
+ json={
68
+ "data": convert_and_respect_annotation_metadata(object_=data, annotation=Card, direction="write"),
69
+ "token_id": token_id,
70
+ "token_intent_id": token_intent_id,
71
+ "cardholder_info": convert_and_respect_annotation_metadata(
72
+ object_=cardholder_info, annotation=CardholderInfo, direction="write"
73
+ ),
74
+ },
75
+ headers={
76
+ "content-type": "application/json",
77
+ },
78
+ request_options=request_options,
79
+ omit=OMIT,
80
+ )
81
+ try:
82
+ if 200 <= _response.status_code < 300:
83
+ _data = typing.cast(
84
+ NetworkToken,
85
+ parse_obj_as(
86
+ type_=NetworkToken, # type: ignore
87
+ object_=_response.json(),
88
+ ),
89
+ )
90
+ return HttpResponse(response=_response, data=_data)
91
+ if _response.status_code == 400:
92
+ raise BadRequestError(
93
+ headers=dict(_response.headers),
94
+ body=typing.cast(
95
+ ValidationProblemDetails,
96
+ parse_obj_as(
97
+ type_=ValidationProblemDetails, # type: ignore
98
+ object_=_response.json(),
99
+ ),
100
+ ),
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 == 422:
125
+ raise UnprocessableEntityError(
126
+ headers=dict(_response.headers),
127
+ body=typing.cast(
128
+ ProblemDetails,
129
+ parse_obj_as(
130
+ type_=ProblemDetails, # type: ignore
131
+ object_=_response.json(),
132
+ ),
133
+ ),
134
+ )
135
+ if _response.status_code == 500:
136
+ raise InternalServerError(
137
+ headers=dict(_response.headers),
138
+ body=typing.cast(
139
+ ProblemDetails,
140
+ parse_obj_as(
141
+ type_=ProblemDetails, # type: ignore
142
+ object_=_response.json(),
143
+ ),
144
+ ),
145
+ )
146
+ _response_json = _response.json()
147
+ except JSONDecodeError:
148
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
149
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
150
+
151
+ def cryptogram(
152
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
153
+ ) -> HttpResponse[NetworkTokenCryptogram]:
154
+ """
155
+ Parameters
156
+ ----------
157
+ id : str
158
+
159
+ request_options : typing.Optional[RequestOptions]
160
+ Request-specific configuration.
161
+
162
+ Returns
163
+ -------
164
+ HttpResponse[NetworkTokenCryptogram]
165
+ Success
166
+ """
167
+ _response = self._client_wrapper.httpx_client.request(
168
+ f"network-tokens/{jsonable_encoder(id)}/cryptogram",
169
+ method="POST",
170
+ request_options=request_options,
171
+ )
172
+ try:
173
+ if 200 <= _response.status_code < 300:
174
+ _data = typing.cast(
175
+ NetworkTokenCryptogram,
176
+ parse_obj_as(
177
+ type_=NetworkTokenCryptogram, # type: ignore
178
+ object_=_response.json(),
179
+ ),
180
+ )
181
+ return HttpResponse(response=_response, data=_data)
182
+ if _response.status_code == 400:
183
+ raise BadRequestError(
184
+ headers=dict(_response.headers),
185
+ body=typing.cast(
186
+ ValidationProblemDetails,
187
+ parse_obj_as(
188
+ type_=ValidationProblemDetails, # type: ignore
189
+ object_=_response.json(),
190
+ ),
191
+ ),
192
+ )
193
+ if _response.status_code == 401:
194
+ raise UnauthorizedError(
195
+ headers=dict(_response.headers),
196
+ body=typing.cast(
197
+ ProblemDetails,
198
+ parse_obj_as(
199
+ type_=ProblemDetails, # type: ignore
200
+ object_=_response.json(),
201
+ ),
202
+ ),
203
+ )
204
+ if _response.status_code == 403:
205
+ raise ForbiddenError(
206
+ headers=dict(_response.headers),
207
+ body=typing.cast(
208
+ ProblemDetails,
209
+ parse_obj_as(
210
+ type_=ProblemDetails, # type: ignore
211
+ object_=_response.json(),
212
+ ),
213
+ ),
214
+ )
215
+ if _response.status_code == 404:
216
+ raise NotFoundError(
217
+ headers=dict(_response.headers),
218
+ body=typing.cast(
219
+ typing.Optional[typing.Any],
220
+ parse_obj_as(
221
+ type_=typing.Optional[typing.Any], # type: ignore
222
+ object_=_response.json(),
223
+ ),
224
+ ),
225
+ )
226
+ if _response.status_code == 500:
227
+ raise InternalServerError(
228
+ headers=dict(_response.headers),
229
+ body=typing.cast(
230
+ ProblemDetails,
231
+ parse_obj_as(
232
+ type_=ProblemDetails, # type: ignore
233
+ object_=_response.json(),
234
+ ),
235
+ ),
236
+ )
237
+ _response_json = _response.json()
238
+ except JSONDecodeError:
239
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
240
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
241
+
242
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[NetworkToken]:
243
+ """
244
+ Parameters
245
+ ----------
246
+ id : str
247
+
248
+ request_options : typing.Optional[RequestOptions]
249
+ Request-specific configuration.
250
+
251
+ Returns
252
+ -------
253
+ HttpResponse[NetworkToken]
254
+ Success
255
+ """
256
+ _response = self._client_wrapper.httpx_client.request(
257
+ f"network-tokens/{jsonable_encoder(id)}",
258
+ method="GET",
259
+ request_options=request_options,
260
+ )
261
+ try:
262
+ if 200 <= _response.status_code < 300:
263
+ _data = typing.cast(
264
+ NetworkToken,
265
+ parse_obj_as(
266
+ type_=NetworkToken, # type: ignore
267
+ object_=_response.json(),
268
+ ),
269
+ )
270
+ return HttpResponse(response=_response, data=_data)
271
+ if _response.status_code == 401:
272
+ raise UnauthorizedError(
273
+ headers=dict(_response.headers),
274
+ body=typing.cast(
275
+ ProblemDetails,
276
+ parse_obj_as(
277
+ type_=ProblemDetails, # type: ignore
278
+ object_=_response.json(),
279
+ ),
280
+ ),
281
+ )
282
+ if _response.status_code == 403:
283
+ raise ForbiddenError(
284
+ headers=dict(_response.headers),
285
+ body=typing.cast(
286
+ ProblemDetails,
287
+ parse_obj_as(
288
+ type_=ProblemDetails, # type: ignore
289
+ object_=_response.json(),
290
+ ),
291
+ ),
292
+ )
293
+ if _response.status_code == 404:
294
+ raise NotFoundError(
295
+ headers=dict(_response.headers),
296
+ body=typing.cast(
297
+ typing.Optional[typing.Any],
298
+ parse_obj_as(
299
+ type_=typing.Optional[typing.Any], # type: ignore
300
+ object_=_response.json(),
301
+ ),
302
+ ),
303
+ )
304
+ if _response.status_code == 500:
305
+ raise InternalServerError(
306
+ headers=dict(_response.headers),
307
+ body=typing.cast(
308
+ ProblemDetails,
309
+ parse_obj_as(
310
+ type_=ProblemDetails, # type: ignore
311
+ object_=_response.json(),
312
+ ),
313
+ ),
314
+ )
315
+ _response_json = _response.json()
316
+ except JSONDecodeError:
317
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
318
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
319
+
320
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[None]:
321
+ """
322
+ Parameters
323
+ ----------
324
+ id : str
325
+
326
+ request_options : typing.Optional[RequestOptions]
327
+ Request-specific configuration.
328
+
329
+ Returns
330
+ -------
331
+ HttpResponse[None]
332
+ """
333
+ _response = self._client_wrapper.httpx_client.request(
334
+ f"network-tokens/{jsonable_encoder(id)}",
335
+ method="DELETE",
336
+ request_options=request_options,
337
+ )
338
+ try:
339
+ if 200 <= _response.status_code < 300:
340
+ return HttpResponse(response=_response, data=None)
341
+ if _response.status_code == 401:
342
+ raise UnauthorizedError(
343
+ headers=dict(_response.headers),
344
+ body=typing.cast(
345
+ ProblemDetails,
346
+ parse_obj_as(
347
+ type_=ProblemDetails, # type: ignore
348
+ object_=_response.json(),
349
+ ),
350
+ ),
351
+ )
352
+ if _response.status_code == 403:
353
+ raise ForbiddenError(
354
+ headers=dict(_response.headers),
355
+ body=typing.cast(
356
+ ProblemDetails,
357
+ parse_obj_as(
358
+ type_=ProblemDetails, # type: ignore
359
+ object_=_response.json(),
360
+ ),
361
+ ),
362
+ )
363
+ if _response.status_code == 404:
364
+ raise NotFoundError(
365
+ headers=dict(_response.headers),
366
+ body=typing.cast(
367
+ typing.Optional[typing.Any],
368
+ parse_obj_as(
369
+ type_=typing.Optional[typing.Any], # type: ignore
370
+ object_=_response.json(),
371
+ ),
372
+ ),
373
+ )
374
+ if _response.status_code == 500:
375
+ raise InternalServerError(
376
+ headers=dict(_response.headers),
377
+ body=typing.cast(
378
+ ProblemDetails,
379
+ parse_obj_as(
380
+ type_=ProblemDetails, # type: ignore
381
+ object_=_response.json(),
382
+ ),
383
+ ),
384
+ )
385
+ _response_json = _response.json()
386
+ except JSONDecodeError:
387
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
388
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
389
+
390
+ def suspend(
391
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
392
+ ) -> HttpResponse[NetworkToken]:
393
+ """
394
+ Parameters
395
+ ----------
396
+ id : str
397
+
398
+ request_options : typing.Optional[RequestOptions]
399
+ Request-specific configuration.
400
+
401
+ Returns
402
+ -------
403
+ HttpResponse[NetworkToken]
404
+ Success
405
+ """
406
+ _response = self._client_wrapper.httpx_client.request(
407
+ f"network-tokens/{jsonable_encoder(id)}/suspend",
408
+ method="PUT",
409
+ request_options=request_options,
410
+ )
411
+ try:
412
+ if 200 <= _response.status_code < 300:
413
+ _data = typing.cast(
414
+ NetworkToken,
415
+ parse_obj_as(
416
+ type_=NetworkToken, # type: ignore
417
+ object_=_response.json(),
418
+ ),
419
+ )
420
+ return HttpResponse(response=_response, data=_data)
421
+ if _response.status_code == 401:
422
+ raise UnauthorizedError(
423
+ headers=dict(_response.headers),
424
+ body=typing.cast(
425
+ ProblemDetails,
426
+ parse_obj_as(
427
+ type_=ProblemDetails, # type: ignore
428
+ object_=_response.json(),
429
+ ),
430
+ ),
431
+ )
432
+ if _response.status_code == 403:
433
+ raise ForbiddenError(
434
+ headers=dict(_response.headers),
435
+ body=typing.cast(
436
+ ProblemDetails,
437
+ parse_obj_as(
438
+ type_=ProblemDetails, # type: ignore
439
+ object_=_response.json(),
440
+ ),
441
+ ),
442
+ )
443
+ if _response.status_code == 404:
444
+ raise NotFoundError(
445
+ headers=dict(_response.headers),
446
+ body=typing.cast(
447
+ typing.Optional[typing.Any],
448
+ parse_obj_as(
449
+ type_=typing.Optional[typing.Any], # type: ignore
450
+ object_=_response.json(),
451
+ ),
452
+ ),
453
+ )
454
+ if _response.status_code == 409:
455
+ raise ConflictError(
456
+ headers=dict(_response.headers),
457
+ body=typing.cast(
458
+ ProblemDetails,
459
+ parse_obj_as(
460
+ type_=ProblemDetails, # type: ignore
461
+ object_=_response.json(),
462
+ ),
463
+ ),
464
+ )
465
+ if _response.status_code == 503:
466
+ raise ServiceUnavailableError(
467
+ headers=dict(_response.headers),
468
+ body=typing.cast(
469
+ ProblemDetails,
470
+ parse_obj_as(
471
+ type_=ProblemDetails, # type: ignore
472
+ object_=_response.json(),
473
+ ),
474
+ ),
475
+ )
476
+ _response_json = _response.json()
477
+ except JSONDecodeError:
478
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
479
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
480
+
481
+ def resume(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> HttpResponse[NetworkToken]:
482
+ """
483
+ Parameters
484
+ ----------
485
+ id : str
486
+
487
+ request_options : typing.Optional[RequestOptions]
488
+ Request-specific configuration.
489
+
490
+ Returns
491
+ -------
492
+ HttpResponse[NetworkToken]
493
+ Success
494
+ """
495
+ _response = self._client_wrapper.httpx_client.request(
496
+ f"network-tokens/{jsonable_encoder(id)}/resume",
497
+ method="PUT",
498
+ request_options=request_options,
499
+ )
500
+ try:
501
+ if 200 <= _response.status_code < 300:
502
+ _data = typing.cast(
503
+ NetworkToken,
504
+ parse_obj_as(
505
+ type_=NetworkToken, # type: ignore
506
+ object_=_response.json(),
507
+ ),
508
+ )
509
+ return HttpResponse(response=_response, data=_data)
510
+ if _response.status_code == 401:
511
+ raise UnauthorizedError(
512
+ headers=dict(_response.headers),
513
+ body=typing.cast(
514
+ ProblemDetails,
515
+ parse_obj_as(
516
+ type_=ProblemDetails, # type: ignore
517
+ object_=_response.json(),
518
+ ),
519
+ ),
520
+ )
521
+ if _response.status_code == 403:
522
+ raise ForbiddenError(
523
+ headers=dict(_response.headers),
524
+ body=typing.cast(
525
+ ProblemDetails,
526
+ parse_obj_as(
527
+ type_=ProblemDetails, # type: ignore
528
+ object_=_response.json(),
529
+ ),
530
+ ),
531
+ )
532
+ if _response.status_code == 404:
533
+ raise NotFoundError(
534
+ headers=dict(_response.headers),
535
+ body=typing.cast(
536
+ typing.Optional[typing.Any],
537
+ parse_obj_as(
538
+ type_=typing.Optional[typing.Any], # type: ignore
539
+ object_=_response.json(),
540
+ ),
541
+ ),
542
+ )
543
+ if _response.status_code == 409:
544
+ raise ConflictError(
545
+ headers=dict(_response.headers),
546
+ body=typing.cast(
547
+ ProblemDetails,
548
+ parse_obj_as(
549
+ type_=ProblemDetails, # type: ignore
550
+ object_=_response.json(),
551
+ ),
552
+ ),
553
+ )
554
+ if _response.status_code == 503:
555
+ raise ServiceUnavailableError(
556
+ headers=dict(_response.headers),
557
+ body=typing.cast(
558
+ ProblemDetails,
559
+ parse_obj_as(
560
+ type_=ProblemDetails, # type: ignore
561
+ object_=_response.json(),
562
+ ),
563
+ ),
564
+ )
565
+ _response_json = _response.json()
566
+ except JSONDecodeError:
567
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
568
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
569
+
570
+
571
+ class AsyncRawNetworkTokensClient:
572
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
573
+ self._client_wrapper = client_wrapper
574
+
575
+ async def create(
576
+ self,
577
+ *,
578
+ data: typing.Optional[Card] = OMIT,
579
+ token_id: typing.Optional[str] = OMIT,
580
+ token_intent_id: typing.Optional[str] = OMIT,
581
+ cardholder_info: typing.Optional[CardholderInfo] = OMIT,
582
+ request_options: typing.Optional[RequestOptions] = None,
583
+ ) -> AsyncHttpResponse[NetworkToken]:
584
+ """
585
+ Parameters
586
+ ----------
587
+ data : typing.Optional[Card]
588
+
589
+ token_id : typing.Optional[str]
590
+
591
+ token_intent_id : typing.Optional[str]
592
+
593
+ cardholder_info : typing.Optional[CardholderInfo]
594
+
595
+ request_options : typing.Optional[RequestOptions]
596
+ Request-specific configuration.
597
+
598
+ Returns
599
+ -------
600
+ AsyncHttpResponse[NetworkToken]
601
+ Created
602
+ """
603
+ _response = await self._client_wrapper.httpx_client.request(
604
+ "network-tokens",
605
+ method="POST",
606
+ json={
607
+ "data": convert_and_respect_annotation_metadata(object_=data, annotation=Card, direction="write"),
608
+ "token_id": token_id,
609
+ "token_intent_id": token_intent_id,
610
+ "cardholder_info": convert_and_respect_annotation_metadata(
611
+ object_=cardholder_info, annotation=CardholderInfo, direction="write"
612
+ ),
613
+ },
614
+ headers={
615
+ "content-type": "application/json",
616
+ },
617
+ request_options=request_options,
618
+ omit=OMIT,
619
+ )
620
+ try:
621
+ if 200 <= _response.status_code < 300:
622
+ _data = typing.cast(
623
+ NetworkToken,
624
+ parse_obj_as(
625
+ type_=NetworkToken, # type: ignore
626
+ object_=_response.json(),
627
+ ),
628
+ )
629
+ return AsyncHttpResponse(response=_response, data=_data)
630
+ if _response.status_code == 400:
631
+ raise BadRequestError(
632
+ headers=dict(_response.headers),
633
+ body=typing.cast(
634
+ ValidationProblemDetails,
635
+ parse_obj_as(
636
+ type_=ValidationProblemDetails, # type: ignore
637
+ object_=_response.json(),
638
+ ),
639
+ ),
640
+ )
641
+ if _response.status_code == 401:
642
+ raise UnauthorizedError(
643
+ headers=dict(_response.headers),
644
+ body=typing.cast(
645
+ ProblemDetails,
646
+ parse_obj_as(
647
+ type_=ProblemDetails, # type: ignore
648
+ object_=_response.json(),
649
+ ),
650
+ ),
651
+ )
652
+ if _response.status_code == 403:
653
+ raise ForbiddenError(
654
+ headers=dict(_response.headers),
655
+ body=typing.cast(
656
+ ProblemDetails,
657
+ parse_obj_as(
658
+ type_=ProblemDetails, # type: ignore
659
+ object_=_response.json(),
660
+ ),
661
+ ),
662
+ )
663
+ if _response.status_code == 422:
664
+ raise UnprocessableEntityError(
665
+ headers=dict(_response.headers),
666
+ body=typing.cast(
667
+ ProblemDetails,
668
+ parse_obj_as(
669
+ type_=ProblemDetails, # type: ignore
670
+ object_=_response.json(),
671
+ ),
672
+ ),
673
+ )
674
+ if _response.status_code == 500:
675
+ raise InternalServerError(
676
+ headers=dict(_response.headers),
677
+ body=typing.cast(
678
+ ProblemDetails,
679
+ parse_obj_as(
680
+ type_=ProblemDetails, # type: ignore
681
+ object_=_response.json(),
682
+ ),
683
+ ),
684
+ )
685
+ _response_json = _response.json()
686
+ except JSONDecodeError:
687
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
688
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
689
+
690
+ async def cryptogram(
691
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
692
+ ) -> AsyncHttpResponse[NetworkTokenCryptogram]:
693
+ """
694
+ Parameters
695
+ ----------
696
+ id : str
697
+
698
+ request_options : typing.Optional[RequestOptions]
699
+ Request-specific configuration.
700
+
701
+ Returns
702
+ -------
703
+ AsyncHttpResponse[NetworkTokenCryptogram]
704
+ Success
705
+ """
706
+ _response = await self._client_wrapper.httpx_client.request(
707
+ f"network-tokens/{jsonable_encoder(id)}/cryptogram",
708
+ method="POST",
709
+ request_options=request_options,
710
+ )
711
+ try:
712
+ if 200 <= _response.status_code < 300:
713
+ _data = typing.cast(
714
+ NetworkTokenCryptogram,
715
+ parse_obj_as(
716
+ type_=NetworkTokenCryptogram, # type: ignore
717
+ object_=_response.json(),
718
+ ),
719
+ )
720
+ return AsyncHttpResponse(response=_response, data=_data)
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
+ if _response.status_code == 500:
766
+ raise InternalServerError(
767
+ headers=dict(_response.headers),
768
+ body=typing.cast(
769
+ ProblemDetails,
770
+ parse_obj_as(
771
+ type_=ProblemDetails, # type: ignore
772
+ object_=_response.json(),
773
+ ),
774
+ ),
775
+ )
776
+ _response_json = _response.json()
777
+ except JSONDecodeError:
778
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
779
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
780
+
781
+ async def get(
782
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
783
+ ) -> AsyncHttpResponse[NetworkToken]:
784
+ """
785
+ Parameters
786
+ ----------
787
+ id : str
788
+
789
+ request_options : typing.Optional[RequestOptions]
790
+ Request-specific configuration.
791
+
792
+ Returns
793
+ -------
794
+ AsyncHttpResponse[NetworkToken]
795
+ Success
796
+ """
797
+ _response = await self._client_wrapper.httpx_client.request(
798
+ f"network-tokens/{jsonable_encoder(id)}",
799
+ method="GET",
800
+ request_options=request_options,
801
+ )
802
+ try:
803
+ if 200 <= _response.status_code < 300:
804
+ _data = typing.cast(
805
+ NetworkToken,
806
+ parse_obj_as(
807
+ type_=NetworkToken, # type: ignore
808
+ object_=_response.json(),
809
+ ),
810
+ )
811
+ return AsyncHttpResponse(response=_response, data=_data)
812
+ if _response.status_code == 401:
813
+ raise UnauthorizedError(
814
+ headers=dict(_response.headers),
815
+ body=typing.cast(
816
+ ProblemDetails,
817
+ parse_obj_as(
818
+ type_=ProblemDetails, # type: ignore
819
+ object_=_response.json(),
820
+ ),
821
+ ),
822
+ )
823
+ if _response.status_code == 403:
824
+ raise ForbiddenError(
825
+ headers=dict(_response.headers),
826
+ body=typing.cast(
827
+ ProblemDetails,
828
+ parse_obj_as(
829
+ type_=ProblemDetails, # type: ignore
830
+ object_=_response.json(),
831
+ ),
832
+ ),
833
+ )
834
+ if _response.status_code == 404:
835
+ raise NotFoundError(
836
+ headers=dict(_response.headers),
837
+ body=typing.cast(
838
+ typing.Optional[typing.Any],
839
+ parse_obj_as(
840
+ type_=typing.Optional[typing.Any], # type: ignore
841
+ object_=_response.json(),
842
+ ),
843
+ ),
844
+ )
845
+ if _response.status_code == 500:
846
+ raise InternalServerError(
847
+ headers=dict(_response.headers),
848
+ body=typing.cast(
849
+ ProblemDetails,
850
+ parse_obj_as(
851
+ type_=ProblemDetails, # type: ignore
852
+ object_=_response.json(),
853
+ ),
854
+ ),
855
+ )
856
+ _response_json = _response.json()
857
+ except JSONDecodeError:
858
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
859
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
860
+
861
+ async def delete(
862
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
863
+ ) -> AsyncHttpResponse[None]:
864
+ """
865
+ Parameters
866
+ ----------
867
+ id : str
868
+
869
+ request_options : typing.Optional[RequestOptions]
870
+ Request-specific configuration.
871
+
872
+ Returns
873
+ -------
874
+ AsyncHttpResponse[None]
875
+ """
876
+ _response = await self._client_wrapper.httpx_client.request(
877
+ f"network-tokens/{jsonable_encoder(id)}",
878
+ method="DELETE",
879
+ request_options=request_options,
880
+ )
881
+ try:
882
+ if 200 <= _response.status_code < 300:
883
+ return AsyncHttpResponse(response=_response, data=None)
884
+ if _response.status_code == 401:
885
+ raise UnauthorizedError(
886
+ headers=dict(_response.headers),
887
+ body=typing.cast(
888
+ ProblemDetails,
889
+ parse_obj_as(
890
+ type_=ProblemDetails, # type: ignore
891
+ object_=_response.json(),
892
+ ),
893
+ ),
894
+ )
895
+ if _response.status_code == 403:
896
+ raise ForbiddenError(
897
+ headers=dict(_response.headers),
898
+ body=typing.cast(
899
+ ProblemDetails,
900
+ parse_obj_as(
901
+ type_=ProblemDetails, # type: ignore
902
+ object_=_response.json(),
903
+ ),
904
+ ),
905
+ )
906
+ if _response.status_code == 404:
907
+ raise NotFoundError(
908
+ headers=dict(_response.headers),
909
+ body=typing.cast(
910
+ typing.Optional[typing.Any],
911
+ parse_obj_as(
912
+ type_=typing.Optional[typing.Any], # type: ignore
913
+ object_=_response.json(),
914
+ ),
915
+ ),
916
+ )
917
+ if _response.status_code == 500:
918
+ raise InternalServerError(
919
+ headers=dict(_response.headers),
920
+ body=typing.cast(
921
+ ProblemDetails,
922
+ parse_obj_as(
923
+ type_=ProblemDetails, # type: ignore
924
+ object_=_response.json(),
925
+ ),
926
+ ),
927
+ )
928
+ _response_json = _response.json()
929
+ except JSONDecodeError:
930
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
931
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
932
+
933
+ async def suspend(
934
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
935
+ ) -> AsyncHttpResponse[NetworkToken]:
936
+ """
937
+ Parameters
938
+ ----------
939
+ id : str
940
+
941
+ request_options : typing.Optional[RequestOptions]
942
+ Request-specific configuration.
943
+
944
+ Returns
945
+ -------
946
+ AsyncHttpResponse[NetworkToken]
947
+ Success
948
+ """
949
+ _response = await self._client_wrapper.httpx_client.request(
950
+ f"network-tokens/{jsonable_encoder(id)}/suspend",
951
+ method="PUT",
952
+ request_options=request_options,
953
+ )
954
+ try:
955
+ if 200 <= _response.status_code < 300:
956
+ _data = typing.cast(
957
+ NetworkToken,
958
+ parse_obj_as(
959
+ type_=NetworkToken, # type: ignore
960
+ object_=_response.json(),
961
+ ),
962
+ )
963
+ return AsyncHttpResponse(response=_response, data=_data)
964
+ if _response.status_code == 401:
965
+ raise UnauthorizedError(
966
+ headers=dict(_response.headers),
967
+ body=typing.cast(
968
+ ProblemDetails,
969
+ parse_obj_as(
970
+ type_=ProblemDetails, # type: ignore
971
+ object_=_response.json(),
972
+ ),
973
+ ),
974
+ )
975
+ if _response.status_code == 403:
976
+ raise ForbiddenError(
977
+ headers=dict(_response.headers),
978
+ body=typing.cast(
979
+ ProblemDetails,
980
+ parse_obj_as(
981
+ type_=ProblemDetails, # type: ignore
982
+ object_=_response.json(),
983
+ ),
984
+ ),
985
+ )
986
+ if _response.status_code == 404:
987
+ raise NotFoundError(
988
+ headers=dict(_response.headers),
989
+ body=typing.cast(
990
+ typing.Optional[typing.Any],
991
+ parse_obj_as(
992
+ type_=typing.Optional[typing.Any], # type: ignore
993
+ object_=_response.json(),
994
+ ),
995
+ ),
996
+ )
997
+ if _response.status_code == 409:
998
+ raise ConflictError(
999
+ headers=dict(_response.headers),
1000
+ body=typing.cast(
1001
+ ProblemDetails,
1002
+ parse_obj_as(
1003
+ type_=ProblemDetails, # type: ignore
1004
+ object_=_response.json(),
1005
+ ),
1006
+ ),
1007
+ )
1008
+ if _response.status_code == 503:
1009
+ raise ServiceUnavailableError(
1010
+ headers=dict(_response.headers),
1011
+ body=typing.cast(
1012
+ ProblemDetails,
1013
+ parse_obj_as(
1014
+ type_=ProblemDetails, # type: ignore
1015
+ object_=_response.json(),
1016
+ ),
1017
+ ),
1018
+ )
1019
+ _response_json = _response.json()
1020
+ except JSONDecodeError:
1021
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1022
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
1023
+
1024
+ async def resume(
1025
+ self, id: str, *, request_options: typing.Optional[RequestOptions] = None
1026
+ ) -> AsyncHttpResponse[NetworkToken]:
1027
+ """
1028
+ Parameters
1029
+ ----------
1030
+ id : str
1031
+
1032
+ request_options : typing.Optional[RequestOptions]
1033
+ Request-specific configuration.
1034
+
1035
+ Returns
1036
+ -------
1037
+ AsyncHttpResponse[NetworkToken]
1038
+ Success
1039
+ """
1040
+ _response = await self._client_wrapper.httpx_client.request(
1041
+ f"network-tokens/{jsonable_encoder(id)}/resume",
1042
+ method="PUT",
1043
+ request_options=request_options,
1044
+ )
1045
+ try:
1046
+ if 200 <= _response.status_code < 300:
1047
+ _data = typing.cast(
1048
+ NetworkToken,
1049
+ parse_obj_as(
1050
+ type_=NetworkToken, # type: ignore
1051
+ object_=_response.json(),
1052
+ ),
1053
+ )
1054
+ return AsyncHttpResponse(response=_response, data=_data)
1055
+ if _response.status_code == 401:
1056
+ raise UnauthorizedError(
1057
+ headers=dict(_response.headers),
1058
+ body=typing.cast(
1059
+ ProblemDetails,
1060
+ parse_obj_as(
1061
+ type_=ProblemDetails, # type: ignore
1062
+ object_=_response.json(),
1063
+ ),
1064
+ ),
1065
+ )
1066
+ if _response.status_code == 403:
1067
+ raise ForbiddenError(
1068
+ headers=dict(_response.headers),
1069
+ body=typing.cast(
1070
+ ProblemDetails,
1071
+ parse_obj_as(
1072
+ type_=ProblemDetails, # type: ignore
1073
+ object_=_response.json(),
1074
+ ),
1075
+ ),
1076
+ )
1077
+ if _response.status_code == 404:
1078
+ raise NotFoundError(
1079
+ headers=dict(_response.headers),
1080
+ body=typing.cast(
1081
+ typing.Optional[typing.Any],
1082
+ parse_obj_as(
1083
+ type_=typing.Optional[typing.Any], # type: ignore
1084
+ object_=_response.json(),
1085
+ ),
1086
+ ),
1087
+ )
1088
+ if _response.status_code == 409:
1089
+ raise ConflictError(
1090
+ headers=dict(_response.headers),
1091
+ body=typing.cast(
1092
+ ProblemDetails,
1093
+ parse_obj_as(
1094
+ type_=ProblemDetails, # type: ignore
1095
+ object_=_response.json(),
1096
+ ),
1097
+ ),
1098
+ )
1099
+ if _response.status_code == 503:
1100
+ raise ServiceUnavailableError(
1101
+ headers=dict(_response.headers),
1102
+ body=typing.cast(
1103
+ ProblemDetails,
1104
+ parse_obj_as(
1105
+ type_=ProblemDetails, # type: ignore
1106
+ object_=_response.json(),
1107
+ ),
1108
+ ),
1109
+ )
1110
+ _response_json = _response.json()
1111
+ except JSONDecodeError:
1112
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
1113
+ raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)