moovio_sdk 0.16.3__py3-none-any.whl → 0.17.0__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 (57) hide show
  1. moovio_sdk/_version.py +3 -3
  2. moovio_sdk/account_terminal_applications.py +8 -8
  3. moovio_sdk/accounts.py +18 -18
  4. moovio_sdk/adjustments.py +4 -4
  5. moovio_sdk/apple_pay.py +10 -10
  6. moovio_sdk/authentication.py +4 -4
  7. moovio_sdk/avatars.py +2 -2
  8. moovio_sdk/bank_accounts.py +18 -18
  9. moovio_sdk/branding.py +8 -8
  10. moovio_sdk/capabilities.py +8 -8
  11. moovio_sdk/card_issuing.py +10 -10
  12. moovio_sdk/cards.py +10 -10
  13. moovio_sdk/disputes.py +22 -22
  14. moovio_sdk/end_to_end_encryption.py +4 -4
  15. moovio_sdk/enriched_address.py +2 -2
  16. moovio_sdk/enriched_profile.py +2 -2
  17. moovio_sdk/fee_plans.py +14 -14
  18. moovio_sdk/files.py +6 -6
  19. moovio_sdk/httpclient.py +0 -1
  20. moovio_sdk/images.py +833 -0
  21. moovio_sdk/industries.py +2 -2
  22. moovio_sdk/institutions.py +4 -4
  23. moovio_sdk/issuing_transactions.py +10 -10
  24. moovio_sdk/models/components/__init__.py +21 -0
  25. moovio_sdk/models/components/capabilityid.py +1 -0
  26. moovio_sdk/models/components/imagemetadata.py +40 -0
  27. moovio_sdk/models/components/paymentmethodswallet.py +4 -4
  28. moovio_sdk/models/components/sendfunds.py +6 -0
  29. moovio_sdk/models/components/sendfundserror.py +9 -0
  30. moovio_sdk/models/components/sendfundsinstantbank.py +18 -0
  31. moovio_sdk/models/components/sendfundsinstantbankerror.py +21 -0
  32. moovio_sdk/models/components/wallet.py +4 -4
  33. moovio_sdk/models/components/wallettype.py +2 -2
  34. moovio_sdk/models/operations/__init__.py +80 -0
  35. moovio_sdk/models/operations/deleteimage.py +67 -0
  36. moovio_sdk/models/operations/getimagemetadata.py +71 -0
  37. moovio_sdk/models/operations/getpublicimage.py +74 -0
  38. moovio_sdk/models/operations/listimagemetadata.py +64 -0
  39. moovio_sdk/onboarding.py +8 -8
  40. moovio_sdk/payment_links.py +12 -12
  41. moovio_sdk/payment_methods.py +4 -4
  42. moovio_sdk/ping.py +2 -2
  43. moovio_sdk/receipts.py +4 -4
  44. moovio_sdk/representatives.py +10 -10
  45. moovio_sdk/scheduling.py +12 -12
  46. moovio_sdk/sdk.py +3 -0
  47. moovio_sdk/statements.py +4 -4
  48. moovio_sdk/support.py +10 -10
  49. moovio_sdk/sweeps.py +12 -12
  50. moovio_sdk/terminal_applications.py +10 -10
  51. moovio_sdk/transfers.py +22 -22
  52. moovio_sdk/underwriting.py +6 -6
  53. moovio_sdk/wallet_transactions.py +4 -4
  54. moovio_sdk/wallets.py +8 -8
  55. {moovio_sdk-0.16.3.dist-info → moovio_sdk-0.17.0.dist-info}/METADATA +51 -45
  56. {moovio_sdk-0.16.3.dist-info → moovio_sdk-0.17.0.dist-info}/RECORD +57 -49
  57. {moovio_sdk-0.16.3.dist-info → moovio_sdk-0.17.0.dist-info}/WHEEL +0 -0
moovio_sdk/images.py ADDED
@@ -0,0 +1,833 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from enum import Enum
5
+ from moovio_sdk import utils
6
+ from moovio_sdk._hooks import HookContext
7
+ from moovio_sdk.models import components, errors, operations
8
+ from moovio_sdk.types import OptionalNullable, UNSET
9
+ from moovio_sdk.utils import get_security_from_env
10
+ from moovio_sdk.utils.unmarshal_json_response import unmarshal_json_response
11
+ from typing import Any, List, Mapping, Optional
12
+
13
+
14
+ class GetPublicAcceptEnum(str, Enum):
15
+ IMAGE_JPEG = "image/jpeg"
16
+ IMAGE_PNG = "image/png"
17
+ IMAGE_WEBP = "image/webp"
18
+
19
+
20
+ class Images(BaseSDK):
21
+ def list(
22
+ self,
23
+ *,
24
+ account_id: str,
25
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
26
+ server_url: Optional[str] = None,
27
+ timeout_ms: Optional[int] = None,
28
+ http_headers: Optional[Mapping[str, str]] = None,
29
+ ) -> operations.ListImageMetadataResponse:
30
+ r"""List metadata for all images in the specified account.
31
+
32
+ :param account_id:
33
+ :param retries: Override the default retry configuration for this method
34
+ :param server_url: Override the default server URL for this method
35
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
36
+ :param http_headers: Additional headers to set or replace on requests.
37
+ """
38
+ base_url = None
39
+ url_variables = None
40
+ if timeout_ms is None:
41
+ timeout_ms = self.sdk_configuration.timeout_ms
42
+
43
+ if server_url is not None:
44
+ base_url = server_url
45
+ else:
46
+ base_url = self._get_url(base_url, url_variables)
47
+
48
+ request = operations.ListImageMetadataRequest(
49
+ account_id=account_id,
50
+ )
51
+
52
+ req = self._build_request(
53
+ method="GET",
54
+ path="/accounts/{accountID}/images",
55
+ base_url=base_url,
56
+ url_variables=url_variables,
57
+ request=request,
58
+ request_body_required=False,
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.ListImageMetadataGlobals(
65
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
66
+ ),
67
+ security=self.sdk_configuration.security,
68
+ timeout_ms=timeout_ms,
69
+ )
70
+
71
+ if retries == UNSET:
72
+ if self.sdk_configuration.retry_config is not UNSET:
73
+ retries = self.sdk_configuration.retry_config
74
+
75
+ retry_config = None
76
+ if isinstance(retries, utils.RetryConfig):
77
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
78
+
79
+ http_res = self.do_request(
80
+ hook_ctx=HookContext(
81
+ config=self.sdk_configuration,
82
+ base_url=base_url or "",
83
+ operation_id="listImageMetadata",
84
+ oauth2_scopes=None,
85
+ security_source=get_security_from_env(
86
+ self.sdk_configuration.security, components.Security
87
+ ),
88
+ ),
89
+ request=req,
90
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
91
+ retry_config=retry_config,
92
+ )
93
+
94
+ if utils.match_response(http_res, "200", "application/json"):
95
+ return operations.ListImageMetadataResponse(
96
+ result=unmarshal_json_response(
97
+ List[components.ImageMetadata], http_res
98
+ ),
99
+ headers=utils.get_response_headers(http_res.headers),
100
+ )
101
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
102
+ http_res_text = utils.stream_to_text(http_res)
103
+ raise errors.APIError("API error occurred", http_res, http_res_text)
104
+ if utils.match_response(http_res, ["500", "504"], "*"):
105
+ http_res_text = utils.stream_to_text(http_res)
106
+ raise errors.APIError("API error occurred", http_res, http_res_text)
107
+ if utils.match_response(http_res, "4XX", "*"):
108
+ http_res_text = utils.stream_to_text(http_res)
109
+ raise errors.APIError("API error occurred", http_res, http_res_text)
110
+ if utils.match_response(http_res, "5XX", "*"):
111
+ http_res_text = utils.stream_to_text(http_res)
112
+ raise errors.APIError("API error occurred", http_res, http_res_text)
113
+
114
+ raise errors.APIError("Unexpected response received", http_res)
115
+
116
+ async def list_async(
117
+ self,
118
+ *,
119
+ account_id: str,
120
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
121
+ server_url: Optional[str] = None,
122
+ timeout_ms: Optional[int] = None,
123
+ http_headers: Optional[Mapping[str, str]] = None,
124
+ ) -> operations.ListImageMetadataResponse:
125
+ r"""List metadata for all images in the specified account.
126
+
127
+ :param account_id:
128
+ :param retries: Override the default retry configuration for this method
129
+ :param server_url: Override the default server URL for this method
130
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
131
+ :param http_headers: Additional headers to set or replace on requests.
132
+ """
133
+ base_url = None
134
+ url_variables = None
135
+ if timeout_ms is None:
136
+ timeout_ms = self.sdk_configuration.timeout_ms
137
+
138
+ if server_url is not None:
139
+ base_url = server_url
140
+ else:
141
+ base_url = self._get_url(base_url, url_variables)
142
+
143
+ request = operations.ListImageMetadataRequest(
144
+ account_id=account_id,
145
+ )
146
+
147
+ req = self._build_request_async(
148
+ method="GET",
149
+ path="/accounts/{accountID}/images",
150
+ base_url=base_url,
151
+ url_variables=url_variables,
152
+ request=request,
153
+ request_body_required=False,
154
+ request_has_path_params=True,
155
+ request_has_query_params=True,
156
+ user_agent_header="user-agent",
157
+ accept_header_value="application/json",
158
+ http_headers=http_headers,
159
+ _globals=operations.ListImageMetadataGlobals(
160
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
161
+ ),
162
+ security=self.sdk_configuration.security,
163
+ timeout_ms=timeout_ms,
164
+ )
165
+
166
+ if retries == UNSET:
167
+ if self.sdk_configuration.retry_config is not UNSET:
168
+ retries = self.sdk_configuration.retry_config
169
+
170
+ retry_config = None
171
+ if isinstance(retries, utils.RetryConfig):
172
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
173
+
174
+ http_res = await self.do_request_async(
175
+ hook_ctx=HookContext(
176
+ config=self.sdk_configuration,
177
+ base_url=base_url or "",
178
+ operation_id="listImageMetadata",
179
+ oauth2_scopes=None,
180
+ security_source=get_security_from_env(
181
+ self.sdk_configuration.security, components.Security
182
+ ),
183
+ ),
184
+ request=req,
185
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
186
+ retry_config=retry_config,
187
+ )
188
+
189
+ if utils.match_response(http_res, "200", "application/json"):
190
+ return operations.ListImageMetadataResponse(
191
+ result=unmarshal_json_response(
192
+ List[components.ImageMetadata], http_res
193
+ ),
194
+ headers=utils.get_response_headers(http_res.headers),
195
+ )
196
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
197
+ http_res_text = await utils.stream_to_text_async(http_res)
198
+ raise errors.APIError("API error occurred", http_res, http_res_text)
199
+ if utils.match_response(http_res, ["500", "504"], "*"):
200
+ http_res_text = await utils.stream_to_text_async(http_res)
201
+ raise errors.APIError("API error occurred", http_res, http_res_text)
202
+ if utils.match_response(http_res, "4XX", "*"):
203
+ http_res_text = await utils.stream_to_text_async(http_res)
204
+ raise errors.APIError("API error occurred", http_res, http_res_text)
205
+ if utils.match_response(http_res, "5XX", "*"):
206
+ http_res_text = await utils.stream_to_text_async(http_res)
207
+ raise errors.APIError("API error occurred", http_res, http_res_text)
208
+
209
+ raise errors.APIError("Unexpected response received", http_res)
210
+
211
+ def get_metadata(
212
+ self,
213
+ *,
214
+ account_id: str,
215
+ image_id: str,
216
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
217
+ server_url: Optional[str] = None,
218
+ timeout_ms: Optional[int] = None,
219
+ http_headers: Optional[Mapping[str, str]] = None,
220
+ ) -> operations.GetImageMetadataResponse:
221
+ r"""Retrieve metadata for a specific image by its ID.
222
+
223
+ :param account_id:
224
+ :param image_id:
225
+ :param retries: Override the default retry configuration for this method
226
+ :param server_url: Override the default server URL for this method
227
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
228
+ :param http_headers: Additional headers to set or replace on requests.
229
+ """
230
+ base_url = None
231
+ url_variables = None
232
+ if timeout_ms is None:
233
+ timeout_ms = self.sdk_configuration.timeout_ms
234
+
235
+ if server_url is not None:
236
+ base_url = server_url
237
+ else:
238
+ base_url = self._get_url(base_url, url_variables)
239
+
240
+ request = operations.GetImageMetadataRequest(
241
+ account_id=account_id,
242
+ image_id=image_id,
243
+ )
244
+
245
+ req = self._build_request(
246
+ method="GET",
247
+ path="/accounts/{accountID}/images/{imageID}",
248
+ base_url=base_url,
249
+ url_variables=url_variables,
250
+ request=request,
251
+ request_body_required=False,
252
+ request_has_path_params=True,
253
+ request_has_query_params=True,
254
+ user_agent_header="user-agent",
255
+ accept_header_value="application/json",
256
+ http_headers=http_headers,
257
+ _globals=operations.GetImageMetadataGlobals(
258
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
259
+ ),
260
+ security=self.sdk_configuration.security,
261
+ timeout_ms=timeout_ms,
262
+ )
263
+
264
+ if retries == UNSET:
265
+ if self.sdk_configuration.retry_config is not UNSET:
266
+ retries = self.sdk_configuration.retry_config
267
+
268
+ retry_config = None
269
+ if isinstance(retries, utils.RetryConfig):
270
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
271
+
272
+ http_res = self.do_request(
273
+ hook_ctx=HookContext(
274
+ config=self.sdk_configuration,
275
+ base_url=base_url or "",
276
+ operation_id="getImageMetadata",
277
+ oauth2_scopes=None,
278
+ security_source=get_security_from_env(
279
+ self.sdk_configuration.security, components.Security
280
+ ),
281
+ ),
282
+ request=req,
283
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
284
+ retry_config=retry_config,
285
+ )
286
+
287
+ if utils.match_response(http_res, "200", "application/json"):
288
+ return operations.GetImageMetadataResponse(
289
+ result=unmarshal_json_response(components.ImageMetadata, http_res),
290
+ headers=utils.get_response_headers(http_res.headers),
291
+ )
292
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
293
+ http_res_text = utils.stream_to_text(http_res)
294
+ raise errors.APIError("API error occurred", http_res, http_res_text)
295
+ if utils.match_response(http_res, ["500", "504"], "*"):
296
+ http_res_text = utils.stream_to_text(http_res)
297
+ raise errors.APIError("API error occurred", http_res, http_res_text)
298
+ if utils.match_response(http_res, "4XX", "*"):
299
+ http_res_text = utils.stream_to_text(http_res)
300
+ raise errors.APIError("API error occurred", http_res, http_res_text)
301
+ if utils.match_response(http_res, "5XX", "*"):
302
+ http_res_text = utils.stream_to_text(http_res)
303
+ raise errors.APIError("API error occurred", http_res, http_res_text)
304
+
305
+ raise errors.APIError("Unexpected response received", http_res)
306
+
307
+ async def get_metadata_async(
308
+ self,
309
+ *,
310
+ account_id: str,
311
+ image_id: str,
312
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
313
+ server_url: Optional[str] = None,
314
+ timeout_ms: Optional[int] = None,
315
+ http_headers: Optional[Mapping[str, str]] = None,
316
+ ) -> operations.GetImageMetadataResponse:
317
+ r"""Retrieve metadata for a specific image by its ID.
318
+
319
+ :param account_id:
320
+ :param image_id:
321
+ :param retries: Override the default retry configuration for this method
322
+ :param server_url: Override the default server URL for this method
323
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
324
+ :param http_headers: Additional headers to set or replace on requests.
325
+ """
326
+ base_url = None
327
+ url_variables = None
328
+ if timeout_ms is None:
329
+ timeout_ms = self.sdk_configuration.timeout_ms
330
+
331
+ if server_url is not None:
332
+ base_url = server_url
333
+ else:
334
+ base_url = self._get_url(base_url, url_variables)
335
+
336
+ request = operations.GetImageMetadataRequest(
337
+ account_id=account_id,
338
+ image_id=image_id,
339
+ )
340
+
341
+ req = self._build_request_async(
342
+ method="GET",
343
+ path="/accounts/{accountID}/images/{imageID}",
344
+ base_url=base_url,
345
+ url_variables=url_variables,
346
+ request=request,
347
+ request_body_required=False,
348
+ request_has_path_params=True,
349
+ request_has_query_params=True,
350
+ user_agent_header="user-agent",
351
+ accept_header_value="application/json",
352
+ http_headers=http_headers,
353
+ _globals=operations.GetImageMetadataGlobals(
354
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
355
+ ),
356
+ security=self.sdk_configuration.security,
357
+ timeout_ms=timeout_ms,
358
+ )
359
+
360
+ if retries == UNSET:
361
+ if self.sdk_configuration.retry_config is not UNSET:
362
+ retries = self.sdk_configuration.retry_config
363
+
364
+ retry_config = None
365
+ if isinstance(retries, utils.RetryConfig):
366
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
367
+
368
+ http_res = await self.do_request_async(
369
+ hook_ctx=HookContext(
370
+ config=self.sdk_configuration,
371
+ base_url=base_url or "",
372
+ operation_id="getImageMetadata",
373
+ oauth2_scopes=None,
374
+ security_source=get_security_from_env(
375
+ self.sdk_configuration.security, components.Security
376
+ ),
377
+ ),
378
+ request=req,
379
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
380
+ retry_config=retry_config,
381
+ )
382
+
383
+ if utils.match_response(http_res, "200", "application/json"):
384
+ return operations.GetImageMetadataResponse(
385
+ result=unmarshal_json_response(components.ImageMetadata, http_res),
386
+ headers=utils.get_response_headers(http_res.headers),
387
+ )
388
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
389
+ http_res_text = await utils.stream_to_text_async(http_res)
390
+ raise errors.APIError("API error occurred", http_res, http_res_text)
391
+ if utils.match_response(http_res, ["500", "504"], "*"):
392
+ http_res_text = await utils.stream_to_text_async(http_res)
393
+ raise errors.APIError("API error occurred", http_res, http_res_text)
394
+ if utils.match_response(http_res, "4XX", "*"):
395
+ http_res_text = await utils.stream_to_text_async(http_res)
396
+ raise errors.APIError("API error occurred", http_res, http_res_text)
397
+ if utils.match_response(http_res, "5XX", "*"):
398
+ http_res_text = await utils.stream_to_text_async(http_res)
399
+ raise errors.APIError("API error occurred", http_res, http_res_text)
400
+
401
+ raise errors.APIError("Unexpected response received", http_res)
402
+
403
+ def delete(
404
+ self,
405
+ *,
406
+ account_id: str,
407
+ image_id: str,
408
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
409
+ server_url: Optional[str] = None,
410
+ timeout_ms: Optional[int] = None,
411
+ http_headers: Optional[Mapping[str, str]] = None,
412
+ ) -> operations.DeleteImageResponse:
413
+ r"""Permanently delete an image by its ID.
414
+
415
+ :param account_id:
416
+ :param image_id:
417
+ :param retries: Override the default retry configuration for this method
418
+ :param server_url: Override the default server URL for this method
419
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
420
+ :param http_headers: Additional headers to set or replace on requests.
421
+ """
422
+ base_url = None
423
+ url_variables = None
424
+ if timeout_ms is None:
425
+ timeout_ms = self.sdk_configuration.timeout_ms
426
+
427
+ if server_url is not None:
428
+ base_url = server_url
429
+ else:
430
+ base_url = self._get_url(base_url, url_variables)
431
+
432
+ request = operations.DeleteImageRequest(
433
+ account_id=account_id,
434
+ image_id=image_id,
435
+ )
436
+
437
+ req = self._build_request(
438
+ method="DELETE",
439
+ path="/accounts/{accountID}/images/{imageID}",
440
+ base_url=base_url,
441
+ url_variables=url_variables,
442
+ request=request,
443
+ request_body_required=False,
444
+ request_has_path_params=True,
445
+ request_has_query_params=True,
446
+ user_agent_header="user-agent",
447
+ accept_header_value="application/json",
448
+ http_headers=http_headers,
449
+ _globals=operations.DeleteImageGlobals(
450
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
451
+ ),
452
+ security=self.sdk_configuration.security,
453
+ timeout_ms=timeout_ms,
454
+ )
455
+
456
+ if retries == UNSET:
457
+ if self.sdk_configuration.retry_config is not UNSET:
458
+ retries = self.sdk_configuration.retry_config
459
+
460
+ retry_config = None
461
+ if isinstance(retries, utils.RetryConfig):
462
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
463
+
464
+ http_res = self.do_request(
465
+ hook_ctx=HookContext(
466
+ config=self.sdk_configuration,
467
+ base_url=base_url or "",
468
+ operation_id="deleteImage",
469
+ oauth2_scopes=None,
470
+ security_source=get_security_from_env(
471
+ self.sdk_configuration.security, components.Security
472
+ ),
473
+ ),
474
+ request=req,
475
+ error_status_codes=[
476
+ "400",
477
+ "401",
478
+ "403",
479
+ "404",
480
+ "409",
481
+ "429",
482
+ "4XX",
483
+ "500",
484
+ "504",
485
+ "5XX",
486
+ ],
487
+ retry_config=retry_config,
488
+ )
489
+
490
+ response_data: Any = None
491
+ if utils.match_response(http_res, "204", "*"):
492
+ return operations.DeleteImageResponse(
493
+ headers=utils.get_response_headers(http_res.headers)
494
+ )
495
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
496
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
497
+ raise errors.GenericError(response_data, http_res)
498
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
499
+ http_res_text = utils.stream_to_text(http_res)
500
+ raise errors.APIError("API error occurred", http_res, http_res_text)
501
+ if utils.match_response(http_res, ["500", "504"], "*"):
502
+ http_res_text = utils.stream_to_text(http_res)
503
+ raise errors.APIError("API error occurred", http_res, http_res_text)
504
+ if utils.match_response(http_res, "4XX", "*"):
505
+ http_res_text = utils.stream_to_text(http_res)
506
+ raise errors.APIError("API error occurred", http_res, http_res_text)
507
+ if utils.match_response(http_res, "5XX", "*"):
508
+ http_res_text = utils.stream_to_text(http_res)
509
+ raise errors.APIError("API error occurred", http_res, http_res_text)
510
+
511
+ raise errors.APIError("Unexpected response received", http_res)
512
+
513
+ async def delete_async(
514
+ self,
515
+ *,
516
+ account_id: str,
517
+ image_id: str,
518
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
519
+ server_url: Optional[str] = None,
520
+ timeout_ms: Optional[int] = None,
521
+ http_headers: Optional[Mapping[str, str]] = None,
522
+ ) -> operations.DeleteImageResponse:
523
+ r"""Permanently delete an image by its ID.
524
+
525
+ :param account_id:
526
+ :param image_id:
527
+ :param retries: Override the default retry configuration for this method
528
+ :param server_url: Override the default server URL for this method
529
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
530
+ :param http_headers: Additional headers to set or replace on requests.
531
+ """
532
+ base_url = None
533
+ url_variables = None
534
+ if timeout_ms is None:
535
+ timeout_ms = self.sdk_configuration.timeout_ms
536
+
537
+ if server_url is not None:
538
+ base_url = server_url
539
+ else:
540
+ base_url = self._get_url(base_url, url_variables)
541
+
542
+ request = operations.DeleteImageRequest(
543
+ account_id=account_id,
544
+ image_id=image_id,
545
+ )
546
+
547
+ req = self._build_request_async(
548
+ method="DELETE",
549
+ path="/accounts/{accountID}/images/{imageID}",
550
+ base_url=base_url,
551
+ url_variables=url_variables,
552
+ request=request,
553
+ request_body_required=False,
554
+ request_has_path_params=True,
555
+ request_has_query_params=True,
556
+ user_agent_header="user-agent",
557
+ accept_header_value="application/json",
558
+ http_headers=http_headers,
559
+ _globals=operations.DeleteImageGlobals(
560
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
561
+ ),
562
+ security=self.sdk_configuration.security,
563
+ timeout_ms=timeout_ms,
564
+ )
565
+
566
+ if retries == UNSET:
567
+ if self.sdk_configuration.retry_config is not UNSET:
568
+ retries = self.sdk_configuration.retry_config
569
+
570
+ retry_config = None
571
+ if isinstance(retries, utils.RetryConfig):
572
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
573
+
574
+ http_res = await self.do_request_async(
575
+ hook_ctx=HookContext(
576
+ config=self.sdk_configuration,
577
+ base_url=base_url or "",
578
+ operation_id="deleteImage",
579
+ oauth2_scopes=None,
580
+ security_source=get_security_from_env(
581
+ self.sdk_configuration.security, components.Security
582
+ ),
583
+ ),
584
+ request=req,
585
+ error_status_codes=[
586
+ "400",
587
+ "401",
588
+ "403",
589
+ "404",
590
+ "409",
591
+ "429",
592
+ "4XX",
593
+ "500",
594
+ "504",
595
+ "5XX",
596
+ ],
597
+ retry_config=retry_config,
598
+ )
599
+
600
+ response_data: Any = None
601
+ if utils.match_response(http_res, "204", "*"):
602
+ return operations.DeleteImageResponse(
603
+ headers=utils.get_response_headers(http_res.headers)
604
+ )
605
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
606
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
607
+ raise errors.GenericError(response_data, http_res)
608
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
609
+ http_res_text = await utils.stream_to_text_async(http_res)
610
+ raise errors.APIError("API error occurred", http_res, http_res_text)
611
+ if utils.match_response(http_res, ["500", "504"], "*"):
612
+ http_res_text = await utils.stream_to_text_async(http_res)
613
+ raise errors.APIError("API error occurred", http_res, http_res_text)
614
+ if utils.match_response(http_res, "4XX", "*"):
615
+ http_res_text = await utils.stream_to_text_async(http_res)
616
+ raise errors.APIError("API error occurred", http_res, http_res_text)
617
+ if utils.match_response(http_res, "5XX", "*"):
618
+ http_res_text = await utils.stream_to_text_async(http_res)
619
+ raise errors.APIError("API error occurred", http_res, http_res_text)
620
+
621
+ raise errors.APIError("Unexpected response received", http_res)
622
+
623
+ def get_public(
624
+ self,
625
+ *,
626
+ public_id: str,
627
+ if_none_match: Optional[str] = None,
628
+ size: Optional[str] = "400x400",
629
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
630
+ server_url: Optional[str] = None,
631
+ timeout_ms: Optional[int] = None,
632
+ accept_header_override: Optional[GetPublicAcceptEnum] = None,
633
+ http_headers: Optional[Mapping[str, str]] = None,
634
+ ) -> operations.GetPublicImageResponse:
635
+ r"""Get an image by its public ID.
636
+
637
+ :param public_id:
638
+ :param if_none_match:
639
+ :param size: Optional parameter to request a resized version of the image (WxH). If either dimension is 0, the image will be scaled proportionally based on the non-zero dimension. Dimensions are capped at 2048 pixels. A default size of 400x400 will be used if this parameter is omitted.
640
+ :param retries: Override the default retry configuration for this method
641
+ :param server_url: Override the default server URL for this method
642
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
643
+ :param accept_header_override: Override the default accept header for this method
644
+ :param http_headers: Additional headers to set or replace on requests.
645
+ """
646
+ base_url = None
647
+ url_variables = None
648
+ if timeout_ms is None:
649
+ timeout_ms = self.sdk_configuration.timeout_ms
650
+
651
+ if server_url is not None:
652
+ base_url = server_url
653
+ else:
654
+ base_url = self._get_url(base_url, url_variables)
655
+
656
+ request = operations.GetPublicImageRequest(
657
+ if_none_match=if_none_match,
658
+ public_id=public_id,
659
+ size=size,
660
+ )
661
+
662
+ req = self._build_request(
663
+ method="GET",
664
+ path="/images/{publicID}",
665
+ base_url=base_url,
666
+ url_variables=url_variables,
667
+ request=request,
668
+ request_body_required=False,
669
+ request_has_path_params=True,
670
+ request_has_query_params=True,
671
+ user_agent_header="user-agent",
672
+ accept_header_value=accept_header_override.value
673
+ if accept_header_override is not None
674
+ else "image/jpeg;q=1, image/png;q=0.7, image/webp;q=0",
675
+ http_headers=http_headers,
676
+ timeout_ms=timeout_ms,
677
+ )
678
+
679
+ if retries == UNSET:
680
+ if self.sdk_configuration.retry_config is not UNSET:
681
+ retries = self.sdk_configuration.retry_config
682
+
683
+ retry_config = None
684
+ if isinstance(retries, utils.RetryConfig):
685
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
686
+
687
+ http_res = self.do_request(
688
+ hook_ctx=HookContext(
689
+ config=self.sdk_configuration,
690
+ base_url=base_url or "",
691
+ operation_id="getPublicImage",
692
+ oauth2_scopes=None,
693
+ security_source=None,
694
+ ),
695
+ request=req,
696
+ error_status_codes=["404", "429", "4XX", "500", "502", "504", "5XX"],
697
+ stream=True,
698
+ retry_config=retry_config,
699
+ )
700
+
701
+ if utils.match_response(http_res, "200", "image/webp"):
702
+ return operations.GetPublicImageResponse(
703
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
704
+ )
705
+ if utils.match_response(http_res, "200", "image/png"):
706
+ return operations.GetPublicImageResponse(
707
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
708
+ )
709
+ if utils.match_response(http_res, "200", "image/jpeg"):
710
+ return operations.GetPublicImageResponse(
711
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
712
+ )
713
+ if utils.match_response(http_res, ["404", "429"], "*"):
714
+ http_res_text = utils.stream_to_text(http_res)
715
+ raise errors.APIError("API error occurred", http_res, http_res_text)
716
+ if utils.match_response(http_res, ["500", "502", "504"], "*"):
717
+ http_res_text = utils.stream_to_text(http_res)
718
+ raise errors.APIError("API error occurred", http_res, http_res_text)
719
+ if utils.match_response(http_res, "4XX", "*"):
720
+ http_res_text = utils.stream_to_text(http_res)
721
+ raise errors.APIError("API error occurred", http_res, http_res_text)
722
+ if utils.match_response(http_res, "5XX", "*"):
723
+ http_res_text = utils.stream_to_text(http_res)
724
+ raise errors.APIError("API error occurred", http_res, http_res_text)
725
+
726
+ http_res_text = utils.stream_to_text(http_res)
727
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)
728
+
729
+ async def get_public_async(
730
+ self,
731
+ *,
732
+ public_id: str,
733
+ if_none_match: Optional[str] = None,
734
+ size: Optional[str] = "400x400",
735
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
736
+ server_url: Optional[str] = None,
737
+ timeout_ms: Optional[int] = None,
738
+ accept_header_override: Optional[GetPublicAcceptEnum] = None,
739
+ http_headers: Optional[Mapping[str, str]] = None,
740
+ ) -> operations.GetPublicImageResponse:
741
+ r"""Get an image by its public ID.
742
+
743
+ :param public_id:
744
+ :param if_none_match:
745
+ :param size: Optional parameter to request a resized version of the image (WxH). If either dimension is 0, the image will be scaled proportionally based on the non-zero dimension. Dimensions are capped at 2048 pixels. A default size of 400x400 will be used if this parameter is omitted.
746
+ :param retries: Override the default retry configuration for this method
747
+ :param server_url: Override the default server URL for this method
748
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
749
+ :param accept_header_override: Override the default accept header for this method
750
+ :param http_headers: Additional headers to set or replace on requests.
751
+ """
752
+ base_url = None
753
+ url_variables = None
754
+ if timeout_ms is None:
755
+ timeout_ms = self.sdk_configuration.timeout_ms
756
+
757
+ if server_url is not None:
758
+ base_url = server_url
759
+ else:
760
+ base_url = self._get_url(base_url, url_variables)
761
+
762
+ request = operations.GetPublicImageRequest(
763
+ if_none_match=if_none_match,
764
+ public_id=public_id,
765
+ size=size,
766
+ )
767
+
768
+ req = self._build_request_async(
769
+ method="GET",
770
+ path="/images/{publicID}",
771
+ base_url=base_url,
772
+ url_variables=url_variables,
773
+ request=request,
774
+ request_body_required=False,
775
+ request_has_path_params=True,
776
+ request_has_query_params=True,
777
+ user_agent_header="user-agent",
778
+ accept_header_value=accept_header_override.value
779
+ if accept_header_override is not None
780
+ else "image/jpeg;q=1, image/png;q=0.7, image/webp;q=0",
781
+ http_headers=http_headers,
782
+ timeout_ms=timeout_ms,
783
+ )
784
+
785
+ if retries == UNSET:
786
+ if self.sdk_configuration.retry_config is not UNSET:
787
+ retries = self.sdk_configuration.retry_config
788
+
789
+ retry_config = None
790
+ if isinstance(retries, utils.RetryConfig):
791
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
792
+
793
+ http_res = await self.do_request_async(
794
+ hook_ctx=HookContext(
795
+ config=self.sdk_configuration,
796
+ base_url=base_url or "",
797
+ operation_id="getPublicImage",
798
+ oauth2_scopes=None,
799
+ security_source=None,
800
+ ),
801
+ request=req,
802
+ error_status_codes=["404", "429", "4XX", "500", "502", "504", "5XX"],
803
+ stream=True,
804
+ retry_config=retry_config,
805
+ )
806
+
807
+ if utils.match_response(http_res, "200", "image/webp"):
808
+ return operations.GetPublicImageResponse(
809
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
810
+ )
811
+ if utils.match_response(http_res, "200", "image/png"):
812
+ return operations.GetPublicImageResponse(
813
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
814
+ )
815
+ if utils.match_response(http_res, "200", "image/jpeg"):
816
+ return operations.GetPublicImageResponse(
817
+ result=http_res, headers=utils.get_response_headers(http_res.headers)
818
+ )
819
+ if utils.match_response(http_res, ["404", "429"], "*"):
820
+ http_res_text = await utils.stream_to_text_async(http_res)
821
+ raise errors.APIError("API error occurred", http_res, http_res_text)
822
+ if utils.match_response(http_res, ["500", "502", "504"], "*"):
823
+ http_res_text = await utils.stream_to_text_async(http_res)
824
+ raise errors.APIError("API error occurred", http_res, http_res_text)
825
+ if utils.match_response(http_res, "4XX", "*"):
826
+ http_res_text = await utils.stream_to_text_async(http_res)
827
+ raise errors.APIError("API error occurred", http_res, http_res_text)
828
+ if utils.match_response(http_res, "5XX", "*"):
829
+ http_res_text = await utils.stream_to_text_async(http_res)
830
+ raise errors.APIError("API error occurred", http_res, http_res_text)
831
+
832
+ http_res_text = await utils.stream_to_text_async(http_res)
833
+ raise errors.APIError("Unexpected response received", http_res, http_res_text)