moovio_sdk 0.4.0__py3-none-any.whl → 0.4.2__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.
- moovio_sdk/_version.py +3 -3
- moovio_sdk/account_terminal_applications.py +985 -0
- moovio_sdk/models/components/__init__.py +6 -0
- moovio_sdk/models/components/linkaccountterminalapplication.py +22 -0
- moovio_sdk/models/errors/__init__.py +6 -0
- moovio_sdk/models/errors/accountterminalapplicationerror.py +24 -0
- moovio_sdk/models/operations/__init__.py +42 -0
- moovio_sdk/models/operations/createtransfer.py +2 -2
- moovio_sdk/models/operations/getaccountterminalapplication.py +73 -0
- moovio_sdk/models/operations/initiaterefund.py +2 -2
- moovio_sdk/models/operations/linkaccountterminalapplication.py +78 -0
- moovio_sdk/models/operations/listaccountterminalapplications.py +66 -0
- moovio_sdk/sdk.py +5 -3
- moovio_sdk/terminal_applications.py +8 -8
- moovio_sdk/transfers.py +4 -4
- {moovio_sdk-0.4.0.dist-info → moovio_sdk-0.4.2.dist-info}/METADATA +24 -12
- {moovio_sdk-0.4.0.dist-info → moovio_sdk-0.4.2.dist-info}/RECORD +18 -13
- moovio_sdk/terminal_configurations.py +0 -241
- {moovio_sdk-0.4.0.dist-info → moovio_sdk-0.4.2.dist-info}/WHEEL +0 -0
@@ -0,0 +1,985 @@
|
|
1
|
+
"""Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
|
2
|
+
|
3
|
+
from .basesdk import BaseSDK
|
4
|
+
from moovio_sdk import utils
|
5
|
+
from moovio_sdk._hooks import HookContext
|
6
|
+
from moovio_sdk.models import components, errors, operations
|
7
|
+
from moovio_sdk.types import OptionalNullable, UNSET
|
8
|
+
from moovio_sdk.utils import get_security_from_env
|
9
|
+
from typing import Any, List, Mapping, Optional
|
10
|
+
|
11
|
+
|
12
|
+
class AccountTerminalApplications(BaseSDK):
|
13
|
+
def link(
|
14
|
+
self,
|
15
|
+
*,
|
16
|
+
account_id: str,
|
17
|
+
terminal_application_id: str,
|
18
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
19
|
+
server_url: Optional[str] = None,
|
20
|
+
timeout_ms: Optional[int] = None,
|
21
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
22
|
+
) -> operations.LinkAccountTerminalApplicationResponse:
|
23
|
+
r"""Link an account with a terminal application.
|
24
|
+
|
25
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
26
|
+
you'll need to specify the `/accounts/{accountID}/terminal-applications.write` scope.
|
27
|
+
|
28
|
+
:param account_id:
|
29
|
+
:param terminal_application_id: ID of the terminal application.
|
30
|
+
:param retries: Override the default retry configuration for this method
|
31
|
+
:param server_url: Override the default server URL for this method
|
32
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
33
|
+
:param http_headers: Additional headers to set or replace on requests.
|
34
|
+
"""
|
35
|
+
base_url = None
|
36
|
+
url_variables = None
|
37
|
+
if timeout_ms is None:
|
38
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
39
|
+
|
40
|
+
if server_url is not None:
|
41
|
+
base_url = server_url
|
42
|
+
else:
|
43
|
+
base_url = self._get_url(base_url, url_variables)
|
44
|
+
|
45
|
+
request = operations.LinkAccountTerminalApplicationRequest(
|
46
|
+
account_id=account_id,
|
47
|
+
link_account_terminal_application=components.LinkAccountTerminalApplication(
|
48
|
+
terminal_application_id=terminal_application_id,
|
49
|
+
),
|
50
|
+
)
|
51
|
+
|
52
|
+
req = self._build_request(
|
53
|
+
method="POST",
|
54
|
+
path="/accounts/{accountID}/terminal-applications",
|
55
|
+
base_url=base_url,
|
56
|
+
url_variables=url_variables,
|
57
|
+
request=request,
|
58
|
+
request_body_required=True,
|
59
|
+
request_has_path_params=True,
|
60
|
+
request_has_query_params=True,
|
61
|
+
user_agent_header="user-agent",
|
62
|
+
accept_header_value="application/json",
|
63
|
+
http_headers=http_headers,
|
64
|
+
_globals=operations.LinkAccountTerminalApplicationGlobals(
|
65
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
66
|
+
),
|
67
|
+
security=self.sdk_configuration.security,
|
68
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
69
|
+
request.link_account_terminal_application,
|
70
|
+
False,
|
71
|
+
False,
|
72
|
+
"json",
|
73
|
+
components.LinkAccountTerminalApplication,
|
74
|
+
),
|
75
|
+
timeout_ms=timeout_ms,
|
76
|
+
)
|
77
|
+
|
78
|
+
if retries == UNSET:
|
79
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
80
|
+
retries = self.sdk_configuration.retry_config
|
81
|
+
|
82
|
+
retry_config = None
|
83
|
+
if isinstance(retries, utils.RetryConfig):
|
84
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
85
|
+
|
86
|
+
http_res = self.do_request(
|
87
|
+
hook_ctx=HookContext(
|
88
|
+
base_url=base_url or "",
|
89
|
+
operation_id="linkAccountTerminalApplication",
|
90
|
+
oauth2_scopes=[],
|
91
|
+
security_source=get_security_from_env(
|
92
|
+
self.sdk_configuration.security, components.Security
|
93
|
+
),
|
94
|
+
),
|
95
|
+
request=req,
|
96
|
+
error_status_codes=[
|
97
|
+
"400",
|
98
|
+
"401",
|
99
|
+
"403",
|
100
|
+
"404",
|
101
|
+
"409",
|
102
|
+
"422",
|
103
|
+
"429",
|
104
|
+
"4XX",
|
105
|
+
"500",
|
106
|
+
"504",
|
107
|
+
"5XX",
|
108
|
+
],
|
109
|
+
retry_config=retry_config,
|
110
|
+
)
|
111
|
+
|
112
|
+
response_data: Any = None
|
113
|
+
if utils.match_response(http_res, "200", "application/json"):
|
114
|
+
return operations.LinkAccountTerminalApplicationResponse(
|
115
|
+
result=utils.unmarshal_json(
|
116
|
+
http_res.text, components.TerminalApplication
|
117
|
+
),
|
118
|
+
headers=utils.get_response_headers(http_res.headers),
|
119
|
+
)
|
120
|
+
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
121
|
+
response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
|
122
|
+
raise errors.GenericError(data=response_data)
|
123
|
+
if utils.match_response(http_res, "422", "application/json"):
|
124
|
+
response_data = utils.unmarshal_json(
|
125
|
+
http_res.text, errors.AccountTerminalApplicationErrorData
|
126
|
+
)
|
127
|
+
raise errors.AccountTerminalApplicationError(data=response_data)
|
128
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
129
|
+
http_res_text = utils.stream_to_text(http_res)
|
130
|
+
raise errors.APIError(
|
131
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
132
|
+
)
|
133
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
134
|
+
http_res_text = utils.stream_to_text(http_res)
|
135
|
+
raise errors.APIError(
|
136
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
137
|
+
)
|
138
|
+
if utils.match_response(http_res, "4XX", "*"):
|
139
|
+
http_res_text = utils.stream_to_text(http_res)
|
140
|
+
raise errors.APIError(
|
141
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
142
|
+
)
|
143
|
+
if utils.match_response(http_res, "5XX", "*"):
|
144
|
+
http_res_text = utils.stream_to_text(http_res)
|
145
|
+
raise errors.APIError(
|
146
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
147
|
+
)
|
148
|
+
|
149
|
+
content_type = http_res.headers.get("Content-Type")
|
150
|
+
http_res_text = utils.stream_to_text(http_res)
|
151
|
+
raise errors.APIError(
|
152
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
153
|
+
http_res.status_code,
|
154
|
+
http_res_text,
|
155
|
+
http_res,
|
156
|
+
)
|
157
|
+
|
158
|
+
async def link_async(
|
159
|
+
self,
|
160
|
+
*,
|
161
|
+
account_id: str,
|
162
|
+
terminal_application_id: str,
|
163
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
164
|
+
server_url: Optional[str] = None,
|
165
|
+
timeout_ms: Optional[int] = None,
|
166
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
167
|
+
) -> operations.LinkAccountTerminalApplicationResponse:
|
168
|
+
r"""Link an account with a terminal application.
|
169
|
+
|
170
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
171
|
+
you'll need to specify the `/accounts/{accountID}/terminal-applications.write` scope.
|
172
|
+
|
173
|
+
:param account_id:
|
174
|
+
:param terminal_application_id: ID of the terminal application.
|
175
|
+
:param retries: Override the default retry configuration for this method
|
176
|
+
:param server_url: Override the default server URL for this method
|
177
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
178
|
+
:param http_headers: Additional headers to set or replace on requests.
|
179
|
+
"""
|
180
|
+
base_url = None
|
181
|
+
url_variables = None
|
182
|
+
if timeout_ms is None:
|
183
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
184
|
+
|
185
|
+
if server_url is not None:
|
186
|
+
base_url = server_url
|
187
|
+
else:
|
188
|
+
base_url = self._get_url(base_url, url_variables)
|
189
|
+
|
190
|
+
request = operations.LinkAccountTerminalApplicationRequest(
|
191
|
+
account_id=account_id,
|
192
|
+
link_account_terminal_application=components.LinkAccountTerminalApplication(
|
193
|
+
terminal_application_id=terminal_application_id,
|
194
|
+
),
|
195
|
+
)
|
196
|
+
|
197
|
+
req = self._build_request_async(
|
198
|
+
method="POST",
|
199
|
+
path="/accounts/{accountID}/terminal-applications",
|
200
|
+
base_url=base_url,
|
201
|
+
url_variables=url_variables,
|
202
|
+
request=request,
|
203
|
+
request_body_required=True,
|
204
|
+
request_has_path_params=True,
|
205
|
+
request_has_query_params=True,
|
206
|
+
user_agent_header="user-agent",
|
207
|
+
accept_header_value="application/json",
|
208
|
+
http_headers=http_headers,
|
209
|
+
_globals=operations.LinkAccountTerminalApplicationGlobals(
|
210
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
211
|
+
),
|
212
|
+
security=self.sdk_configuration.security,
|
213
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
214
|
+
request.link_account_terminal_application,
|
215
|
+
False,
|
216
|
+
False,
|
217
|
+
"json",
|
218
|
+
components.LinkAccountTerminalApplication,
|
219
|
+
),
|
220
|
+
timeout_ms=timeout_ms,
|
221
|
+
)
|
222
|
+
|
223
|
+
if retries == UNSET:
|
224
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
225
|
+
retries = self.sdk_configuration.retry_config
|
226
|
+
|
227
|
+
retry_config = None
|
228
|
+
if isinstance(retries, utils.RetryConfig):
|
229
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
230
|
+
|
231
|
+
http_res = await self.do_request_async(
|
232
|
+
hook_ctx=HookContext(
|
233
|
+
base_url=base_url or "",
|
234
|
+
operation_id="linkAccountTerminalApplication",
|
235
|
+
oauth2_scopes=[],
|
236
|
+
security_source=get_security_from_env(
|
237
|
+
self.sdk_configuration.security, components.Security
|
238
|
+
),
|
239
|
+
),
|
240
|
+
request=req,
|
241
|
+
error_status_codes=[
|
242
|
+
"400",
|
243
|
+
"401",
|
244
|
+
"403",
|
245
|
+
"404",
|
246
|
+
"409",
|
247
|
+
"422",
|
248
|
+
"429",
|
249
|
+
"4XX",
|
250
|
+
"500",
|
251
|
+
"504",
|
252
|
+
"5XX",
|
253
|
+
],
|
254
|
+
retry_config=retry_config,
|
255
|
+
)
|
256
|
+
|
257
|
+
response_data: Any = None
|
258
|
+
if utils.match_response(http_res, "200", "application/json"):
|
259
|
+
return operations.LinkAccountTerminalApplicationResponse(
|
260
|
+
result=utils.unmarshal_json(
|
261
|
+
http_res.text, components.TerminalApplication
|
262
|
+
),
|
263
|
+
headers=utils.get_response_headers(http_res.headers),
|
264
|
+
)
|
265
|
+
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
266
|
+
response_data = utils.unmarshal_json(http_res.text, errors.GenericErrorData)
|
267
|
+
raise errors.GenericError(data=response_data)
|
268
|
+
if utils.match_response(http_res, "422", "application/json"):
|
269
|
+
response_data = utils.unmarshal_json(
|
270
|
+
http_res.text, errors.AccountTerminalApplicationErrorData
|
271
|
+
)
|
272
|
+
raise errors.AccountTerminalApplicationError(data=response_data)
|
273
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
274
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
275
|
+
raise errors.APIError(
|
276
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
277
|
+
)
|
278
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
279
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
280
|
+
raise errors.APIError(
|
281
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
282
|
+
)
|
283
|
+
if utils.match_response(http_res, "4XX", "*"):
|
284
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
285
|
+
raise errors.APIError(
|
286
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
287
|
+
)
|
288
|
+
if utils.match_response(http_res, "5XX", "*"):
|
289
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
290
|
+
raise errors.APIError(
|
291
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
292
|
+
)
|
293
|
+
|
294
|
+
content_type = http_res.headers.get("Content-Type")
|
295
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
296
|
+
raise errors.APIError(
|
297
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
298
|
+
http_res.status_code,
|
299
|
+
http_res_text,
|
300
|
+
http_res,
|
301
|
+
)
|
302
|
+
|
303
|
+
def list(
|
304
|
+
self,
|
305
|
+
*,
|
306
|
+
account_id: str,
|
307
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
308
|
+
server_url: Optional[str] = None,
|
309
|
+
timeout_ms: Optional[int] = None,
|
310
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
311
|
+
) -> operations.ListAccountTerminalApplicationsResponse:
|
312
|
+
r"""Retrieve all terminal applications linked to a specific account.
|
313
|
+
|
314
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
315
|
+
you'll need to specify the `/accounts/{accountID}/terminal-applications.read` scope.
|
316
|
+
|
317
|
+
:param account_id:
|
318
|
+
:param retries: Override the default retry configuration for this method
|
319
|
+
:param server_url: Override the default server URL for this method
|
320
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
321
|
+
:param http_headers: Additional headers to set or replace on requests.
|
322
|
+
"""
|
323
|
+
base_url = None
|
324
|
+
url_variables = None
|
325
|
+
if timeout_ms is None:
|
326
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
327
|
+
|
328
|
+
if server_url is not None:
|
329
|
+
base_url = server_url
|
330
|
+
else:
|
331
|
+
base_url = self._get_url(base_url, url_variables)
|
332
|
+
|
333
|
+
request = operations.ListAccountTerminalApplicationsRequest(
|
334
|
+
account_id=account_id,
|
335
|
+
)
|
336
|
+
|
337
|
+
req = self._build_request(
|
338
|
+
method="GET",
|
339
|
+
path="/accounts/{accountID}/terminal-applications",
|
340
|
+
base_url=base_url,
|
341
|
+
url_variables=url_variables,
|
342
|
+
request=request,
|
343
|
+
request_body_required=False,
|
344
|
+
request_has_path_params=True,
|
345
|
+
request_has_query_params=True,
|
346
|
+
user_agent_header="user-agent",
|
347
|
+
accept_header_value="application/json",
|
348
|
+
http_headers=http_headers,
|
349
|
+
_globals=operations.ListAccountTerminalApplicationsGlobals(
|
350
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
351
|
+
),
|
352
|
+
security=self.sdk_configuration.security,
|
353
|
+
timeout_ms=timeout_ms,
|
354
|
+
)
|
355
|
+
|
356
|
+
if retries == UNSET:
|
357
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
358
|
+
retries = self.sdk_configuration.retry_config
|
359
|
+
|
360
|
+
retry_config = None
|
361
|
+
if isinstance(retries, utils.RetryConfig):
|
362
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
363
|
+
|
364
|
+
http_res = self.do_request(
|
365
|
+
hook_ctx=HookContext(
|
366
|
+
base_url=base_url or "",
|
367
|
+
operation_id="listAccountTerminalApplications",
|
368
|
+
oauth2_scopes=[],
|
369
|
+
security_source=get_security_from_env(
|
370
|
+
self.sdk_configuration.security, components.Security
|
371
|
+
),
|
372
|
+
),
|
373
|
+
request=req,
|
374
|
+
error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
|
375
|
+
retry_config=retry_config,
|
376
|
+
)
|
377
|
+
|
378
|
+
if utils.match_response(http_res, "200", "application/json"):
|
379
|
+
return operations.ListAccountTerminalApplicationsResponse(
|
380
|
+
result=utils.unmarshal_json(
|
381
|
+
http_res.text, List[components.TerminalApplication]
|
382
|
+
),
|
383
|
+
headers=utils.get_response_headers(http_res.headers),
|
384
|
+
)
|
385
|
+
if utils.match_response(http_res, ["401", "403", "429"], "*"):
|
386
|
+
http_res_text = utils.stream_to_text(http_res)
|
387
|
+
raise errors.APIError(
|
388
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
389
|
+
)
|
390
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
391
|
+
http_res_text = utils.stream_to_text(http_res)
|
392
|
+
raise errors.APIError(
|
393
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
394
|
+
)
|
395
|
+
if utils.match_response(http_res, "4XX", "*"):
|
396
|
+
http_res_text = utils.stream_to_text(http_res)
|
397
|
+
raise errors.APIError(
|
398
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
399
|
+
)
|
400
|
+
if utils.match_response(http_res, "5XX", "*"):
|
401
|
+
http_res_text = utils.stream_to_text(http_res)
|
402
|
+
raise errors.APIError(
|
403
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
404
|
+
)
|
405
|
+
|
406
|
+
content_type = http_res.headers.get("Content-Type")
|
407
|
+
http_res_text = utils.stream_to_text(http_res)
|
408
|
+
raise errors.APIError(
|
409
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
410
|
+
http_res.status_code,
|
411
|
+
http_res_text,
|
412
|
+
http_res,
|
413
|
+
)
|
414
|
+
|
415
|
+
async def list_async(
|
416
|
+
self,
|
417
|
+
*,
|
418
|
+
account_id: str,
|
419
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
420
|
+
server_url: Optional[str] = None,
|
421
|
+
timeout_ms: Optional[int] = None,
|
422
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
423
|
+
) -> operations.ListAccountTerminalApplicationsResponse:
|
424
|
+
r"""Retrieve all terminal applications linked to a specific account.
|
425
|
+
|
426
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
427
|
+
you'll need to specify the `/accounts/{accountID}/terminal-applications.read` scope.
|
428
|
+
|
429
|
+
:param account_id:
|
430
|
+
:param retries: Override the default retry configuration for this method
|
431
|
+
:param server_url: Override the default server URL for this method
|
432
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
433
|
+
:param http_headers: Additional headers to set or replace on requests.
|
434
|
+
"""
|
435
|
+
base_url = None
|
436
|
+
url_variables = None
|
437
|
+
if timeout_ms is None:
|
438
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
439
|
+
|
440
|
+
if server_url is not None:
|
441
|
+
base_url = server_url
|
442
|
+
else:
|
443
|
+
base_url = self._get_url(base_url, url_variables)
|
444
|
+
|
445
|
+
request = operations.ListAccountTerminalApplicationsRequest(
|
446
|
+
account_id=account_id,
|
447
|
+
)
|
448
|
+
|
449
|
+
req = self._build_request_async(
|
450
|
+
method="GET",
|
451
|
+
path="/accounts/{accountID}/terminal-applications",
|
452
|
+
base_url=base_url,
|
453
|
+
url_variables=url_variables,
|
454
|
+
request=request,
|
455
|
+
request_body_required=False,
|
456
|
+
request_has_path_params=True,
|
457
|
+
request_has_query_params=True,
|
458
|
+
user_agent_header="user-agent",
|
459
|
+
accept_header_value="application/json",
|
460
|
+
http_headers=http_headers,
|
461
|
+
_globals=operations.ListAccountTerminalApplicationsGlobals(
|
462
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
463
|
+
),
|
464
|
+
security=self.sdk_configuration.security,
|
465
|
+
timeout_ms=timeout_ms,
|
466
|
+
)
|
467
|
+
|
468
|
+
if retries == UNSET:
|
469
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
470
|
+
retries = self.sdk_configuration.retry_config
|
471
|
+
|
472
|
+
retry_config = None
|
473
|
+
if isinstance(retries, utils.RetryConfig):
|
474
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
475
|
+
|
476
|
+
http_res = await self.do_request_async(
|
477
|
+
hook_ctx=HookContext(
|
478
|
+
base_url=base_url or "",
|
479
|
+
operation_id="listAccountTerminalApplications",
|
480
|
+
oauth2_scopes=[],
|
481
|
+
security_source=get_security_from_env(
|
482
|
+
self.sdk_configuration.security, components.Security
|
483
|
+
),
|
484
|
+
),
|
485
|
+
request=req,
|
486
|
+
error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
|
487
|
+
retry_config=retry_config,
|
488
|
+
)
|
489
|
+
|
490
|
+
if utils.match_response(http_res, "200", "application/json"):
|
491
|
+
return operations.ListAccountTerminalApplicationsResponse(
|
492
|
+
result=utils.unmarshal_json(
|
493
|
+
http_res.text, List[components.TerminalApplication]
|
494
|
+
),
|
495
|
+
headers=utils.get_response_headers(http_res.headers),
|
496
|
+
)
|
497
|
+
if utils.match_response(http_res, ["401", "403", "429"], "*"):
|
498
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
499
|
+
raise errors.APIError(
|
500
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
501
|
+
)
|
502
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
503
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
504
|
+
raise errors.APIError(
|
505
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
506
|
+
)
|
507
|
+
if utils.match_response(http_res, "4XX", "*"):
|
508
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
509
|
+
raise errors.APIError(
|
510
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
511
|
+
)
|
512
|
+
if utils.match_response(http_res, "5XX", "*"):
|
513
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
514
|
+
raise errors.APIError(
|
515
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
516
|
+
)
|
517
|
+
|
518
|
+
content_type = http_res.headers.get("Content-Type")
|
519
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
520
|
+
raise errors.APIError(
|
521
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
522
|
+
http_res.status_code,
|
523
|
+
http_res_text,
|
524
|
+
http_res,
|
525
|
+
)
|
526
|
+
|
527
|
+
def get(
|
528
|
+
self,
|
529
|
+
*,
|
530
|
+
account_id: str,
|
531
|
+
terminal_application_id: str,
|
532
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
533
|
+
server_url: Optional[str] = None,
|
534
|
+
timeout_ms: Optional[int] = None,
|
535
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
536
|
+
) -> operations.GetAccountTerminalApplicationResponse:
|
537
|
+
r"""Verifies if a specific Terminal Application is linked to an Account. This endpoint acts as a validation check for the link's existence.
|
538
|
+
|
539
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
540
|
+
you'll need to specify the `/accounts/{accountID}/terminal-applications.read` scope.
|
541
|
+
|
542
|
+
:param account_id:
|
543
|
+
:param terminal_application_id:
|
544
|
+
:param retries: Override the default retry configuration for this method
|
545
|
+
:param server_url: Override the default server URL for this method
|
546
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
547
|
+
:param http_headers: Additional headers to set or replace on requests.
|
548
|
+
"""
|
549
|
+
base_url = None
|
550
|
+
url_variables = None
|
551
|
+
if timeout_ms is None:
|
552
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
553
|
+
|
554
|
+
if server_url is not None:
|
555
|
+
base_url = server_url
|
556
|
+
else:
|
557
|
+
base_url = self._get_url(base_url, url_variables)
|
558
|
+
|
559
|
+
request = operations.GetAccountTerminalApplicationRequest(
|
560
|
+
account_id=account_id,
|
561
|
+
terminal_application_id=terminal_application_id,
|
562
|
+
)
|
563
|
+
|
564
|
+
req = self._build_request(
|
565
|
+
method="GET",
|
566
|
+
path="/accounts/{accountID}/terminal-applications/{terminalApplicationID}",
|
567
|
+
base_url=base_url,
|
568
|
+
url_variables=url_variables,
|
569
|
+
request=request,
|
570
|
+
request_body_required=False,
|
571
|
+
request_has_path_params=True,
|
572
|
+
request_has_query_params=True,
|
573
|
+
user_agent_header="user-agent",
|
574
|
+
accept_header_value="application/json",
|
575
|
+
http_headers=http_headers,
|
576
|
+
_globals=operations.GetAccountTerminalApplicationGlobals(
|
577
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
578
|
+
),
|
579
|
+
security=self.sdk_configuration.security,
|
580
|
+
timeout_ms=timeout_ms,
|
581
|
+
)
|
582
|
+
|
583
|
+
if retries == UNSET:
|
584
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
585
|
+
retries = self.sdk_configuration.retry_config
|
586
|
+
|
587
|
+
retry_config = None
|
588
|
+
if isinstance(retries, utils.RetryConfig):
|
589
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
590
|
+
|
591
|
+
http_res = self.do_request(
|
592
|
+
hook_ctx=HookContext(
|
593
|
+
base_url=base_url or "",
|
594
|
+
operation_id="getAccountTerminalApplication",
|
595
|
+
oauth2_scopes=[],
|
596
|
+
security_source=get_security_from_env(
|
597
|
+
self.sdk_configuration.security, components.Security
|
598
|
+
),
|
599
|
+
),
|
600
|
+
request=req,
|
601
|
+
error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
|
602
|
+
retry_config=retry_config,
|
603
|
+
)
|
604
|
+
|
605
|
+
if utils.match_response(http_res, "200", "application/json"):
|
606
|
+
return operations.GetAccountTerminalApplicationResponse(
|
607
|
+
result=utils.unmarshal_json(
|
608
|
+
http_res.text, components.TerminalApplication
|
609
|
+
),
|
610
|
+
headers=utils.get_response_headers(http_res.headers),
|
611
|
+
)
|
612
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
613
|
+
http_res_text = utils.stream_to_text(http_res)
|
614
|
+
raise errors.APIError(
|
615
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
616
|
+
)
|
617
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
618
|
+
http_res_text = utils.stream_to_text(http_res)
|
619
|
+
raise errors.APIError(
|
620
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
621
|
+
)
|
622
|
+
if utils.match_response(http_res, "4XX", "*"):
|
623
|
+
http_res_text = utils.stream_to_text(http_res)
|
624
|
+
raise errors.APIError(
|
625
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
626
|
+
)
|
627
|
+
if utils.match_response(http_res, "5XX", "*"):
|
628
|
+
http_res_text = utils.stream_to_text(http_res)
|
629
|
+
raise errors.APIError(
|
630
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
631
|
+
)
|
632
|
+
|
633
|
+
content_type = http_res.headers.get("Content-Type")
|
634
|
+
http_res_text = utils.stream_to_text(http_res)
|
635
|
+
raise errors.APIError(
|
636
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
637
|
+
http_res.status_code,
|
638
|
+
http_res_text,
|
639
|
+
http_res,
|
640
|
+
)
|
641
|
+
|
642
|
+
async def get_async(
|
643
|
+
self,
|
644
|
+
*,
|
645
|
+
account_id: str,
|
646
|
+
terminal_application_id: str,
|
647
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
648
|
+
server_url: Optional[str] = None,
|
649
|
+
timeout_ms: Optional[int] = None,
|
650
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
651
|
+
) -> operations.GetAccountTerminalApplicationResponse:
|
652
|
+
r"""Verifies if a specific Terminal Application is linked to an Account. This endpoint acts as a validation check for the link's existence.
|
653
|
+
|
654
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
655
|
+
you'll need to specify the `/accounts/{accountID}/terminal-applications.read` scope.
|
656
|
+
|
657
|
+
:param account_id:
|
658
|
+
:param terminal_application_id:
|
659
|
+
:param retries: Override the default retry configuration for this method
|
660
|
+
:param server_url: Override the default server URL for this method
|
661
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
662
|
+
:param http_headers: Additional headers to set or replace on requests.
|
663
|
+
"""
|
664
|
+
base_url = None
|
665
|
+
url_variables = None
|
666
|
+
if timeout_ms is None:
|
667
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
668
|
+
|
669
|
+
if server_url is not None:
|
670
|
+
base_url = server_url
|
671
|
+
else:
|
672
|
+
base_url = self._get_url(base_url, url_variables)
|
673
|
+
|
674
|
+
request = operations.GetAccountTerminalApplicationRequest(
|
675
|
+
account_id=account_id,
|
676
|
+
terminal_application_id=terminal_application_id,
|
677
|
+
)
|
678
|
+
|
679
|
+
req = self._build_request_async(
|
680
|
+
method="GET",
|
681
|
+
path="/accounts/{accountID}/terminal-applications/{terminalApplicationID}",
|
682
|
+
base_url=base_url,
|
683
|
+
url_variables=url_variables,
|
684
|
+
request=request,
|
685
|
+
request_body_required=False,
|
686
|
+
request_has_path_params=True,
|
687
|
+
request_has_query_params=True,
|
688
|
+
user_agent_header="user-agent",
|
689
|
+
accept_header_value="application/json",
|
690
|
+
http_headers=http_headers,
|
691
|
+
_globals=operations.GetAccountTerminalApplicationGlobals(
|
692
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
693
|
+
),
|
694
|
+
security=self.sdk_configuration.security,
|
695
|
+
timeout_ms=timeout_ms,
|
696
|
+
)
|
697
|
+
|
698
|
+
if retries == UNSET:
|
699
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
700
|
+
retries = self.sdk_configuration.retry_config
|
701
|
+
|
702
|
+
retry_config = None
|
703
|
+
if isinstance(retries, utils.RetryConfig):
|
704
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
705
|
+
|
706
|
+
http_res = await self.do_request_async(
|
707
|
+
hook_ctx=HookContext(
|
708
|
+
base_url=base_url or "",
|
709
|
+
operation_id="getAccountTerminalApplication",
|
710
|
+
oauth2_scopes=[],
|
711
|
+
security_source=get_security_from_env(
|
712
|
+
self.sdk_configuration.security, components.Security
|
713
|
+
),
|
714
|
+
),
|
715
|
+
request=req,
|
716
|
+
error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
|
717
|
+
retry_config=retry_config,
|
718
|
+
)
|
719
|
+
|
720
|
+
if utils.match_response(http_res, "200", "application/json"):
|
721
|
+
return operations.GetAccountTerminalApplicationResponse(
|
722
|
+
result=utils.unmarshal_json(
|
723
|
+
http_res.text, components.TerminalApplication
|
724
|
+
),
|
725
|
+
headers=utils.get_response_headers(http_res.headers),
|
726
|
+
)
|
727
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
728
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
729
|
+
raise errors.APIError(
|
730
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
731
|
+
)
|
732
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
733
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
734
|
+
raise errors.APIError(
|
735
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
736
|
+
)
|
737
|
+
if utils.match_response(http_res, "4XX", "*"):
|
738
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
739
|
+
raise errors.APIError(
|
740
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
741
|
+
)
|
742
|
+
if utils.match_response(http_res, "5XX", "*"):
|
743
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
744
|
+
raise errors.APIError(
|
745
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
746
|
+
)
|
747
|
+
|
748
|
+
content_type = http_res.headers.get("Content-Type")
|
749
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
750
|
+
raise errors.APIError(
|
751
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
752
|
+
http_res.status_code,
|
753
|
+
http_res_text,
|
754
|
+
http_res,
|
755
|
+
)
|
756
|
+
|
757
|
+
def get_configuration(
|
758
|
+
self,
|
759
|
+
*,
|
760
|
+
account_id: str,
|
761
|
+
terminal_application_id: str,
|
762
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
763
|
+
server_url: Optional[str] = None,
|
764
|
+
timeout_ms: Optional[int] = None,
|
765
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
766
|
+
) -> operations.GetTerminalConfigurationResponse:
|
767
|
+
r"""Fetch the configuration for a given Terminal Application linked to a specific Account.
|
768
|
+
|
769
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
770
|
+
you'll need to specify the `/accounts/{accountID}/terminal-configuration.read` scope.
|
771
|
+
|
772
|
+
:param account_id:
|
773
|
+
:param terminal_application_id:
|
774
|
+
:param retries: Override the default retry configuration for this method
|
775
|
+
:param server_url: Override the default server URL for this method
|
776
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
777
|
+
:param http_headers: Additional headers to set or replace on requests.
|
778
|
+
"""
|
779
|
+
base_url = None
|
780
|
+
url_variables = None
|
781
|
+
if timeout_ms is None:
|
782
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
783
|
+
|
784
|
+
if server_url is not None:
|
785
|
+
base_url = server_url
|
786
|
+
else:
|
787
|
+
base_url = self._get_url(base_url, url_variables)
|
788
|
+
|
789
|
+
request = operations.GetTerminalConfigurationRequest(
|
790
|
+
account_id=account_id,
|
791
|
+
terminal_application_id=terminal_application_id,
|
792
|
+
)
|
793
|
+
|
794
|
+
req = self._build_request(
|
795
|
+
method="GET",
|
796
|
+
path="/accounts/{accountID}/terminal-applications/{terminalApplicationID}/configuration",
|
797
|
+
base_url=base_url,
|
798
|
+
url_variables=url_variables,
|
799
|
+
request=request,
|
800
|
+
request_body_required=False,
|
801
|
+
request_has_path_params=True,
|
802
|
+
request_has_query_params=True,
|
803
|
+
user_agent_header="user-agent",
|
804
|
+
accept_header_value="application/json",
|
805
|
+
http_headers=http_headers,
|
806
|
+
_globals=operations.GetTerminalConfigurationGlobals(
|
807
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
808
|
+
),
|
809
|
+
security=self.sdk_configuration.security,
|
810
|
+
timeout_ms=timeout_ms,
|
811
|
+
)
|
812
|
+
|
813
|
+
if retries == UNSET:
|
814
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
815
|
+
retries = self.sdk_configuration.retry_config
|
816
|
+
|
817
|
+
retry_config = None
|
818
|
+
if isinstance(retries, utils.RetryConfig):
|
819
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
820
|
+
|
821
|
+
http_res = self.do_request(
|
822
|
+
hook_ctx=HookContext(
|
823
|
+
base_url=base_url or "",
|
824
|
+
operation_id="getTerminalConfiguration",
|
825
|
+
oauth2_scopes=[],
|
826
|
+
security_source=get_security_from_env(
|
827
|
+
self.sdk_configuration.security, components.Security
|
828
|
+
),
|
829
|
+
),
|
830
|
+
request=req,
|
831
|
+
error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
|
832
|
+
retry_config=retry_config,
|
833
|
+
)
|
834
|
+
|
835
|
+
if utils.match_response(http_res, "200", "application/json"):
|
836
|
+
return operations.GetTerminalConfigurationResponse(
|
837
|
+
result=utils.unmarshal_json(
|
838
|
+
http_res.text, components.TerminalConfiguration
|
839
|
+
),
|
840
|
+
headers=utils.get_response_headers(http_res.headers),
|
841
|
+
)
|
842
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
843
|
+
http_res_text = utils.stream_to_text(http_res)
|
844
|
+
raise errors.APIError(
|
845
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
846
|
+
)
|
847
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
848
|
+
http_res_text = utils.stream_to_text(http_res)
|
849
|
+
raise errors.APIError(
|
850
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
851
|
+
)
|
852
|
+
if utils.match_response(http_res, "4XX", "*"):
|
853
|
+
http_res_text = utils.stream_to_text(http_res)
|
854
|
+
raise errors.APIError(
|
855
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
856
|
+
)
|
857
|
+
if utils.match_response(http_res, "5XX", "*"):
|
858
|
+
http_res_text = utils.stream_to_text(http_res)
|
859
|
+
raise errors.APIError(
|
860
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
861
|
+
)
|
862
|
+
|
863
|
+
content_type = http_res.headers.get("Content-Type")
|
864
|
+
http_res_text = utils.stream_to_text(http_res)
|
865
|
+
raise errors.APIError(
|
866
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
867
|
+
http_res.status_code,
|
868
|
+
http_res_text,
|
869
|
+
http_res,
|
870
|
+
)
|
871
|
+
|
872
|
+
async def get_configuration_async(
|
873
|
+
self,
|
874
|
+
*,
|
875
|
+
account_id: str,
|
876
|
+
terminal_application_id: str,
|
877
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
878
|
+
server_url: Optional[str] = None,
|
879
|
+
timeout_ms: Optional[int] = None,
|
880
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
881
|
+
) -> operations.GetTerminalConfigurationResponse:
|
882
|
+
r"""Fetch the configuration for a given Terminal Application linked to a specific Account.
|
883
|
+
|
884
|
+
To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
|
885
|
+
you'll need to specify the `/accounts/{accountID}/terminal-configuration.read` scope.
|
886
|
+
|
887
|
+
:param account_id:
|
888
|
+
:param terminal_application_id:
|
889
|
+
:param retries: Override the default retry configuration for this method
|
890
|
+
:param server_url: Override the default server URL for this method
|
891
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
892
|
+
:param http_headers: Additional headers to set or replace on requests.
|
893
|
+
"""
|
894
|
+
base_url = None
|
895
|
+
url_variables = None
|
896
|
+
if timeout_ms is None:
|
897
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
898
|
+
|
899
|
+
if server_url is not None:
|
900
|
+
base_url = server_url
|
901
|
+
else:
|
902
|
+
base_url = self._get_url(base_url, url_variables)
|
903
|
+
|
904
|
+
request = operations.GetTerminalConfigurationRequest(
|
905
|
+
account_id=account_id,
|
906
|
+
terminal_application_id=terminal_application_id,
|
907
|
+
)
|
908
|
+
|
909
|
+
req = self._build_request_async(
|
910
|
+
method="GET",
|
911
|
+
path="/accounts/{accountID}/terminal-applications/{terminalApplicationID}/configuration",
|
912
|
+
base_url=base_url,
|
913
|
+
url_variables=url_variables,
|
914
|
+
request=request,
|
915
|
+
request_body_required=False,
|
916
|
+
request_has_path_params=True,
|
917
|
+
request_has_query_params=True,
|
918
|
+
user_agent_header="user-agent",
|
919
|
+
accept_header_value="application/json",
|
920
|
+
http_headers=http_headers,
|
921
|
+
_globals=operations.GetTerminalConfigurationGlobals(
|
922
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
923
|
+
),
|
924
|
+
security=self.sdk_configuration.security,
|
925
|
+
timeout_ms=timeout_ms,
|
926
|
+
)
|
927
|
+
|
928
|
+
if retries == UNSET:
|
929
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
930
|
+
retries = self.sdk_configuration.retry_config
|
931
|
+
|
932
|
+
retry_config = None
|
933
|
+
if isinstance(retries, utils.RetryConfig):
|
934
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
935
|
+
|
936
|
+
http_res = await self.do_request_async(
|
937
|
+
hook_ctx=HookContext(
|
938
|
+
base_url=base_url or "",
|
939
|
+
operation_id="getTerminalConfiguration",
|
940
|
+
oauth2_scopes=[],
|
941
|
+
security_source=get_security_from_env(
|
942
|
+
self.sdk_configuration.security, components.Security
|
943
|
+
),
|
944
|
+
),
|
945
|
+
request=req,
|
946
|
+
error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
|
947
|
+
retry_config=retry_config,
|
948
|
+
)
|
949
|
+
|
950
|
+
if utils.match_response(http_res, "200", "application/json"):
|
951
|
+
return operations.GetTerminalConfigurationResponse(
|
952
|
+
result=utils.unmarshal_json(
|
953
|
+
http_res.text, components.TerminalConfiguration
|
954
|
+
),
|
955
|
+
headers=utils.get_response_headers(http_res.headers),
|
956
|
+
)
|
957
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
958
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
959
|
+
raise errors.APIError(
|
960
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
961
|
+
)
|
962
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
963
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
964
|
+
raise errors.APIError(
|
965
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
966
|
+
)
|
967
|
+
if utils.match_response(http_res, "4XX", "*"):
|
968
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
969
|
+
raise errors.APIError(
|
970
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
971
|
+
)
|
972
|
+
if utils.match_response(http_res, "5XX", "*"):
|
973
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
974
|
+
raise errors.APIError(
|
975
|
+
"API error occurred", http_res.status_code, http_res_text, http_res
|
976
|
+
)
|
977
|
+
|
978
|
+
content_type = http_res.headers.get("Content-Type")
|
979
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
980
|
+
raise errors.APIError(
|
981
|
+
f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
|
982
|
+
http_res.status_code,
|
983
|
+
http_res_text,
|
984
|
+
http_res,
|
985
|
+
)
|