moovio_sdk 0.14.7__py3-none-any.whl → 0.15.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.

Potentially problematic release.


This version of moovio_sdk might be problematic. Click here for more details.

@@ -0,0 +1,100 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from datetime import datetime
5
+ from moovio_sdk.models.components import statement as components_statement
6
+ from moovio_sdk.types import BaseModel
7
+ from moovio_sdk.utils import (
8
+ FieldMetadata,
9
+ HeaderMetadata,
10
+ PathParamMetadata,
11
+ QueryParamMetadata,
12
+ )
13
+ import pydantic
14
+ from typing import Dict, List, Optional
15
+ from typing_extensions import Annotated, NotRequired, TypedDict
16
+
17
+
18
+ class ListStatementsGlobalsTypedDict(TypedDict):
19
+ x_moov_version: NotRequired[str]
20
+ r"""Specify an API version.
21
+
22
+ API versioning follows the format `vYYYY.QQ.BB`, where
23
+ - `YYYY` is the year
24
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
25
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
26
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
27
+
28
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
29
+ """
30
+
31
+
32
+ class ListStatementsGlobals(BaseModel):
33
+ x_moov_version: Annotated[
34
+ Optional[str],
35
+ pydantic.Field(alias="x-moov-version"),
36
+ FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
37
+ ] = "v2024.01.00"
38
+ r"""Specify an API version.
39
+
40
+ API versioning follows the format `vYYYY.QQ.BB`, where
41
+ - `YYYY` is the year
42
+ - `QQ` is the two-digit month for the first month of the quarter (e.g., 01, 04, 07, 10)
43
+ - `BB` is the build number, starting at `.01`, for subsequent builds in the same quarter.
44
+ - For example, `v2024.01.00` is the initial release of the first quarter of 2024.
45
+
46
+ The `latest` version represents the most recent development state. It may include breaking changes and should be treated as a beta release.
47
+ """
48
+
49
+
50
+ class ListStatementsRequestTypedDict(TypedDict):
51
+ account_id: str
52
+ billing_period_start_date_time: NotRequired[datetime]
53
+ r"""Optional date-time which inclusively filters all statements where billing period is on or after this date-time."""
54
+ billing_period_end_date_time: NotRequired[datetime]
55
+ r"""Optional date-time which exclusively filters all statements where billing period is before this date-time."""
56
+ skip: NotRequired[int]
57
+ count: NotRequired[int]
58
+
59
+
60
+ class ListStatementsRequest(BaseModel):
61
+ account_id: Annotated[
62
+ str,
63
+ pydantic.Field(alias="accountID"),
64
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
65
+ ]
66
+
67
+ billing_period_start_date_time: Annotated[
68
+ Optional[datetime],
69
+ pydantic.Field(alias="billingPeriodStartDateTime"),
70
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
71
+ ] = None
72
+ r"""Optional date-time which inclusively filters all statements where billing period is on or after this date-time."""
73
+
74
+ billing_period_end_date_time: Annotated[
75
+ Optional[datetime],
76
+ pydantic.Field(alias="billingPeriodEndDateTime"),
77
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
78
+ ] = None
79
+ r"""Optional date-time which exclusively filters all statements where billing period is before this date-time."""
80
+
81
+ skip: Annotated[
82
+ Optional[int],
83
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
84
+ ] = None
85
+
86
+ count: Annotated[
87
+ Optional[int],
88
+ FieldMetadata(query=QueryParamMetadata(style="form", explode=False)),
89
+ ] = None
90
+
91
+
92
+ class ListStatementsResponseTypedDict(TypedDict):
93
+ headers: Dict[str, List[str]]
94
+ result: List[components_statement.StatementTypedDict]
95
+
96
+
97
+ class ListStatementsResponse(BaseModel):
98
+ headers: Dict[str, List[str]]
99
+
100
+ result: List[components_statement.Statement]
moovio_sdk/sdk.py CHANGED
@@ -43,6 +43,7 @@ if TYPE_CHECKING:
43
43
  from moovio_sdk.receipts import Receipts
44
44
  from moovio_sdk.representatives import Representatives
45
45
  from moovio_sdk.scheduling import Scheduling
46
+ from moovio_sdk.statements import Statements
46
47
  from moovio_sdk.support import Support
47
48
  from moovio_sdk.sweeps import Sweeps
48
49
  from moovio_sdk.terminal_applications import TerminalApplications
@@ -73,6 +74,7 @@ class Moov(BaseSDK):
73
74
  payment_methods: "PaymentMethods"
74
75
  representatives: "Representatives"
75
76
  scheduling: "Scheduling"
77
+ statements: "Statements"
76
78
  sweeps: "Sweeps"
77
79
  account_terminal_applications: "AccountTerminalApplications"
78
80
  support: "Support"
@@ -108,6 +110,7 @@ class Moov(BaseSDK):
108
110
  "payment_methods": ("moovio_sdk.payment_methods", "PaymentMethods"),
109
111
  "representatives": ("moovio_sdk.representatives", "Representatives"),
110
112
  "scheduling": ("moovio_sdk.scheduling", "Scheduling"),
113
+ "statements": ("moovio_sdk.statements", "Statements"),
111
114
  "sweeps": ("moovio_sdk.sweeps", "Sweeps"),
112
115
  "account_terminal_applications": (
113
116
  "moovio_sdk.account_terminal_applications",
@@ -0,0 +1,471 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from datetime import datetime
5
+ from enum import Enum
6
+ from moovio_sdk import utils
7
+ from moovio_sdk._hooks import HookContext
8
+ from moovio_sdk.models import components, errors, operations
9
+ from moovio_sdk.types import OptionalNullable, UNSET
10
+ from moovio_sdk.utils import get_security_from_env
11
+ from moovio_sdk.utils.unmarshal_json_response import unmarshal_json_response
12
+ from typing import Any, List, Mapping, Optional
13
+
14
+
15
+ class GetAcceptEnum(str, Enum):
16
+ APPLICATION_JSON = "application/json"
17
+ APPLICATION_PDF = "application/pdf"
18
+
19
+
20
+ class Statements(BaseSDK):
21
+ def list(
22
+ self,
23
+ *,
24
+ account_id: str,
25
+ billing_period_start_date_time: Optional[datetime] = None,
26
+ billing_period_end_date_time: Optional[datetime] = None,
27
+ skip: Optional[int] = None,
28
+ count: Optional[int] = None,
29
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
30
+ server_url: Optional[str] = None,
31
+ timeout_ms: Optional[int] = None,
32
+ http_headers: Optional[Mapping[str, str]] = None,
33
+ ) -> operations.ListStatementsResponse:
34
+ r"""Retrieve all statements associated with an account.
35
+
36
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
37
+ you'll need to specify the `/accounts/{accountID}/profile.read` scope.
38
+
39
+ :param account_id:
40
+ :param billing_period_start_date_time: Optional date-time which inclusively filters all statements where billing period is on or after this date-time.
41
+ :param billing_period_end_date_time: Optional date-time which exclusively filters all statements where billing period is before this date-time.
42
+ :param skip:
43
+ :param count:
44
+ :param retries: Override the default retry configuration for this method
45
+ :param server_url: Override the default server URL for this method
46
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
47
+ :param http_headers: Additional headers to set or replace on requests.
48
+ """
49
+ base_url = None
50
+ url_variables = None
51
+ if timeout_ms is None:
52
+ timeout_ms = self.sdk_configuration.timeout_ms
53
+
54
+ if server_url is not None:
55
+ base_url = server_url
56
+ else:
57
+ base_url = self._get_url(base_url, url_variables)
58
+
59
+ request = operations.ListStatementsRequest(
60
+ billing_period_start_date_time=billing_period_start_date_time,
61
+ billing_period_end_date_time=billing_period_end_date_time,
62
+ skip=skip,
63
+ count=count,
64
+ account_id=account_id,
65
+ )
66
+
67
+ req = self._build_request(
68
+ method="GET",
69
+ path="/accounts/{accountID}/statements",
70
+ base_url=base_url,
71
+ url_variables=url_variables,
72
+ request=request,
73
+ request_body_required=False,
74
+ request_has_path_params=True,
75
+ request_has_query_params=True,
76
+ user_agent_header="user-agent",
77
+ accept_header_value="application/json",
78
+ http_headers=http_headers,
79
+ _globals=operations.ListStatementsGlobals(
80
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
81
+ ),
82
+ security=self.sdk_configuration.security,
83
+ timeout_ms=timeout_ms,
84
+ )
85
+
86
+ if retries == UNSET:
87
+ if self.sdk_configuration.retry_config is not UNSET:
88
+ retries = self.sdk_configuration.retry_config
89
+
90
+ retry_config = None
91
+ if isinstance(retries, utils.RetryConfig):
92
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
93
+
94
+ http_res = self.do_request(
95
+ hook_ctx=HookContext(
96
+ config=self.sdk_configuration,
97
+ base_url=base_url or "",
98
+ operation_id="listStatements",
99
+ oauth2_scopes=[],
100
+ security_source=get_security_from_env(
101
+ self.sdk_configuration.security, components.Security
102
+ ),
103
+ ),
104
+ request=req,
105
+ error_status_codes=["400", "401", "403", "429", "4XX", "500", "504", "5XX"],
106
+ retry_config=retry_config,
107
+ )
108
+
109
+ response_data: Any = None
110
+ if utils.match_response(http_res, "200", "application/json"):
111
+ return operations.ListStatementsResponse(
112
+ result=unmarshal_json_response(List[components.Statement], http_res),
113
+ headers=utils.get_response_headers(http_res.headers),
114
+ )
115
+ if utils.match_response(http_res, "400", "application/json"):
116
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
117
+ raise errors.GenericError(response_data, http_res)
118
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
119
+ http_res_text = utils.stream_to_text(http_res)
120
+ raise errors.APIError("API error occurred", http_res, http_res_text)
121
+ if utils.match_response(http_res, ["500", "504"], "*"):
122
+ http_res_text = utils.stream_to_text(http_res)
123
+ raise errors.APIError("API error occurred", http_res, http_res_text)
124
+ if utils.match_response(http_res, "4XX", "*"):
125
+ http_res_text = utils.stream_to_text(http_res)
126
+ raise errors.APIError("API error occurred", http_res, http_res_text)
127
+ if utils.match_response(http_res, "5XX", "*"):
128
+ http_res_text = utils.stream_to_text(http_res)
129
+ raise errors.APIError("API error occurred", http_res, http_res_text)
130
+
131
+ raise errors.APIError("Unexpected response received", http_res)
132
+
133
+ async def list_async(
134
+ self,
135
+ *,
136
+ account_id: str,
137
+ billing_period_start_date_time: Optional[datetime] = None,
138
+ billing_period_end_date_time: Optional[datetime] = None,
139
+ skip: Optional[int] = None,
140
+ count: Optional[int] = None,
141
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
142
+ server_url: Optional[str] = None,
143
+ timeout_ms: Optional[int] = None,
144
+ http_headers: Optional[Mapping[str, str]] = None,
145
+ ) -> operations.ListStatementsResponse:
146
+ r"""Retrieve all statements associated with an account.
147
+
148
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
149
+ you'll need to specify the `/accounts/{accountID}/profile.read` scope.
150
+
151
+ :param account_id:
152
+ :param billing_period_start_date_time: Optional date-time which inclusively filters all statements where billing period is on or after this date-time.
153
+ :param billing_period_end_date_time: Optional date-time which exclusively filters all statements where billing period is before this date-time.
154
+ :param skip:
155
+ :param count:
156
+ :param retries: Override the default retry configuration for this method
157
+ :param server_url: Override the default server URL for this method
158
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
159
+ :param http_headers: Additional headers to set or replace on requests.
160
+ """
161
+ base_url = None
162
+ url_variables = None
163
+ if timeout_ms is None:
164
+ timeout_ms = self.sdk_configuration.timeout_ms
165
+
166
+ if server_url is not None:
167
+ base_url = server_url
168
+ else:
169
+ base_url = self._get_url(base_url, url_variables)
170
+
171
+ request = operations.ListStatementsRequest(
172
+ billing_period_start_date_time=billing_period_start_date_time,
173
+ billing_period_end_date_time=billing_period_end_date_time,
174
+ skip=skip,
175
+ count=count,
176
+ account_id=account_id,
177
+ )
178
+
179
+ req = self._build_request_async(
180
+ method="GET",
181
+ path="/accounts/{accountID}/statements",
182
+ base_url=base_url,
183
+ url_variables=url_variables,
184
+ request=request,
185
+ request_body_required=False,
186
+ request_has_path_params=True,
187
+ request_has_query_params=True,
188
+ user_agent_header="user-agent",
189
+ accept_header_value="application/json",
190
+ http_headers=http_headers,
191
+ _globals=operations.ListStatementsGlobals(
192
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
193
+ ),
194
+ security=self.sdk_configuration.security,
195
+ timeout_ms=timeout_ms,
196
+ )
197
+
198
+ if retries == UNSET:
199
+ if self.sdk_configuration.retry_config is not UNSET:
200
+ retries = self.sdk_configuration.retry_config
201
+
202
+ retry_config = None
203
+ if isinstance(retries, utils.RetryConfig):
204
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
205
+
206
+ http_res = await self.do_request_async(
207
+ hook_ctx=HookContext(
208
+ config=self.sdk_configuration,
209
+ base_url=base_url or "",
210
+ operation_id="listStatements",
211
+ oauth2_scopes=[],
212
+ security_source=get_security_from_env(
213
+ self.sdk_configuration.security, components.Security
214
+ ),
215
+ ),
216
+ request=req,
217
+ error_status_codes=["400", "401", "403", "429", "4XX", "500", "504", "5XX"],
218
+ retry_config=retry_config,
219
+ )
220
+
221
+ response_data: Any = None
222
+ if utils.match_response(http_res, "200", "application/json"):
223
+ return operations.ListStatementsResponse(
224
+ result=unmarshal_json_response(List[components.Statement], http_res),
225
+ headers=utils.get_response_headers(http_res.headers),
226
+ )
227
+ if utils.match_response(http_res, "400", "application/json"):
228
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
229
+ raise errors.GenericError(response_data, http_res)
230
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
231
+ http_res_text = await utils.stream_to_text_async(http_res)
232
+ raise errors.APIError("API error occurred", http_res, http_res_text)
233
+ if utils.match_response(http_res, ["500", "504"], "*"):
234
+ http_res_text = await utils.stream_to_text_async(http_res)
235
+ raise errors.APIError("API error occurred", http_res, http_res_text)
236
+ if utils.match_response(http_res, "4XX", "*"):
237
+ http_res_text = await utils.stream_to_text_async(http_res)
238
+ raise errors.APIError("API error occurred", http_res, http_res_text)
239
+ if utils.match_response(http_res, "5XX", "*"):
240
+ http_res_text = await utils.stream_to_text_async(http_res)
241
+ raise errors.APIError("API error occurred", http_res, http_res_text)
242
+
243
+ raise errors.APIError("Unexpected response received", http_res)
244
+
245
+ def get(
246
+ self,
247
+ *,
248
+ account_id: str,
249
+ statement_id: str,
250
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
251
+ server_url: Optional[str] = None,
252
+ timeout_ms: Optional[int] = None,
253
+ accept_header_override: Optional[GetAcceptEnum] = None,
254
+ http_headers: Optional[Mapping[str, str]] = None,
255
+ ) -> operations.GetStatementResponse:
256
+ r"""Retrieve a statement by its ID.
257
+
258
+ Use the `Accept` header to specify the format of the response. Supported formats are `application/json` and `application/pdf`.
259
+
260
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
261
+ you'll need to specify the `/accounts/{accountID}/profile.read` scope.
262
+
263
+ :param account_id:
264
+ :param statement_id:
265
+ :param retries: Override the default retry configuration for this method
266
+ :param server_url: Override the default server URL for this method
267
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
268
+ :param accept_header_override: Override the default accept header for this method
269
+ :param http_headers: Additional headers to set or replace on requests.
270
+ """
271
+ base_url = None
272
+ url_variables = None
273
+ if timeout_ms is None:
274
+ timeout_ms = self.sdk_configuration.timeout_ms
275
+
276
+ if server_url is not None:
277
+ base_url = server_url
278
+ else:
279
+ base_url = self._get_url(base_url, url_variables)
280
+
281
+ request = operations.GetStatementRequest(
282
+ account_id=account_id,
283
+ statement_id=statement_id,
284
+ )
285
+
286
+ req = self._build_request(
287
+ method="GET",
288
+ path="/accounts/{accountID}/statements/{statementID}",
289
+ base_url=base_url,
290
+ url_variables=url_variables,
291
+ request=request,
292
+ request_body_required=False,
293
+ request_has_path_params=True,
294
+ request_has_query_params=True,
295
+ user_agent_header="user-agent",
296
+ accept_header_value=accept_header_override.value
297
+ if accept_header_override is not None
298
+ else "application/json;q=1, application/pdf;q=0",
299
+ http_headers=http_headers,
300
+ _globals=operations.GetStatementGlobals(
301
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
302
+ ),
303
+ security=self.sdk_configuration.security,
304
+ timeout_ms=timeout_ms,
305
+ )
306
+
307
+ if retries == UNSET:
308
+ if self.sdk_configuration.retry_config is not UNSET:
309
+ retries = self.sdk_configuration.retry_config
310
+
311
+ retry_config = None
312
+ if isinstance(retries, utils.RetryConfig):
313
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
314
+
315
+ http_res = self.do_request(
316
+ hook_ctx=HookContext(
317
+ config=self.sdk_configuration,
318
+ base_url=base_url or "",
319
+ operation_id="getStatement",
320
+ oauth2_scopes=[],
321
+ security_source=get_security_from_env(
322
+ self.sdk_configuration.security, components.Security
323
+ ),
324
+ ),
325
+ request=req,
326
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
327
+ stream=True,
328
+ retry_config=retry_config,
329
+ )
330
+
331
+ if utils.match_response(http_res, "200", "application/json"):
332
+ http_res_text = utils.stream_to_text(http_res)
333
+ return operations.GetStatementResponse(
334
+ result=unmarshal_json_response(
335
+ components.Statement, http_res, http_res_text
336
+ ),
337
+ headers=utils.get_response_headers(http_res.headers),
338
+ )
339
+ if utils.match_response(http_res, "200", "application/pdf"):
340
+ return operations.GetStatementResponse(
341
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
342
+ )
343
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
344
+ http_res_text = utils.stream_to_text(http_res)
345
+ raise errors.APIError("API error occurred", http_res, http_res_text)
346
+ if utils.match_response(http_res, ["500", "504"], "*"):
347
+ http_res_text = utils.stream_to_text(http_res)
348
+ raise errors.APIError("API error occurred", http_res, http_res_text)
349
+ if utils.match_response(http_res, "4XX", "*"):
350
+ http_res_text = utils.stream_to_text(http_res)
351
+ raise errors.APIError("API error occurred", http_res, http_res_text)
352
+ if utils.match_response(http_res, "5XX", "*"):
353
+ http_res_text = utils.stream_to_text(http_res)
354
+ raise errors.APIError("API error occurred", http_res, http_res_text)
355
+
356
+ http_res_text = utils.stream_to_text(http_res)
357
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)
358
+
359
+ async def get_async(
360
+ self,
361
+ *,
362
+ account_id: str,
363
+ statement_id: str,
364
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
365
+ server_url: Optional[str] = None,
366
+ timeout_ms: Optional[int] = None,
367
+ accept_header_override: Optional[GetAcceptEnum] = None,
368
+ http_headers: Optional[Mapping[str, str]] = None,
369
+ ) -> operations.GetStatementResponse:
370
+ r"""Retrieve a statement by its ID.
371
+
372
+ Use the `Accept` header to specify the format of the response. Supported formats are `application/json` and `application/pdf`.
373
+
374
+ To access this endpoint using an [access token](https://docs.moov.io/api/authentication/access-tokens/)
375
+ you'll need to specify the `/accounts/{accountID}/profile.read` scope.
376
+
377
+ :param account_id:
378
+ :param statement_id:
379
+ :param retries: Override the default retry configuration for this method
380
+ :param server_url: Override the default server URL for this method
381
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
382
+ :param accept_header_override: Override the default accept header for this method
383
+ :param http_headers: Additional headers to set or replace on requests.
384
+ """
385
+ base_url = None
386
+ url_variables = None
387
+ if timeout_ms is None:
388
+ timeout_ms = self.sdk_configuration.timeout_ms
389
+
390
+ if server_url is not None:
391
+ base_url = server_url
392
+ else:
393
+ base_url = self._get_url(base_url, url_variables)
394
+
395
+ request = operations.GetStatementRequest(
396
+ account_id=account_id,
397
+ statement_id=statement_id,
398
+ )
399
+
400
+ req = self._build_request_async(
401
+ method="GET",
402
+ path="/accounts/{accountID}/statements/{statementID}",
403
+ base_url=base_url,
404
+ url_variables=url_variables,
405
+ request=request,
406
+ request_body_required=False,
407
+ request_has_path_params=True,
408
+ request_has_query_params=True,
409
+ user_agent_header="user-agent",
410
+ accept_header_value=accept_header_override.value
411
+ if accept_header_override is not None
412
+ else "application/json;q=1, application/pdf;q=0",
413
+ http_headers=http_headers,
414
+ _globals=operations.GetStatementGlobals(
415
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
416
+ ),
417
+ security=self.sdk_configuration.security,
418
+ timeout_ms=timeout_ms,
419
+ )
420
+
421
+ if retries == UNSET:
422
+ if self.sdk_configuration.retry_config is not UNSET:
423
+ retries = self.sdk_configuration.retry_config
424
+
425
+ retry_config = None
426
+ if isinstance(retries, utils.RetryConfig):
427
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
428
+
429
+ http_res = await self.do_request_async(
430
+ hook_ctx=HookContext(
431
+ config=self.sdk_configuration,
432
+ base_url=base_url or "",
433
+ operation_id="getStatement",
434
+ oauth2_scopes=[],
435
+ security_source=get_security_from_env(
436
+ self.sdk_configuration.security, components.Security
437
+ ),
438
+ ),
439
+ request=req,
440
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
441
+ stream=True,
442
+ retry_config=retry_config,
443
+ )
444
+
445
+ if utils.match_response(http_res, "200", "application/json"):
446
+ http_res_text = await utils.stream_to_text_async(http_res)
447
+ return operations.GetStatementResponse(
448
+ result=unmarshal_json_response(
449
+ components.Statement, http_res, http_res_text
450
+ ),
451
+ headers=utils.get_response_headers(http_res.headers),
452
+ )
453
+ if utils.match_response(http_res, "200", "application/pdf"):
454
+ return operations.GetStatementResponse(
455
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
456
+ )
457
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
458
+ http_res_text = await utils.stream_to_text_async(http_res)
459
+ raise errors.APIError("API error occurred", http_res, http_res_text)
460
+ if utils.match_response(http_res, ["500", "504"], "*"):
461
+ http_res_text = await utils.stream_to_text_async(http_res)
462
+ raise errors.APIError("API error occurred", http_res, http_res_text)
463
+ if utils.match_response(http_res, "4XX", "*"):
464
+ http_res_text = await utils.stream_to_text_async(http_res)
465
+ raise errors.APIError("API error occurred", http_res, http_res_text)
466
+ if utils.match_response(http_res, "5XX", "*"):
467
+ http_res_text = await utils.stream_to_text_async(http_res)
468
+ raise errors.APIError("API error occurred", http_res, http_res_text)
469
+
470
+ http_res_text = await utils.stream_to_text_async(http_res)
471
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)