moovio_sdk 0.17.4__py3-none-any.whl → 0.18.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.
- moovio_sdk/_version.py +3 -3
- moovio_sdk/images.py +569 -1
- moovio_sdk/models/components/__init__.py +50 -0
- moovio_sdk/models/components/generatedbyaccountid.py +1 -1
- moovio_sdk/models/components/generatedbybankaccountid.py +1 -1
- moovio_sdk/models/components/generatedbycardid.py +1 -1
- moovio_sdk/models/components/generatedbydisputeid.py +1 -1
- moovio_sdk/models/components/imagemetadatarequest.py +21 -0
- moovio_sdk/models/components/imagemetadatavalidationerror.py +15 -0
- moovio_sdk/models/components/imageupdaterequestmultipart.py +119 -0
- moovio_sdk/models/components/imageuploadrequestmultipart.py +54 -0
- moovio_sdk/models/errors/__init__.py +8 -0
- moovio_sdk/models/errors/imagerequestvalidationerror.py +34 -0
- moovio_sdk/models/operations/__init__.py +40 -0
- moovio_sdk/models/operations/updateimage.py +87 -0
- moovio_sdk/models/operations/uploadimage.py +80 -0
- {moovio_sdk-0.17.4.dist-info → moovio_sdk-0.18.1.dist-info}/METADATA +54 -46
- {moovio_sdk-0.17.4.dist-info → moovio_sdk-0.18.1.dist-info}/RECORD +19 -12
- {moovio_sdk-0.17.4.dist-info → moovio_sdk-0.18.1.dist-info}/WHEEL +0 -0
moovio_sdk/_version.py
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import importlib.metadata
|
|
4
4
|
|
|
5
5
|
__title__: str = "moovio_sdk"
|
|
6
|
-
__version__: str = "0.
|
|
6
|
+
__version__: str = "0.18.1"
|
|
7
7
|
__openapi_doc_version__: str = "latest"
|
|
8
|
-
__gen_version__: str = "2.
|
|
9
|
-
__user_agent__: str = "speakeasy-sdk/python 0.
|
|
8
|
+
__gen_version__: str = "2.727.9"
|
|
9
|
+
__user_agent__: str = "speakeasy-sdk/python 0.18.1 2.727.9 latest moovio_sdk"
|
|
10
10
|
|
|
11
11
|
try:
|
|
12
12
|
if __package__ is not None:
|
moovio_sdk/images.py
CHANGED
|
@@ -8,7 +8,7 @@ from moovio_sdk.models import components, errors, operations
|
|
|
8
8
|
from moovio_sdk.types import OptionalNullable, UNSET
|
|
9
9
|
from moovio_sdk.utils import get_security_from_env
|
|
10
10
|
from moovio_sdk.utils.unmarshal_json_response import unmarshal_json_response
|
|
11
|
-
from typing import Any, List, Mapping, Optional
|
|
11
|
+
from typing import Any, List, Mapping, Optional, Union
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
class GetPublicAcceptEnum(str, Enum):
|
|
@@ -208,6 +208,280 @@ class Images(BaseSDK):
|
|
|
208
208
|
|
|
209
209
|
raise errors.APIError("Unexpected response received", http_res)
|
|
210
210
|
|
|
211
|
+
def upload(
|
|
212
|
+
self,
|
|
213
|
+
*,
|
|
214
|
+
account_id: str,
|
|
215
|
+
image: Union[components.Image, components.ImageTypedDict],
|
|
216
|
+
metadata: Optional[
|
|
217
|
+
Union[
|
|
218
|
+
components.ImageMetadataRequest,
|
|
219
|
+
components.ImageMetadataRequestTypedDict,
|
|
220
|
+
]
|
|
221
|
+
] = None,
|
|
222
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
223
|
+
server_url: Optional[str] = None,
|
|
224
|
+
timeout_ms: Optional[int] = None,
|
|
225
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
226
|
+
) -> operations.UploadImageResponse:
|
|
227
|
+
r"""Upload a new PNG, JPEG, or WebP image with optional metadata.
|
|
228
|
+
Duplicate images, and requests larger than 16MB will be rejected.
|
|
229
|
+
|
|
230
|
+
:param account_id:
|
|
231
|
+
:param image:
|
|
232
|
+
:param metadata: Optional, json-encoded metadata to associate with the uploaded image.
|
|
233
|
+
:param retries: Override the default retry configuration for this method
|
|
234
|
+
:param server_url: Override the default server URL for this method
|
|
235
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
236
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
237
|
+
"""
|
|
238
|
+
base_url = None
|
|
239
|
+
url_variables = None
|
|
240
|
+
if timeout_ms is None:
|
|
241
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
242
|
+
|
|
243
|
+
if server_url is not None:
|
|
244
|
+
base_url = server_url
|
|
245
|
+
else:
|
|
246
|
+
base_url = self._get_url(base_url, url_variables)
|
|
247
|
+
|
|
248
|
+
request = operations.UploadImageRequest(
|
|
249
|
+
account_id=account_id,
|
|
250
|
+
image_upload_request_multi_part=components.ImageUploadRequestMultiPart(
|
|
251
|
+
image=utils.get_pydantic_model(image, components.Image),
|
|
252
|
+
metadata=utils.get_pydantic_model(
|
|
253
|
+
metadata, Optional[components.ImageMetadataRequest]
|
|
254
|
+
),
|
|
255
|
+
),
|
|
256
|
+
)
|
|
257
|
+
|
|
258
|
+
req = self._build_request(
|
|
259
|
+
method="POST",
|
|
260
|
+
path="/accounts/{accountID}/images",
|
|
261
|
+
base_url=base_url,
|
|
262
|
+
url_variables=url_variables,
|
|
263
|
+
request=request,
|
|
264
|
+
request_body_required=True,
|
|
265
|
+
request_has_path_params=True,
|
|
266
|
+
request_has_query_params=True,
|
|
267
|
+
user_agent_header="user-agent",
|
|
268
|
+
accept_header_value="application/json",
|
|
269
|
+
http_headers=http_headers,
|
|
270
|
+
_globals=operations.UploadImageGlobals(
|
|
271
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
|
272
|
+
),
|
|
273
|
+
security=self.sdk_configuration.security,
|
|
274
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
275
|
+
request.image_upload_request_multi_part,
|
|
276
|
+
False,
|
|
277
|
+
False,
|
|
278
|
+
"multipart",
|
|
279
|
+
components.ImageUploadRequestMultiPart,
|
|
280
|
+
),
|
|
281
|
+
timeout_ms=timeout_ms,
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
if retries == UNSET:
|
|
285
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
286
|
+
retries = self.sdk_configuration.retry_config
|
|
287
|
+
|
|
288
|
+
retry_config = None
|
|
289
|
+
if isinstance(retries, utils.RetryConfig):
|
|
290
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
291
|
+
|
|
292
|
+
http_res = self.do_request(
|
|
293
|
+
hook_ctx=HookContext(
|
|
294
|
+
config=self.sdk_configuration,
|
|
295
|
+
base_url=base_url or "",
|
|
296
|
+
operation_id="uploadImage",
|
|
297
|
+
oauth2_scopes=None,
|
|
298
|
+
security_source=get_security_from_env(
|
|
299
|
+
self.sdk_configuration.security, components.Security
|
|
300
|
+
),
|
|
301
|
+
),
|
|
302
|
+
request=req,
|
|
303
|
+
error_status_codes=[
|
|
304
|
+
"400",
|
|
305
|
+
"401",
|
|
306
|
+
"403",
|
|
307
|
+
"404",
|
|
308
|
+
"409",
|
|
309
|
+
"422",
|
|
310
|
+
"429",
|
|
311
|
+
"4XX",
|
|
312
|
+
"500",
|
|
313
|
+
"504",
|
|
314
|
+
"5XX",
|
|
315
|
+
],
|
|
316
|
+
retry_config=retry_config,
|
|
317
|
+
)
|
|
318
|
+
|
|
319
|
+
response_data: Any = None
|
|
320
|
+
if utils.match_response(http_res, "201", "application/json"):
|
|
321
|
+
return operations.UploadImageResponse(
|
|
322
|
+
result=unmarshal_json_response(components.ImageMetadata, http_res),
|
|
323
|
+
headers=utils.get_response_headers(http_res.headers),
|
|
324
|
+
)
|
|
325
|
+
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
|
326
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
|
327
|
+
raise errors.GenericError(response_data, http_res)
|
|
328
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
329
|
+
response_data = unmarshal_json_response(
|
|
330
|
+
errors.ImageRequestValidationErrorData, http_res
|
|
331
|
+
)
|
|
332
|
+
raise errors.ImageRequestValidationError(response_data, http_res)
|
|
333
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
|
334
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
335
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
336
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
|
337
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
338
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
339
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
340
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
341
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
342
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
343
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
344
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
345
|
+
|
|
346
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
347
|
+
|
|
348
|
+
async def upload_async(
|
|
349
|
+
self,
|
|
350
|
+
*,
|
|
351
|
+
account_id: str,
|
|
352
|
+
image: Union[components.Image, components.ImageTypedDict],
|
|
353
|
+
metadata: Optional[
|
|
354
|
+
Union[
|
|
355
|
+
components.ImageMetadataRequest,
|
|
356
|
+
components.ImageMetadataRequestTypedDict,
|
|
357
|
+
]
|
|
358
|
+
] = None,
|
|
359
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
360
|
+
server_url: Optional[str] = None,
|
|
361
|
+
timeout_ms: Optional[int] = None,
|
|
362
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
363
|
+
) -> operations.UploadImageResponse:
|
|
364
|
+
r"""Upload a new PNG, JPEG, or WebP image with optional metadata.
|
|
365
|
+
Duplicate images, and requests larger than 16MB will be rejected.
|
|
366
|
+
|
|
367
|
+
:param account_id:
|
|
368
|
+
:param image:
|
|
369
|
+
:param metadata: Optional, json-encoded metadata to associate with the uploaded image.
|
|
370
|
+
:param retries: Override the default retry configuration for this method
|
|
371
|
+
:param server_url: Override the default server URL for this method
|
|
372
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
373
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
374
|
+
"""
|
|
375
|
+
base_url = None
|
|
376
|
+
url_variables = None
|
|
377
|
+
if timeout_ms is None:
|
|
378
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
379
|
+
|
|
380
|
+
if server_url is not None:
|
|
381
|
+
base_url = server_url
|
|
382
|
+
else:
|
|
383
|
+
base_url = self._get_url(base_url, url_variables)
|
|
384
|
+
|
|
385
|
+
request = operations.UploadImageRequest(
|
|
386
|
+
account_id=account_id,
|
|
387
|
+
image_upload_request_multi_part=components.ImageUploadRequestMultiPart(
|
|
388
|
+
image=utils.get_pydantic_model(image, components.Image),
|
|
389
|
+
metadata=utils.get_pydantic_model(
|
|
390
|
+
metadata, Optional[components.ImageMetadataRequest]
|
|
391
|
+
),
|
|
392
|
+
),
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
req = self._build_request_async(
|
|
396
|
+
method="POST",
|
|
397
|
+
path="/accounts/{accountID}/images",
|
|
398
|
+
base_url=base_url,
|
|
399
|
+
url_variables=url_variables,
|
|
400
|
+
request=request,
|
|
401
|
+
request_body_required=True,
|
|
402
|
+
request_has_path_params=True,
|
|
403
|
+
request_has_query_params=True,
|
|
404
|
+
user_agent_header="user-agent",
|
|
405
|
+
accept_header_value="application/json",
|
|
406
|
+
http_headers=http_headers,
|
|
407
|
+
_globals=operations.UploadImageGlobals(
|
|
408
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
|
409
|
+
),
|
|
410
|
+
security=self.sdk_configuration.security,
|
|
411
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
412
|
+
request.image_upload_request_multi_part,
|
|
413
|
+
False,
|
|
414
|
+
False,
|
|
415
|
+
"multipart",
|
|
416
|
+
components.ImageUploadRequestMultiPart,
|
|
417
|
+
),
|
|
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="uploadImage",
|
|
434
|
+
oauth2_scopes=None,
|
|
435
|
+
security_source=get_security_from_env(
|
|
436
|
+
self.sdk_configuration.security, components.Security
|
|
437
|
+
),
|
|
438
|
+
),
|
|
439
|
+
request=req,
|
|
440
|
+
error_status_codes=[
|
|
441
|
+
"400",
|
|
442
|
+
"401",
|
|
443
|
+
"403",
|
|
444
|
+
"404",
|
|
445
|
+
"409",
|
|
446
|
+
"422",
|
|
447
|
+
"429",
|
|
448
|
+
"4XX",
|
|
449
|
+
"500",
|
|
450
|
+
"504",
|
|
451
|
+
"5XX",
|
|
452
|
+
],
|
|
453
|
+
retry_config=retry_config,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
response_data: Any = None
|
|
457
|
+
if utils.match_response(http_res, "201", "application/json"):
|
|
458
|
+
return operations.UploadImageResponse(
|
|
459
|
+
result=unmarshal_json_response(components.ImageMetadata, http_res),
|
|
460
|
+
headers=utils.get_response_headers(http_res.headers),
|
|
461
|
+
)
|
|
462
|
+
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
|
463
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
|
464
|
+
raise errors.GenericError(response_data, http_res)
|
|
465
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
466
|
+
response_data = unmarshal_json_response(
|
|
467
|
+
errors.ImageRequestValidationErrorData, http_res
|
|
468
|
+
)
|
|
469
|
+
raise errors.ImageRequestValidationError(response_data, http_res)
|
|
470
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
|
471
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
472
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
473
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
|
474
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
475
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
476
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
477
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
478
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
479
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
480
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
481
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
482
|
+
|
|
483
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
484
|
+
|
|
211
485
|
def get_metadata(
|
|
212
486
|
self,
|
|
213
487
|
*,
|
|
@@ -400,6 +674,300 @@ class Images(BaseSDK):
|
|
|
400
674
|
|
|
401
675
|
raise errors.APIError("Unexpected response received", http_res)
|
|
402
676
|
|
|
677
|
+
def update(
|
|
678
|
+
self,
|
|
679
|
+
*,
|
|
680
|
+
account_id: str,
|
|
681
|
+
image_id: str,
|
|
682
|
+
image: Optional[
|
|
683
|
+
Union[
|
|
684
|
+
components.ImageUpdateRequestMultiPartImage,
|
|
685
|
+
components.ImageUpdateRequestMultiPartImageTypedDict,
|
|
686
|
+
]
|
|
687
|
+
] = None,
|
|
688
|
+
metadata: OptionalNullable[
|
|
689
|
+
Union[components.Metadata, components.MetadataTypedDict]
|
|
690
|
+
] = UNSET,
|
|
691
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
692
|
+
server_url: Optional[str] = None,
|
|
693
|
+
timeout_ms: Optional[int] = None,
|
|
694
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
695
|
+
) -> operations.UpdateImageResponse:
|
|
696
|
+
r"""Update an existing image and/or its metadata.
|
|
697
|
+
|
|
698
|
+
Duplicate images, and requests larger than 16MB will be rejected. Omit any
|
|
699
|
+
form parts you do not wish to update. Existing metadata can be cleared by
|
|
700
|
+
sending `null` for the `metadata` form part.
|
|
701
|
+
|
|
702
|
+
:param account_id:
|
|
703
|
+
:param image_id:
|
|
704
|
+
:param image:
|
|
705
|
+
:param metadata: JSON-encoded metadata to update for the image. Omit this field if not updating metadata, or send `null` to clear existing metadata.
|
|
706
|
+
:param retries: Override the default retry configuration for this method
|
|
707
|
+
:param server_url: Override the default server URL for this method
|
|
708
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
709
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
710
|
+
"""
|
|
711
|
+
base_url = None
|
|
712
|
+
url_variables = None
|
|
713
|
+
if timeout_ms is None:
|
|
714
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
715
|
+
|
|
716
|
+
if server_url is not None:
|
|
717
|
+
base_url = server_url
|
|
718
|
+
else:
|
|
719
|
+
base_url = self._get_url(base_url, url_variables)
|
|
720
|
+
|
|
721
|
+
request = operations.UpdateImageRequest(
|
|
722
|
+
account_id=account_id,
|
|
723
|
+
image_id=image_id,
|
|
724
|
+
image_update_request_multi_part=components.ImageUpdateRequestMultiPart(
|
|
725
|
+
image=utils.get_pydantic_model(
|
|
726
|
+
image, Optional[components.ImageUpdateRequestMultiPartImage]
|
|
727
|
+
),
|
|
728
|
+
metadata=utils.get_pydantic_model(
|
|
729
|
+
metadata, OptionalNullable[components.Metadata]
|
|
730
|
+
),
|
|
731
|
+
),
|
|
732
|
+
)
|
|
733
|
+
|
|
734
|
+
req = self._build_request(
|
|
735
|
+
method="PATCH",
|
|
736
|
+
path="/accounts/{accountID}/images/{imageID}",
|
|
737
|
+
base_url=base_url,
|
|
738
|
+
url_variables=url_variables,
|
|
739
|
+
request=request,
|
|
740
|
+
request_body_required=True,
|
|
741
|
+
request_has_path_params=True,
|
|
742
|
+
request_has_query_params=True,
|
|
743
|
+
user_agent_header="user-agent",
|
|
744
|
+
accept_header_value="application/json",
|
|
745
|
+
http_headers=http_headers,
|
|
746
|
+
_globals=operations.UpdateImageGlobals(
|
|
747
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
|
748
|
+
),
|
|
749
|
+
security=self.sdk_configuration.security,
|
|
750
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
751
|
+
request.image_update_request_multi_part,
|
|
752
|
+
False,
|
|
753
|
+
False,
|
|
754
|
+
"multipart",
|
|
755
|
+
components.ImageUpdateRequestMultiPart,
|
|
756
|
+
),
|
|
757
|
+
timeout_ms=timeout_ms,
|
|
758
|
+
)
|
|
759
|
+
|
|
760
|
+
if retries == UNSET:
|
|
761
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
762
|
+
retries = self.sdk_configuration.retry_config
|
|
763
|
+
|
|
764
|
+
retry_config = None
|
|
765
|
+
if isinstance(retries, utils.RetryConfig):
|
|
766
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
767
|
+
|
|
768
|
+
http_res = self.do_request(
|
|
769
|
+
hook_ctx=HookContext(
|
|
770
|
+
config=self.sdk_configuration,
|
|
771
|
+
base_url=base_url or "",
|
|
772
|
+
operation_id="updateImage",
|
|
773
|
+
oauth2_scopes=None,
|
|
774
|
+
security_source=get_security_from_env(
|
|
775
|
+
self.sdk_configuration.security, components.Security
|
|
776
|
+
),
|
|
777
|
+
),
|
|
778
|
+
request=req,
|
|
779
|
+
error_status_codes=[
|
|
780
|
+
"400",
|
|
781
|
+
"401",
|
|
782
|
+
"403",
|
|
783
|
+
"404",
|
|
784
|
+
"409",
|
|
785
|
+
"422",
|
|
786
|
+
"429",
|
|
787
|
+
"4XX",
|
|
788
|
+
"500",
|
|
789
|
+
"504",
|
|
790
|
+
"5XX",
|
|
791
|
+
],
|
|
792
|
+
retry_config=retry_config,
|
|
793
|
+
)
|
|
794
|
+
|
|
795
|
+
response_data: Any = None
|
|
796
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
797
|
+
return operations.UpdateImageResponse(
|
|
798
|
+
result=unmarshal_json_response(components.ImageMetadata, http_res),
|
|
799
|
+
headers=utils.get_response_headers(http_res.headers),
|
|
800
|
+
)
|
|
801
|
+
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
|
802
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
|
803
|
+
raise errors.GenericError(response_data, http_res)
|
|
804
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
805
|
+
response_data = unmarshal_json_response(
|
|
806
|
+
errors.ImageRequestValidationErrorData, http_res
|
|
807
|
+
)
|
|
808
|
+
raise errors.ImageRequestValidationError(response_data, http_res)
|
|
809
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
|
810
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
811
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
812
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
|
813
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
814
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
815
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
816
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
817
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
818
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
819
|
+
http_res_text = utils.stream_to_text(http_res)
|
|
820
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
821
|
+
|
|
822
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
823
|
+
|
|
824
|
+
async def update_async(
|
|
825
|
+
self,
|
|
826
|
+
*,
|
|
827
|
+
account_id: str,
|
|
828
|
+
image_id: str,
|
|
829
|
+
image: Optional[
|
|
830
|
+
Union[
|
|
831
|
+
components.ImageUpdateRequestMultiPartImage,
|
|
832
|
+
components.ImageUpdateRequestMultiPartImageTypedDict,
|
|
833
|
+
]
|
|
834
|
+
] = None,
|
|
835
|
+
metadata: OptionalNullable[
|
|
836
|
+
Union[components.Metadata, components.MetadataTypedDict]
|
|
837
|
+
] = UNSET,
|
|
838
|
+
retries: OptionalNullable[utils.RetryConfig] = UNSET,
|
|
839
|
+
server_url: Optional[str] = None,
|
|
840
|
+
timeout_ms: Optional[int] = None,
|
|
841
|
+
http_headers: Optional[Mapping[str, str]] = None,
|
|
842
|
+
) -> operations.UpdateImageResponse:
|
|
843
|
+
r"""Update an existing image and/or its metadata.
|
|
844
|
+
|
|
845
|
+
Duplicate images, and requests larger than 16MB will be rejected. Omit any
|
|
846
|
+
form parts you do not wish to update. Existing metadata can be cleared by
|
|
847
|
+
sending `null` for the `metadata` form part.
|
|
848
|
+
|
|
849
|
+
:param account_id:
|
|
850
|
+
:param image_id:
|
|
851
|
+
:param image:
|
|
852
|
+
:param metadata: JSON-encoded metadata to update for the image. Omit this field if not updating metadata, or send `null` to clear existing metadata.
|
|
853
|
+
:param retries: Override the default retry configuration for this method
|
|
854
|
+
:param server_url: Override the default server URL for this method
|
|
855
|
+
:param timeout_ms: Override the default request timeout configuration for this method in milliseconds
|
|
856
|
+
:param http_headers: Additional headers to set or replace on requests.
|
|
857
|
+
"""
|
|
858
|
+
base_url = None
|
|
859
|
+
url_variables = None
|
|
860
|
+
if timeout_ms is None:
|
|
861
|
+
timeout_ms = self.sdk_configuration.timeout_ms
|
|
862
|
+
|
|
863
|
+
if server_url is not None:
|
|
864
|
+
base_url = server_url
|
|
865
|
+
else:
|
|
866
|
+
base_url = self._get_url(base_url, url_variables)
|
|
867
|
+
|
|
868
|
+
request = operations.UpdateImageRequest(
|
|
869
|
+
account_id=account_id,
|
|
870
|
+
image_id=image_id,
|
|
871
|
+
image_update_request_multi_part=components.ImageUpdateRequestMultiPart(
|
|
872
|
+
image=utils.get_pydantic_model(
|
|
873
|
+
image, Optional[components.ImageUpdateRequestMultiPartImage]
|
|
874
|
+
),
|
|
875
|
+
metadata=utils.get_pydantic_model(
|
|
876
|
+
metadata, OptionalNullable[components.Metadata]
|
|
877
|
+
),
|
|
878
|
+
),
|
|
879
|
+
)
|
|
880
|
+
|
|
881
|
+
req = self._build_request_async(
|
|
882
|
+
method="PATCH",
|
|
883
|
+
path="/accounts/{accountID}/images/{imageID}",
|
|
884
|
+
base_url=base_url,
|
|
885
|
+
url_variables=url_variables,
|
|
886
|
+
request=request,
|
|
887
|
+
request_body_required=True,
|
|
888
|
+
request_has_path_params=True,
|
|
889
|
+
request_has_query_params=True,
|
|
890
|
+
user_agent_header="user-agent",
|
|
891
|
+
accept_header_value="application/json",
|
|
892
|
+
http_headers=http_headers,
|
|
893
|
+
_globals=operations.UpdateImageGlobals(
|
|
894
|
+
x_moov_version=self.sdk_configuration.globals.x_moov_version,
|
|
895
|
+
),
|
|
896
|
+
security=self.sdk_configuration.security,
|
|
897
|
+
get_serialized_body=lambda: utils.serialize_request_body(
|
|
898
|
+
request.image_update_request_multi_part,
|
|
899
|
+
False,
|
|
900
|
+
False,
|
|
901
|
+
"multipart",
|
|
902
|
+
components.ImageUpdateRequestMultiPart,
|
|
903
|
+
),
|
|
904
|
+
timeout_ms=timeout_ms,
|
|
905
|
+
)
|
|
906
|
+
|
|
907
|
+
if retries == UNSET:
|
|
908
|
+
if self.sdk_configuration.retry_config is not UNSET:
|
|
909
|
+
retries = self.sdk_configuration.retry_config
|
|
910
|
+
|
|
911
|
+
retry_config = None
|
|
912
|
+
if isinstance(retries, utils.RetryConfig):
|
|
913
|
+
retry_config = (retries, ["429", "500", "502", "503", "504"])
|
|
914
|
+
|
|
915
|
+
http_res = await self.do_request_async(
|
|
916
|
+
hook_ctx=HookContext(
|
|
917
|
+
config=self.sdk_configuration,
|
|
918
|
+
base_url=base_url or "",
|
|
919
|
+
operation_id="updateImage",
|
|
920
|
+
oauth2_scopes=None,
|
|
921
|
+
security_source=get_security_from_env(
|
|
922
|
+
self.sdk_configuration.security, components.Security
|
|
923
|
+
),
|
|
924
|
+
),
|
|
925
|
+
request=req,
|
|
926
|
+
error_status_codes=[
|
|
927
|
+
"400",
|
|
928
|
+
"401",
|
|
929
|
+
"403",
|
|
930
|
+
"404",
|
|
931
|
+
"409",
|
|
932
|
+
"422",
|
|
933
|
+
"429",
|
|
934
|
+
"4XX",
|
|
935
|
+
"500",
|
|
936
|
+
"504",
|
|
937
|
+
"5XX",
|
|
938
|
+
],
|
|
939
|
+
retry_config=retry_config,
|
|
940
|
+
)
|
|
941
|
+
|
|
942
|
+
response_data: Any = None
|
|
943
|
+
if utils.match_response(http_res, "200", "application/json"):
|
|
944
|
+
return operations.UpdateImageResponse(
|
|
945
|
+
result=unmarshal_json_response(components.ImageMetadata, http_res),
|
|
946
|
+
headers=utils.get_response_headers(http_res.headers),
|
|
947
|
+
)
|
|
948
|
+
if utils.match_response(http_res, ["400", "409"], "application/json"):
|
|
949
|
+
response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
|
|
950
|
+
raise errors.GenericError(response_data, http_res)
|
|
951
|
+
if utils.match_response(http_res, "422", "application/json"):
|
|
952
|
+
response_data = unmarshal_json_response(
|
|
953
|
+
errors.ImageRequestValidationErrorData, http_res
|
|
954
|
+
)
|
|
955
|
+
raise errors.ImageRequestValidationError(response_data, http_res)
|
|
956
|
+
if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
|
|
957
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
958
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
959
|
+
if utils.match_response(http_res, ["500", "504"], "*"):
|
|
960
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
961
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
962
|
+
if utils.match_response(http_res, "4XX", "*"):
|
|
963
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
964
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
965
|
+
if utils.match_response(http_res, "5XX", "*"):
|
|
966
|
+
http_res_text = await utils.stream_to_text_async(http_res)
|
|
967
|
+
raise errors.APIError("API error occurred", http_res, http_res_text)
|
|
968
|
+
|
|
969
|
+
raise errors.APIError("Unexpected response received", http_res)
|
|
970
|
+
|
|
403
971
|
def delete(
|
|
404
972
|
self,
|
|
405
973
|
*,
|
|
@@ -527,6 +527,28 @@ if TYPE_CHECKING:
|
|
|
527
527
|
from .granttype import GrantType
|
|
528
528
|
from .guestprofile import GuestProfile, GuestProfileTypedDict
|
|
529
529
|
from .imagemetadata import ImageMetadata, ImageMetadataTypedDict
|
|
530
|
+
from .imagemetadatarequest import (
|
|
531
|
+
ImageMetadataRequest,
|
|
532
|
+
ImageMetadataRequestTypedDict,
|
|
533
|
+
)
|
|
534
|
+
from .imagemetadatavalidationerror import (
|
|
535
|
+
ImageMetadataValidationError,
|
|
536
|
+
ImageMetadataValidationErrorTypedDict,
|
|
537
|
+
)
|
|
538
|
+
from .imageupdaterequestmultipart import (
|
|
539
|
+
ImageUpdateRequestMultiPart,
|
|
540
|
+
ImageUpdateRequestMultiPartImage,
|
|
541
|
+
ImageUpdateRequestMultiPartImageTypedDict,
|
|
542
|
+
ImageUpdateRequestMultiPartTypedDict,
|
|
543
|
+
Metadata,
|
|
544
|
+
MetadataTypedDict,
|
|
545
|
+
)
|
|
546
|
+
from .imageuploadrequestmultipart import (
|
|
547
|
+
Image,
|
|
548
|
+
ImageTypedDict,
|
|
549
|
+
ImageUploadRequestMultiPart,
|
|
550
|
+
ImageUploadRequestMultiPartTypedDict,
|
|
551
|
+
)
|
|
530
552
|
from .incurredfee import IncurredFee, IncurredFeeTypedDict
|
|
531
553
|
from .individualname import IndividualName, IndividualNameTypedDict
|
|
532
554
|
from .individualnameerror import IndividualNameError, IndividualNameErrorTypedDict
|
|
@@ -1605,8 +1627,20 @@ __all__ = [
|
|
|
1605
1627
|
"GrantType",
|
|
1606
1628
|
"GuestProfile",
|
|
1607
1629
|
"GuestProfileTypedDict",
|
|
1630
|
+
"Image",
|
|
1608
1631
|
"ImageMetadata",
|
|
1632
|
+
"ImageMetadataRequest",
|
|
1633
|
+
"ImageMetadataRequestTypedDict",
|
|
1609
1634
|
"ImageMetadataTypedDict",
|
|
1635
|
+
"ImageMetadataValidationError",
|
|
1636
|
+
"ImageMetadataValidationErrorTypedDict",
|
|
1637
|
+
"ImageTypedDict",
|
|
1638
|
+
"ImageUpdateRequestMultiPart",
|
|
1639
|
+
"ImageUpdateRequestMultiPartImage",
|
|
1640
|
+
"ImageUpdateRequestMultiPartImageTypedDict",
|
|
1641
|
+
"ImageUpdateRequestMultiPartTypedDict",
|
|
1642
|
+
"ImageUploadRequestMultiPart",
|
|
1643
|
+
"ImageUploadRequestMultiPartTypedDict",
|
|
1610
1644
|
"IncurredFee",
|
|
1611
1645
|
"IncurredFeeTypedDict",
|
|
1612
1646
|
"IndividualName",
|
|
@@ -1685,6 +1719,8 @@ __all__ = [
|
|
|
1685
1719
|
"ManualTermsOfServiceUpdate",
|
|
1686
1720
|
"ManualTermsOfServiceUpdateTypedDict",
|
|
1687
1721
|
"ManualTypedDict",
|
|
1722
|
+
"Metadata",
|
|
1723
|
+
"MetadataTypedDict",
|
|
1688
1724
|
"MicroDepositStatus",
|
|
1689
1725
|
"MinimumCommitment",
|
|
1690
1726
|
"MinimumCommitmentTypedDict",
|
|
@@ -2584,6 +2620,20 @@ _dynamic_imports: dict[str, str] = {
|
|
|
2584
2620
|
"GuestProfileTypedDict": ".guestprofile",
|
|
2585
2621
|
"ImageMetadata": ".imagemetadata",
|
|
2586
2622
|
"ImageMetadataTypedDict": ".imagemetadata",
|
|
2623
|
+
"ImageMetadataRequest": ".imagemetadatarequest",
|
|
2624
|
+
"ImageMetadataRequestTypedDict": ".imagemetadatarequest",
|
|
2625
|
+
"ImageMetadataValidationError": ".imagemetadatavalidationerror",
|
|
2626
|
+
"ImageMetadataValidationErrorTypedDict": ".imagemetadatavalidationerror",
|
|
2627
|
+
"ImageUpdateRequestMultiPart": ".imageupdaterequestmultipart",
|
|
2628
|
+
"ImageUpdateRequestMultiPartImage": ".imageupdaterequestmultipart",
|
|
2629
|
+
"ImageUpdateRequestMultiPartImageTypedDict": ".imageupdaterequestmultipart",
|
|
2630
|
+
"ImageUpdateRequestMultiPartTypedDict": ".imageupdaterequestmultipart",
|
|
2631
|
+
"Metadata": ".imageupdaterequestmultipart",
|
|
2632
|
+
"MetadataTypedDict": ".imageupdaterequestmultipart",
|
|
2633
|
+
"Image": ".imageuploadrequestmultipart",
|
|
2634
|
+
"ImageTypedDict": ".imageuploadrequestmultipart",
|
|
2635
|
+
"ImageUploadRequestMultiPart": ".imageuploadrequestmultipart",
|
|
2636
|
+
"ImageUploadRequestMultiPartTypedDict": ".imageuploadrequestmultipart",
|
|
2587
2637
|
"IncurredFee": ".incurredfee",
|
|
2588
2638
|
"IncurredFeeTypedDict": ".incurredfee",
|
|
2589
2639
|
"IndividualName": ".individualname",
|