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,1646 @@
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.grant_entitlement_request import GrantEntitlementRequest
23
+ from vortex.models.revoke_entitlement_request import RevokeEntitlementRequest
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 EntitlementsApi:
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 check_customer_access(
45
+ self,
46
+ customer_id: StrictStr,
47
+ key: StrictStr,
48
+ environment: StrictStr,
49
+ merchant_account_id: StrictStr,
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
+ """Check product-facing customer access for one entitlement key
64
+
65
+
66
+ :param customer_id: (required)
67
+ :type customer_id: str
68
+ :param key: (required)
69
+ :type key: str
70
+ :param environment: (required)
71
+ :type environment: str
72
+ :param merchant_account_id: (required)
73
+ :type merchant_account_id: 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._check_customer_access_serialize(
97
+ customer_id=customer_id,
98
+ key=key,
99
+ environment=environment,
100
+ merchant_account_id=merchant_account_id,
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 check_customer_access_with_http_info(
128
+ self,
129
+ customer_id: StrictStr,
130
+ key: StrictStr,
131
+ environment: StrictStr,
132
+ merchant_account_id: StrictStr,
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
+ """Check product-facing customer access for one entitlement key
147
+
148
+
149
+ :param customer_id: (required)
150
+ :type customer_id: str
151
+ :param key: (required)
152
+ :type key: str
153
+ :param environment: (required)
154
+ :type environment: str
155
+ :param merchant_account_id: (required)
156
+ :type merchant_account_id: 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._check_customer_access_serialize(
180
+ customer_id=customer_id,
181
+ key=key,
182
+ environment=environment,
183
+ merchant_account_id=merchant_account_id,
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 check_customer_access_without_preload_content(
211
+ self,
212
+ customer_id: StrictStr,
213
+ key: StrictStr,
214
+ environment: StrictStr,
215
+ merchant_account_id: StrictStr,
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
+ """Check product-facing customer access for one entitlement key
230
+
231
+
232
+ :param customer_id: (required)
233
+ :type customer_id: str
234
+ :param key: (required)
235
+ :type key: str
236
+ :param environment: (required)
237
+ :type environment: str
238
+ :param merchant_account_id: (required)
239
+ :type merchant_account_id: 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._check_customer_access_serialize(
263
+ customer_id=customer_id,
264
+ key=key,
265
+ environment=environment,
266
+ merchant_account_id=merchant_account_id,
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 _check_customer_access_serialize(
289
+ self,
290
+ customer_id,
291
+ key,
292
+ environment,
293
+ merchant_account_id,
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
+ if customer_id is not None:
316
+ _path_params['customerId'] = customer_id
317
+ # process the query parameters
318
+ if key is not None:
319
+
320
+ _query_params.append(('key', key))
321
+
322
+ if environment is not None:
323
+
324
+ _query_params.append(('environment', environment))
325
+
326
+ if merchant_account_id is not None:
327
+
328
+ _query_params.append(('merchantAccountId', merchant_account_id))
329
+
330
+ # process the header parameters
331
+ # process the form parameters
332
+ # process the body parameter
333
+
334
+
335
+ # set the HTTP header `Accept`
336
+ if 'Accept' not in _header_params:
337
+ _header_params['Accept'] = self.api_client.select_header_accept(
338
+ [
339
+ 'application/json'
340
+ ]
341
+ )
342
+
343
+
344
+ # authentication setting
345
+ _auth_settings: List[str] = [
346
+ 'api-key'
347
+ ]
348
+
349
+ return self.api_client.param_serialize(
350
+ method='GET',
351
+ resource_path='/v1/customers/{customerId}/access',
352
+ path_params=_path_params,
353
+ query_params=_query_params,
354
+ header_params=_header_params,
355
+ body=_body_params,
356
+ post_params=_form_params,
357
+ files=_files,
358
+ auth_settings=_auth_settings,
359
+ collection_formats=_collection_formats,
360
+ _host=_host,
361
+ _request_auth=_request_auth
362
+ )
363
+
364
+
365
+
366
+
367
+ @validate_call
368
+ def get_customer_entitlements(
369
+ self,
370
+ customer_id: StrictStr,
371
+ environment: StrictStr,
372
+ merchant_account_id: StrictStr,
373
+ _request_timeout: Union[
374
+ None,
375
+ Annotated[StrictFloat, Field(gt=0)],
376
+ Tuple[
377
+ Annotated[StrictFloat, Field(gt=0)],
378
+ Annotated[StrictFloat, Field(gt=0)]
379
+ ]
380
+ ] = None,
381
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
382
+ _content_type: Optional[StrictStr] = None,
383
+ _headers: Optional[Dict[StrictStr, Any]] = None,
384
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
385
+ ) -> ApiWriteEnvelope:
386
+ """Get effective customer entitlements
387
+
388
+
389
+ :param customer_id: (required)
390
+ :type customer_id: str
391
+ :param environment: (required)
392
+ :type environment: str
393
+ :param merchant_account_id: (required)
394
+ :type merchant_account_id: str
395
+ :param _request_timeout: timeout setting for this request. If one
396
+ number provided, it will be total request
397
+ timeout. It can also be a pair (tuple) of
398
+ (connection, read) timeouts.
399
+ :type _request_timeout: int, tuple(int, int), optional
400
+ :param _request_auth: set to override the auth_settings for an a single
401
+ request; this effectively ignores the
402
+ authentication in the spec for a single request.
403
+ :type _request_auth: dict, optional
404
+ :param _content_type: force content-type for the request.
405
+ :type _content_type: str, Optional
406
+ :param _headers: set to override the headers for a single
407
+ request; this effectively ignores the headers
408
+ in the spec for a single request.
409
+ :type _headers: dict, optional
410
+ :param _host_index: set to override the host_index for a single
411
+ request; this effectively ignores the host_index
412
+ in the spec for a single request.
413
+ :type _host_index: int, optional
414
+ :return: Returns the result object.
415
+ """ # noqa: E501
416
+
417
+ _param = self._get_customer_entitlements_serialize(
418
+ customer_id=customer_id,
419
+ environment=environment,
420
+ merchant_account_id=merchant_account_id,
421
+ _request_auth=_request_auth,
422
+ _content_type=_content_type,
423
+ _headers=_headers,
424
+ _host_index=_host_index
425
+ )
426
+
427
+ _response_types_map: Dict[str, Optional[str]] = {
428
+ '200': "ApiWriteEnvelope",
429
+ '400': "ApiError",
430
+ '401': "ApiError",
431
+ '409': "ApiError",
432
+ '422': "ApiError",
433
+ '429': "ApiError",
434
+ }
435
+ response_data = self.api_client.call_api(
436
+ *_param,
437
+ _request_timeout=_request_timeout
438
+ )
439
+ response_data.read()
440
+ return self.api_client.response_deserialize(
441
+ response_data=response_data,
442
+ response_types_map=_response_types_map,
443
+ ).data
444
+
445
+
446
+ @validate_call
447
+ def get_customer_entitlements_with_http_info(
448
+ self,
449
+ customer_id: StrictStr,
450
+ environment: StrictStr,
451
+ merchant_account_id: StrictStr,
452
+ _request_timeout: Union[
453
+ None,
454
+ Annotated[StrictFloat, Field(gt=0)],
455
+ Tuple[
456
+ Annotated[StrictFloat, Field(gt=0)],
457
+ Annotated[StrictFloat, Field(gt=0)]
458
+ ]
459
+ ] = None,
460
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
461
+ _content_type: Optional[StrictStr] = None,
462
+ _headers: Optional[Dict[StrictStr, Any]] = None,
463
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
464
+ ) -> ApiResponse[ApiWriteEnvelope]:
465
+ """Get effective customer entitlements
466
+
467
+
468
+ :param customer_id: (required)
469
+ :type customer_id: str
470
+ :param environment: (required)
471
+ :type environment: str
472
+ :param merchant_account_id: (required)
473
+ :type merchant_account_id: str
474
+ :param _request_timeout: timeout setting for this request. If one
475
+ number provided, it will be total request
476
+ timeout. It can also be a pair (tuple) of
477
+ (connection, read) timeouts.
478
+ :type _request_timeout: int, tuple(int, int), optional
479
+ :param _request_auth: set to override the auth_settings for an a single
480
+ request; this effectively ignores the
481
+ authentication in the spec for a single request.
482
+ :type _request_auth: dict, optional
483
+ :param _content_type: force content-type for the request.
484
+ :type _content_type: str, Optional
485
+ :param _headers: set to override the headers for a single
486
+ request; this effectively ignores the headers
487
+ in the spec for a single request.
488
+ :type _headers: dict, optional
489
+ :param _host_index: set to override the host_index for a single
490
+ request; this effectively ignores the host_index
491
+ in the spec for a single request.
492
+ :type _host_index: int, optional
493
+ :return: Returns the result object.
494
+ """ # noqa: E501
495
+
496
+ _param = self._get_customer_entitlements_serialize(
497
+ customer_id=customer_id,
498
+ environment=environment,
499
+ merchant_account_id=merchant_account_id,
500
+ _request_auth=_request_auth,
501
+ _content_type=_content_type,
502
+ _headers=_headers,
503
+ _host_index=_host_index
504
+ )
505
+
506
+ _response_types_map: Dict[str, Optional[str]] = {
507
+ '200': "ApiWriteEnvelope",
508
+ '400': "ApiError",
509
+ '401': "ApiError",
510
+ '409': "ApiError",
511
+ '422': "ApiError",
512
+ '429': "ApiError",
513
+ }
514
+ response_data = self.api_client.call_api(
515
+ *_param,
516
+ _request_timeout=_request_timeout
517
+ )
518
+ response_data.read()
519
+ return self.api_client.response_deserialize(
520
+ response_data=response_data,
521
+ response_types_map=_response_types_map,
522
+ )
523
+
524
+
525
+ @validate_call
526
+ def get_customer_entitlements_without_preload_content(
527
+ self,
528
+ customer_id: StrictStr,
529
+ environment: StrictStr,
530
+ merchant_account_id: StrictStr,
531
+ _request_timeout: Union[
532
+ None,
533
+ Annotated[StrictFloat, Field(gt=0)],
534
+ Tuple[
535
+ Annotated[StrictFloat, Field(gt=0)],
536
+ Annotated[StrictFloat, Field(gt=0)]
537
+ ]
538
+ ] = None,
539
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
540
+ _content_type: Optional[StrictStr] = None,
541
+ _headers: Optional[Dict[StrictStr, Any]] = None,
542
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
543
+ ) -> RESTResponseType:
544
+ """Get effective customer entitlements
545
+
546
+
547
+ :param customer_id: (required)
548
+ :type customer_id: str
549
+ :param environment: (required)
550
+ :type environment: str
551
+ :param merchant_account_id: (required)
552
+ :type merchant_account_id: str
553
+ :param _request_timeout: timeout setting for this request. If one
554
+ number provided, it will be total request
555
+ timeout. It can also be a pair (tuple) of
556
+ (connection, read) timeouts.
557
+ :type _request_timeout: int, tuple(int, int), optional
558
+ :param _request_auth: set to override the auth_settings for an a single
559
+ request; this effectively ignores the
560
+ authentication in the spec for a single request.
561
+ :type _request_auth: dict, optional
562
+ :param _content_type: force content-type for the request.
563
+ :type _content_type: str, Optional
564
+ :param _headers: set to override the headers for a single
565
+ request; this effectively ignores the headers
566
+ in the spec for a single request.
567
+ :type _headers: dict, optional
568
+ :param _host_index: set to override the host_index for a single
569
+ request; this effectively ignores the host_index
570
+ in the spec for a single request.
571
+ :type _host_index: int, optional
572
+ :return: Returns the result object.
573
+ """ # noqa: E501
574
+
575
+ _param = self._get_customer_entitlements_serialize(
576
+ customer_id=customer_id,
577
+ environment=environment,
578
+ merchant_account_id=merchant_account_id,
579
+ _request_auth=_request_auth,
580
+ _content_type=_content_type,
581
+ _headers=_headers,
582
+ _host_index=_host_index
583
+ )
584
+
585
+ _response_types_map: Dict[str, Optional[str]] = {
586
+ '200': "ApiWriteEnvelope",
587
+ '400': "ApiError",
588
+ '401': "ApiError",
589
+ '409': "ApiError",
590
+ '422': "ApiError",
591
+ '429': "ApiError",
592
+ }
593
+ response_data = self.api_client.call_api(
594
+ *_param,
595
+ _request_timeout=_request_timeout
596
+ )
597
+ return response_data.response
598
+
599
+
600
+ def _get_customer_entitlements_serialize(
601
+ self,
602
+ customer_id,
603
+ environment,
604
+ merchant_account_id,
605
+ _request_auth,
606
+ _content_type,
607
+ _headers,
608
+ _host_index,
609
+ ) -> RequestSerialized:
610
+
611
+ _host = None
612
+
613
+ _collection_formats: Dict[str, str] = {
614
+ }
615
+
616
+ _path_params: Dict[str, str] = {}
617
+ _query_params: List[Tuple[str, str]] = []
618
+ _header_params: Dict[str, Optional[str]] = _headers or {}
619
+ _form_params: List[Tuple[str, str]] = []
620
+ _files: Dict[
621
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
622
+ ] = {}
623
+ _body_params: Optional[bytes] = None
624
+
625
+ # process the path parameters
626
+ if customer_id is not None:
627
+ _path_params['customerId'] = customer_id
628
+ # process the query parameters
629
+ if environment is not None:
630
+
631
+ _query_params.append(('environment', environment))
632
+
633
+ if merchant_account_id is not None:
634
+
635
+ _query_params.append(('merchantAccountId', merchant_account_id))
636
+
637
+ # process the header parameters
638
+ # process the form parameters
639
+ # process the body parameter
640
+
641
+
642
+ # set the HTTP header `Accept`
643
+ if 'Accept' not in _header_params:
644
+ _header_params['Accept'] = self.api_client.select_header_accept(
645
+ [
646
+ 'application/json'
647
+ ]
648
+ )
649
+
650
+
651
+ # authentication setting
652
+ _auth_settings: List[str] = [
653
+ 'api-key'
654
+ ]
655
+
656
+ return self.api_client.param_serialize(
657
+ method='GET',
658
+ resource_path='/v1/customers/{customerId}/entitlements',
659
+ path_params=_path_params,
660
+ query_params=_query_params,
661
+ header_params=_header_params,
662
+ body=_body_params,
663
+ post_params=_form_params,
664
+ files=_files,
665
+ auth_settings=_auth_settings,
666
+ collection_formats=_collection_formats,
667
+ _host=_host,
668
+ _request_auth=_request_auth
669
+ )
670
+
671
+
672
+
673
+
674
+ @validate_call
675
+ def get_customer_state(
676
+ self,
677
+ customer_id: StrictStr,
678
+ environment: StrictStr,
679
+ merchant_account_id: StrictStr,
680
+ _request_timeout: Union[
681
+ None,
682
+ Annotated[StrictFloat, Field(gt=0)],
683
+ Tuple[
684
+ Annotated[StrictFloat, Field(gt=0)],
685
+ Annotated[StrictFloat, Field(gt=0)]
686
+ ]
687
+ ] = None,
688
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
689
+ _content_type: Optional[StrictStr] = None,
690
+ _headers: Optional[Dict[StrictStr, Any]] = None,
691
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
692
+ ) -> ApiWriteEnvelope:
693
+ """Get product-facing customer billing and access state
694
+
695
+
696
+ :param customer_id: (required)
697
+ :type customer_id: str
698
+ :param environment: (required)
699
+ :type environment: str
700
+ :param merchant_account_id: (required)
701
+ :type merchant_account_id: str
702
+ :param _request_timeout: timeout setting for this request. If one
703
+ number provided, it will be total request
704
+ timeout. It can also be a pair (tuple) of
705
+ (connection, read) timeouts.
706
+ :type _request_timeout: int, tuple(int, int), optional
707
+ :param _request_auth: set to override the auth_settings for an a single
708
+ request; this effectively ignores the
709
+ authentication in the spec for a single request.
710
+ :type _request_auth: dict, optional
711
+ :param _content_type: force content-type for the request.
712
+ :type _content_type: str, Optional
713
+ :param _headers: set to override the headers for a single
714
+ request; this effectively ignores the headers
715
+ in the spec for a single request.
716
+ :type _headers: dict, optional
717
+ :param _host_index: set to override the host_index for a single
718
+ request; this effectively ignores the host_index
719
+ in the spec for a single request.
720
+ :type _host_index: int, optional
721
+ :return: Returns the result object.
722
+ """ # noqa: E501
723
+
724
+ _param = self._get_customer_state_serialize(
725
+ customer_id=customer_id,
726
+ environment=environment,
727
+ merchant_account_id=merchant_account_id,
728
+ _request_auth=_request_auth,
729
+ _content_type=_content_type,
730
+ _headers=_headers,
731
+ _host_index=_host_index
732
+ )
733
+
734
+ _response_types_map: Dict[str, Optional[str]] = {
735
+ '200': "ApiWriteEnvelope",
736
+ '400': "ApiError",
737
+ '401': "ApiError",
738
+ '409': "ApiError",
739
+ '422': "ApiError",
740
+ '429': "ApiError",
741
+ }
742
+ response_data = self.api_client.call_api(
743
+ *_param,
744
+ _request_timeout=_request_timeout
745
+ )
746
+ response_data.read()
747
+ return self.api_client.response_deserialize(
748
+ response_data=response_data,
749
+ response_types_map=_response_types_map,
750
+ ).data
751
+
752
+
753
+ @validate_call
754
+ def get_customer_state_with_http_info(
755
+ self,
756
+ customer_id: StrictStr,
757
+ environment: StrictStr,
758
+ merchant_account_id: StrictStr,
759
+ _request_timeout: Union[
760
+ None,
761
+ Annotated[StrictFloat, Field(gt=0)],
762
+ Tuple[
763
+ Annotated[StrictFloat, Field(gt=0)],
764
+ Annotated[StrictFloat, Field(gt=0)]
765
+ ]
766
+ ] = None,
767
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
768
+ _content_type: Optional[StrictStr] = None,
769
+ _headers: Optional[Dict[StrictStr, Any]] = None,
770
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
771
+ ) -> ApiResponse[ApiWriteEnvelope]:
772
+ """Get product-facing customer billing and access state
773
+
774
+
775
+ :param customer_id: (required)
776
+ :type customer_id: str
777
+ :param environment: (required)
778
+ :type environment: str
779
+ :param merchant_account_id: (required)
780
+ :type merchant_account_id: str
781
+ :param _request_timeout: timeout setting for this request. If one
782
+ number provided, it will be total request
783
+ timeout. It can also be a pair (tuple) of
784
+ (connection, read) timeouts.
785
+ :type _request_timeout: int, tuple(int, int), optional
786
+ :param _request_auth: set to override the auth_settings for an a single
787
+ request; this effectively ignores the
788
+ authentication in the spec for a single request.
789
+ :type _request_auth: dict, optional
790
+ :param _content_type: force content-type for the request.
791
+ :type _content_type: str, Optional
792
+ :param _headers: set to override the headers for a single
793
+ request; this effectively ignores the headers
794
+ in the spec for a single request.
795
+ :type _headers: dict, optional
796
+ :param _host_index: set to override the host_index for a single
797
+ request; this effectively ignores the host_index
798
+ in the spec for a single request.
799
+ :type _host_index: int, optional
800
+ :return: Returns the result object.
801
+ """ # noqa: E501
802
+
803
+ _param = self._get_customer_state_serialize(
804
+ customer_id=customer_id,
805
+ environment=environment,
806
+ merchant_account_id=merchant_account_id,
807
+ _request_auth=_request_auth,
808
+ _content_type=_content_type,
809
+ _headers=_headers,
810
+ _host_index=_host_index
811
+ )
812
+
813
+ _response_types_map: Dict[str, Optional[str]] = {
814
+ '200': "ApiWriteEnvelope",
815
+ '400': "ApiError",
816
+ '401': "ApiError",
817
+ '409': "ApiError",
818
+ '422': "ApiError",
819
+ '429': "ApiError",
820
+ }
821
+ response_data = self.api_client.call_api(
822
+ *_param,
823
+ _request_timeout=_request_timeout
824
+ )
825
+ response_data.read()
826
+ return self.api_client.response_deserialize(
827
+ response_data=response_data,
828
+ response_types_map=_response_types_map,
829
+ )
830
+
831
+
832
+ @validate_call
833
+ def get_customer_state_without_preload_content(
834
+ self,
835
+ customer_id: StrictStr,
836
+ environment: StrictStr,
837
+ merchant_account_id: StrictStr,
838
+ _request_timeout: Union[
839
+ None,
840
+ Annotated[StrictFloat, Field(gt=0)],
841
+ Tuple[
842
+ Annotated[StrictFloat, Field(gt=0)],
843
+ Annotated[StrictFloat, Field(gt=0)]
844
+ ]
845
+ ] = None,
846
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
847
+ _content_type: Optional[StrictStr] = None,
848
+ _headers: Optional[Dict[StrictStr, Any]] = None,
849
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
850
+ ) -> RESTResponseType:
851
+ """Get product-facing customer billing and access state
852
+
853
+
854
+ :param customer_id: (required)
855
+ :type customer_id: str
856
+ :param environment: (required)
857
+ :type environment: str
858
+ :param merchant_account_id: (required)
859
+ :type merchant_account_id: str
860
+ :param _request_timeout: timeout setting for this request. If one
861
+ number provided, it will be total request
862
+ timeout. It can also be a pair (tuple) of
863
+ (connection, read) timeouts.
864
+ :type _request_timeout: int, tuple(int, int), optional
865
+ :param _request_auth: set to override the auth_settings for an a single
866
+ request; this effectively ignores the
867
+ authentication in the spec for a single request.
868
+ :type _request_auth: dict, optional
869
+ :param _content_type: force content-type for the request.
870
+ :type _content_type: str, Optional
871
+ :param _headers: set to override the headers for a single
872
+ request; this effectively ignores the headers
873
+ in the spec for a single request.
874
+ :type _headers: dict, optional
875
+ :param _host_index: set to override the host_index for a single
876
+ request; this effectively ignores the host_index
877
+ in the spec for a single request.
878
+ :type _host_index: int, optional
879
+ :return: Returns the result object.
880
+ """ # noqa: E501
881
+
882
+ _param = self._get_customer_state_serialize(
883
+ customer_id=customer_id,
884
+ environment=environment,
885
+ merchant_account_id=merchant_account_id,
886
+ _request_auth=_request_auth,
887
+ _content_type=_content_type,
888
+ _headers=_headers,
889
+ _host_index=_host_index
890
+ )
891
+
892
+ _response_types_map: Dict[str, Optional[str]] = {
893
+ '200': "ApiWriteEnvelope",
894
+ '400': "ApiError",
895
+ '401': "ApiError",
896
+ '409': "ApiError",
897
+ '422': "ApiError",
898
+ '429': "ApiError",
899
+ }
900
+ response_data = self.api_client.call_api(
901
+ *_param,
902
+ _request_timeout=_request_timeout
903
+ )
904
+ return response_data.response
905
+
906
+
907
+ def _get_customer_state_serialize(
908
+ self,
909
+ customer_id,
910
+ environment,
911
+ merchant_account_id,
912
+ _request_auth,
913
+ _content_type,
914
+ _headers,
915
+ _host_index,
916
+ ) -> RequestSerialized:
917
+
918
+ _host = None
919
+
920
+ _collection_formats: Dict[str, str] = {
921
+ }
922
+
923
+ _path_params: Dict[str, str] = {}
924
+ _query_params: List[Tuple[str, str]] = []
925
+ _header_params: Dict[str, Optional[str]] = _headers or {}
926
+ _form_params: List[Tuple[str, str]] = []
927
+ _files: Dict[
928
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
929
+ ] = {}
930
+ _body_params: Optional[bytes] = None
931
+
932
+ # process the path parameters
933
+ if customer_id is not None:
934
+ _path_params['customerId'] = customer_id
935
+ # process the query parameters
936
+ if environment is not None:
937
+
938
+ _query_params.append(('environment', environment))
939
+
940
+ if merchant_account_id is not None:
941
+
942
+ _query_params.append(('merchantAccountId', merchant_account_id))
943
+
944
+ # process the header parameters
945
+ # process the form parameters
946
+ # process the body parameter
947
+
948
+
949
+ # set the HTTP header `Accept`
950
+ if 'Accept' not in _header_params:
951
+ _header_params['Accept'] = self.api_client.select_header_accept(
952
+ [
953
+ 'application/json'
954
+ ]
955
+ )
956
+
957
+
958
+ # authentication setting
959
+ _auth_settings: List[str] = [
960
+ 'api-key'
961
+ ]
962
+
963
+ return self.api_client.param_serialize(
964
+ method='GET',
965
+ resource_path='/v1/customers/{customerId}/state',
966
+ path_params=_path_params,
967
+ query_params=_query_params,
968
+ header_params=_header_params,
969
+ body=_body_params,
970
+ post_params=_form_params,
971
+ files=_files,
972
+ auth_settings=_auth_settings,
973
+ collection_formats=_collection_formats,
974
+ _host=_host,
975
+ _request_auth=_request_auth
976
+ )
977
+
978
+
979
+
980
+
981
+ @validate_call
982
+ def grant_entitlement(
983
+ self,
984
+ environment: StrictStr,
985
+ merchant_account_id: StrictStr,
986
+ grant_entitlement_request: GrantEntitlementRequest,
987
+ 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,
988
+ _request_timeout: Union[
989
+ None,
990
+ Annotated[StrictFloat, Field(gt=0)],
991
+ Tuple[
992
+ Annotated[StrictFloat, Field(gt=0)],
993
+ Annotated[StrictFloat, Field(gt=0)]
994
+ ]
995
+ ] = None,
996
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
997
+ _content_type: Optional[StrictStr] = None,
998
+ _headers: Optional[Dict[StrictStr, Any]] = None,
999
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1000
+ ) -> ApiWriteEnvelope:
1001
+ """Grant a customer entitlement
1002
+
1003
+
1004
+ :param environment: (required)
1005
+ :type environment: str
1006
+ :param merchant_account_id: (required)
1007
+ :type merchant_account_id: str
1008
+ :param grant_entitlement_request: (required)
1009
+ :type grant_entitlement_request: GrantEntitlementRequest
1010
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1011
+ :type idempotency_key: str
1012
+ :param _request_timeout: timeout setting for this request. If one
1013
+ number provided, it will be total request
1014
+ timeout. It can also be a pair (tuple) of
1015
+ (connection, read) timeouts.
1016
+ :type _request_timeout: int, tuple(int, int), optional
1017
+ :param _request_auth: set to override the auth_settings for an a single
1018
+ request; this effectively ignores the
1019
+ authentication in the spec for a single request.
1020
+ :type _request_auth: dict, optional
1021
+ :param _content_type: force content-type for the request.
1022
+ :type _content_type: str, Optional
1023
+ :param _headers: set to override the headers for a single
1024
+ request; this effectively ignores the headers
1025
+ in the spec for a single request.
1026
+ :type _headers: dict, optional
1027
+ :param _host_index: set to override the host_index for a single
1028
+ request; this effectively ignores the host_index
1029
+ in the spec for a single request.
1030
+ :type _host_index: int, optional
1031
+ :return: Returns the result object.
1032
+ """ # noqa: E501
1033
+
1034
+ _param = self._grant_entitlement_serialize(
1035
+ environment=environment,
1036
+ merchant_account_id=merchant_account_id,
1037
+ grant_entitlement_request=grant_entitlement_request,
1038
+ idempotency_key=idempotency_key,
1039
+ _request_auth=_request_auth,
1040
+ _content_type=_content_type,
1041
+ _headers=_headers,
1042
+ _host_index=_host_index
1043
+ )
1044
+
1045
+ _response_types_map: Dict[str, Optional[str]] = {
1046
+ '200': "ApiWriteEnvelope",
1047
+ '400': "ApiError",
1048
+ '401': "ApiError",
1049
+ '409': "ApiError",
1050
+ '422': "ApiError",
1051
+ '429': "ApiError",
1052
+ }
1053
+ response_data = self.api_client.call_api(
1054
+ *_param,
1055
+ _request_timeout=_request_timeout
1056
+ )
1057
+ response_data.read()
1058
+ return self.api_client.response_deserialize(
1059
+ response_data=response_data,
1060
+ response_types_map=_response_types_map,
1061
+ ).data
1062
+
1063
+
1064
+ @validate_call
1065
+ def grant_entitlement_with_http_info(
1066
+ self,
1067
+ environment: StrictStr,
1068
+ merchant_account_id: StrictStr,
1069
+ grant_entitlement_request: GrantEntitlementRequest,
1070
+ 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,
1071
+ _request_timeout: Union[
1072
+ None,
1073
+ Annotated[StrictFloat, Field(gt=0)],
1074
+ Tuple[
1075
+ Annotated[StrictFloat, Field(gt=0)],
1076
+ Annotated[StrictFloat, Field(gt=0)]
1077
+ ]
1078
+ ] = None,
1079
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1080
+ _content_type: Optional[StrictStr] = None,
1081
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1082
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1083
+ ) -> ApiResponse[ApiWriteEnvelope]:
1084
+ """Grant a customer entitlement
1085
+
1086
+
1087
+ :param environment: (required)
1088
+ :type environment: str
1089
+ :param merchant_account_id: (required)
1090
+ :type merchant_account_id: str
1091
+ :param grant_entitlement_request: (required)
1092
+ :type grant_entitlement_request: GrantEntitlementRequest
1093
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1094
+ :type idempotency_key: str
1095
+ :param _request_timeout: timeout setting for this request. If one
1096
+ number provided, it will be total request
1097
+ timeout. It can also be a pair (tuple) of
1098
+ (connection, read) timeouts.
1099
+ :type _request_timeout: int, tuple(int, int), optional
1100
+ :param _request_auth: set to override the auth_settings for an a single
1101
+ request; this effectively ignores the
1102
+ authentication in the spec for a single request.
1103
+ :type _request_auth: dict, optional
1104
+ :param _content_type: force content-type for the request.
1105
+ :type _content_type: str, Optional
1106
+ :param _headers: set to override the headers for a single
1107
+ request; this effectively ignores the headers
1108
+ in the spec for a single request.
1109
+ :type _headers: dict, optional
1110
+ :param _host_index: set to override the host_index for a single
1111
+ request; this effectively ignores the host_index
1112
+ in the spec for a single request.
1113
+ :type _host_index: int, optional
1114
+ :return: Returns the result object.
1115
+ """ # noqa: E501
1116
+
1117
+ _param = self._grant_entitlement_serialize(
1118
+ environment=environment,
1119
+ merchant_account_id=merchant_account_id,
1120
+ grant_entitlement_request=grant_entitlement_request,
1121
+ idempotency_key=idempotency_key,
1122
+ _request_auth=_request_auth,
1123
+ _content_type=_content_type,
1124
+ _headers=_headers,
1125
+ _host_index=_host_index
1126
+ )
1127
+
1128
+ _response_types_map: Dict[str, Optional[str]] = {
1129
+ '200': "ApiWriteEnvelope",
1130
+ '400': "ApiError",
1131
+ '401': "ApiError",
1132
+ '409': "ApiError",
1133
+ '422': "ApiError",
1134
+ '429': "ApiError",
1135
+ }
1136
+ response_data = self.api_client.call_api(
1137
+ *_param,
1138
+ _request_timeout=_request_timeout
1139
+ )
1140
+ response_data.read()
1141
+ return self.api_client.response_deserialize(
1142
+ response_data=response_data,
1143
+ response_types_map=_response_types_map,
1144
+ )
1145
+
1146
+
1147
+ @validate_call
1148
+ def grant_entitlement_without_preload_content(
1149
+ self,
1150
+ environment: StrictStr,
1151
+ merchant_account_id: StrictStr,
1152
+ grant_entitlement_request: GrantEntitlementRequest,
1153
+ 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,
1154
+ _request_timeout: Union[
1155
+ None,
1156
+ Annotated[StrictFloat, Field(gt=0)],
1157
+ Tuple[
1158
+ Annotated[StrictFloat, Field(gt=0)],
1159
+ Annotated[StrictFloat, Field(gt=0)]
1160
+ ]
1161
+ ] = None,
1162
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1163
+ _content_type: Optional[StrictStr] = None,
1164
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1165
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1166
+ ) -> RESTResponseType:
1167
+ """Grant a customer entitlement
1168
+
1169
+
1170
+ :param environment: (required)
1171
+ :type environment: str
1172
+ :param merchant_account_id: (required)
1173
+ :type merchant_account_id: str
1174
+ :param grant_entitlement_request: (required)
1175
+ :type grant_entitlement_request: GrantEntitlementRequest
1176
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1177
+ :type idempotency_key: str
1178
+ :param _request_timeout: timeout setting for this request. If one
1179
+ number provided, it will be total request
1180
+ timeout. It can also be a pair (tuple) of
1181
+ (connection, read) timeouts.
1182
+ :type _request_timeout: int, tuple(int, int), optional
1183
+ :param _request_auth: set to override the auth_settings for an a single
1184
+ request; this effectively ignores the
1185
+ authentication in the spec for a single request.
1186
+ :type _request_auth: dict, optional
1187
+ :param _content_type: force content-type for the request.
1188
+ :type _content_type: str, Optional
1189
+ :param _headers: set to override the headers for a single
1190
+ request; this effectively ignores the headers
1191
+ in the spec for a single request.
1192
+ :type _headers: dict, optional
1193
+ :param _host_index: set to override the host_index for a single
1194
+ request; this effectively ignores the host_index
1195
+ in the spec for a single request.
1196
+ :type _host_index: int, optional
1197
+ :return: Returns the result object.
1198
+ """ # noqa: E501
1199
+
1200
+ _param = self._grant_entitlement_serialize(
1201
+ environment=environment,
1202
+ merchant_account_id=merchant_account_id,
1203
+ grant_entitlement_request=grant_entitlement_request,
1204
+ idempotency_key=idempotency_key,
1205
+ _request_auth=_request_auth,
1206
+ _content_type=_content_type,
1207
+ _headers=_headers,
1208
+ _host_index=_host_index
1209
+ )
1210
+
1211
+ _response_types_map: Dict[str, Optional[str]] = {
1212
+ '200': "ApiWriteEnvelope",
1213
+ '400': "ApiError",
1214
+ '401': "ApiError",
1215
+ '409': "ApiError",
1216
+ '422': "ApiError",
1217
+ '429': "ApiError",
1218
+ }
1219
+ response_data = self.api_client.call_api(
1220
+ *_param,
1221
+ _request_timeout=_request_timeout
1222
+ )
1223
+ return response_data.response
1224
+
1225
+
1226
+ def _grant_entitlement_serialize(
1227
+ self,
1228
+ environment,
1229
+ merchant_account_id,
1230
+ grant_entitlement_request,
1231
+ idempotency_key,
1232
+ _request_auth,
1233
+ _content_type,
1234
+ _headers,
1235
+ _host_index,
1236
+ ) -> RequestSerialized:
1237
+
1238
+ _host = None
1239
+
1240
+ _collection_formats: Dict[str, str] = {
1241
+ }
1242
+
1243
+ _path_params: Dict[str, str] = {}
1244
+ _query_params: List[Tuple[str, str]] = []
1245
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1246
+ _form_params: List[Tuple[str, str]] = []
1247
+ _files: Dict[
1248
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1249
+ ] = {}
1250
+ _body_params: Optional[bytes] = None
1251
+
1252
+ # process the path parameters
1253
+ # process the query parameters
1254
+ if environment is not None:
1255
+
1256
+ _query_params.append(('environment', environment))
1257
+
1258
+ if merchant_account_id is not None:
1259
+
1260
+ _query_params.append(('merchantAccountId', merchant_account_id))
1261
+
1262
+ # process the header parameters
1263
+ if idempotency_key is not None:
1264
+ _header_params['Idempotency-Key'] = idempotency_key
1265
+ # process the form parameters
1266
+ # process the body parameter
1267
+ if grant_entitlement_request is not None:
1268
+ _body_params = grant_entitlement_request
1269
+
1270
+
1271
+ # set the HTTP header `Accept`
1272
+ if 'Accept' not in _header_params:
1273
+ _header_params['Accept'] = self.api_client.select_header_accept(
1274
+ [
1275
+ 'application/json'
1276
+ ]
1277
+ )
1278
+
1279
+ # set the HTTP header `Content-Type`
1280
+ if _content_type:
1281
+ _header_params['Content-Type'] = _content_type
1282
+ else:
1283
+ _default_content_type = (
1284
+ self.api_client.select_header_content_type(
1285
+ [
1286
+ 'application/json'
1287
+ ]
1288
+ )
1289
+ )
1290
+ if _default_content_type is not None:
1291
+ _header_params['Content-Type'] = _default_content_type
1292
+
1293
+ # authentication setting
1294
+ _auth_settings: List[str] = [
1295
+ 'api-key'
1296
+ ]
1297
+
1298
+ return self.api_client.param_serialize(
1299
+ method='POST',
1300
+ resource_path='/v1/entitlements/grant',
1301
+ path_params=_path_params,
1302
+ query_params=_query_params,
1303
+ header_params=_header_params,
1304
+ body=_body_params,
1305
+ post_params=_form_params,
1306
+ files=_files,
1307
+ auth_settings=_auth_settings,
1308
+ collection_formats=_collection_formats,
1309
+ _host=_host,
1310
+ _request_auth=_request_auth
1311
+ )
1312
+
1313
+
1314
+
1315
+
1316
+ @validate_call
1317
+ def revoke_entitlement(
1318
+ self,
1319
+ environment: StrictStr,
1320
+ merchant_account_id: StrictStr,
1321
+ revoke_entitlement_request: RevokeEntitlementRequest,
1322
+ 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,
1323
+ _request_timeout: Union[
1324
+ None,
1325
+ Annotated[StrictFloat, Field(gt=0)],
1326
+ Tuple[
1327
+ Annotated[StrictFloat, Field(gt=0)],
1328
+ Annotated[StrictFloat, Field(gt=0)]
1329
+ ]
1330
+ ] = None,
1331
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1332
+ _content_type: Optional[StrictStr] = None,
1333
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1334
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1335
+ ) -> ApiWriteEnvelope:
1336
+ """Revoke a customer entitlement
1337
+
1338
+
1339
+ :param environment: (required)
1340
+ :type environment: str
1341
+ :param merchant_account_id: (required)
1342
+ :type merchant_account_id: str
1343
+ :param revoke_entitlement_request: (required)
1344
+ :type revoke_entitlement_request: RevokeEntitlementRequest
1345
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1346
+ :type idempotency_key: str
1347
+ :param _request_timeout: timeout setting for this request. If one
1348
+ number provided, it will be total request
1349
+ timeout. It can also be a pair (tuple) of
1350
+ (connection, read) timeouts.
1351
+ :type _request_timeout: int, tuple(int, int), optional
1352
+ :param _request_auth: set to override the auth_settings for an a single
1353
+ request; this effectively ignores the
1354
+ authentication in the spec for a single request.
1355
+ :type _request_auth: dict, optional
1356
+ :param _content_type: force content-type for the request.
1357
+ :type _content_type: str, Optional
1358
+ :param _headers: set to override the headers for a single
1359
+ request; this effectively ignores the headers
1360
+ in the spec for a single request.
1361
+ :type _headers: dict, optional
1362
+ :param _host_index: set to override the host_index for a single
1363
+ request; this effectively ignores the host_index
1364
+ in the spec for a single request.
1365
+ :type _host_index: int, optional
1366
+ :return: Returns the result object.
1367
+ """ # noqa: E501
1368
+
1369
+ _param = self._revoke_entitlement_serialize(
1370
+ environment=environment,
1371
+ merchant_account_id=merchant_account_id,
1372
+ revoke_entitlement_request=revoke_entitlement_request,
1373
+ idempotency_key=idempotency_key,
1374
+ _request_auth=_request_auth,
1375
+ _content_type=_content_type,
1376
+ _headers=_headers,
1377
+ _host_index=_host_index
1378
+ )
1379
+
1380
+ _response_types_map: Dict[str, Optional[str]] = {
1381
+ '200': "ApiWriteEnvelope",
1382
+ '400': "ApiError",
1383
+ '401': "ApiError",
1384
+ '409': "ApiError",
1385
+ '422': "ApiError",
1386
+ '429': "ApiError",
1387
+ }
1388
+ response_data = self.api_client.call_api(
1389
+ *_param,
1390
+ _request_timeout=_request_timeout
1391
+ )
1392
+ response_data.read()
1393
+ return self.api_client.response_deserialize(
1394
+ response_data=response_data,
1395
+ response_types_map=_response_types_map,
1396
+ ).data
1397
+
1398
+
1399
+ @validate_call
1400
+ def revoke_entitlement_with_http_info(
1401
+ self,
1402
+ environment: StrictStr,
1403
+ merchant_account_id: StrictStr,
1404
+ revoke_entitlement_request: RevokeEntitlementRequest,
1405
+ 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,
1406
+ _request_timeout: Union[
1407
+ None,
1408
+ Annotated[StrictFloat, Field(gt=0)],
1409
+ Tuple[
1410
+ Annotated[StrictFloat, Field(gt=0)],
1411
+ Annotated[StrictFloat, Field(gt=0)]
1412
+ ]
1413
+ ] = None,
1414
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1415
+ _content_type: Optional[StrictStr] = None,
1416
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1417
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1418
+ ) -> ApiResponse[ApiWriteEnvelope]:
1419
+ """Revoke a customer entitlement
1420
+
1421
+
1422
+ :param environment: (required)
1423
+ :type environment: str
1424
+ :param merchant_account_id: (required)
1425
+ :type merchant_account_id: str
1426
+ :param revoke_entitlement_request: (required)
1427
+ :type revoke_entitlement_request: RevokeEntitlementRequest
1428
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1429
+ :type idempotency_key: str
1430
+ :param _request_timeout: timeout setting for this request. If one
1431
+ number provided, it will be total request
1432
+ timeout. It can also be a pair (tuple) of
1433
+ (connection, read) timeouts.
1434
+ :type _request_timeout: int, tuple(int, int), optional
1435
+ :param _request_auth: set to override the auth_settings for an a single
1436
+ request; this effectively ignores the
1437
+ authentication in the spec for a single request.
1438
+ :type _request_auth: dict, optional
1439
+ :param _content_type: force content-type for the request.
1440
+ :type _content_type: str, Optional
1441
+ :param _headers: set to override the headers for a single
1442
+ request; this effectively ignores the headers
1443
+ in the spec for a single request.
1444
+ :type _headers: dict, optional
1445
+ :param _host_index: set to override the host_index for a single
1446
+ request; this effectively ignores the host_index
1447
+ in the spec for a single request.
1448
+ :type _host_index: int, optional
1449
+ :return: Returns the result object.
1450
+ """ # noqa: E501
1451
+
1452
+ _param = self._revoke_entitlement_serialize(
1453
+ environment=environment,
1454
+ merchant_account_id=merchant_account_id,
1455
+ revoke_entitlement_request=revoke_entitlement_request,
1456
+ idempotency_key=idempotency_key,
1457
+ _request_auth=_request_auth,
1458
+ _content_type=_content_type,
1459
+ _headers=_headers,
1460
+ _host_index=_host_index
1461
+ )
1462
+
1463
+ _response_types_map: Dict[str, Optional[str]] = {
1464
+ '200': "ApiWriteEnvelope",
1465
+ '400': "ApiError",
1466
+ '401': "ApiError",
1467
+ '409': "ApiError",
1468
+ '422': "ApiError",
1469
+ '429': "ApiError",
1470
+ }
1471
+ response_data = self.api_client.call_api(
1472
+ *_param,
1473
+ _request_timeout=_request_timeout
1474
+ )
1475
+ response_data.read()
1476
+ return self.api_client.response_deserialize(
1477
+ response_data=response_data,
1478
+ response_types_map=_response_types_map,
1479
+ )
1480
+
1481
+
1482
+ @validate_call
1483
+ def revoke_entitlement_without_preload_content(
1484
+ self,
1485
+ environment: StrictStr,
1486
+ merchant_account_id: StrictStr,
1487
+ revoke_entitlement_request: RevokeEntitlementRequest,
1488
+ 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,
1489
+ _request_timeout: Union[
1490
+ None,
1491
+ Annotated[StrictFloat, Field(gt=0)],
1492
+ Tuple[
1493
+ Annotated[StrictFloat, Field(gt=0)],
1494
+ Annotated[StrictFloat, Field(gt=0)]
1495
+ ]
1496
+ ] = None,
1497
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1498
+ _content_type: Optional[StrictStr] = None,
1499
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1500
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1501
+ ) -> RESTResponseType:
1502
+ """Revoke a customer entitlement
1503
+
1504
+
1505
+ :param environment: (required)
1506
+ :type environment: str
1507
+ :param merchant_account_id: (required)
1508
+ :type merchant_account_id: str
1509
+ :param revoke_entitlement_request: (required)
1510
+ :type revoke_entitlement_request: RevokeEntitlementRequest
1511
+ :param idempotency_key: Required for production-safe retries on mutating routes. Reusing a key with a different request body returns 409.
1512
+ :type idempotency_key: str
1513
+ :param _request_timeout: timeout setting for this request. If one
1514
+ number provided, it will be total request
1515
+ timeout. It can also be a pair (tuple) of
1516
+ (connection, read) timeouts.
1517
+ :type _request_timeout: int, tuple(int, int), optional
1518
+ :param _request_auth: set to override the auth_settings for an a single
1519
+ request; this effectively ignores the
1520
+ authentication in the spec for a single request.
1521
+ :type _request_auth: dict, optional
1522
+ :param _content_type: force content-type for the request.
1523
+ :type _content_type: str, Optional
1524
+ :param _headers: set to override the headers for a single
1525
+ request; this effectively ignores the headers
1526
+ in the spec for a single request.
1527
+ :type _headers: dict, optional
1528
+ :param _host_index: set to override the host_index for a single
1529
+ request; this effectively ignores the host_index
1530
+ in the spec for a single request.
1531
+ :type _host_index: int, optional
1532
+ :return: Returns the result object.
1533
+ """ # noqa: E501
1534
+
1535
+ _param = self._revoke_entitlement_serialize(
1536
+ environment=environment,
1537
+ merchant_account_id=merchant_account_id,
1538
+ revoke_entitlement_request=revoke_entitlement_request,
1539
+ idempotency_key=idempotency_key,
1540
+ _request_auth=_request_auth,
1541
+ _content_type=_content_type,
1542
+ _headers=_headers,
1543
+ _host_index=_host_index
1544
+ )
1545
+
1546
+ _response_types_map: Dict[str, Optional[str]] = {
1547
+ '200': "ApiWriteEnvelope",
1548
+ '400': "ApiError",
1549
+ '401': "ApiError",
1550
+ '409': "ApiError",
1551
+ '422': "ApiError",
1552
+ '429': "ApiError",
1553
+ }
1554
+ response_data = self.api_client.call_api(
1555
+ *_param,
1556
+ _request_timeout=_request_timeout
1557
+ )
1558
+ return response_data.response
1559
+
1560
+
1561
+ def _revoke_entitlement_serialize(
1562
+ self,
1563
+ environment,
1564
+ merchant_account_id,
1565
+ revoke_entitlement_request,
1566
+ idempotency_key,
1567
+ _request_auth,
1568
+ _content_type,
1569
+ _headers,
1570
+ _host_index,
1571
+ ) -> RequestSerialized:
1572
+
1573
+ _host = None
1574
+
1575
+ _collection_formats: Dict[str, str] = {
1576
+ }
1577
+
1578
+ _path_params: Dict[str, str] = {}
1579
+ _query_params: List[Tuple[str, str]] = []
1580
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1581
+ _form_params: List[Tuple[str, str]] = []
1582
+ _files: Dict[
1583
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1584
+ ] = {}
1585
+ _body_params: Optional[bytes] = None
1586
+
1587
+ # process the path parameters
1588
+ # process the query parameters
1589
+ if environment is not None:
1590
+
1591
+ _query_params.append(('environment', environment))
1592
+
1593
+ if merchant_account_id is not None:
1594
+
1595
+ _query_params.append(('merchantAccountId', merchant_account_id))
1596
+
1597
+ # process the header parameters
1598
+ if idempotency_key is not None:
1599
+ _header_params['Idempotency-Key'] = idempotency_key
1600
+ # process the form parameters
1601
+ # process the body parameter
1602
+ if revoke_entitlement_request is not None:
1603
+ _body_params = revoke_entitlement_request
1604
+
1605
+
1606
+ # set the HTTP header `Accept`
1607
+ if 'Accept' not in _header_params:
1608
+ _header_params['Accept'] = self.api_client.select_header_accept(
1609
+ [
1610
+ 'application/json'
1611
+ ]
1612
+ )
1613
+
1614
+ # set the HTTP header `Content-Type`
1615
+ if _content_type:
1616
+ _header_params['Content-Type'] = _content_type
1617
+ else:
1618
+ _default_content_type = (
1619
+ self.api_client.select_header_content_type(
1620
+ [
1621
+ 'application/json'
1622
+ ]
1623
+ )
1624
+ )
1625
+ if _default_content_type is not None:
1626
+ _header_params['Content-Type'] = _default_content_type
1627
+
1628
+ # authentication setting
1629
+ _auth_settings: List[str] = [
1630
+ 'api-key'
1631
+ ]
1632
+
1633
+ return self.api_client.param_serialize(
1634
+ method='POST',
1635
+ resource_path='/v1/entitlements/revoke',
1636
+ path_params=_path_params,
1637
+ query_params=_query_params,
1638
+ header_params=_header_params,
1639
+ body=_body_params,
1640
+ post_params=_form_params,
1641
+ files=_files,
1642
+ auth_settings=_auth_settings,
1643
+ collection_formats=_collection_formats,
1644
+ _host=_host,
1645
+ _request_auth=_request_auth
1646
+ )