vortex-sdk 0.2.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 (123) hide show
  1. vortex/__init__.py +265 -0
  2. vortex/api/__init__.py +24 -0
  3. vortex/api/billing_api.py +34608 -0
  4. vortex/api/catalog_api.py +708 -0
  5. vortex/api/checkout_api.py +372 -0
  6. vortex/api/credit_notes_api.py +1688 -0
  7. vortex/api/customer_balance_api.py +1747 -0
  8. vortex/api/customers_api.py +387 -0
  9. vortex/api/discounts_api.py +2623 -0
  10. vortex/api/entitlements_api.py +1646 -0
  11. vortex/api/hosted_api.py +2855 -0
  12. vortex/api/invoices_api.py +2402 -0
  13. vortex/api/payables_api.py +1380 -0
  14. vortex/api/payment_methods_api.py +2069 -0
  15. vortex/api/payment_requests_api.py +1877 -0
  16. vortex/api/payments_api.py +694 -0
  17. vortex/api/payments_readiness_api.py +2311 -0
  18. vortex/api/public_api.py +6931 -0
  19. vortex/api/quotes_api.py +6817 -0
  20. vortex/api/receipts_api.py +1111 -0
  21. vortex/api/subscriptions_api.py +1059 -0
  22. vortex/api/tax_api.py +1397 -0
  23. vortex/api/webhooks_api.py +4931 -0
  24. vortex/api_client.py +804 -0
  25. vortex/api_response.py +21 -0
  26. vortex/configuration.py +658 -0
  27. vortex/exceptions.py +218 -0
  28. vortex/models/__init__.py +104 -0
  29. vortex/models/api_error.py +103 -0
  30. vortex/models/api_error_error.py +114 -0
  31. vortex/models/api_write_envelope.py +101 -0
  32. vortex/models/apply_coupon_request.py +97 -0
  33. vortex/models/billing_order_form_sign_request.py +103 -0
  34. vortex/models/billing_order_form_signature_request_request.py +86 -0
  35. vortex/models/billing_order_form_void_request.py +86 -0
  36. vortex/models/billing_order_forms_expire_due_request.py +90 -0
  37. vortex/models/billing_order_update_request.py +99 -0
  38. vortex/models/billing_orders_execute_due_request.py +90 -0
  39. vortex/models/billing_quote_create_request.py +119 -0
  40. vortex/models/billing_quote_line_input.py +93 -0
  41. vortex/models/billing_quote_version_approve_request.py +87 -0
  42. vortex/models/billing_quote_version_create_request.py +103 -0
  43. vortex/models/billing_quote_version_update_request.py +102 -0
  44. vortex/models/billing_quote_version_void_request.py +96 -0
  45. vortex/models/checkout_session_line_item_request.py +91 -0
  46. vortex/models/coupon_targets.py +89 -0
  47. vortex/models/create_checkout_session_request.py +140 -0
  48. vortex/models/create_coupon_request.py +132 -0
  49. vortex/models/create_deposit_balance_payable_request.py +172 -0
  50. vortex/models/create_installment_payable_request.py +170 -0
  51. vortex/models/create_payable_request.py +158 -0
  52. vortex/models/create_recurring_payable_request.py +181 -0
  53. vortex/models/create_recurring_payable_request_cadence.py +96 -0
  54. vortex/models/credit_note_create_line.py +105 -0
  55. vortex/models/credit_note_create_request.py +112 -0
  56. vortex/models/credit_note_reason.py +39 -0
  57. vortex/models/credit_note_refund_reconcile_request.py +86 -0
  58. vortex/models/credit_note_refund_request.py +94 -0
  59. vortex/models/customer_balance_targets.py +102 -0
  60. vortex/models/customer_default_payment_method_request.py +88 -0
  61. vortex/models/customer_payment_method_archive_request.py +88 -0
  62. vortex/models/customer_payment_method_attach_request.py +94 -0
  63. vortex/models/customer_payment_method_setup_request.py +100 -0
  64. vortex/models/customer_upsert_request.py +96 -0
  65. vortex/models/expire_customer_balance_request.py +98 -0
  66. vortex/models/grant_customer_balance_from_payment_request.py +103 -0
  67. vortex/models/grant_customer_balance_request.py +106 -0
  68. vortex/models/grant_entitlement_request.py +106 -0
  69. vortex/models/invoice_collect_request.py +86 -0
  70. vortex/models/invoice_create_request.py +92 -0
  71. vortex/models/invoice_finalize_request.py +86 -0
  72. vortex/models/invoice_mark_uncollectible_request.py +90 -0
  73. vortex/models/invoice_tax.py +142 -0
  74. vortex/models/invoice_void_request.py +88 -0
  75. vortex/models/merchant_account_create_request.py +183 -0
  76. vortex/models/merchant_address.py +96 -0
  77. vortex/models/merchant_associated_identity.py +114 -0
  78. vortex/models/merchant_onboarding_link_request.py +95 -0
  79. vortex/models/merchant_profile_date.py +90 -0
  80. vortex/models/merchant_settlement_bank_account.py +94 -0
  81. vortex/models/merchant_tax_profile_request.py +125 -0
  82. vortex/models/merchant_tax_profile_request_registrations_inner.py +88 -0
  83. vortex/models/merchant_underwriting_data.py +127 -0
  84. vortex/models/merchant_underwriting_data_card_volume_distribution.py +90 -0
  85. vortex/models/merchant_underwriting_data_volume_distribution_by_business_type.py +90 -0
  86. vortex/models/open_api_invoice_tax_response.py +92 -0
  87. vortex/models/open_api_invoice_tax_response_all_of_data.py +92 -0
  88. vortex/models/payment_request_collect_request.py +86 -0
  89. vortex/models/payment_request_create_request.py +100 -0
  90. vortex/models/payment_request_link_create_request.py +89 -0
  91. vortex/models/price_create_request.py +122 -0
  92. vortex/models/product_create_request.py +92 -0
  93. vortex/models/reverse_customer_balance_request.py +98 -0
  94. vortex/models/revoke_entitlement_request.py +106 -0
  95. vortex/models/subscription_change_request.py +111 -0
  96. vortex/models/subscription_create_request.py +122 -0
  97. vortex/models/subscription_item_change_preview_request.py +100 -0
  98. vortex/models/subscription_item_change_request_item.py +91 -0
  99. vortex/models/tax_address.py +96 -0
  100. vortex/models/tax_behavior.py +36 -0
  101. vortex/models/tax_behavior_policy.py +100 -0
  102. vortex/models/tax_behavior_policy_request.py +89 -0
  103. vortex/models/tax_failure.py +104 -0
  104. vortex/models/tax_finalize_request.py +98 -0
  105. vortex/models/tax_jurisdiction_evidence.py +94 -0
  106. vortex/models/tax_line_evidence.py +103 -0
  107. vortex/models/tax_quote_request.py +98 -0
  108. vortex/models/terminate_applied_coupon_request.py +87 -0
  109. vortex/models/terminate_coupon_request.py +87 -0
  110. vortex/models/webhook_deliveries_dispatch_request.py +91 -0
  111. vortex/models/webhook_deliveries_redrive_request.py +107 -0
  112. vortex/models/webhook_delivery_replay_request.py +88 -0
  113. vortex/models/webhook_endpoint_create_request.py +91 -0
  114. vortex/models/webhook_endpoint_secret_rotate_request.py +87 -0
  115. vortex/models/webhook_endpoint_test_request.py +88 -0
  116. vortex/models/webhook_endpoint_update_request.py +103 -0
  117. vortex/models/webhook_event_resend_request.py +86 -0
  118. vortex/rest.py +263 -0
  119. vortex_sdk-0.2.0.dist-info/METADATA +34 -0
  120. vortex_sdk-0.2.0.dist-info/RECORD +123 -0
  121. vortex_sdk-0.2.0.dist-info/WHEEL +5 -0
  122. vortex_sdk-0.2.0.dist-info/licenses/LICENSE +21 -0
  123. vortex_sdk-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,708 @@
1
+ """
2
+ Vortex Payments API
3
+
4
+ Public Vortex Payments API for customers, subscriptions, invoices, payment requests, checkout, receipts, webhooks, tax.
5
+
6
+ The version of the OpenAPI document: 2026-08
7
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
8
+
9
+ Do not edit the class manually.
10
+ """ # noqa: E501
11
+
12
+
13
+ import warnings
14
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
15
+ from typing import Any, Dict, List, Optional, Tuple, Union
16
+ from typing_extensions import Annotated
17
+
18
+ from pydantic import Field, StrictStr
19
+ from typing import Optional
20
+ from typing_extensions import Annotated
21
+ from vortex.models.api_write_envelope import ApiWriteEnvelope
22
+ from vortex.models.price_create_request import PriceCreateRequest
23
+ from vortex.models.product_create_request import ProductCreateRequest
24
+
25
+ from vortex.api_client import ApiClient, RequestSerialized
26
+ from vortex.api_response import ApiResponse
27
+ from vortex.rest import RESTResponseType
28
+
29
+
30
+ class CatalogApi:
31
+ """NOTE: This class is auto generated by OpenAPI Generator
32
+ Ref: https://openapi-generator.tech
33
+
34
+ Do not edit the class manually.
35
+ """
36
+
37
+ def __init__(self, api_client=None) -> None:
38
+ if api_client is None:
39
+ api_client = ApiClient.get_default()
40
+ self.api_client = api_client
41
+
42
+
43
+ @validate_call
44
+ def create_price(
45
+ self,
46
+ environment: StrictStr,
47
+ merchant_account_id: StrictStr,
48
+ price_create_request: PriceCreateRequest,
49
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
50
+ _request_timeout: Union[
51
+ None,
52
+ Annotated[StrictFloat, Field(gt=0)],
53
+ Tuple[
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Annotated[StrictFloat, Field(gt=0)]
56
+ ]
57
+ ] = None,
58
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
59
+ _content_type: Optional[StrictStr] = None,
60
+ _headers: Optional[Dict[StrictStr, Any]] = None,
61
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
62
+ ) -> ApiWriteEnvelope:
63
+ """Create a catalog price
64
+
65
+
66
+ :param environment: (required)
67
+ :type environment: str
68
+ :param merchant_account_id: (required)
69
+ :type merchant_account_id: str
70
+ :param price_create_request: (required)
71
+ :type price_create_request: PriceCreateRequest
72
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
73
+ :type idempotency_key: str
74
+ :param _request_timeout: timeout setting for this request. If one
75
+ number provided, it will be total request
76
+ timeout. It can also be a pair (tuple) of
77
+ (connection, read) timeouts.
78
+ :type _request_timeout: int, tuple(int, int), optional
79
+ :param _request_auth: set to override the auth_settings for an a single
80
+ request; this effectively ignores the
81
+ authentication in the spec for a single request.
82
+ :type _request_auth: dict, optional
83
+ :param _content_type: force content-type for the request.
84
+ :type _content_type: str, Optional
85
+ :param _headers: set to override the headers for a single
86
+ request; this effectively ignores the headers
87
+ in the spec for a single request.
88
+ :type _headers: dict, optional
89
+ :param _host_index: set to override the host_index for a single
90
+ request; this effectively ignores the host_index
91
+ in the spec for a single request.
92
+ :type _host_index: int, optional
93
+ :return: Returns the result object.
94
+ """ # noqa: E501
95
+
96
+ _param = self._create_price_serialize(
97
+ environment=environment,
98
+ merchant_account_id=merchant_account_id,
99
+ price_create_request=price_create_request,
100
+ idempotency_key=idempotency_key,
101
+ _request_auth=_request_auth,
102
+ _content_type=_content_type,
103
+ _headers=_headers,
104
+ _host_index=_host_index
105
+ )
106
+
107
+ _response_types_map: Dict[str, Optional[str]] = {
108
+ '200': "ApiWriteEnvelope",
109
+ '400': "ApiError",
110
+ '401': "ApiError",
111
+ '409': "ApiError",
112
+ '422': "ApiError",
113
+ '429': "ApiError",
114
+ }
115
+ response_data = self.api_client.call_api(
116
+ *_param,
117
+ _request_timeout=_request_timeout
118
+ )
119
+ response_data.read()
120
+ return self.api_client.response_deserialize(
121
+ response_data=response_data,
122
+ response_types_map=_response_types_map,
123
+ ).data
124
+
125
+
126
+ @validate_call
127
+ def create_price_with_http_info(
128
+ self,
129
+ environment: StrictStr,
130
+ merchant_account_id: StrictStr,
131
+ price_create_request: PriceCreateRequest,
132
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
133
+ _request_timeout: Union[
134
+ None,
135
+ Annotated[StrictFloat, Field(gt=0)],
136
+ Tuple[
137
+ Annotated[StrictFloat, Field(gt=0)],
138
+ Annotated[StrictFloat, Field(gt=0)]
139
+ ]
140
+ ] = None,
141
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
142
+ _content_type: Optional[StrictStr] = None,
143
+ _headers: Optional[Dict[StrictStr, Any]] = None,
144
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
145
+ ) -> ApiResponse[ApiWriteEnvelope]:
146
+ """Create a catalog price
147
+
148
+
149
+ :param environment: (required)
150
+ :type environment: str
151
+ :param merchant_account_id: (required)
152
+ :type merchant_account_id: str
153
+ :param price_create_request: (required)
154
+ :type price_create_request: PriceCreateRequest
155
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
156
+ :type idempotency_key: str
157
+ :param _request_timeout: timeout setting for this request. If one
158
+ number provided, it will be total request
159
+ timeout. It can also be a pair (tuple) of
160
+ (connection, read) timeouts.
161
+ :type _request_timeout: int, tuple(int, int), optional
162
+ :param _request_auth: set to override the auth_settings for an a single
163
+ request; this effectively ignores the
164
+ authentication in the spec for a single request.
165
+ :type _request_auth: dict, optional
166
+ :param _content_type: force content-type for the request.
167
+ :type _content_type: str, Optional
168
+ :param _headers: set to override the headers for a single
169
+ request; this effectively ignores the headers
170
+ in the spec for a single request.
171
+ :type _headers: dict, optional
172
+ :param _host_index: set to override the host_index for a single
173
+ request; this effectively ignores the host_index
174
+ in the spec for a single request.
175
+ :type _host_index: int, optional
176
+ :return: Returns the result object.
177
+ """ # noqa: E501
178
+
179
+ _param = self._create_price_serialize(
180
+ environment=environment,
181
+ merchant_account_id=merchant_account_id,
182
+ price_create_request=price_create_request,
183
+ idempotency_key=idempotency_key,
184
+ _request_auth=_request_auth,
185
+ _content_type=_content_type,
186
+ _headers=_headers,
187
+ _host_index=_host_index
188
+ )
189
+
190
+ _response_types_map: Dict[str, Optional[str]] = {
191
+ '200': "ApiWriteEnvelope",
192
+ '400': "ApiError",
193
+ '401': "ApiError",
194
+ '409': "ApiError",
195
+ '422': "ApiError",
196
+ '429': "ApiError",
197
+ }
198
+ response_data = self.api_client.call_api(
199
+ *_param,
200
+ _request_timeout=_request_timeout
201
+ )
202
+ response_data.read()
203
+ return self.api_client.response_deserialize(
204
+ response_data=response_data,
205
+ response_types_map=_response_types_map,
206
+ )
207
+
208
+
209
+ @validate_call
210
+ def create_price_without_preload_content(
211
+ self,
212
+ environment: StrictStr,
213
+ merchant_account_id: StrictStr,
214
+ price_create_request: PriceCreateRequest,
215
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
216
+ _request_timeout: Union[
217
+ None,
218
+ Annotated[StrictFloat, Field(gt=0)],
219
+ Tuple[
220
+ Annotated[StrictFloat, Field(gt=0)],
221
+ Annotated[StrictFloat, Field(gt=0)]
222
+ ]
223
+ ] = None,
224
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
225
+ _content_type: Optional[StrictStr] = None,
226
+ _headers: Optional[Dict[StrictStr, Any]] = None,
227
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
228
+ ) -> RESTResponseType:
229
+ """Create a catalog price
230
+
231
+
232
+ :param environment: (required)
233
+ :type environment: str
234
+ :param merchant_account_id: (required)
235
+ :type merchant_account_id: str
236
+ :param price_create_request: (required)
237
+ :type price_create_request: PriceCreateRequest
238
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
239
+ :type idempotency_key: str
240
+ :param _request_timeout: timeout setting for this request. If one
241
+ number provided, it will be total request
242
+ timeout. It can also be a pair (tuple) of
243
+ (connection, read) timeouts.
244
+ :type _request_timeout: int, tuple(int, int), optional
245
+ :param _request_auth: set to override the auth_settings for an a single
246
+ request; this effectively ignores the
247
+ authentication in the spec for a single request.
248
+ :type _request_auth: dict, optional
249
+ :param _content_type: force content-type for the request.
250
+ :type _content_type: str, Optional
251
+ :param _headers: set to override the headers for a single
252
+ request; this effectively ignores the headers
253
+ in the spec for a single request.
254
+ :type _headers: dict, optional
255
+ :param _host_index: set to override the host_index for a single
256
+ request; this effectively ignores the host_index
257
+ in the spec for a single request.
258
+ :type _host_index: int, optional
259
+ :return: Returns the result object.
260
+ """ # noqa: E501
261
+
262
+ _param = self._create_price_serialize(
263
+ environment=environment,
264
+ merchant_account_id=merchant_account_id,
265
+ price_create_request=price_create_request,
266
+ idempotency_key=idempotency_key,
267
+ _request_auth=_request_auth,
268
+ _content_type=_content_type,
269
+ _headers=_headers,
270
+ _host_index=_host_index
271
+ )
272
+
273
+ _response_types_map: Dict[str, Optional[str]] = {
274
+ '200': "ApiWriteEnvelope",
275
+ '400': "ApiError",
276
+ '401': "ApiError",
277
+ '409': "ApiError",
278
+ '422': "ApiError",
279
+ '429': "ApiError",
280
+ }
281
+ response_data = self.api_client.call_api(
282
+ *_param,
283
+ _request_timeout=_request_timeout
284
+ )
285
+ return response_data.response
286
+
287
+
288
+ def _create_price_serialize(
289
+ self,
290
+ environment,
291
+ merchant_account_id,
292
+ price_create_request,
293
+ idempotency_key,
294
+ _request_auth,
295
+ _content_type,
296
+ _headers,
297
+ _host_index,
298
+ ) -> RequestSerialized:
299
+
300
+ _host = None
301
+
302
+ _collection_formats: Dict[str, str] = {
303
+ }
304
+
305
+ _path_params: Dict[str, str] = {}
306
+ _query_params: List[Tuple[str, str]] = []
307
+ _header_params: Dict[str, Optional[str]] = _headers or {}
308
+ _form_params: List[Tuple[str, str]] = []
309
+ _files: Dict[
310
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
311
+ ] = {}
312
+ _body_params: Optional[bytes] = None
313
+
314
+ # process the path parameters
315
+ # process the query parameters
316
+ if environment is not None:
317
+
318
+ _query_params.append(('environment', environment))
319
+
320
+ if merchant_account_id is not None:
321
+
322
+ _query_params.append(('merchantAccountId', merchant_account_id))
323
+
324
+ # process the header parameters
325
+ if idempotency_key is not None:
326
+ _header_params['Idempotency-Key'] = idempotency_key
327
+ # process the form parameters
328
+ # process the body parameter
329
+ if price_create_request is not None:
330
+ _body_params = price_create_request
331
+
332
+
333
+ # set the HTTP header `Accept`
334
+ if 'Accept' not in _header_params:
335
+ _header_params['Accept'] = self.api_client.select_header_accept(
336
+ [
337
+ 'application/json'
338
+ ]
339
+ )
340
+
341
+ # set the HTTP header `Content-Type`
342
+ if _content_type:
343
+ _header_params['Content-Type'] = _content_type
344
+ else:
345
+ _default_content_type = (
346
+ self.api_client.select_header_content_type(
347
+ [
348
+ 'application/json'
349
+ ]
350
+ )
351
+ )
352
+ if _default_content_type is not None:
353
+ _header_params['Content-Type'] = _default_content_type
354
+
355
+ # authentication setting
356
+ _auth_settings: List[str] = [
357
+ 'api-key'
358
+ ]
359
+
360
+ return self.api_client.param_serialize(
361
+ method='POST',
362
+ resource_path='/v1/prices',
363
+ path_params=_path_params,
364
+ query_params=_query_params,
365
+ header_params=_header_params,
366
+ body=_body_params,
367
+ post_params=_form_params,
368
+ files=_files,
369
+ auth_settings=_auth_settings,
370
+ collection_formats=_collection_formats,
371
+ _host=_host,
372
+ _request_auth=_request_auth
373
+ )
374
+
375
+
376
+
377
+
378
+ @validate_call
379
+ def create_product(
380
+ self,
381
+ environment: StrictStr,
382
+ merchant_account_id: StrictStr,
383
+ product_create_request: ProductCreateRequest,
384
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
385
+ _request_timeout: Union[
386
+ None,
387
+ Annotated[StrictFloat, Field(gt=0)],
388
+ Tuple[
389
+ Annotated[StrictFloat, Field(gt=0)],
390
+ Annotated[StrictFloat, Field(gt=0)]
391
+ ]
392
+ ] = None,
393
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
394
+ _content_type: Optional[StrictStr] = None,
395
+ _headers: Optional[Dict[StrictStr, Any]] = None,
396
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
397
+ ) -> ApiWriteEnvelope:
398
+ """Create a catalog product
399
+
400
+
401
+ :param environment: (required)
402
+ :type environment: str
403
+ :param merchant_account_id: (required)
404
+ :type merchant_account_id: str
405
+ :param product_create_request: (required)
406
+ :type product_create_request: ProductCreateRequest
407
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
408
+ :type idempotency_key: str
409
+ :param _request_timeout: timeout setting for this request. If one
410
+ number provided, it will be total request
411
+ timeout. It can also be a pair (tuple) of
412
+ (connection, read) timeouts.
413
+ :type _request_timeout: int, tuple(int, int), optional
414
+ :param _request_auth: set to override the auth_settings for an a single
415
+ request; this effectively ignores the
416
+ authentication in the spec for a single request.
417
+ :type _request_auth: dict, optional
418
+ :param _content_type: force content-type for the request.
419
+ :type _content_type: str, Optional
420
+ :param _headers: set to override the headers for a single
421
+ request; this effectively ignores the headers
422
+ in the spec for a single request.
423
+ :type _headers: dict, optional
424
+ :param _host_index: set to override the host_index for a single
425
+ request; this effectively ignores the host_index
426
+ in the spec for a single request.
427
+ :type _host_index: int, optional
428
+ :return: Returns the result object.
429
+ """ # noqa: E501
430
+
431
+ _param = self._create_product_serialize(
432
+ environment=environment,
433
+ merchant_account_id=merchant_account_id,
434
+ product_create_request=product_create_request,
435
+ idempotency_key=idempotency_key,
436
+ _request_auth=_request_auth,
437
+ _content_type=_content_type,
438
+ _headers=_headers,
439
+ _host_index=_host_index
440
+ )
441
+
442
+ _response_types_map: Dict[str, Optional[str]] = {
443
+ '200': "ApiWriteEnvelope",
444
+ '400': "ApiError",
445
+ '401': "ApiError",
446
+ '409': "ApiError",
447
+ '422': "ApiError",
448
+ '429': "ApiError",
449
+ }
450
+ response_data = self.api_client.call_api(
451
+ *_param,
452
+ _request_timeout=_request_timeout
453
+ )
454
+ response_data.read()
455
+ return self.api_client.response_deserialize(
456
+ response_data=response_data,
457
+ response_types_map=_response_types_map,
458
+ ).data
459
+
460
+
461
+ @validate_call
462
+ def create_product_with_http_info(
463
+ self,
464
+ environment: StrictStr,
465
+ merchant_account_id: StrictStr,
466
+ product_create_request: ProductCreateRequest,
467
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
468
+ _request_timeout: Union[
469
+ None,
470
+ Annotated[StrictFloat, Field(gt=0)],
471
+ Tuple[
472
+ Annotated[StrictFloat, Field(gt=0)],
473
+ Annotated[StrictFloat, Field(gt=0)]
474
+ ]
475
+ ] = None,
476
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
477
+ _content_type: Optional[StrictStr] = None,
478
+ _headers: Optional[Dict[StrictStr, Any]] = None,
479
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
480
+ ) -> ApiResponse[ApiWriteEnvelope]:
481
+ """Create a catalog product
482
+
483
+
484
+ :param environment: (required)
485
+ :type environment: str
486
+ :param merchant_account_id: (required)
487
+ :type merchant_account_id: str
488
+ :param product_create_request: (required)
489
+ :type product_create_request: ProductCreateRequest
490
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
491
+ :type idempotency_key: str
492
+ :param _request_timeout: timeout setting for this request. If one
493
+ number provided, it will be total request
494
+ timeout. It can also be a pair (tuple) of
495
+ (connection, read) timeouts.
496
+ :type _request_timeout: int, tuple(int, int), optional
497
+ :param _request_auth: set to override the auth_settings for an a single
498
+ request; this effectively ignores the
499
+ authentication in the spec for a single request.
500
+ :type _request_auth: dict, optional
501
+ :param _content_type: force content-type for the request.
502
+ :type _content_type: str, Optional
503
+ :param _headers: set to override the headers for a single
504
+ request; this effectively ignores the headers
505
+ in the spec for a single request.
506
+ :type _headers: dict, optional
507
+ :param _host_index: set to override the host_index for a single
508
+ request; this effectively ignores the host_index
509
+ in the spec for a single request.
510
+ :type _host_index: int, optional
511
+ :return: Returns the result object.
512
+ """ # noqa: E501
513
+
514
+ _param = self._create_product_serialize(
515
+ environment=environment,
516
+ merchant_account_id=merchant_account_id,
517
+ product_create_request=product_create_request,
518
+ idempotency_key=idempotency_key,
519
+ _request_auth=_request_auth,
520
+ _content_type=_content_type,
521
+ _headers=_headers,
522
+ _host_index=_host_index
523
+ )
524
+
525
+ _response_types_map: Dict[str, Optional[str]] = {
526
+ '200': "ApiWriteEnvelope",
527
+ '400': "ApiError",
528
+ '401': "ApiError",
529
+ '409': "ApiError",
530
+ '422': "ApiError",
531
+ '429': "ApiError",
532
+ }
533
+ response_data = self.api_client.call_api(
534
+ *_param,
535
+ _request_timeout=_request_timeout
536
+ )
537
+ response_data.read()
538
+ return self.api_client.response_deserialize(
539
+ response_data=response_data,
540
+ response_types_map=_response_types_map,
541
+ )
542
+
543
+
544
+ @validate_call
545
+ def create_product_without_preload_content(
546
+ self,
547
+ environment: StrictStr,
548
+ merchant_account_id: StrictStr,
549
+ product_create_request: ProductCreateRequest,
550
+ idempotency_key: Annotated[Optional[Annotated[str, Field(min_length=1, strict=True)]], Field(description="Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.")] = None,
551
+ _request_timeout: Union[
552
+ None,
553
+ Annotated[StrictFloat, Field(gt=0)],
554
+ Tuple[
555
+ Annotated[StrictFloat, Field(gt=0)],
556
+ Annotated[StrictFloat, Field(gt=0)]
557
+ ]
558
+ ] = None,
559
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
560
+ _content_type: Optional[StrictStr] = None,
561
+ _headers: Optional[Dict[StrictStr, Any]] = None,
562
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
563
+ ) -> RESTResponseType:
564
+ """Create a catalog product
565
+
566
+
567
+ :param environment: (required)
568
+ :type environment: str
569
+ :param merchant_account_id: (required)
570
+ :type merchant_account_id: str
571
+ :param product_create_request: (required)
572
+ :type product_create_request: ProductCreateRequest
573
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
574
+ :type idempotency_key: str
575
+ :param _request_timeout: timeout setting for this request. If one
576
+ number provided, it will be total request
577
+ timeout. It can also be a pair (tuple) of
578
+ (connection, read) timeouts.
579
+ :type _request_timeout: int, tuple(int, int), optional
580
+ :param _request_auth: set to override the auth_settings for an a single
581
+ request; this effectively ignores the
582
+ authentication in the spec for a single request.
583
+ :type _request_auth: dict, optional
584
+ :param _content_type: force content-type for the request.
585
+ :type _content_type: str, Optional
586
+ :param _headers: set to override the headers for a single
587
+ request; this effectively ignores the headers
588
+ in the spec for a single request.
589
+ :type _headers: dict, optional
590
+ :param _host_index: set to override the host_index for a single
591
+ request; this effectively ignores the host_index
592
+ in the spec for a single request.
593
+ :type _host_index: int, optional
594
+ :return: Returns the result object.
595
+ """ # noqa: E501
596
+
597
+ _param = self._create_product_serialize(
598
+ environment=environment,
599
+ merchant_account_id=merchant_account_id,
600
+ product_create_request=product_create_request,
601
+ idempotency_key=idempotency_key,
602
+ _request_auth=_request_auth,
603
+ _content_type=_content_type,
604
+ _headers=_headers,
605
+ _host_index=_host_index
606
+ )
607
+
608
+ _response_types_map: Dict[str, Optional[str]] = {
609
+ '200': "ApiWriteEnvelope",
610
+ '400': "ApiError",
611
+ '401': "ApiError",
612
+ '409': "ApiError",
613
+ '422': "ApiError",
614
+ '429': "ApiError",
615
+ }
616
+ response_data = self.api_client.call_api(
617
+ *_param,
618
+ _request_timeout=_request_timeout
619
+ )
620
+ return response_data.response
621
+
622
+
623
+ def _create_product_serialize(
624
+ self,
625
+ environment,
626
+ merchant_account_id,
627
+ product_create_request,
628
+ idempotency_key,
629
+ _request_auth,
630
+ _content_type,
631
+ _headers,
632
+ _host_index,
633
+ ) -> RequestSerialized:
634
+
635
+ _host = None
636
+
637
+ _collection_formats: Dict[str, str] = {
638
+ }
639
+
640
+ _path_params: Dict[str, str] = {}
641
+ _query_params: List[Tuple[str, str]] = []
642
+ _header_params: Dict[str, Optional[str]] = _headers or {}
643
+ _form_params: List[Tuple[str, str]] = []
644
+ _files: Dict[
645
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
646
+ ] = {}
647
+ _body_params: Optional[bytes] = None
648
+
649
+ # process the path parameters
650
+ # process the query parameters
651
+ if environment is not None:
652
+
653
+ _query_params.append(('environment', environment))
654
+
655
+ if merchant_account_id is not None:
656
+
657
+ _query_params.append(('merchantAccountId', merchant_account_id))
658
+
659
+ # process the header parameters
660
+ if idempotency_key is not None:
661
+ _header_params['Idempotency-Key'] = idempotency_key
662
+ # process the form parameters
663
+ # process the body parameter
664
+ if product_create_request is not None:
665
+ _body_params = product_create_request
666
+
667
+
668
+ # set the HTTP header `Accept`
669
+ if 'Accept' not in _header_params:
670
+ _header_params['Accept'] = self.api_client.select_header_accept(
671
+ [
672
+ 'application/json'
673
+ ]
674
+ )
675
+
676
+ # set the HTTP header `Content-Type`
677
+ if _content_type:
678
+ _header_params['Content-Type'] = _content_type
679
+ else:
680
+ _default_content_type = (
681
+ self.api_client.select_header_content_type(
682
+ [
683
+ 'application/json'
684
+ ]
685
+ )
686
+ )
687
+ if _default_content_type is not None:
688
+ _header_params['Content-Type'] = _default_content_type
689
+
690
+ # authentication setting
691
+ _auth_settings: List[str] = [
692
+ 'api-key'
693
+ ]
694
+
695
+ return self.api_client.param_serialize(
696
+ method='POST',
697
+ resource_path='/v1/products',
698
+ path_params=_path_params,
699
+ query_params=_query_params,
700
+ header_params=_header_params,
701
+ body=_body_params,
702
+ post_params=_form_params,
703
+ files=_files,
704
+ auth_settings=_auth_settings,
705
+ collection_formats=_collection_formats,
706
+ _host=_host,
707
+ _request_auth=_request_auth
708
+ )