moovio_sdk 0.17.1__py3-none-any.whl → 0.17.3__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.

Files changed (31) hide show
  1. moovio_sdk/_version.py +2 -2
  2. moovio_sdk/models/components/__init__.py +83 -0
  3. moovio_sdk/models/components/amountdecimalvalidationerror.py +18 -0
  4. moovio_sdk/models/components/assignproductimage.py +16 -0
  5. moovio_sdk/models/components/assignproductimagevalidationerror.py +15 -0
  6. moovio_sdk/models/components/createproductoption.py +45 -0
  7. moovio_sdk/models/components/createproductoptiongroup.py +52 -0
  8. moovio_sdk/models/components/feeproperties.py +7 -1
  9. moovio_sdk/models/components/partnerpricing.py +12 -6
  10. moovio_sdk/models/components/partnerpricingagreement.py +10 -4
  11. moovio_sdk/models/components/product.py +77 -0
  12. moovio_sdk/models/components/productimagemetadata.py +27 -0
  13. moovio_sdk/models/components/productoption.py +49 -0
  14. moovio_sdk/models/components/productoptiongroup.py +56 -0
  15. moovio_sdk/models/components/productoptiongroupvalidationerror.py +31 -0
  16. moovio_sdk/models/components/productoptionvalidationerror.py +30 -0
  17. moovio_sdk/models/components/productrequest.py +57 -0
  18. moovio_sdk/models/components/volumerange.py +37 -0
  19. moovio_sdk/models/errors/__init__.py +8 -0
  20. moovio_sdk/models/errors/productrequestvalidationerror.py +58 -0
  21. moovio_sdk/models/operations/__init__.py +100 -0
  22. moovio_sdk/models/operations/createproduct.py +78 -0
  23. moovio_sdk/models/operations/disableproduct.py +67 -0
  24. moovio_sdk/models/operations/getproduct.py +71 -0
  25. moovio_sdk/models/operations/listproducts.py +81 -0
  26. moovio_sdk/models/operations/updateproduct.py +85 -0
  27. moovio_sdk/products.py +1232 -0
  28. moovio_sdk/sdk.py +3 -0
  29. {moovio_sdk-0.17.1.dist-info → moovio_sdk-0.17.3.dist-info}/METADATA +56 -45
  30. {moovio_sdk-0.17.1.dist-info → moovio_sdk-0.17.3.dist-info}/RECORD +31 -11
  31. {moovio_sdk-0.17.1.dist-info → moovio_sdk-0.17.3.dist-info}/WHEEL +0 -0
moovio_sdk/products.py ADDED
@@ -0,0 +1,1232 @@
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 moovio_sdk.utils.unmarshal_json_response import unmarshal_json_response
10
+ from typing import Any, List, Mapping, Optional, Union
11
+
12
+
13
+ class Products(BaseSDK):
14
+ def list(
15
+ self,
16
+ *,
17
+ account_id: str,
18
+ skip: Optional[int] = None,
19
+ count: Optional[int] = None,
20
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
21
+ server_url: Optional[str] = None,
22
+ timeout_ms: Optional[int] = None,
23
+ http_headers: Optional[Mapping[str, str]] = None,
24
+ ) -> operations.ListProductsResponse:
25
+ r"""List active (non-disabled) products for an account.
26
+
27
+ :param account_id:
28
+ :param skip:
29
+ :param count:
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.ListProductsRequest(
46
+ account_id=account_id,
47
+ skip=skip,
48
+ count=count,
49
+ )
50
+
51
+ req = self._build_request(
52
+ method="GET",
53
+ path="/accounts/{accountID}/products",
54
+ base_url=base_url,
55
+ url_variables=url_variables,
56
+ request=request,
57
+ request_body_required=False,
58
+ request_has_path_params=True,
59
+ request_has_query_params=True,
60
+ user_agent_header="user-agent",
61
+ accept_header_value="application/json",
62
+ http_headers=http_headers,
63
+ _globals=operations.ListProductsGlobals(
64
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
65
+ ),
66
+ security=self.sdk_configuration.security,
67
+ timeout_ms=timeout_ms,
68
+ )
69
+
70
+ if retries == UNSET:
71
+ if self.sdk_configuration.retry_config is not UNSET:
72
+ retries = self.sdk_configuration.retry_config
73
+
74
+ retry_config = None
75
+ if isinstance(retries, utils.RetryConfig):
76
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
77
+
78
+ http_res = self.do_request(
79
+ hook_ctx=HookContext(
80
+ config=self.sdk_configuration,
81
+ base_url=base_url or "",
82
+ operation_id="listProducts",
83
+ oauth2_scopes=None,
84
+ security_source=get_security_from_env(
85
+ self.sdk_configuration.security, components.Security
86
+ ),
87
+ ),
88
+ request=req,
89
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
90
+ retry_config=retry_config,
91
+ )
92
+
93
+ if utils.match_response(http_res, "200", "application/json"):
94
+ return operations.ListProductsResponse(
95
+ result=unmarshal_json_response(List[components.Product], http_res),
96
+ headers=utils.get_response_headers(http_res.headers),
97
+ )
98
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
99
+ http_res_text = utils.stream_to_text(http_res)
100
+ raise errors.APIError("API error occurred", http_res, http_res_text)
101
+ if utils.match_response(http_res, ["500", "504"], "*"):
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, "4XX", "*"):
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, "5XX", "*"):
108
+ http_res_text = utils.stream_to_text(http_res)
109
+ raise errors.APIError("API error occurred", http_res, http_res_text)
110
+
111
+ raise errors.APIError("Unexpected response received", http_res)
112
+
113
+ async def list_async(
114
+ self,
115
+ *,
116
+ account_id: str,
117
+ skip: Optional[int] = None,
118
+ count: Optional[int] = None,
119
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
120
+ server_url: Optional[str] = None,
121
+ timeout_ms: Optional[int] = None,
122
+ http_headers: Optional[Mapping[str, str]] = None,
123
+ ) -> operations.ListProductsResponse:
124
+ r"""List active (non-disabled) products for an account.
125
+
126
+ :param account_id:
127
+ :param skip:
128
+ :param count:
129
+ :param retries: Override the default retry configuration for this method
130
+ :param server_url: Override the default server URL for this method
131
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
132
+ :param http_headers: Additional headers to set or replace on requests.
133
+ """
134
+ base_url = None
135
+ url_variables = None
136
+ if timeout_ms is None:
137
+ timeout_ms = self.sdk_configuration.timeout_ms
138
+
139
+ if server_url is not None:
140
+ base_url = server_url
141
+ else:
142
+ base_url = self._get_url(base_url, url_variables)
143
+
144
+ request = operations.ListProductsRequest(
145
+ account_id=account_id,
146
+ skip=skip,
147
+ count=count,
148
+ )
149
+
150
+ req = self._build_request_async(
151
+ method="GET",
152
+ path="/accounts/{accountID}/products",
153
+ base_url=base_url,
154
+ url_variables=url_variables,
155
+ request=request,
156
+ request_body_required=False,
157
+ request_has_path_params=True,
158
+ request_has_query_params=True,
159
+ user_agent_header="user-agent",
160
+ accept_header_value="application/json",
161
+ http_headers=http_headers,
162
+ _globals=operations.ListProductsGlobals(
163
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
164
+ ),
165
+ security=self.sdk_configuration.security,
166
+ timeout_ms=timeout_ms,
167
+ )
168
+
169
+ if retries == UNSET:
170
+ if self.sdk_configuration.retry_config is not UNSET:
171
+ retries = self.sdk_configuration.retry_config
172
+
173
+ retry_config = None
174
+ if isinstance(retries, utils.RetryConfig):
175
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
176
+
177
+ http_res = await self.do_request_async(
178
+ hook_ctx=HookContext(
179
+ config=self.sdk_configuration,
180
+ base_url=base_url or "",
181
+ operation_id="listProducts",
182
+ oauth2_scopes=None,
183
+ security_source=get_security_from_env(
184
+ self.sdk_configuration.security, components.Security
185
+ ),
186
+ ),
187
+ request=req,
188
+ error_status_codes=["401", "403", "429", "4XX", "500", "504", "5XX"],
189
+ retry_config=retry_config,
190
+ )
191
+
192
+ if utils.match_response(http_res, "200", "application/json"):
193
+ return operations.ListProductsResponse(
194
+ result=unmarshal_json_response(List[components.Product], http_res),
195
+ headers=utils.get_response_headers(http_res.headers),
196
+ )
197
+ if utils.match_response(http_res, ["401", "403", "429"], "*"):
198
+ http_res_text = await utils.stream_to_text_async(http_res)
199
+ raise errors.APIError("API error occurred", http_res, http_res_text)
200
+ if utils.match_response(http_res, ["500", "504"], "*"):
201
+ http_res_text = await utils.stream_to_text_async(http_res)
202
+ raise errors.APIError("API error occurred", http_res, http_res_text)
203
+ if utils.match_response(http_res, "4XX", "*"):
204
+ http_res_text = await utils.stream_to_text_async(http_res)
205
+ raise errors.APIError("API error occurred", http_res, http_res_text)
206
+ if utils.match_response(http_res, "5XX", "*"):
207
+ http_res_text = await utils.stream_to_text_async(http_res)
208
+ raise errors.APIError("API error occurred", http_res, http_res_text)
209
+
210
+ raise errors.APIError("Unexpected response received", http_res)
211
+
212
+ def create(
213
+ self,
214
+ *,
215
+ account_id: str,
216
+ title: str,
217
+ base_price: Union[components.AmountDecimal, components.AmountDecimalTypedDict],
218
+ description: Optional[str] = None,
219
+ images: Optional[
220
+ Union[
221
+ List[components.AssignProductImage],
222
+ List[components.AssignProductImageTypedDict],
223
+ ]
224
+ ] = None,
225
+ option_groups: Optional[
226
+ Union[
227
+ List[components.CreateProductOptionGroup],
228
+ List[components.CreateProductOptionGroupTypedDict],
229
+ ]
230
+ ] = None,
231
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
232
+ server_url: Optional[str] = None,
233
+ timeout_ms: Optional[int] = None,
234
+ http_headers: Optional[Mapping[str, str]] = None,
235
+ ) -> operations.CreateProductResponse:
236
+ r"""Creates a new product for the specified account.
237
+
238
+ :param account_id:
239
+ :param title:
240
+ :param base_price: A product's starting price, before applying modifiers.
241
+ :param description: A detailed description of the product. - Must be valid UTF-8 text - Supports Markdown for formatting - HTML is not permitted and will be rejected
242
+ :param images: Assign previously uploaded images to a product or option.
243
+ :param option_groups: Optional configuration options for a product, such as size or color.
244
+ :param retries: Override the default retry configuration for this method
245
+ :param server_url: Override the default server URL for this method
246
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
247
+ :param http_headers: Additional headers to set or replace on requests.
248
+ """
249
+ base_url = None
250
+ url_variables = None
251
+ if timeout_ms is None:
252
+ timeout_ms = self.sdk_configuration.timeout_ms
253
+
254
+ if server_url is not None:
255
+ base_url = server_url
256
+ else:
257
+ base_url = self._get_url(base_url, url_variables)
258
+
259
+ request = operations.CreateProductRequest(
260
+ account_id=account_id,
261
+ product_request=components.ProductRequest(
262
+ title=title,
263
+ description=description,
264
+ base_price=utils.get_pydantic_model(
265
+ base_price, components.AmountDecimal
266
+ ),
267
+ images=utils.get_pydantic_model(
268
+ images, Optional[List[components.AssignProductImage]]
269
+ ),
270
+ option_groups=utils.get_pydantic_model(
271
+ option_groups, Optional[List[components.CreateProductOptionGroup]]
272
+ ),
273
+ ),
274
+ )
275
+
276
+ req = self._build_request(
277
+ method="POST",
278
+ path="/accounts/{accountID}/products",
279
+ base_url=base_url,
280
+ url_variables=url_variables,
281
+ request=request,
282
+ request_body_required=True,
283
+ request_has_path_params=True,
284
+ request_has_query_params=True,
285
+ user_agent_header="user-agent",
286
+ accept_header_value="application/json",
287
+ http_headers=http_headers,
288
+ _globals=operations.CreateProductGlobals(
289
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
290
+ ),
291
+ security=self.sdk_configuration.security,
292
+ get_serialized_body=lambda: utils.serialize_request_body(
293
+ request.product_request, False, False, "json", components.ProductRequest
294
+ ),
295
+ timeout_ms=timeout_ms,
296
+ )
297
+
298
+ if retries == UNSET:
299
+ if self.sdk_configuration.retry_config is not UNSET:
300
+ retries = self.sdk_configuration.retry_config
301
+
302
+ retry_config = None
303
+ if isinstance(retries, utils.RetryConfig):
304
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
305
+
306
+ http_res = self.do_request(
307
+ hook_ctx=HookContext(
308
+ config=self.sdk_configuration,
309
+ base_url=base_url or "",
310
+ operation_id="createProduct",
311
+ oauth2_scopes=None,
312
+ security_source=get_security_from_env(
313
+ self.sdk_configuration.security, components.Security
314
+ ),
315
+ ),
316
+ request=req,
317
+ error_status_codes=[
318
+ "400",
319
+ "401",
320
+ "403",
321
+ "404",
322
+ "409",
323
+ "422",
324
+ "429",
325
+ "4XX",
326
+ "500",
327
+ "504",
328
+ "5XX",
329
+ ],
330
+ retry_config=retry_config,
331
+ )
332
+
333
+ response_data: Any = None
334
+ if utils.match_response(http_res, "201", "application/json"):
335
+ return operations.CreateProductResponse(
336
+ result=unmarshal_json_response(components.Product, http_res),
337
+ headers=utils.get_response_headers(http_res.headers),
338
+ )
339
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
340
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
341
+ raise errors.GenericError(response_data, http_res)
342
+ if utils.match_response(http_res, "422", "application/json"):
343
+ response_data = unmarshal_json_response(
344
+ errors.ProductRequestValidationErrorData, http_res
345
+ )
346
+ raise errors.ProductRequestValidationError(response_data, http_res)
347
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
348
+ http_res_text = utils.stream_to_text(http_res)
349
+ raise errors.APIError("API error occurred", http_res, http_res_text)
350
+ if utils.match_response(http_res, ["500", "504"], "*"):
351
+ http_res_text = utils.stream_to_text(http_res)
352
+ raise errors.APIError("API error occurred", http_res, http_res_text)
353
+ if utils.match_response(http_res, "4XX", "*"):
354
+ http_res_text = utils.stream_to_text(http_res)
355
+ raise errors.APIError("API error occurred", http_res, http_res_text)
356
+ if utils.match_response(http_res, "5XX", "*"):
357
+ http_res_text = utils.stream_to_text(http_res)
358
+ raise errors.APIError("API error occurred", http_res, http_res_text)
359
+
360
+ raise errors.APIError("Unexpected response received", http_res)
361
+
362
+ async def create_async(
363
+ self,
364
+ *,
365
+ account_id: str,
366
+ title: str,
367
+ base_price: Union[components.AmountDecimal, components.AmountDecimalTypedDict],
368
+ description: Optional[str] = None,
369
+ images: Optional[
370
+ Union[
371
+ List[components.AssignProductImage],
372
+ List[components.AssignProductImageTypedDict],
373
+ ]
374
+ ] = None,
375
+ option_groups: Optional[
376
+ Union[
377
+ List[components.CreateProductOptionGroup],
378
+ List[components.CreateProductOptionGroupTypedDict],
379
+ ]
380
+ ] = None,
381
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
382
+ server_url: Optional[str] = None,
383
+ timeout_ms: Optional[int] = None,
384
+ http_headers: Optional[Mapping[str, str]] = None,
385
+ ) -> operations.CreateProductResponse:
386
+ r"""Creates a new product for the specified account.
387
+
388
+ :param account_id:
389
+ :param title:
390
+ :param base_price: A product's starting price, before applying modifiers.
391
+ :param description: A detailed description of the product. - Must be valid UTF-8 text - Supports Markdown for formatting - HTML is not permitted and will be rejected
392
+ :param images: Assign previously uploaded images to a product or option.
393
+ :param option_groups: Optional configuration options for a product, such as size or color.
394
+ :param retries: Override the default retry configuration for this method
395
+ :param server_url: Override the default server URL for this method
396
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
397
+ :param http_headers: Additional headers to set or replace on requests.
398
+ """
399
+ base_url = None
400
+ url_variables = None
401
+ if timeout_ms is None:
402
+ timeout_ms = self.sdk_configuration.timeout_ms
403
+
404
+ if server_url is not None:
405
+ base_url = server_url
406
+ else:
407
+ base_url = self._get_url(base_url, url_variables)
408
+
409
+ request = operations.CreateProductRequest(
410
+ account_id=account_id,
411
+ product_request=components.ProductRequest(
412
+ title=title,
413
+ description=description,
414
+ base_price=utils.get_pydantic_model(
415
+ base_price, components.AmountDecimal
416
+ ),
417
+ images=utils.get_pydantic_model(
418
+ images, Optional[List[components.AssignProductImage]]
419
+ ),
420
+ option_groups=utils.get_pydantic_model(
421
+ option_groups, Optional[List[components.CreateProductOptionGroup]]
422
+ ),
423
+ ),
424
+ )
425
+
426
+ req = self._build_request_async(
427
+ method="POST",
428
+ path="/accounts/{accountID}/products",
429
+ base_url=base_url,
430
+ url_variables=url_variables,
431
+ request=request,
432
+ request_body_required=True,
433
+ request_has_path_params=True,
434
+ request_has_query_params=True,
435
+ user_agent_header="user-agent",
436
+ accept_header_value="application/json",
437
+ http_headers=http_headers,
438
+ _globals=operations.CreateProductGlobals(
439
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
440
+ ),
441
+ security=self.sdk_configuration.security,
442
+ get_serialized_body=lambda: utils.serialize_request_body(
443
+ request.product_request, False, False, "json", components.ProductRequest
444
+ ),
445
+ timeout_ms=timeout_ms,
446
+ )
447
+
448
+ if retries == UNSET:
449
+ if self.sdk_configuration.retry_config is not UNSET:
450
+ retries = self.sdk_configuration.retry_config
451
+
452
+ retry_config = None
453
+ if isinstance(retries, utils.RetryConfig):
454
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
455
+
456
+ http_res = await self.do_request_async(
457
+ hook_ctx=HookContext(
458
+ config=self.sdk_configuration,
459
+ base_url=base_url or "",
460
+ operation_id="createProduct",
461
+ oauth2_scopes=None,
462
+ security_source=get_security_from_env(
463
+ self.sdk_configuration.security, components.Security
464
+ ),
465
+ ),
466
+ request=req,
467
+ error_status_codes=[
468
+ "400",
469
+ "401",
470
+ "403",
471
+ "404",
472
+ "409",
473
+ "422",
474
+ "429",
475
+ "4XX",
476
+ "500",
477
+ "504",
478
+ "5XX",
479
+ ],
480
+ retry_config=retry_config,
481
+ )
482
+
483
+ response_data: Any = None
484
+ if utils.match_response(http_res, "201", "application/json"):
485
+ return operations.CreateProductResponse(
486
+ result=unmarshal_json_response(components.Product, http_res),
487
+ headers=utils.get_response_headers(http_res.headers),
488
+ )
489
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
490
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
491
+ raise errors.GenericError(response_data, http_res)
492
+ if utils.match_response(http_res, "422", "application/json"):
493
+ response_data = unmarshal_json_response(
494
+ errors.ProductRequestValidationErrorData, http_res
495
+ )
496
+ raise errors.ProductRequestValidationError(response_data, http_res)
497
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
498
+ http_res_text = await utils.stream_to_text_async(http_res)
499
+ raise errors.APIError("API error occurred", http_res, http_res_text)
500
+ if utils.match_response(http_res, ["500", "504"], "*"):
501
+ http_res_text = await utils.stream_to_text_async(http_res)
502
+ raise errors.APIError("API error occurred", http_res, http_res_text)
503
+ if utils.match_response(http_res, "4XX", "*"):
504
+ http_res_text = await utils.stream_to_text_async(http_res)
505
+ raise errors.APIError("API error occurred", http_res, http_res_text)
506
+ if utils.match_response(http_res, "5XX", "*"):
507
+ http_res_text = await utils.stream_to_text_async(http_res)
508
+ raise errors.APIError("API error occurred", http_res, http_res_text)
509
+
510
+ raise errors.APIError("Unexpected response received", http_res)
511
+
512
+ def get(
513
+ self,
514
+ *,
515
+ account_id: str,
516
+ product_id: str,
517
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
518
+ server_url: Optional[str] = None,
519
+ timeout_ms: Optional[int] = None,
520
+ http_headers: Optional[Mapping[str, str]] = None,
521
+ ) -> operations.GetProductResponse:
522
+ r"""Retrieve a product by ID.
523
+
524
+ :param account_id:
525
+ :param product_id:
526
+ :param retries: Override the default retry configuration for this method
527
+ :param server_url: Override the default server URL for this method
528
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
529
+ :param http_headers: Additional headers to set or replace on requests.
530
+ """
531
+ base_url = None
532
+ url_variables = None
533
+ if timeout_ms is None:
534
+ timeout_ms = self.sdk_configuration.timeout_ms
535
+
536
+ if server_url is not None:
537
+ base_url = server_url
538
+ else:
539
+ base_url = self._get_url(base_url, url_variables)
540
+
541
+ request = operations.GetProductRequest(
542
+ account_id=account_id,
543
+ product_id=product_id,
544
+ )
545
+
546
+ req = self._build_request(
547
+ method="GET",
548
+ path="/accounts/{accountID}/products/{productID}",
549
+ base_url=base_url,
550
+ url_variables=url_variables,
551
+ request=request,
552
+ request_body_required=False,
553
+ request_has_path_params=True,
554
+ request_has_query_params=True,
555
+ user_agent_header="user-agent",
556
+ accept_header_value="application/json",
557
+ http_headers=http_headers,
558
+ _globals=operations.GetProductGlobals(
559
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
560
+ ),
561
+ security=self.sdk_configuration.security,
562
+ timeout_ms=timeout_ms,
563
+ )
564
+
565
+ if retries == UNSET:
566
+ if self.sdk_configuration.retry_config is not UNSET:
567
+ retries = self.sdk_configuration.retry_config
568
+
569
+ retry_config = None
570
+ if isinstance(retries, utils.RetryConfig):
571
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
572
+
573
+ http_res = self.do_request(
574
+ hook_ctx=HookContext(
575
+ config=self.sdk_configuration,
576
+ base_url=base_url or "",
577
+ operation_id="getProduct",
578
+ oauth2_scopes=None,
579
+ security_source=get_security_from_env(
580
+ self.sdk_configuration.security, components.Security
581
+ ),
582
+ ),
583
+ request=req,
584
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
585
+ retry_config=retry_config,
586
+ )
587
+
588
+ if utils.match_response(http_res, "200", "application/json"):
589
+ return operations.GetProductResponse(
590
+ result=unmarshal_json_response(components.Product, http_res),
591
+ headers=utils.get_response_headers(http_res.headers),
592
+ )
593
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
594
+ http_res_text = utils.stream_to_text(http_res)
595
+ raise errors.APIError("API error occurred", http_res, http_res_text)
596
+ if utils.match_response(http_res, ["500", "504"], "*"):
597
+ http_res_text = utils.stream_to_text(http_res)
598
+ raise errors.APIError("API error occurred", http_res, http_res_text)
599
+ if utils.match_response(http_res, "4XX", "*"):
600
+ http_res_text = utils.stream_to_text(http_res)
601
+ raise errors.APIError("API error occurred", http_res, http_res_text)
602
+ if utils.match_response(http_res, "5XX", "*"):
603
+ http_res_text = utils.stream_to_text(http_res)
604
+ raise errors.APIError("API error occurred", http_res, http_res_text)
605
+
606
+ raise errors.APIError("Unexpected response received", http_res)
607
+
608
+ async def get_async(
609
+ self,
610
+ *,
611
+ account_id: str,
612
+ product_id: str,
613
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
614
+ server_url: Optional[str] = None,
615
+ timeout_ms: Optional[int] = None,
616
+ http_headers: Optional[Mapping[str, str]] = None,
617
+ ) -> operations.GetProductResponse:
618
+ r"""Retrieve a product by ID.
619
+
620
+ :param account_id:
621
+ :param product_id:
622
+ :param retries: Override the default retry configuration for this method
623
+ :param server_url: Override the default server URL for this method
624
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
625
+ :param http_headers: Additional headers to set or replace on requests.
626
+ """
627
+ base_url = None
628
+ url_variables = None
629
+ if timeout_ms is None:
630
+ timeout_ms = self.sdk_configuration.timeout_ms
631
+
632
+ if server_url is not None:
633
+ base_url = server_url
634
+ else:
635
+ base_url = self._get_url(base_url, url_variables)
636
+
637
+ request = operations.GetProductRequest(
638
+ account_id=account_id,
639
+ product_id=product_id,
640
+ )
641
+
642
+ req = self._build_request_async(
643
+ method="GET",
644
+ path="/accounts/{accountID}/products/{productID}",
645
+ base_url=base_url,
646
+ url_variables=url_variables,
647
+ request=request,
648
+ request_body_required=False,
649
+ request_has_path_params=True,
650
+ request_has_query_params=True,
651
+ user_agent_header="user-agent",
652
+ accept_header_value="application/json",
653
+ http_headers=http_headers,
654
+ _globals=operations.GetProductGlobals(
655
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
656
+ ),
657
+ security=self.sdk_configuration.security,
658
+ timeout_ms=timeout_ms,
659
+ )
660
+
661
+ if retries == UNSET:
662
+ if self.sdk_configuration.retry_config is not UNSET:
663
+ retries = self.sdk_configuration.retry_config
664
+
665
+ retry_config = None
666
+ if isinstance(retries, utils.RetryConfig):
667
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
668
+
669
+ http_res = await self.do_request_async(
670
+ hook_ctx=HookContext(
671
+ config=self.sdk_configuration,
672
+ base_url=base_url or "",
673
+ operation_id="getProduct",
674
+ oauth2_scopes=None,
675
+ security_source=get_security_from_env(
676
+ self.sdk_configuration.security, components.Security
677
+ ),
678
+ ),
679
+ request=req,
680
+ error_status_codes=["401", "403", "404", "429", "4XX", "500", "504", "5XX"],
681
+ retry_config=retry_config,
682
+ )
683
+
684
+ if utils.match_response(http_res, "200", "application/json"):
685
+ return operations.GetProductResponse(
686
+ result=unmarshal_json_response(components.Product, http_res),
687
+ headers=utils.get_response_headers(http_res.headers),
688
+ )
689
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
690
+ http_res_text = await utils.stream_to_text_async(http_res)
691
+ raise errors.APIError("API error occurred", http_res, http_res_text)
692
+ if utils.match_response(http_res, ["500", "504"], "*"):
693
+ http_res_text = await utils.stream_to_text_async(http_res)
694
+ raise errors.APIError("API error occurred", http_res, http_res_text)
695
+ if utils.match_response(http_res, "4XX", "*"):
696
+ http_res_text = await utils.stream_to_text_async(http_res)
697
+ raise errors.APIError("API error occurred", http_res, http_res_text)
698
+ if utils.match_response(http_res, "5XX", "*"):
699
+ http_res_text = await utils.stream_to_text_async(http_res)
700
+ raise errors.APIError("API error occurred", http_res, http_res_text)
701
+
702
+ raise errors.APIError("Unexpected response received", http_res)
703
+
704
+ def update(
705
+ self,
706
+ *,
707
+ account_id: str,
708
+ product_id: str,
709
+ title: str,
710
+ base_price: Union[components.AmountDecimal, components.AmountDecimalTypedDict],
711
+ description: Optional[str] = None,
712
+ images: Optional[
713
+ Union[
714
+ List[components.AssignProductImage],
715
+ List[components.AssignProductImageTypedDict],
716
+ ]
717
+ ] = None,
718
+ option_groups: Optional[
719
+ Union[
720
+ List[components.CreateProductOptionGroup],
721
+ List[components.CreateProductOptionGroupTypedDict],
722
+ ]
723
+ ] = None,
724
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
725
+ server_url: Optional[str] = None,
726
+ timeout_ms: Optional[int] = None,
727
+ http_headers: Optional[Mapping[str, str]] = None,
728
+ ) -> operations.UpdateProductResponse:
729
+ r"""Update a product and its options.
730
+
731
+ :param account_id:
732
+ :param product_id:
733
+ :param title:
734
+ :param base_price: A product's starting price, before applying modifiers.
735
+ :param description: A detailed description of the product. - Must be valid UTF-8 text - Supports Markdown for formatting - HTML is not permitted and will be rejected
736
+ :param images: Assign previously uploaded images to a product or option.
737
+ :param option_groups: Optional configuration options for a product, such as size or color.
738
+ :param retries: Override the default retry configuration for this method
739
+ :param server_url: Override the default server URL for this method
740
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
741
+ :param http_headers: Additional headers to set or replace on requests.
742
+ """
743
+ base_url = None
744
+ url_variables = None
745
+ if timeout_ms is None:
746
+ timeout_ms = self.sdk_configuration.timeout_ms
747
+
748
+ if server_url is not None:
749
+ base_url = server_url
750
+ else:
751
+ base_url = self._get_url(base_url, url_variables)
752
+
753
+ request = operations.UpdateProductRequest(
754
+ account_id=account_id,
755
+ product_id=product_id,
756
+ product_request=components.ProductRequest(
757
+ title=title,
758
+ description=description,
759
+ base_price=utils.get_pydantic_model(
760
+ base_price, components.AmountDecimal
761
+ ),
762
+ images=utils.get_pydantic_model(
763
+ images, Optional[List[components.AssignProductImage]]
764
+ ),
765
+ option_groups=utils.get_pydantic_model(
766
+ option_groups, Optional[List[components.CreateProductOptionGroup]]
767
+ ),
768
+ ),
769
+ )
770
+
771
+ req = self._build_request(
772
+ method="PUT",
773
+ path="/accounts/{accountID}/products/{productID}",
774
+ base_url=base_url,
775
+ url_variables=url_variables,
776
+ request=request,
777
+ request_body_required=True,
778
+ request_has_path_params=True,
779
+ request_has_query_params=True,
780
+ user_agent_header="user-agent",
781
+ accept_header_value="application/json",
782
+ http_headers=http_headers,
783
+ _globals=operations.UpdateProductGlobals(
784
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
785
+ ),
786
+ security=self.sdk_configuration.security,
787
+ get_serialized_body=lambda: utils.serialize_request_body(
788
+ request.product_request, False, False, "json", components.ProductRequest
789
+ ),
790
+ timeout_ms=timeout_ms,
791
+ )
792
+
793
+ if retries == UNSET:
794
+ if self.sdk_configuration.retry_config is not UNSET:
795
+ retries = self.sdk_configuration.retry_config
796
+
797
+ retry_config = None
798
+ if isinstance(retries, utils.RetryConfig):
799
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
800
+
801
+ http_res = self.do_request(
802
+ hook_ctx=HookContext(
803
+ config=self.sdk_configuration,
804
+ base_url=base_url or "",
805
+ operation_id="updateProduct",
806
+ oauth2_scopes=None,
807
+ security_source=get_security_from_env(
808
+ self.sdk_configuration.security, components.Security
809
+ ),
810
+ ),
811
+ request=req,
812
+ error_status_codes=[
813
+ "400",
814
+ "401",
815
+ "403",
816
+ "404",
817
+ "409",
818
+ "422",
819
+ "429",
820
+ "4XX",
821
+ "500",
822
+ "504",
823
+ "5XX",
824
+ ],
825
+ retry_config=retry_config,
826
+ )
827
+
828
+ response_data: Any = None
829
+ if utils.match_response(http_res, "200", "application/json"):
830
+ return operations.UpdateProductResponse(
831
+ result=unmarshal_json_response(components.Product, http_res),
832
+ headers=utils.get_response_headers(http_res.headers),
833
+ )
834
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
835
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
836
+ raise errors.GenericError(response_data, http_res)
837
+ if utils.match_response(http_res, "422", "application/json"):
838
+ response_data = unmarshal_json_response(
839
+ errors.ProductRequestValidationErrorData, http_res
840
+ )
841
+ raise errors.ProductRequestValidationError(response_data, http_res)
842
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
843
+ http_res_text = utils.stream_to_text(http_res)
844
+ raise errors.APIError("API error occurred", http_res, http_res_text)
845
+ if utils.match_response(http_res, ["500", "504"], "*"):
846
+ http_res_text = utils.stream_to_text(http_res)
847
+ raise errors.APIError("API error occurred", http_res, http_res_text)
848
+ if utils.match_response(http_res, "4XX", "*"):
849
+ http_res_text = utils.stream_to_text(http_res)
850
+ raise errors.APIError("API error occurred", http_res, http_res_text)
851
+ if utils.match_response(http_res, "5XX", "*"):
852
+ http_res_text = utils.stream_to_text(http_res)
853
+ raise errors.APIError("API error occurred", http_res, http_res_text)
854
+
855
+ raise errors.APIError("Unexpected response received", http_res)
856
+
857
+ async def update_async(
858
+ self,
859
+ *,
860
+ account_id: str,
861
+ product_id: str,
862
+ title: str,
863
+ base_price: Union[components.AmountDecimal, components.AmountDecimalTypedDict],
864
+ description: Optional[str] = None,
865
+ images: Optional[
866
+ Union[
867
+ List[components.AssignProductImage],
868
+ List[components.AssignProductImageTypedDict],
869
+ ]
870
+ ] = None,
871
+ option_groups: Optional[
872
+ Union[
873
+ List[components.CreateProductOptionGroup],
874
+ List[components.CreateProductOptionGroupTypedDict],
875
+ ]
876
+ ] = None,
877
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
878
+ server_url: Optional[str] = None,
879
+ timeout_ms: Optional[int] = None,
880
+ http_headers: Optional[Mapping[str, str]] = None,
881
+ ) -> operations.UpdateProductResponse:
882
+ r"""Update a product and its options.
883
+
884
+ :param account_id:
885
+ :param product_id:
886
+ :param title:
887
+ :param base_price: A product's starting price, before applying modifiers.
888
+ :param description: A detailed description of the product. - Must be valid UTF-8 text - Supports Markdown for formatting - HTML is not permitted and will be rejected
889
+ :param images: Assign previously uploaded images to a product or option.
890
+ :param option_groups: Optional configuration options for a product, such as size or color.
891
+ :param retries: Override the default retry configuration for this method
892
+ :param server_url: Override the default server URL for this method
893
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
894
+ :param http_headers: Additional headers to set or replace on requests.
895
+ """
896
+ base_url = None
897
+ url_variables = None
898
+ if timeout_ms is None:
899
+ timeout_ms = self.sdk_configuration.timeout_ms
900
+
901
+ if server_url is not None:
902
+ base_url = server_url
903
+ else:
904
+ base_url = self._get_url(base_url, url_variables)
905
+
906
+ request = operations.UpdateProductRequest(
907
+ account_id=account_id,
908
+ product_id=product_id,
909
+ product_request=components.ProductRequest(
910
+ title=title,
911
+ description=description,
912
+ base_price=utils.get_pydantic_model(
913
+ base_price, components.AmountDecimal
914
+ ),
915
+ images=utils.get_pydantic_model(
916
+ images, Optional[List[components.AssignProductImage]]
917
+ ),
918
+ option_groups=utils.get_pydantic_model(
919
+ option_groups, Optional[List[components.CreateProductOptionGroup]]
920
+ ),
921
+ ),
922
+ )
923
+
924
+ req = self._build_request_async(
925
+ method="PUT",
926
+ path="/accounts/{accountID}/products/{productID}",
927
+ base_url=base_url,
928
+ url_variables=url_variables,
929
+ request=request,
930
+ request_body_required=True,
931
+ request_has_path_params=True,
932
+ request_has_query_params=True,
933
+ user_agent_header="user-agent",
934
+ accept_header_value="application/json",
935
+ http_headers=http_headers,
936
+ _globals=operations.UpdateProductGlobals(
937
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
938
+ ),
939
+ security=self.sdk_configuration.security,
940
+ get_serialized_body=lambda: utils.serialize_request_body(
941
+ request.product_request, False, False, "json", components.ProductRequest
942
+ ),
943
+ timeout_ms=timeout_ms,
944
+ )
945
+
946
+ if retries == UNSET:
947
+ if self.sdk_configuration.retry_config is not UNSET:
948
+ retries = self.sdk_configuration.retry_config
949
+
950
+ retry_config = None
951
+ if isinstance(retries, utils.RetryConfig):
952
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
953
+
954
+ http_res = await self.do_request_async(
955
+ hook_ctx=HookContext(
956
+ config=self.sdk_configuration,
957
+ base_url=base_url or "",
958
+ operation_id="updateProduct",
959
+ oauth2_scopes=None,
960
+ security_source=get_security_from_env(
961
+ self.sdk_configuration.security, components.Security
962
+ ),
963
+ ),
964
+ request=req,
965
+ error_status_codes=[
966
+ "400",
967
+ "401",
968
+ "403",
969
+ "404",
970
+ "409",
971
+ "422",
972
+ "429",
973
+ "4XX",
974
+ "500",
975
+ "504",
976
+ "5XX",
977
+ ],
978
+ retry_config=retry_config,
979
+ )
980
+
981
+ response_data: Any = None
982
+ if utils.match_response(http_res, "200", "application/json"):
983
+ return operations.UpdateProductResponse(
984
+ result=unmarshal_json_response(components.Product, http_res),
985
+ headers=utils.get_response_headers(http_res.headers),
986
+ )
987
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
988
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
989
+ raise errors.GenericError(response_data, http_res)
990
+ if utils.match_response(http_res, "422", "application/json"):
991
+ response_data = unmarshal_json_response(
992
+ errors.ProductRequestValidationErrorData, http_res
993
+ )
994
+ raise errors.ProductRequestValidationError(response_data, http_res)
995
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
996
+ http_res_text = await utils.stream_to_text_async(http_res)
997
+ raise errors.APIError("API error occurred", http_res, http_res_text)
998
+ if utils.match_response(http_res, ["500", "504"], "*"):
999
+ http_res_text = await utils.stream_to_text_async(http_res)
1000
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1001
+ if utils.match_response(http_res, "4XX", "*"):
1002
+ http_res_text = await utils.stream_to_text_async(http_res)
1003
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1004
+ if utils.match_response(http_res, "5XX", "*"):
1005
+ http_res_text = await utils.stream_to_text_async(http_res)
1006
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1007
+
1008
+ raise errors.APIError("Unexpected response received", http_res)
1009
+
1010
+ def disable(
1011
+ self,
1012
+ *,
1013
+ account_id: str,
1014
+ product_id: str,
1015
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1016
+ server_url: Optional[str] = None,
1017
+ timeout_ms: Optional[int] = None,
1018
+ http_headers: Optional[Mapping[str, str]] = None,
1019
+ ) -> operations.DisableProductResponse:
1020
+ r"""Disable a product by ID.
1021
+
1022
+ The product will no longer be available, but will remain in the system for historical and reporting purposes.
1023
+
1024
+ :param account_id:
1025
+ :param product_id:
1026
+ :param retries: Override the default retry configuration for this method
1027
+ :param server_url: Override the default server URL for this method
1028
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1029
+ :param http_headers: Additional headers to set or replace on requests.
1030
+ """
1031
+ base_url = None
1032
+ url_variables = None
1033
+ if timeout_ms is None:
1034
+ timeout_ms = self.sdk_configuration.timeout_ms
1035
+
1036
+ if server_url is not None:
1037
+ base_url = server_url
1038
+ else:
1039
+ base_url = self._get_url(base_url, url_variables)
1040
+
1041
+ request = operations.DisableProductRequest(
1042
+ account_id=account_id,
1043
+ product_id=product_id,
1044
+ )
1045
+
1046
+ req = self._build_request(
1047
+ method="DELETE",
1048
+ path="/accounts/{accountID}/products/{productID}",
1049
+ base_url=base_url,
1050
+ url_variables=url_variables,
1051
+ request=request,
1052
+ request_body_required=False,
1053
+ request_has_path_params=True,
1054
+ request_has_query_params=True,
1055
+ user_agent_header="user-agent",
1056
+ accept_header_value="application/json",
1057
+ http_headers=http_headers,
1058
+ _globals=operations.DisableProductGlobals(
1059
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1060
+ ),
1061
+ security=self.sdk_configuration.security,
1062
+ timeout_ms=timeout_ms,
1063
+ )
1064
+
1065
+ if retries == UNSET:
1066
+ if self.sdk_configuration.retry_config is not UNSET:
1067
+ retries = self.sdk_configuration.retry_config
1068
+
1069
+ retry_config = None
1070
+ if isinstance(retries, utils.RetryConfig):
1071
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1072
+
1073
+ http_res = self.do_request(
1074
+ hook_ctx=HookContext(
1075
+ config=self.sdk_configuration,
1076
+ base_url=base_url or "",
1077
+ operation_id="disableProduct",
1078
+ oauth2_scopes=None,
1079
+ security_source=get_security_from_env(
1080
+ self.sdk_configuration.security, components.Security
1081
+ ),
1082
+ ),
1083
+ request=req,
1084
+ error_status_codes=[
1085
+ "400",
1086
+ "401",
1087
+ "403",
1088
+ "404",
1089
+ "409",
1090
+ "429",
1091
+ "4XX",
1092
+ "500",
1093
+ "504",
1094
+ "5XX",
1095
+ ],
1096
+ retry_config=retry_config,
1097
+ )
1098
+
1099
+ response_data: Any = None
1100
+ if utils.match_response(http_res, "204", "*"):
1101
+ return operations.DisableProductResponse(
1102
+ headers=utils.get_response_headers(http_res.headers)
1103
+ )
1104
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
1105
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
1106
+ raise errors.GenericError(response_data, http_res)
1107
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1108
+ http_res_text = utils.stream_to_text(http_res)
1109
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1110
+ if utils.match_response(http_res, ["500", "504"], "*"):
1111
+ http_res_text = utils.stream_to_text(http_res)
1112
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1113
+ if utils.match_response(http_res, "4XX", "*"):
1114
+ http_res_text = utils.stream_to_text(http_res)
1115
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1116
+ if utils.match_response(http_res, "5XX", "*"):
1117
+ http_res_text = utils.stream_to_text(http_res)
1118
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1119
+
1120
+ raise errors.APIError("Unexpected response received", http_res)
1121
+
1122
+ async def disable_async(
1123
+ self,
1124
+ *,
1125
+ account_id: str,
1126
+ product_id: str,
1127
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
1128
+ server_url: Optional[str] = None,
1129
+ timeout_ms: Optional[int] = None,
1130
+ http_headers: Optional[Mapping[str, str]] = None,
1131
+ ) -> operations.DisableProductResponse:
1132
+ r"""Disable a product by ID.
1133
+
1134
+ The product will no longer be available, but will remain in the system for historical and reporting purposes.
1135
+
1136
+ :param account_id:
1137
+ :param product_id:
1138
+ :param retries: Override the default retry configuration for this method
1139
+ :param server_url: Override the default server URL for this method
1140
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
1141
+ :param http_headers: Additional headers to set or replace on requests.
1142
+ """
1143
+ base_url = None
1144
+ url_variables = None
1145
+ if timeout_ms is None:
1146
+ timeout_ms = self.sdk_configuration.timeout_ms
1147
+
1148
+ if server_url is not None:
1149
+ base_url = server_url
1150
+ else:
1151
+ base_url = self._get_url(base_url, url_variables)
1152
+
1153
+ request = operations.DisableProductRequest(
1154
+ account_id=account_id,
1155
+ product_id=product_id,
1156
+ )
1157
+
1158
+ req = self._build_request_async(
1159
+ method="DELETE",
1160
+ path="/accounts/{accountID}/products/{productID}",
1161
+ base_url=base_url,
1162
+ url_variables=url_variables,
1163
+ request=request,
1164
+ request_body_required=False,
1165
+ request_has_path_params=True,
1166
+ request_has_query_params=True,
1167
+ user_agent_header="user-agent",
1168
+ accept_header_value="application/json",
1169
+ http_headers=http_headers,
1170
+ _globals=operations.DisableProductGlobals(
1171
+ x_moov_version=self.sdk_configuration.globals.x_moov_version,
1172
+ ),
1173
+ security=self.sdk_configuration.security,
1174
+ timeout_ms=timeout_ms,
1175
+ )
1176
+
1177
+ if retries == UNSET:
1178
+ if self.sdk_configuration.retry_config is not UNSET:
1179
+ retries = self.sdk_configuration.retry_config
1180
+
1181
+ retry_config = None
1182
+ if isinstance(retries, utils.RetryConfig):
1183
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
1184
+
1185
+ http_res = await self.do_request_async(
1186
+ hook_ctx=HookContext(
1187
+ config=self.sdk_configuration,
1188
+ base_url=base_url or "",
1189
+ operation_id="disableProduct",
1190
+ oauth2_scopes=None,
1191
+ security_source=get_security_from_env(
1192
+ self.sdk_configuration.security, components.Security
1193
+ ),
1194
+ ),
1195
+ request=req,
1196
+ error_status_codes=[
1197
+ "400",
1198
+ "401",
1199
+ "403",
1200
+ "404",
1201
+ "409",
1202
+ "429",
1203
+ "4XX",
1204
+ "500",
1205
+ "504",
1206
+ "5XX",
1207
+ ],
1208
+ retry_config=retry_config,
1209
+ )
1210
+
1211
+ response_data: Any = None
1212
+ if utils.match_response(http_res, "204", "*"):
1213
+ return operations.DisableProductResponse(
1214
+ headers=utils.get_response_headers(http_res.headers)
1215
+ )
1216
+ if utils.match_response(http_res, ["400", "409"], "application/json"):
1217
+ response_data = unmarshal_json_response(errors.GenericErrorData, http_res)
1218
+ raise errors.GenericError(response_data, http_res)
1219
+ if utils.match_response(http_res, ["401", "403", "404", "429"], "*"):
1220
+ http_res_text = await utils.stream_to_text_async(http_res)
1221
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1222
+ if utils.match_response(http_res, ["500", "504"], "*"):
1223
+ http_res_text = await utils.stream_to_text_async(http_res)
1224
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1225
+ if utils.match_response(http_res, "4XX", "*"):
1226
+ http_res_text = await utils.stream_to_text_async(http_res)
1227
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1228
+ if utils.match_response(http_res, "5XX", "*"):
1229
+ http_res_text = await utils.stream_to_text_async(http_res)
1230
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1231
+
1232
+ raise errors.APIError("Unexpected response received", http_res)