moovio_sdk 0.4.1__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.
@@ -1,241 +0,0 @@
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 Mapping, Optional
10
-
11
-
12
- class TerminalConfigurations(BaseSDK):
13
- def get(
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.GetTerminalConfigurationResponse:
23
- r"""Fetch the configuration for a given 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-configuration.read` scope.
27
-
28
- :param account_id:
29
- :param terminal_application_id:
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.GetTerminalConfigurationRequest(
46
- account_id=account_id,
47
- terminal_application_id=terminal_application_id,
48
- )
49
-
50
- req = self._build_request(
51
- method="GET",
52
- path="/accounts/{accountID}/terminal-applications/{terminalApplicationID}/configuration",
53
- base_url=base_url,
54
- url_variables=url_variables,
55
- request=request,
56
- request_body_required=False,
57
- request_has_path_params=True,
58
- request_has_query_params=True,
59
- user_agent_header="user-agent",
60
- accept_header_value="application/json",
61
- http_headers=http_headers,
62
- _globals=operations.GetTerminalConfigurationGlobals(
63
- x_moov_version=self.sdk_configuration.globals.x_moov_version,
64
- ),
65
- security=self.sdk_configuration.security,
66
- timeout_ms=timeout_ms,
67
- )
68
-
69
- if retries == UNSET:
70
- if self.sdk_configuration.retry_config is not UNSET:
71
- retries = self.sdk_configuration.retry_config
72
-
73
- retry_config = None
74
- if isinstance(retries, utils.RetryConfig):
75
- retry_config = (retries, ["429", "500", "502", "503", "504"])
76
-
77
- http_res = self.do_request(
78
- hook_ctx=HookContext(
79
- base_url=base_url or "",
80
- operation_id="getTerminalConfiguration",
81
- oauth2_scopes=[],
82
- security_source=get_security_from_env(
83
- self.sdk_configuration.security, components.Security
84
- ),
85
- ),
86
- request=req,
87
- error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
88
- retry_config=retry_config,
89
- )
90
-
91
- if utils.match_response(http_res, "200", "application/json"):
92
- return operations.GetTerminalConfigurationResponse(
93
- result=utils.unmarshal_json(
94
- http_res.text, components.TerminalConfiguration
95
- ),
96
- headers=utils.get_response_headers(http_res.headers),
97
- )
98
- if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
99
- http_res_text = utils.stream_to_text(http_res)
100
- raise errors.APIError(
101
- "API error occurred", http_res.status_code, http_res_text, http_res
102
- )
103
- if utils.match_response(http_res, ["500", "504"], "*"):
104
- http_res_text = utils.stream_to_text(http_res)
105
- raise errors.APIError(
106
- "API error occurred", http_res.status_code, http_res_text, http_res
107
- )
108
- if utils.match_response(http_res, "4XX", "*"):
109
- http_res_text = utils.stream_to_text(http_res)
110
- raise errors.APIError(
111
- "API error occurred", http_res.status_code, http_res_text, http_res
112
- )
113
- if utils.match_response(http_res, "5XX", "*"):
114
- http_res_text = utils.stream_to_text(http_res)
115
- raise errors.APIError(
116
- "API error occurred", http_res.status_code, http_res_text, http_res
117
- )
118
-
119
- content_type = http_res.headers.get("Content-Type")
120
- http_res_text = utils.stream_to_text(http_res)
121
- raise errors.APIError(
122
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
123
- http_res.status_code,
124
- http_res_text,
125
- http_res,
126
- )
127
-
128
- async def get_async(
129
- self,
130
- *,
131
- account_id: str,
132
- terminal_application_id: str,
133
- retries: OptionalNullable[utils.RetryConfig] = UNSET,
134
- server_url: Optional[str] = None,
135
- timeout_ms: Optional[int] = None,
136
- http_headers: Optional[Mapping[str, str]] = None,
137
- ) -> operations.GetTerminalConfigurationResponse:
138
- r"""Fetch the configuration for a given Terminal Application
139
-
140
- To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
141
- you'll need to specify the `/accounts/{accountID}/terminal-configuration.read` scope.
142
-
143
- :param account_id:
144
- :param terminal_application_id:
145
- :param retries: Override the default retry configuration for this method
146
- :param server_url: Override the default server URL for this method
147
- :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
148
- :param http_headers: Additional headers to set or replace on requests.
149
- """
150
- base_url = None
151
- url_variables = None
152
- if timeout_ms is None:
153
- timeout_ms = self.sdk_configuration.timeout_ms
154
-
155
- if server_url is not None:
156
- base_url = server_url
157
- else:
158
- base_url = self._get_url(base_url, url_variables)
159
-
160
- request = operations.GetTerminalConfigurationRequest(
161
- account_id=account_id,
162
- terminal_application_id=terminal_application_id,
163
- )
164
-
165
- req = self._build_request_async(
166
- method="GET",
167
- path="/accounts/{accountID}/terminal-applications/{terminalApplicationID}/configuration",
168
- base_url=base_url,
169
- url_variables=url_variables,
170
- request=request,
171
- request_body_required=False,
172
- request_has_path_params=True,
173
- request_has_query_params=True,
174
- user_agent_header="user-agent",
175
- accept_header_value="application/json",
176
- http_headers=http_headers,
177
- _globals=operations.GetTerminalConfigurationGlobals(
178
- x_moov_version=self.sdk_configuration.globals.x_moov_version,
179
- ),
180
- security=self.sdk_configuration.security,
181
- timeout_ms=timeout_ms,
182
- )
183
-
184
- if retries == UNSET:
185
- if self.sdk_configuration.retry_config is not UNSET:
186
- retries = self.sdk_configuration.retry_config
187
-
188
- retry_config = None
189
- if isinstance(retries, utils.RetryConfig):
190
- retry_config = (retries, ["429", "500", "502", "503", "504"])
191
-
192
- http_res = await self.do_request_async(
193
- hook_ctx=HookContext(
194
- base_url=base_url or "",
195
- operation_id="getTerminalConfiguration",
196
- oauth2_scopes=[],
197
- security_source=get_security_from_env(
198
- self.sdk_configuration.security, components.Security
199
- ),
200
- ),
201
- request=req,
202
- error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
203
- retry_config=retry_config,
204
- )
205
-
206
- if utils.match_response(http_res, "200", "application/json"):
207
- return operations.GetTerminalConfigurationResponse(
208
- result=utils.unmarshal_json(
209
- http_res.text, components.TerminalConfiguration
210
- ),
211
- headers=utils.get_response_headers(http_res.headers),
212
- )
213
- if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
214
- http_res_text = await utils.stream_to_text_async(http_res)
215
- raise errors.APIError(
216
- "API error occurred", http_res.status_code, http_res_text, http_res
217
- )
218
- if utils.match_response(http_res, ["500", "504"], "*"):
219
- http_res_text = await utils.stream_to_text_async(http_res)
220
- raise errors.APIError(
221
- "API error occurred", http_res.status_code, http_res_text, http_res
222
- )
223
- if utils.match_response(http_res, "4XX", "*"):
224
- http_res_text = await utils.stream_to_text_async(http_res)
225
- raise errors.APIError(
226
- "API error occurred", http_res.status_code, http_res_text, http_res
227
- )
228
- if utils.match_response(http_res, "5XX", "*"):
229
- http_res_text = await utils.stream_to_text_async(http_res)
230
- raise errors.APIError(
231
- "API error occurred", http_res.status_code, http_res_text, http_res
232
- )
233
-
234
- content_type = http_res.headers.get("Content-Type")
235
- http_res_text = await utils.stream_to_text_async(http_res)
236
- raise errors.APIError(
237
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
238
- http_res.status_code,
239
- http_res_text,
240
- http_res,
241
- )