astrada.sandbox
Astrada Sandbox API
Calls that exist in the sandbox only: simulated transactions and network ingestion, and deletes for clearing test data. Production has none of them.
The version of the OpenAPI document: 2024-02-28 Contact: developer@astrada.co Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
1# coding: utf-8 2 3# flake8: noqa 4 5""" 6 Astrada Sandbox API 7 8 Calls that exist in the sandbox only: simulated transactions and network ingestion, and deletes for clearing test data. Production has none of them. 9 10 The version of the OpenAPI document: 2024-02-28 11 Contact: developer@astrada.co 12 Generated by OpenAPI Generator (https://openapi-generator.tech) 13 14 Do not edit the class manually. 15""" # noqa: E501 16 17 18__version__ = "2.0.0" 19 20# Define package exports 21__all__ = [ 22 "CardSubscriptionApi", 23 "NetworkBulkFeedsApi", 24 "SandboxSimulationApi", 25 "SubaccountsApi", 26 "ApiResponse", 27 "ApiClient", 28 "Configuration", 29 "AuthenticationClient", 30 "AccessToken", 31 "OpenApiException", 32 "ApiTypeError", 33 "ApiValueError", 34 "ApiKeyError", 35 "ApiAttributeError", 36 "ApiException", 37 "AuthenticationError", 38 "ApiConnectionError", 39 "RateLimitError", 40 "SandboxOnlyError", 41 "ScopeRequiredError", 42 "BadRequestException", 43 "UnauthorizedException", 44 "ForbiddenException", 45 "NotFoundException", 46 "ConflictException", 47 "UnprocessableEntityException", 48 "ServiceException", 49 "Conflict", 50 "Problem", 51 "SimulateBulkFeedFileGlRequest", 52 "SimulateBulkFeedFileSmartdataRequest", 53 "SimulateBulkFeedFileVbdsRequest", 54 "SimulateBulkFeedFileVcfRequest", 55 "SimulateTransactionAccepted", 56 "SimulateTransactionMessageRequest", 57 "SimulateTransactionRequest", 58 "SimulateTransactionRequestMerchant", 59 "SimulateTransactionScenarioAccepted", 60 "SimulateTransactionScenarioRequest", 61 "SimulateTransactionScenarioTransaction", 62 "ValidationProblem", 63 "ValidationProblemItem", 64] 65 66# import apis into sdk package 67from astrada.sandbox.api.card_subscription_api import CardSubscriptionApi as CardSubscriptionApi 68from astrada.sandbox.api.network_bulk_feeds_api import NetworkBulkFeedsApi as NetworkBulkFeedsApi 69from astrada.sandbox.api.sandbox_simulation_api import SandboxSimulationApi as SandboxSimulationApi 70from astrada.sandbox.api.subaccounts_api import SubaccountsApi as SubaccountsApi 71 72# import ApiClient 73from astrada.sandbox.api_response import ApiResponse as ApiResponse 74from astrada.sandbox.api_client import ApiClient as ApiClient 75from astrada.sandbox.configuration import Configuration as Configuration 76from astrada.auth_client import AuthenticationClient as AuthenticationClient 77from astrada.auth_client import AccessToken as AccessToken 78from astrada.environments import Environment as Environment 79from astrada.sandbox.exceptions import OpenApiException as OpenApiException 80from astrada.sandbox.exceptions import ApiTypeError as ApiTypeError 81from astrada.sandbox.exceptions import ApiValueError as ApiValueError 82from astrada.sandbox.exceptions import ApiKeyError as ApiKeyError 83from astrada.sandbox.exceptions import ApiAttributeError as ApiAttributeError 84from astrada.sandbox.exceptions import ApiException as ApiException 85from astrada.sandbox.exceptions import AuthenticationError as AuthenticationError 86from astrada.sandbox.exceptions import ApiConnectionError as ApiConnectionError 87from astrada.sandbox.exceptions import RateLimitError as RateLimitError 88from astrada.sandbox.exceptions import SandboxOnlyError as SandboxOnlyError 89from astrada.sandbox.exceptions import ScopeRequiredError as ScopeRequiredError 90from astrada.sandbox.exceptions import BadRequestException as BadRequestException 91from astrada.sandbox.exceptions import UnauthorizedException as UnauthorizedException 92from astrada.sandbox.exceptions import ForbiddenException as ForbiddenException 93from astrada.sandbox.exceptions import NotFoundException as NotFoundException 94from astrada.sandbox.exceptions import ConflictException as ConflictException 95from astrada.sandbox.exceptions import UnprocessableEntityException as UnprocessableEntityException 96from astrada.sandbox.exceptions import ServiceException as ServiceException 97 98# import models into sdk package 99from astrada.sandbox.models.conflict import Conflict as Conflict 100from astrada.sandbox.models.problem import Problem as Problem 101from astrada.sandbox.models.simulate_bulk_feed_file_gl_request import SimulateBulkFeedFileGlRequest as SimulateBulkFeedFileGlRequest 102from astrada.sandbox.models.simulate_bulk_feed_file_smartdata_request import SimulateBulkFeedFileSmartdataRequest as SimulateBulkFeedFileSmartdataRequest 103from astrada.sandbox.models.simulate_bulk_feed_file_vbds_request import SimulateBulkFeedFileVbdsRequest as SimulateBulkFeedFileVbdsRequest 104from astrada.sandbox.models.simulate_bulk_feed_file_vcf_request import SimulateBulkFeedFileVcfRequest as SimulateBulkFeedFileVcfRequest 105from astrada.sandbox.models.simulate_transaction_accepted import SimulateTransactionAccepted as SimulateTransactionAccepted 106from astrada.sandbox.models.simulate_transaction_message_request import SimulateTransactionMessageRequest as SimulateTransactionMessageRequest 107from astrada.sandbox.models.simulate_transaction_request import SimulateTransactionRequest as SimulateTransactionRequest 108from astrada.sandbox.models.simulate_transaction_request_merchant import SimulateTransactionRequestMerchant as SimulateTransactionRequestMerchant 109from astrada.sandbox.models.simulate_transaction_scenario_accepted import SimulateTransactionScenarioAccepted as SimulateTransactionScenarioAccepted 110from astrada.sandbox.models.simulate_transaction_scenario_request import SimulateTransactionScenarioRequest as SimulateTransactionScenarioRequest 111from astrada.sandbox.models.simulate_transaction_scenario_transaction import SimulateTransactionScenarioTransaction as SimulateTransactionScenarioTransaction 112from astrada.sandbox.models.validation_problem import ValidationProblem as ValidationProblem 113from astrada.sandbox.models.validation_problem_item import ValidationProblemItem as ValidationProblemItem
28class CardSubscriptionApi: 29 """NOTE: This class is auto generated by OpenAPI Generator 30 Ref: https://openapi-generator.tech 31 32 Do not edit the class manually. 33 """ 34 35 def __init__(self, api_client=None) -> None: 36 if api_client is None: 37 api_client = ApiClient.get_default() 38 self.api_client = api_client 39 40 41 @validate_call 42 def delete_card_subscription( 43 self, 44 subscription_id: UUID, 45 _request_timeout: Union[ 46 None, 47 Annotated[StrictFloat, Field(gt=0)], 48 Tuple[ 49 Annotated[StrictFloat, Field(gt=0)], 50 Annotated[StrictFloat, Field(gt=0)] 51 ] 52 ] = None, 53 _request_auth: Optional[Dict[StrictStr, Any]] = None, 54 _content_type: Optional[StrictStr] = None, 55 _headers: Optional[Dict[StrictStr, Any]] = None, 56 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 57 ) -> None: 58 """Delete card subscription (sandbox only) 59 60 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 61 62 :param subscription_id: (required) 63 :type subscription_id: str 64 :param _request_timeout: timeout setting for this request. If one 65 number provided, it will be total request 66 timeout. It can also be a pair (tuple) of 67 (connection, read) timeouts. 68 :type _request_timeout: int, tuple(int, int), optional 69 :param _request_auth: set to override the auth_settings for an a single 70 request; this effectively ignores the 71 authentication in the spec for a single request. 72 :type _request_auth: dict, optional 73 :param _content_type: force content-type for the request. 74 :type _content_type: str, Optional 75 :param _headers: set to override the headers for a single 76 request; this effectively ignores the headers 77 in the spec for a single request. 78 :type _headers: dict, optional 79 :param _host_index: set to override the host_index for a single 80 request; this effectively ignores the host_index 81 in the spec for a single request. 82 :type _host_index: int, optional 83 :return: Returns the result object. 84 """ # noqa: E501 85 86 _param = self._delete_card_subscription_serialize( 87 subscription_id=subscription_id, 88 _request_auth=_request_auth, 89 _content_type=_content_type, 90 _headers=_headers, 91 _host_index=_host_index 92 ) 93 94 _response_types_map: Dict[str, Optional[str]] = { 95 '204': None, 96 '400': "ValidationProblem", 97 '401': "Problem", 98 '403': "Problem", 99 '404': "Problem", 100 '500': "Problem", 101 '502': "Problem", 102 } 103 response_data = self.api_client.call_api( 104 *_param, 105 _request_timeout=_request_timeout 106 ) 107 response_data.read() 108 return self.api_client.response_deserialize( 109 response_data=response_data, 110 response_types_map=_response_types_map, 111 ).data 112 113 114 @validate_call 115 def delete_card_subscription_with_http_info( 116 self, 117 subscription_id: UUID, 118 _request_timeout: Union[ 119 None, 120 Annotated[StrictFloat, Field(gt=0)], 121 Tuple[ 122 Annotated[StrictFloat, Field(gt=0)], 123 Annotated[StrictFloat, Field(gt=0)] 124 ] 125 ] = None, 126 _request_auth: Optional[Dict[StrictStr, Any]] = None, 127 _content_type: Optional[StrictStr] = None, 128 _headers: Optional[Dict[StrictStr, Any]] = None, 129 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 130 ) -> ApiResponse[None]: 131 """Delete card subscription (sandbox only) 132 133 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 134 135 :param subscription_id: (required) 136 :type subscription_id: str 137 :param _request_timeout: timeout setting for this request. If one 138 number provided, it will be total request 139 timeout. It can also be a pair (tuple) of 140 (connection, read) timeouts. 141 :type _request_timeout: int, tuple(int, int), optional 142 :param _request_auth: set to override the auth_settings for an a single 143 request; this effectively ignores the 144 authentication in the spec for a single request. 145 :type _request_auth: dict, optional 146 :param _content_type: force content-type for the request. 147 :type _content_type: str, Optional 148 :param _headers: set to override the headers for a single 149 request; this effectively ignores the headers 150 in the spec for a single request. 151 :type _headers: dict, optional 152 :param _host_index: set to override the host_index for a single 153 request; this effectively ignores the host_index 154 in the spec for a single request. 155 :type _host_index: int, optional 156 :return: Returns the result object. 157 """ # noqa: E501 158 159 _param = self._delete_card_subscription_serialize( 160 subscription_id=subscription_id, 161 _request_auth=_request_auth, 162 _content_type=_content_type, 163 _headers=_headers, 164 _host_index=_host_index 165 ) 166 167 _response_types_map: Dict[str, Optional[str]] = { 168 '204': None, 169 '400': "ValidationProblem", 170 '401': "Problem", 171 '403': "Problem", 172 '404': "Problem", 173 '500': "Problem", 174 '502': "Problem", 175 } 176 response_data = self.api_client.call_api( 177 *_param, 178 _request_timeout=_request_timeout 179 ) 180 response_data.read() 181 return self.api_client.response_deserialize( 182 response_data=response_data, 183 response_types_map=_response_types_map, 184 ) 185 186 187 @validate_call 188 def delete_card_subscription_without_preload_content( 189 self, 190 subscription_id: UUID, 191 _request_timeout: Union[ 192 None, 193 Annotated[StrictFloat, Field(gt=0)], 194 Tuple[ 195 Annotated[StrictFloat, Field(gt=0)], 196 Annotated[StrictFloat, Field(gt=0)] 197 ] 198 ] = None, 199 _request_auth: Optional[Dict[StrictStr, Any]] = None, 200 _content_type: Optional[StrictStr] = None, 201 _headers: Optional[Dict[StrictStr, Any]] = None, 202 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 203 ) -> RESTResponseType: 204 """Delete card subscription (sandbox only) 205 206 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 207 208 :param subscription_id: (required) 209 :type subscription_id: str 210 :param _request_timeout: timeout setting for this request. If one 211 number provided, it will be total request 212 timeout. It can also be a pair (tuple) of 213 (connection, read) timeouts. 214 :type _request_timeout: int, tuple(int, int), optional 215 :param _request_auth: set to override the auth_settings for an a single 216 request; this effectively ignores the 217 authentication in the spec for a single request. 218 :type _request_auth: dict, optional 219 :param _content_type: force content-type for the request. 220 :type _content_type: str, Optional 221 :param _headers: set to override the headers for a single 222 request; this effectively ignores the headers 223 in the spec for a single request. 224 :type _headers: dict, optional 225 :param _host_index: set to override the host_index for a single 226 request; this effectively ignores the host_index 227 in the spec for a single request. 228 :type _host_index: int, optional 229 :return: Returns the result object. 230 """ # noqa: E501 231 232 _param = self._delete_card_subscription_serialize( 233 subscription_id=subscription_id, 234 _request_auth=_request_auth, 235 _content_type=_content_type, 236 _headers=_headers, 237 _host_index=_host_index 238 ) 239 240 _response_types_map: Dict[str, Optional[str]] = { 241 '204': None, 242 '400': "ValidationProblem", 243 '401': "Problem", 244 '403': "Problem", 245 '404': "Problem", 246 '500': "Problem", 247 '502': "Problem", 248 } 249 response_data = self.api_client.call_api( 250 *_param, 251 _request_timeout=_request_timeout 252 ) 253 return response_data.response 254 255 256 def _delete_card_subscription_serialize( 257 self, 258 subscription_id, 259 _request_auth, 260 _content_type, 261 _headers, 262 _host_index, 263 ) -> RequestSerialized: 264 265 _host = None 266 267 _collection_formats: Dict[str, str] = { 268 } 269 270 _path_params: Dict[str, str] = {} 271 _query_params: List[Tuple[str, str]] = [] 272 _header_params: Dict[str, Optional[str]] = _headers or {} 273 _form_params: List[Tuple[str, str]] = [] 274 _files: Dict[ 275 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 276 ] = {} 277 _body_params: Optional[bytes] = None 278 279 # process the path parameters 280 if subscription_id is not None: 281 _path_params['subscriptionId'] = subscription_id 282 # process the query parameters 283 # process the header parameters 284 # process the form parameters 285 # process the body parameter 286 287 288 # set the HTTP header `Accept` 289 if 'Accept' not in _header_params: 290 _header_params['Accept'] = self.api_client.select_header_accept( 291 [ 292 'application/problem+json' 293 ] 294 ) 295 296 297 # authentication setting 298 _auth_settings: List[str] = [ 299 'main-auth' 300 ] 301 302 return self.api_client.param_serialize( 303 method='DELETE', 304 resource_path='/card-subscriptions/{subscriptionId}', 305 path_params=_path_params, 306 query_params=_query_params, 307 header_params=_header_params, 308 body=_body_params, 309 post_params=_form_params, 310 files=_files, 311 auth_settings=_auth_settings, 312 collection_formats=_collection_formats, 313 _host=_host, 314 _request_auth=_request_auth 315 )
NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech
Do not edit the class manually.
41 @validate_call 42 def delete_card_subscription( 43 self, 44 subscription_id: UUID, 45 _request_timeout: Union[ 46 None, 47 Annotated[StrictFloat, Field(gt=0)], 48 Tuple[ 49 Annotated[StrictFloat, Field(gt=0)], 50 Annotated[StrictFloat, Field(gt=0)] 51 ] 52 ] = None, 53 _request_auth: Optional[Dict[StrictStr, Any]] = None, 54 _content_type: Optional[StrictStr] = None, 55 _headers: Optional[Dict[StrictStr, Any]] = None, 56 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 57 ) -> None: 58 """Delete card subscription (sandbox only) 59 60 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 61 62 :param subscription_id: (required) 63 :type subscription_id: str 64 :param _request_timeout: timeout setting for this request. If one 65 number provided, it will be total request 66 timeout. It can also be a pair (tuple) of 67 (connection, read) timeouts. 68 :type _request_timeout: int, tuple(int, int), optional 69 :param _request_auth: set to override the auth_settings for an a single 70 request; this effectively ignores the 71 authentication in the spec for a single request. 72 :type _request_auth: dict, optional 73 :param _content_type: force content-type for the request. 74 :type _content_type: str, Optional 75 :param _headers: set to override the headers for a single 76 request; this effectively ignores the headers 77 in the spec for a single request. 78 :type _headers: dict, optional 79 :param _host_index: set to override the host_index for a single 80 request; this effectively ignores the host_index 81 in the spec for a single request. 82 :type _host_index: int, optional 83 :return: Returns the result object. 84 """ # noqa: E501 85 86 _param = self._delete_card_subscription_serialize( 87 subscription_id=subscription_id, 88 _request_auth=_request_auth, 89 _content_type=_content_type, 90 _headers=_headers, 91 _host_index=_host_index 92 ) 93 94 _response_types_map: Dict[str, Optional[str]] = { 95 '204': None, 96 '400': "ValidationProblem", 97 '401': "Problem", 98 '403': "Problem", 99 '404': "Problem", 100 '500': "Problem", 101 '502': "Problem", 102 } 103 response_data = self.api_client.call_api( 104 *_param, 105 _request_timeout=_request_timeout 106 ) 107 response_data.read() 108 return self.api_client.response_deserialize( 109 response_data=response_data, 110 response_types_map=_response_types_map, 111 ).data
Delete card subscription (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with PATCH. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- subscription_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
114 @validate_call 115 def delete_card_subscription_with_http_info( 116 self, 117 subscription_id: UUID, 118 _request_timeout: Union[ 119 None, 120 Annotated[StrictFloat, Field(gt=0)], 121 Tuple[ 122 Annotated[StrictFloat, Field(gt=0)], 123 Annotated[StrictFloat, Field(gt=0)] 124 ] 125 ] = None, 126 _request_auth: Optional[Dict[StrictStr, Any]] = None, 127 _content_type: Optional[StrictStr] = None, 128 _headers: Optional[Dict[StrictStr, Any]] = None, 129 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 130 ) -> ApiResponse[None]: 131 """Delete card subscription (sandbox only) 132 133 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 134 135 :param subscription_id: (required) 136 :type subscription_id: str 137 :param _request_timeout: timeout setting for this request. If one 138 number provided, it will be total request 139 timeout. It can also be a pair (tuple) of 140 (connection, read) timeouts. 141 :type _request_timeout: int, tuple(int, int), optional 142 :param _request_auth: set to override the auth_settings for an a single 143 request; this effectively ignores the 144 authentication in the spec for a single request. 145 :type _request_auth: dict, optional 146 :param _content_type: force content-type for the request. 147 :type _content_type: str, Optional 148 :param _headers: set to override the headers for a single 149 request; this effectively ignores the headers 150 in the spec for a single request. 151 :type _headers: dict, optional 152 :param _host_index: set to override the host_index for a single 153 request; this effectively ignores the host_index 154 in the spec for a single request. 155 :type _host_index: int, optional 156 :return: Returns the result object. 157 """ # noqa: E501 158 159 _param = self._delete_card_subscription_serialize( 160 subscription_id=subscription_id, 161 _request_auth=_request_auth, 162 _content_type=_content_type, 163 _headers=_headers, 164 _host_index=_host_index 165 ) 166 167 _response_types_map: Dict[str, Optional[str]] = { 168 '204': None, 169 '400': "ValidationProblem", 170 '401': "Problem", 171 '403': "Problem", 172 '404': "Problem", 173 '500': "Problem", 174 '502': "Problem", 175 } 176 response_data = self.api_client.call_api( 177 *_param, 178 _request_timeout=_request_timeout 179 ) 180 response_data.read() 181 return self.api_client.response_deserialize( 182 response_data=response_data, 183 response_types_map=_response_types_map, 184 )
Delete card subscription (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with PATCH. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- subscription_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
187 @validate_call 188 def delete_card_subscription_without_preload_content( 189 self, 190 subscription_id: UUID, 191 _request_timeout: Union[ 192 None, 193 Annotated[StrictFloat, Field(gt=0)], 194 Tuple[ 195 Annotated[StrictFloat, Field(gt=0)], 196 Annotated[StrictFloat, Field(gt=0)] 197 ] 198 ] = None, 199 _request_auth: Optional[Dict[StrictStr, Any]] = None, 200 _content_type: Optional[StrictStr] = None, 201 _headers: Optional[Dict[StrictStr, Any]] = None, 202 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 203 ) -> RESTResponseType: 204 """Delete card subscription (sandbox only) 205 206 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 207 208 :param subscription_id: (required) 209 :type subscription_id: str 210 :param _request_timeout: timeout setting for this request. If one 211 number provided, it will be total request 212 timeout. It can also be a pair (tuple) of 213 (connection, read) timeouts. 214 :type _request_timeout: int, tuple(int, int), optional 215 :param _request_auth: set to override the auth_settings for an a single 216 request; this effectively ignores the 217 authentication in the spec for a single request. 218 :type _request_auth: dict, optional 219 :param _content_type: force content-type for the request. 220 :type _content_type: str, Optional 221 :param _headers: set to override the headers for a single 222 request; this effectively ignores the headers 223 in the spec for a single request. 224 :type _headers: dict, optional 225 :param _host_index: set to override the host_index for a single 226 request; this effectively ignores the host_index 227 in the spec for a single request. 228 :type _host_index: int, optional 229 :return: Returns the result object. 230 """ # noqa: E501 231 232 _param = self._delete_card_subscription_serialize( 233 subscription_id=subscription_id, 234 _request_auth=_request_auth, 235 _content_type=_content_type, 236 _headers=_headers, 237 _host_index=_host_index 238 ) 239 240 _response_types_map: Dict[str, Optional[str]] = { 241 '204': None, 242 '400': "ValidationProblem", 243 '401': "Problem", 244 '403': "Problem", 245 '404': "Problem", 246 '500': "Problem", 247 '502': "Problem", 248 } 249 response_data = self.api_client.call_api( 250 *_param, 251 _request_timeout=_request_timeout 252 ) 253 return response_data.response
Delete card subscription (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with PATCH. Deletes a card subscription and the data it owns, and cannot be undone. When it is the last subscription on its card, the card, cardholder, stored token and transactions are removed as well. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- subscription_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
28class NetworkBulkFeedsApi: 29 """NOTE: This class is auto generated by OpenAPI Generator 30 Ref: https://openapi-generator.tech 31 32 Do not edit the class manually. 33 """ 34 35 def __init__(self, api_client=None) -> None: 36 if api_client is None: 37 api_client = ApiClient.get_default() 38 self.api_client = api_client 39 40 41 @validate_call 42 def delete_network_bulk_feed( 43 self, 44 network_bulk_feed_id: UUID, 45 _request_timeout: Union[ 46 None, 47 Annotated[StrictFloat, Field(gt=0)], 48 Tuple[ 49 Annotated[StrictFloat, Field(gt=0)], 50 Annotated[StrictFloat, Field(gt=0)] 51 ] 52 ] = None, 53 _request_auth: Optional[Dict[StrictStr, Any]] = None, 54 _content_type: Optional[StrictStr] = None, 55 _headers: Optional[Dict[StrictStr, Any]] = None, 56 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 57 ) -> None: 58 """Delete network bulk feed (sandbox only) 59 60 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 61 62 :param network_bulk_feed_id: (required) 63 :type network_bulk_feed_id: str 64 :param _request_timeout: timeout setting for this request. If one 65 number provided, it will be total request 66 timeout. It can also be a pair (tuple) of 67 (connection, read) timeouts. 68 :type _request_timeout: int, tuple(int, int), optional 69 :param _request_auth: set to override the auth_settings for an a single 70 request; this effectively ignores the 71 authentication in the spec for a single request. 72 :type _request_auth: dict, optional 73 :param _content_type: force content-type for the request. 74 :type _content_type: str, Optional 75 :param _headers: set to override the headers for a single 76 request; this effectively ignores the headers 77 in the spec for a single request. 78 :type _headers: dict, optional 79 :param _host_index: set to override the host_index for a single 80 request; this effectively ignores the host_index 81 in the spec for a single request. 82 :type _host_index: int, optional 83 :return: Returns the result object. 84 """ # noqa: E501 85 86 _param = self._delete_network_bulk_feed_serialize( 87 network_bulk_feed_id=network_bulk_feed_id, 88 _request_auth=_request_auth, 89 _content_type=_content_type, 90 _headers=_headers, 91 _host_index=_host_index 92 ) 93 94 _response_types_map: Dict[str, Optional[str]] = { 95 '204': None, 96 '400': "ValidationProblem", 97 '401': "Problem", 98 '403': "Problem", 99 '404': "Problem", 100 '500': "Problem", 101 '502': "Problem", 102 } 103 response_data = self.api_client.call_api( 104 *_param, 105 _request_timeout=_request_timeout 106 ) 107 response_data.read() 108 return self.api_client.response_deserialize( 109 response_data=response_data, 110 response_types_map=_response_types_map, 111 ).data 112 113 114 @validate_call 115 def delete_network_bulk_feed_with_http_info( 116 self, 117 network_bulk_feed_id: UUID, 118 _request_timeout: Union[ 119 None, 120 Annotated[StrictFloat, Field(gt=0)], 121 Tuple[ 122 Annotated[StrictFloat, Field(gt=0)], 123 Annotated[StrictFloat, Field(gt=0)] 124 ] 125 ] = None, 126 _request_auth: Optional[Dict[StrictStr, Any]] = None, 127 _content_type: Optional[StrictStr] = None, 128 _headers: Optional[Dict[StrictStr, Any]] = None, 129 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 130 ) -> ApiResponse[None]: 131 """Delete network bulk feed (sandbox only) 132 133 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 134 135 :param network_bulk_feed_id: (required) 136 :type network_bulk_feed_id: str 137 :param _request_timeout: timeout setting for this request. If one 138 number provided, it will be total request 139 timeout. It can also be a pair (tuple) of 140 (connection, read) timeouts. 141 :type _request_timeout: int, tuple(int, int), optional 142 :param _request_auth: set to override the auth_settings for an a single 143 request; this effectively ignores the 144 authentication in the spec for a single request. 145 :type _request_auth: dict, optional 146 :param _content_type: force content-type for the request. 147 :type _content_type: str, Optional 148 :param _headers: set to override the headers for a single 149 request; this effectively ignores the headers 150 in the spec for a single request. 151 :type _headers: dict, optional 152 :param _host_index: set to override the host_index for a single 153 request; this effectively ignores the host_index 154 in the spec for a single request. 155 :type _host_index: int, optional 156 :return: Returns the result object. 157 """ # noqa: E501 158 159 _param = self._delete_network_bulk_feed_serialize( 160 network_bulk_feed_id=network_bulk_feed_id, 161 _request_auth=_request_auth, 162 _content_type=_content_type, 163 _headers=_headers, 164 _host_index=_host_index 165 ) 166 167 _response_types_map: Dict[str, Optional[str]] = { 168 '204': None, 169 '400': "ValidationProblem", 170 '401': "Problem", 171 '403': "Problem", 172 '404': "Problem", 173 '500': "Problem", 174 '502': "Problem", 175 } 176 response_data = self.api_client.call_api( 177 *_param, 178 _request_timeout=_request_timeout 179 ) 180 response_data.read() 181 return self.api_client.response_deserialize( 182 response_data=response_data, 183 response_types_map=_response_types_map, 184 ) 185 186 187 @validate_call 188 def delete_network_bulk_feed_without_preload_content( 189 self, 190 network_bulk_feed_id: UUID, 191 _request_timeout: Union[ 192 None, 193 Annotated[StrictFloat, Field(gt=0)], 194 Tuple[ 195 Annotated[StrictFloat, Field(gt=0)], 196 Annotated[StrictFloat, Field(gt=0)] 197 ] 198 ] = None, 199 _request_auth: Optional[Dict[StrictStr, Any]] = None, 200 _content_type: Optional[StrictStr] = None, 201 _headers: Optional[Dict[StrictStr, Any]] = None, 202 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 203 ) -> RESTResponseType: 204 """Delete network bulk feed (sandbox only) 205 206 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 207 208 :param network_bulk_feed_id: (required) 209 :type network_bulk_feed_id: str 210 :param _request_timeout: timeout setting for this request. If one 211 number provided, it will be total request 212 timeout. It can also be a pair (tuple) of 213 (connection, read) timeouts. 214 :type _request_timeout: int, tuple(int, int), optional 215 :param _request_auth: set to override the auth_settings for an a single 216 request; this effectively ignores the 217 authentication in the spec for a single request. 218 :type _request_auth: dict, optional 219 :param _content_type: force content-type for the request. 220 :type _content_type: str, Optional 221 :param _headers: set to override the headers for a single 222 request; this effectively ignores the headers 223 in the spec for a single request. 224 :type _headers: dict, optional 225 :param _host_index: set to override the host_index for a single 226 request; this effectively ignores the host_index 227 in the spec for a single request. 228 :type _host_index: int, optional 229 :return: Returns the result object. 230 """ # noqa: E501 231 232 _param = self._delete_network_bulk_feed_serialize( 233 network_bulk_feed_id=network_bulk_feed_id, 234 _request_auth=_request_auth, 235 _content_type=_content_type, 236 _headers=_headers, 237 _host_index=_host_index 238 ) 239 240 _response_types_map: Dict[str, Optional[str]] = { 241 '204': None, 242 '400': "ValidationProblem", 243 '401': "Problem", 244 '403': "Problem", 245 '404': "Problem", 246 '500': "Problem", 247 '502': "Problem", 248 } 249 response_data = self.api_client.call_api( 250 *_param, 251 _request_timeout=_request_timeout 252 ) 253 return response_data.response 254 255 256 def _delete_network_bulk_feed_serialize( 257 self, 258 network_bulk_feed_id, 259 _request_auth, 260 _content_type, 261 _headers, 262 _host_index, 263 ) -> RequestSerialized: 264 265 _host = None 266 267 _collection_formats: Dict[str, str] = { 268 } 269 270 _path_params: Dict[str, str] = {} 271 _query_params: List[Tuple[str, str]] = [] 272 _header_params: Dict[str, Optional[str]] = _headers or {} 273 _form_params: List[Tuple[str, str]] = [] 274 _files: Dict[ 275 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 276 ] = {} 277 _body_params: Optional[bytes] = None 278 279 # process the path parameters 280 if network_bulk_feed_id is not None: 281 _path_params['networkBulkFeedId'] = network_bulk_feed_id 282 # process the query parameters 283 # process the header parameters 284 # process the form parameters 285 # process the body parameter 286 287 288 # set the HTTP header `Accept` 289 if 'Accept' not in _header_params: 290 _header_params['Accept'] = self.api_client.select_header_accept( 291 [ 292 'application/problem+json' 293 ] 294 ) 295 296 297 # authentication setting 298 _auth_settings: List[str] = [ 299 'main-auth' 300 ] 301 302 return self.api_client.param_serialize( 303 method='DELETE', 304 resource_path='/network-bulk-feeds/{networkBulkFeedId}', 305 path_params=_path_params, 306 query_params=_query_params, 307 header_params=_header_params, 308 body=_body_params, 309 post_params=_form_params, 310 files=_files, 311 auth_settings=_auth_settings, 312 collection_formats=_collection_formats, 313 _host=_host, 314 _request_auth=_request_auth 315 )
NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech
Do not edit the class manually.
41 @validate_call 42 def delete_network_bulk_feed( 43 self, 44 network_bulk_feed_id: UUID, 45 _request_timeout: Union[ 46 None, 47 Annotated[StrictFloat, Field(gt=0)], 48 Tuple[ 49 Annotated[StrictFloat, Field(gt=0)], 50 Annotated[StrictFloat, Field(gt=0)] 51 ] 52 ] = None, 53 _request_auth: Optional[Dict[StrictStr, Any]] = None, 54 _content_type: Optional[StrictStr] = None, 55 _headers: Optional[Dict[StrictStr, Any]] = None, 56 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 57 ) -> None: 58 """Delete network bulk feed (sandbox only) 59 60 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 61 62 :param network_bulk_feed_id: (required) 63 :type network_bulk_feed_id: str 64 :param _request_timeout: timeout setting for this request. If one 65 number provided, it will be total request 66 timeout. It can also be a pair (tuple) of 67 (connection, read) timeouts. 68 :type _request_timeout: int, tuple(int, int), optional 69 :param _request_auth: set to override the auth_settings for an a single 70 request; this effectively ignores the 71 authentication in the spec for a single request. 72 :type _request_auth: dict, optional 73 :param _content_type: force content-type for the request. 74 :type _content_type: str, Optional 75 :param _headers: set to override the headers for a single 76 request; this effectively ignores the headers 77 in the spec for a single request. 78 :type _headers: dict, optional 79 :param _host_index: set to override the host_index for a single 80 request; this effectively ignores the host_index 81 in the spec for a single request. 82 :type _host_index: int, optional 83 :return: Returns the result object. 84 """ # noqa: E501 85 86 _param = self._delete_network_bulk_feed_serialize( 87 network_bulk_feed_id=network_bulk_feed_id, 88 _request_auth=_request_auth, 89 _content_type=_content_type, 90 _headers=_headers, 91 _host_index=_host_index 92 ) 93 94 _response_types_map: Dict[str, Optional[str]] = { 95 '204': None, 96 '400': "ValidationProblem", 97 '401': "Problem", 98 '403': "Problem", 99 '404': "Problem", 100 '500': "Problem", 101 '502': "Problem", 102 } 103 response_data = self.api_client.call_api( 104 *_param, 105 _request_timeout=_request_timeout 106 ) 107 response_data.read() 108 return self.api_client.response_deserialize( 109 response_data=response_data, 110 response_types_map=_response_types_map, 111 ).data
Delete network bulk feed (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- network_bulk_feed_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
114 @validate_call 115 def delete_network_bulk_feed_with_http_info( 116 self, 117 network_bulk_feed_id: UUID, 118 _request_timeout: Union[ 119 None, 120 Annotated[StrictFloat, Field(gt=0)], 121 Tuple[ 122 Annotated[StrictFloat, Field(gt=0)], 123 Annotated[StrictFloat, Field(gt=0)] 124 ] 125 ] = None, 126 _request_auth: Optional[Dict[StrictStr, Any]] = None, 127 _content_type: Optional[StrictStr] = None, 128 _headers: Optional[Dict[StrictStr, Any]] = None, 129 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 130 ) -> ApiResponse[None]: 131 """Delete network bulk feed (sandbox only) 132 133 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 134 135 :param network_bulk_feed_id: (required) 136 :type network_bulk_feed_id: str 137 :param _request_timeout: timeout setting for this request. If one 138 number provided, it will be total request 139 timeout. It can also be a pair (tuple) of 140 (connection, read) timeouts. 141 :type _request_timeout: int, tuple(int, int), optional 142 :param _request_auth: set to override the auth_settings for an a single 143 request; this effectively ignores the 144 authentication in the spec for a single request. 145 :type _request_auth: dict, optional 146 :param _content_type: force content-type for the request. 147 :type _content_type: str, Optional 148 :param _headers: set to override the headers for a single 149 request; this effectively ignores the headers 150 in the spec for a single request. 151 :type _headers: dict, optional 152 :param _host_index: set to override the host_index for a single 153 request; this effectively ignores the host_index 154 in the spec for a single request. 155 :type _host_index: int, optional 156 :return: Returns the result object. 157 """ # noqa: E501 158 159 _param = self._delete_network_bulk_feed_serialize( 160 network_bulk_feed_id=network_bulk_feed_id, 161 _request_auth=_request_auth, 162 _content_type=_content_type, 163 _headers=_headers, 164 _host_index=_host_index 165 ) 166 167 _response_types_map: Dict[str, Optional[str]] = { 168 '204': None, 169 '400': "ValidationProblem", 170 '401': "Problem", 171 '403': "Problem", 172 '404': "Problem", 173 '500': "Problem", 174 '502': "Problem", 175 } 176 response_data = self.api_client.call_api( 177 *_param, 178 _request_timeout=_request_timeout 179 ) 180 response_data.read() 181 return self.api_client.response_deserialize( 182 response_data=response_data, 183 response_types_map=_response_types_map, 184 )
Delete network bulk feed (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- network_bulk_feed_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
187 @validate_call 188 def delete_network_bulk_feed_without_preload_content( 189 self, 190 network_bulk_feed_id: UUID, 191 _request_timeout: Union[ 192 None, 193 Annotated[StrictFloat, Field(gt=0)], 194 Tuple[ 195 Annotated[StrictFloat, Field(gt=0)], 196 Annotated[StrictFloat, Field(gt=0)] 197 ] 198 ] = None, 199 _request_auth: Optional[Dict[StrictStr, Any]] = None, 200 _content_type: Optional[StrictStr] = None, 201 _headers: Optional[Dict[StrictStr, Any]] = None, 202 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 203 ) -> RESTResponseType: 204 """Delete network bulk feed (sandbox only) 205 206 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 207 208 :param network_bulk_feed_id: (required) 209 :type network_bulk_feed_id: str 210 :param _request_timeout: timeout setting for this request. If one 211 number provided, it will be total request 212 timeout. It can also be a pair (tuple) of 213 (connection, read) timeouts. 214 :type _request_timeout: int, tuple(int, int), optional 215 :param _request_auth: set to override the auth_settings for an a single 216 request; this effectively ignores the 217 authentication in the spec for a single request. 218 :type _request_auth: dict, optional 219 :param _content_type: force content-type for the request. 220 :type _content_type: str, Optional 221 :param _headers: set to override the headers for a single 222 request; this effectively ignores the headers 223 in the spec for a single request. 224 :type _headers: dict, optional 225 :param _host_index: set to override the host_index for a single 226 request; this effectively ignores the host_index 227 in the spec for a single request. 228 :type _host_index: int, optional 229 :return: Returns the result object. 230 """ # noqa: E501 231 232 _param = self._delete_network_bulk_feed_serialize( 233 network_bulk_feed_id=network_bulk_feed_id, 234 _request_auth=_request_auth, 235 _content_type=_content_type, 236 _headers=_headers, 237 _host_index=_host_index 238 ) 239 240 _response_types_map: Dict[str, Optional[str]] = { 241 '204': None, 242 '400': "ValidationProblem", 243 '401': "Problem", 244 '403': "Problem", 245 '404': "Problem", 246 '500': "Problem", 247 '502': "Problem", 248 } 249 response_data = self.api_client.call_api( 250 *_param, 251 _request_timeout=_request_timeout 252 ) 253 return response_data.response
Delete network bulk feed (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call. Deletes a network bulk feed and the data it owns, and cannot be undone. The feed stops first, then every card subscription enrolled through it is removed, along with the cards, cardholders, stored tokens and transactions that only those subscriptions used. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- network_bulk_feed_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
37class SandboxSimulationApi: 38 """NOTE: This class is auto generated by OpenAPI Generator 39 Ref: https://openapi-generator.tech 40 41 Do not edit the class manually. 42 """ 43 44 def __init__(self, api_client=None) -> None: 45 if api_client is None: 46 api_client = ApiClient.get_default() 47 self.api_client = api_client 48 49 50 @validate_call 51 def simulate_bulk_feed_file_gl( 52 self, 53 simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest, 54 _request_timeout: Union[ 55 None, 56 Annotated[StrictFloat, Field(gt=0)], 57 Tuple[ 58 Annotated[StrictFloat, Field(gt=0)], 59 Annotated[StrictFloat, Field(gt=0)] 60 ] 61 ] = None, 62 _request_auth: Optional[Dict[StrictStr, Any]] = None, 63 _content_type: Optional[StrictStr] = None, 64 _headers: Optional[Dict[StrictStr, Any]] = None, 65 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 66 ) -> None: 67 """Simulate an American Express bulk file (sandbox only) 68 69 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when `transactionsPerCard` is above `0`, and processes it as if American Express had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. For a feed registered `tokenized` (see `panFormat` on `POST /network-bulk-feeds`), `cardCount` draws American Express network tokens instead of raw card numbers, and `newCardCount` is not supported (there is no tokenized new-card pool). 70 71 :param simulate_bulk_feed_file_gl_request: (required) 72 :type simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest 73 :param _request_timeout: timeout setting for this request. If one 74 number provided, it will be total request 75 timeout. It can also be a pair (tuple) of 76 (connection, read) timeouts. 77 :type _request_timeout: int, tuple(int, int), optional 78 :param _request_auth: set to override the auth_settings for an a single 79 request; this effectively ignores the 80 authentication in the spec for a single request. 81 :type _request_auth: dict, optional 82 :param _content_type: force content-type for the request. 83 :type _content_type: str, Optional 84 :param _headers: set to override the headers for a single 85 request; this effectively ignores the headers 86 in the spec for a single request. 87 :type _headers: dict, optional 88 :param _host_index: set to override the host_index for a single 89 request; this effectively ignores the host_index 90 in the spec for a single request. 91 :type _host_index: int, optional 92 :return: Returns the result object. 93 """ # noqa: E501 94 95 _param = self._simulate_bulk_feed_file_gl_serialize( 96 simulate_bulk_feed_file_gl_request=simulate_bulk_feed_file_gl_request, 97 _request_auth=_request_auth, 98 _content_type=_content_type, 99 _headers=_headers, 100 _host_index=_host_index 101 ) 102 103 _response_types_map: Dict[str, Optional[str]] = { 104 '202': None, 105 '400': "ValidationProblem", 106 '401': "Problem", 107 '403': "Problem", 108 '413': "Problem", 109 '500': "Problem", 110 } 111 response_data = self.api_client.call_api( 112 *_param, 113 _request_timeout=_request_timeout 114 ) 115 response_data.read() 116 return self.api_client.response_deserialize( 117 response_data=response_data, 118 response_types_map=_response_types_map, 119 ).data 120 121 122 @validate_call 123 def simulate_bulk_feed_file_gl_with_http_info( 124 self, 125 simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest, 126 _request_timeout: Union[ 127 None, 128 Annotated[StrictFloat, Field(gt=0)], 129 Tuple[ 130 Annotated[StrictFloat, Field(gt=0)], 131 Annotated[StrictFloat, Field(gt=0)] 132 ] 133 ] = None, 134 _request_auth: Optional[Dict[StrictStr, Any]] = None, 135 _content_type: Optional[StrictStr] = None, 136 _headers: Optional[Dict[StrictStr, Any]] = None, 137 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 138 ) -> ApiResponse[None]: 139 """Simulate an American Express bulk file (sandbox only) 140 141 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when `transactionsPerCard` is above `0`, and processes it as if American Express had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. For a feed registered `tokenized` (see `panFormat` on `POST /network-bulk-feeds`), `cardCount` draws American Express network tokens instead of raw card numbers, and `newCardCount` is not supported (there is no tokenized new-card pool). 142 143 :param simulate_bulk_feed_file_gl_request: (required) 144 :type simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest 145 :param _request_timeout: timeout setting for this request. If one 146 number provided, it will be total request 147 timeout. It can also be a pair (tuple) of 148 (connection, read) timeouts. 149 :type _request_timeout: int, tuple(int, int), optional 150 :param _request_auth: set to override the auth_settings for an a single 151 request; this effectively ignores the 152 authentication in the spec for a single request. 153 :type _request_auth: dict, optional 154 :param _content_type: force content-type for the request. 155 :type _content_type: str, Optional 156 :param _headers: set to override the headers for a single 157 request; this effectively ignores the headers 158 in the spec for a single request. 159 :type _headers: dict, optional 160 :param _host_index: set to override the host_index for a single 161 request; this effectively ignores the host_index 162 in the spec for a single request. 163 :type _host_index: int, optional 164 :return: Returns the result object. 165 """ # noqa: E501 166 167 _param = self._simulate_bulk_feed_file_gl_serialize( 168 simulate_bulk_feed_file_gl_request=simulate_bulk_feed_file_gl_request, 169 _request_auth=_request_auth, 170 _content_type=_content_type, 171 _headers=_headers, 172 _host_index=_host_index 173 ) 174 175 _response_types_map: Dict[str, Optional[str]] = { 176 '202': None, 177 '400': "ValidationProblem", 178 '401': "Problem", 179 '403': "Problem", 180 '413': "Problem", 181 '500': "Problem", 182 } 183 response_data = self.api_client.call_api( 184 *_param, 185 _request_timeout=_request_timeout 186 ) 187 response_data.read() 188 return self.api_client.response_deserialize( 189 response_data=response_data, 190 response_types_map=_response_types_map, 191 ) 192 193 194 @validate_call 195 def simulate_bulk_feed_file_gl_without_preload_content( 196 self, 197 simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest, 198 _request_timeout: Union[ 199 None, 200 Annotated[StrictFloat, Field(gt=0)], 201 Tuple[ 202 Annotated[StrictFloat, Field(gt=0)], 203 Annotated[StrictFloat, Field(gt=0)] 204 ] 205 ] = None, 206 _request_auth: Optional[Dict[StrictStr, Any]] = None, 207 _content_type: Optional[StrictStr] = None, 208 _headers: Optional[Dict[StrictStr, Any]] = None, 209 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 210 ) -> RESTResponseType: 211 """Simulate an American Express bulk file (sandbox only) 212 213 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when `transactionsPerCard` is above `0`, and processes it as if American Express had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. For a feed registered `tokenized` (see `panFormat` on `POST /network-bulk-feeds`), `cardCount` draws American Express network tokens instead of raw card numbers, and `newCardCount` is not supported (there is no tokenized new-card pool). 214 215 :param simulate_bulk_feed_file_gl_request: (required) 216 :type simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest 217 :param _request_timeout: timeout setting for this request. If one 218 number provided, it will be total request 219 timeout. It can also be a pair (tuple) of 220 (connection, read) timeouts. 221 :type _request_timeout: int, tuple(int, int), optional 222 :param _request_auth: set to override the auth_settings for an a single 223 request; this effectively ignores the 224 authentication in the spec for a single request. 225 :type _request_auth: dict, optional 226 :param _content_type: force content-type for the request. 227 :type _content_type: str, Optional 228 :param _headers: set to override the headers for a single 229 request; this effectively ignores the headers 230 in the spec for a single request. 231 :type _headers: dict, optional 232 :param _host_index: set to override the host_index for a single 233 request; this effectively ignores the host_index 234 in the spec for a single request. 235 :type _host_index: int, optional 236 :return: Returns the result object. 237 """ # noqa: E501 238 239 _param = self._simulate_bulk_feed_file_gl_serialize( 240 simulate_bulk_feed_file_gl_request=simulate_bulk_feed_file_gl_request, 241 _request_auth=_request_auth, 242 _content_type=_content_type, 243 _headers=_headers, 244 _host_index=_host_index 245 ) 246 247 _response_types_map: Dict[str, Optional[str]] = { 248 '202': None, 249 '400': "ValidationProblem", 250 '401': "Problem", 251 '403': "Problem", 252 '413': "Problem", 253 '500': "Problem", 254 } 255 response_data = self.api_client.call_api( 256 *_param, 257 _request_timeout=_request_timeout 258 ) 259 return response_data.response 260 261 262 def _simulate_bulk_feed_file_gl_serialize( 263 self, 264 simulate_bulk_feed_file_gl_request, 265 _request_auth, 266 _content_type, 267 _headers, 268 _host_index, 269 ) -> RequestSerialized: 270 271 _host = None 272 273 _collection_formats: Dict[str, str] = { 274 } 275 276 _path_params: Dict[str, str] = {} 277 _query_params: List[Tuple[str, str]] = [] 278 _header_params: Dict[str, Optional[str]] = _headers or {} 279 _form_params: List[Tuple[str, str]] = [] 280 _files: Dict[ 281 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 282 ] = {} 283 _body_params: Optional[bytes] = None 284 285 # process the path parameters 286 # process the query parameters 287 # process the header parameters 288 # process the form parameters 289 # process the body parameter 290 if simulate_bulk_feed_file_gl_request is not None: 291 _body_params = simulate_bulk_feed_file_gl_request 292 293 294 # set the HTTP header `Accept` 295 if 'Accept' not in _header_params: 296 _header_params['Accept'] = self.api_client.select_header_accept( 297 [ 298 'application/problem+json' 299 ] 300 ) 301 302 # set the HTTP header `Content-Type` 303 if _content_type: 304 _header_params['Content-Type'] = _content_type 305 else: 306 _default_content_type = ( 307 self.api_client.select_header_content_type( 308 [ 309 'application/json' 310 ] 311 ) 312 ) 313 if _default_content_type is not None: 314 _header_params['Content-Type'] = _default_content_type 315 316 # authentication setting 317 _auth_settings: List[str] = [ 318 'main-auth' 319 ] 320 321 return self.api_client.param_serialize( 322 method='POST', 323 resource_path='/simulate/ingestion/amex-gl', 324 path_params=_path_params, 325 query_params=_query_params, 326 header_params=_header_params, 327 body=_body_params, 328 post_params=_form_params, 329 files=_files, 330 auth_settings=_auth_settings, 331 collection_formats=_collection_formats, 332 _host=_host, 333 _request_auth=_request_auth 334 ) 335 336 337 338 339 @validate_call 340 def simulate_bulk_feed_file_smartdata( 341 self, 342 simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest, 343 _request_timeout: Union[ 344 None, 345 Annotated[StrictFloat, Field(gt=0)], 346 Tuple[ 347 Annotated[StrictFloat, Field(gt=0)], 348 Annotated[StrictFloat, Field(gt=0)] 349 ] 350 ] = None, 351 _request_auth: Optional[Dict[StrictStr, Any]] = None, 352 _content_type: Optional[StrictStr] = None, 353 _headers: Optional[Dict[StrictStr, Any]] = None, 354 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 355 ) -> None: 356 """Simulate a Mastercard bulk file (sandbox only) 357 358 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 359 360 :param simulate_bulk_feed_file_smartdata_request: (required) 361 :type simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest 362 :param _request_timeout: timeout setting for this request. If one 363 number provided, it will be total request 364 timeout. It can also be a pair (tuple) of 365 (connection, read) timeouts. 366 :type _request_timeout: int, tuple(int, int), optional 367 :param _request_auth: set to override the auth_settings for an a single 368 request; this effectively ignores the 369 authentication in the spec for a single request. 370 :type _request_auth: dict, optional 371 :param _content_type: force content-type for the request. 372 :type _content_type: str, Optional 373 :param _headers: set to override the headers for a single 374 request; this effectively ignores the headers 375 in the spec for a single request. 376 :type _headers: dict, optional 377 :param _host_index: set to override the host_index for a single 378 request; this effectively ignores the host_index 379 in the spec for a single request. 380 :type _host_index: int, optional 381 :return: Returns the result object. 382 """ # noqa: E501 383 384 _param = self._simulate_bulk_feed_file_smartdata_serialize( 385 simulate_bulk_feed_file_smartdata_request=simulate_bulk_feed_file_smartdata_request, 386 _request_auth=_request_auth, 387 _content_type=_content_type, 388 _headers=_headers, 389 _host_index=_host_index 390 ) 391 392 _response_types_map: Dict[str, Optional[str]] = { 393 '202': None, 394 '400': "ValidationProblem", 395 '401': "Problem", 396 '403': "Problem", 397 '413': "Problem", 398 '500': "Problem", 399 } 400 response_data = self.api_client.call_api( 401 *_param, 402 _request_timeout=_request_timeout 403 ) 404 response_data.read() 405 return self.api_client.response_deserialize( 406 response_data=response_data, 407 response_types_map=_response_types_map, 408 ).data 409 410 411 @validate_call 412 def simulate_bulk_feed_file_smartdata_with_http_info( 413 self, 414 simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest, 415 _request_timeout: Union[ 416 None, 417 Annotated[StrictFloat, Field(gt=0)], 418 Tuple[ 419 Annotated[StrictFloat, Field(gt=0)], 420 Annotated[StrictFloat, Field(gt=0)] 421 ] 422 ] = None, 423 _request_auth: Optional[Dict[StrictStr, Any]] = None, 424 _content_type: Optional[StrictStr] = None, 425 _headers: Optional[Dict[StrictStr, Any]] = None, 426 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 427 ) -> ApiResponse[None]: 428 """Simulate a Mastercard bulk file (sandbox only) 429 430 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 431 432 :param simulate_bulk_feed_file_smartdata_request: (required) 433 :type simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest 434 :param _request_timeout: timeout setting for this request. If one 435 number provided, it will be total request 436 timeout. It can also be a pair (tuple) of 437 (connection, read) timeouts. 438 :type _request_timeout: int, tuple(int, int), optional 439 :param _request_auth: set to override the auth_settings for an a single 440 request; this effectively ignores the 441 authentication in the spec for a single request. 442 :type _request_auth: dict, optional 443 :param _content_type: force content-type for the request. 444 :type _content_type: str, Optional 445 :param _headers: set to override the headers for a single 446 request; this effectively ignores the headers 447 in the spec for a single request. 448 :type _headers: dict, optional 449 :param _host_index: set to override the host_index for a single 450 request; this effectively ignores the host_index 451 in the spec for a single request. 452 :type _host_index: int, optional 453 :return: Returns the result object. 454 """ # noqa: E501 455 456 _param = self._simulate_bulk_feed_file_smartdata_serialize( 457 simulate_bulk_feed_file_smartdata_request=simulate_bulk_feed_file_smartdata_request, 458 _request_auth=_request_auth, 459 _content_type=_content_type, 460 _headers=_headers, 461 _host_index=_host_index 462 ) 463 464 _response_types_map: Dict[str, Optional[str]] = { 465 '202': None, 466 '400': "ValidationProblem", 467 '401': "Problem", 468 '403': "Problem", 469 '413': "Problem", 470 '500': "Problem", 471 } 472 response_data = self.api_client.call_api( 473 *_param, 474 _request_timeout=_request_timeout 475 ) 476 response_data.read() 477 return self.api_client.response_deserialize( 478 response_data=response_data, 479 response_types_map=_response_types_map, 480 ) 481 482 483 @validate_call 484 def simulate_bulk_feed_file_smartdata_without_preload_content( 485 self, 486 simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest, 487 _request_timeout: Union[ 488 None, 489 Annotated[StrictFloat, Field(gt=0)], 490 Tuple[ 491 Annotated[StrictFloat, Field(gt=0)], 492 Annotated[StrictFloat, Field(gt=0)] 493 ] 494 ] = None, 495 _request_auth: Optional[Dict[StrictStr, Any]] = None, 496 _content_type: Optional[StrictStr] = None, 497 _headers: Optional[Dict[StrictStr, Any]] = None, 498 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 499 ) -> RESTResponseType: 500 """Simulate a Mastercard bulk file (sandbox only) 501 502 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 503 504 :param simulate_bulk_feed_file_smartdata_request: (required) 505 :type simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest 506 :param _request_timeout: timeout setting for this request. If one 507 number provided, it will be total request 508 timeout. It can also be a pair (tuple) of 509 (connection, read) timeouts. 510 :type _request_timeout: int, tuple(int, int), optional 511 :param _request_auth: set to override the auth_settings for an a single 512 request; this effectively ignores the 513 authentication in the spec for a single request. 514 :type _request_auth: dict, optional 515 :param _content_type: force content-type for the request. 516 :type _content_type: str, Optional 517 :param _headers: set to override the headers for a single 518 request; this effectively ignores the headers 519 in the spec for a single request. 520 :type _headers: dict, optional 521 :param _host_index: set to override the host_index for a single 522 request; this effectively ignores the host_index 523 in the spec for a single request. 524 :type _host_index: int, optional 525 :return: Returns the result object. 526 """ # noqa: E501 527 528 _param = self._simulate_bulk_feed_file_smartdata_serialize( 529 simulate_bulk_feed_file_smartdata_request=simulate_bulk_feed_file_smartdata_request, 530 _request_auth=_request_auth, 531 _content_type=_content_type, 532 _headers=_headers, 533 _host_index=_host_index 534 ) 535 536 _response_types_map: Dict[str, Optional[str]] = { 537 '202': None, 538 '400': "ValidationProblem", 539 '401': "Problem", 540 '403': "Problem", 541 '413': "Problem", 542 '500': "Problem", 543 } 544 response_data = self.api_client.call_api( 545 *_param, 546 _request_timeout=_request_timeout 547 ) 548 return response_data.response 549 550 551 def _simulate_bulk_feed_file_smartdata_serialize( 552 self, 553 simulate_bulk_feed_file_smartdata_request, 554 _request_auth, 555 _content_type, 556 _headers, 557 _host_index, 558 ) -> RequestSerialized: 559 560 _host = None 561 562 _collection_formats: Dict[str, str] = { 563 } 564 565 _path_params: Dict[str, str] = {} 566 _query_params: List[Tuple[str, str]] = [] 567 _header_params: Dict[str, Optional[str]] = _headers or {} 568 _form_params: List[Tuple[str, str]] = [] 569 _files: Dict[ 570 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 571 ] = {} 572 _body_params: Optional[bytes] = None 573 574 # process the path parameters 575 # process the query parameters 576 # process the header parameters 577 # process the form parameters 578 # process the body parameter 579 if simulate_bulk_feed_file_smartdata_request is not None: 580 _body_params = simulate_bulk_feed_file_smartdata_request 581 582 583 # set the HTTP header `Accept` 584 if 'Accept' not in _header_params: 585 _header_params['Accept'] = self.api_client.select_header_accept( 586 [ 587 'application/problem+json' 588 ] 589 ) 590 591 # set the HTTP header `Content-Type` 592 if _content_type: 593 _header_params['Content-Type'] = _content_type 594 else: 595 _default_content_type = ( 596 self.api_client.select_header_content_type( 597 [ 598 'application/json' 599 ] 600 ) 601 ) 602 if _default_content_type is not None: 603 _header_params['Content-Type'] = _default_content_type 604 605 # authentication setting 606 _auth_settings: List[str] = [ 607 'main-auth' 608 ] 609 610 return self.api_client.param_serialize( 611 method='POST', 612 resource_path='/simulate/ingestion/smartdata', 613 path_params=_path_params, 614 query_params=_query_params, 615 header_params=_header_params, 616 body=_body_params, 617 post_params=_form_params, 618 files=_files, 619 auth_settings=_auth_settings, 620 collection_formats=_collection_formats, 621 _host=_host, 622 _request_auth=_request_auth 623 ) 624 625 626 627 628 @validate_call 629 def simulate_bulk_feed_file_vbds( 630 self, 631 simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest, 632 _request_timeout: Union[ 633 None, 634 Annotated[StrictFloat, Field(gt=0)], 635 Tuple[ 636 Annotated[StrictFloat, Field(gt=0)], 637 Annotated[StrictFloat, Field(gt=0)] 638 ] 639 ] = None, 640 _request_auth: Optional[Dict[StrictStr, Any]] = None, 641 _content_type: Optional[StrictStr] = None, 642 _headers: Optional[Dict[StrictStr, Any]] = None, 643 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 644 ) -> None: 645 """Simulate a pulled Visa bulk feed delivery (sandbox only) 646 647 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Simulates one delivery on a Visa bulk feed of `type: VBDS`, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when `transactionsPerCard` is above `0`, adds settlements for them. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`; otherwise the call returns `400`. `cardCount` replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a delivery that arrives twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. 648 649 :param simulate_bulk_feed_file_vbds_request: (required) 650 :type simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest 651 :param _request_timeout: timeout setting for this request. If one 652 number provided, it will be total request 653 timeout. It can also be a pair (tuple) of 654 (connection, read) timeouts. 655 :type _request_timeout: int, tuple(int, int), optional 656 :param _request_auth: set to override the auth_settings for an a single 657 request; this effectively ignores the 658 authentication in the spec for a single request. 659 :type _request_auth: dict, optional 660 :param _content_type: force content-type for the request. 661 :type _content_type: str, Optional 662 :param _headers: set to override the headers for a single 663 request; this effectively ignores the headers 664 in the spec for a single request. 665 :type _headers: dict, optional 666 :param _host_index: set to override the host_index for a single 667 request; this effectively ignores the host_index 668 in the spec for a single request. 669 :type _host_index: int, optional 670 :return: Returns the result object. 671 """ # noqa: E501 672 673 _param = self._simulate_bulk_feed_file_vbds_serialize( 674 simulate_bulk_feed_file_vbds_request=simulate_bulk_feed_file_vbds_request, 675 _request_auth=_request_auth, 676 _content_type=_content_type, 677 _headers=_headers, 678 _host_index=_host_index 679 ) 680 681 _response_types_map: Dict[str, Optional[str]] = { 682 '202': None, 683 '400': "ValidationProblem", 684 '401': "Problem", 685 '403': "Problem", 686 '413': "Problem", 687 '500': "Problem", 688 } 689 response_data = self.api_client.call_api( 690 *_param, 691 _request_timeout=_request_timeout 692 ) 693 response_data.read() 694 return self.api_client.response_deserialize( 695 response_data=response_data, 696 response_types_map=_response_types_map, 697 ).data 698 699 700 @validate_call 701 def simulate_bulk_feed_file_vbds_with_http_info( 702 self, 703 simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest, 704 _request_timeout: Union[ 705 None, 706 Annotated[StrictFloat, Field(gt=0)], 707 Tuple[ 708 Annotated[StrictFloat, Field(gt=0)], 709 Annotated[StrictFloat, Field(gt=0)] 710 ] 711 ] = None, 712 _request_auth: Optional[Dict[StrictStr, Any]] = None, 713 _content_type: Optional[StrictStr] = None, 714 _headers: Optional[Dict[StrictStr, Any]] = None, 715 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 716 ) -> ApiResponse[None]: 717 """Simulate a pulled Visa bulk feed delivery (sandbox only) 718 719 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Simulates one delivery on a Visa bulk feed of `type: VBDS`, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when `transactionsPerCard` is above `0`, adds settlements for them. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`; otherwise the call returns `400`. `cardCount` replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a delivery that arrives twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. 720 721 :param simulate_bulk_feed_file_vbds_request: (required) 722 :type simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest 723 :param _request_timeout: timeout setting for this request. If one 724 number provided, it will be total request 725 timeout. It can also be a pair (tuple) of 726 (connection, read) timeouts. 727 :type _request_timeout: int, tuple(int, int), optional 728 :param _request_auth: set to override the auth_settings for an a single 729 request; this effectively ignores the 730 authentication in the spec for a single request. 731 :type _request_auth: dict, optional 732 :param _content_type: force content-type for the request. 733 :type _content_type: str, Optional 734 :param _headers: set to override the headers for a single 735 request; this effectively ignores the headers 736 in the spec for a single request. 737 :type _headers: dict, optional 738 :param _host_index: set to override the host_index for a single 739 request; this effectively ignores the host_index 740 in the spec for a single request. 741 :type _host_index: int, optional 742 :return: Returns the result object. 743 """ # noqa: E501 744 745 _param = self._simulate_bulk_feed_file_vbds_serialize( 746 simulate_bulk_feed_file_vbds_request=simulate_bulk_feed_file_vbds_request, 747 _request_auth=_request_auth, 748 _content_type=_content_type, 749 _headers=_headers, 750 _host_index=_host_index 751 ) 752 753 _response_types_map: Dict[str, Optional[str]] = { 754 '202': None, 755 '400': "ValidationProblem", 756 '401': "Problem", 757 '403': "Problem", 758 '413': "Problem", 759 '500': "Problem", 760 } 761 response_data = self.api_client.call_api( 762 *_param, 763 _request_timeout=_request_timeout 764 ) 765 response_data.read() 766 return self.api_client.response_deserialize( 767 response_data=response_data, 768 response_types_map=_response_types_map, 769 ) 770 771 772 @validate_call 773 def simulate_bulk_feed_file_vbds_without_preload_content( 774 self, 775 simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest, 776 _request_timeout: Union[ 777 None, 778 Annotated[StrictFloat, Field(gt=0)], 779 Tuple[ 780 Annotated[StrictFloat, Field(gt=0)], 781 Annotated[StrictFloat, Field(gt=0)] 782 ] 783 ] = None, 784 _request_auth: Optional[Dict[StrictStr, Any]] = None, 785 _content_type: Optional[StrictStr] = None, 786 _headers: Optional[Dict[StrictStr, Any]] = None, 787 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 788 ) -> RESTResponseType: 789 """Simulate a pulled Visa bulk feed delivery (sandbox only) 790 791 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Simulates one delivery on a Visa bulk feed of `type: VBDS`, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when `transactionsPerCard` is above `0`, adds settlements for them. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`; otherwise the call returns `400`. `cardCount` replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a delivery that arrives twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. 792 793 :param simulate_bulk_feed_file_vbds_request: (required) 794 :type simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest 795 :param _request_timeout: timeout setting for this request. If one 796 number provided, it will be total request 797 timeout. It can also be a pair (tuple) of 798 (connection, read) timeouts. 799 :type _request_timeout: int, tuple(int, int), optional 800 :param _request_auth: set to override the auth_settings for an a single 801 request; this effectively ignores the 802 authentication in the spec for a single request. 803 :type _request_auth: dict, optional 804 :param _content_type: force content-type for the request. 805 :type _content_type: str, Optional 806 :param _headers: set to override the headers for a single 807 request; this effectively ignores the headers 808 in the spec for a single request. 809 :type _headers: dict, optional 810 :param _host_index: set to override the host_index for a single 811 request; this effectively ignores the host_index 812 in the spec for a single request. 813 :type _host_index: int, optional 814 :return: Returns the result object. 815 """ # noqa: E501 816 817 _param = self._simulate_bulk_feed_file_vbds_serialize( 818 simulate_bulk_feed_file_vbds_request=simulate_bulk_feed_file_vbds_request, 819 _request_auth=_request_auth, 820 _content_type=_content_type, 821 _headers=_headers, 822 _host_index=_host_index 823 ) 824 825 _response_types_map: Dict[str, Optional[str]] = { 826 '202': None, 827 '400': "ValidationProblem", 828 '401': "Problem", 829 '403': "Problem", 830 '413': "Problem", 831 '500': "Problem", 832 } 833 response_data = self.api_client.call_api( 834 *_param, 835 _request_timeout=_request_timeout 836 ) 837 return response_data.response 838 839 840 def _simulate_bulk_feed_file_vbds_serialize( 841 self, 842 simulate_bulk_feed_file_vbds_request, 843 _request_auth, 844 _content_type, 845 _headers, 846 _host_index, 847 ) -> RequestSerialized: 848 849 _host = None 850 851 _collection_formats: Dict[str, str] = { 852 } 853 854 _path_params: Dict[str, str] = {} 855 _query_params: List[Tuple[str, str]] = [] 856 _header_params: Dict[str, Optional[str]] = _headers or {} 857 _form_params: List[Tuple[str, str]] = [] 858 _files: Dict[ 859 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 860 ] = {} 861 _body_params: Optional[bytes] = None 862 863 # process the path parameters 864 # process the query parameters 865 # process the header parameters 866 # process the form parameters 867 # process the body parameter 868 if simulate_bulk_feed_file_vbds_request is not None: 869 _body_params = simulate_bulk_feed_file_vbds_request 870 871 872 # set the HTTP header `Accept` 873 if 'Accept' not in _header_params: 874 _header_params['Accept'] = self.api_client.select_header_accept( 875 [ 876 'application/problem+json' 877 ] 878 ) 879 880 # set the HTTP header `Content-Type` 881 if _content_type: 882 _header_params['Content-Type'] = _content_type 883 else: 884 _default_content_type = ( 885 self.api_client.select_header_content_type( 886 [ 887 'application/json' 888 ] 889 ) 890 ) 891 if _default_content_type is not None: 892 _header_params['Content-Type'] = _default_content_type 893 894 # authentication setting 895 _auth_settings: List[str] = [ 896 'main-auth' 897 ] 898 899 return self.api_client.param_serialize( 900 method='POST', 901 resource_path='/simulate/ingestion/vbds', 902 path_params=_path_params, 903 query_params=_query_params, 904 header_params=_header_params, 905 body=_body_params, 906 post_params=_form_params, 907 files=_files, 908 auth_settings=_auth_settings, 909 collection_formats=_collection_formats, 910 _host=_host, 911 _request_auth=_request_auth 912 ) 913 914 915 916 917 @validate_call 918 def simulate_bulk_feed_file_vcf( 919 self, 920 simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest, 921 _request_timeout: Union[ 922 None, 923 Annotated[StrictFloat, Field(gt=0)], 924 Tuple[ 925 Annotated[StrictFloat, Field(gt=0)], 926 Annotated[StrictFloat, Field(gt=0)] 927 ] 928 ] = None, 929 _request_auth: Optional[Dict[StrictStr, Any]] = None, 930 _content_type: Optional[StrictStr] = None, 931 _headers: Optional[Dict[StrictStr, Any]] = None, 932 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 933 ) -> None: 934 """Simulate a Visa bulk file (sandbox only) 935 936 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of `type: VCF`) and processes it as if Visa had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 937 938 :param simulate_bulk_feed_file_vcf_request: (required) 939 :type simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest 940 :param _request_timeout: timeout setting for this request. If one 941 number provided, it will be total request 942 timeout. It can also be a pair (tuple) of 943 (connection, read) timeouts. 944 :type _request_timeout: int, tuple(int, int), optional 945 :param _request_auth: set to override the auth_settings for an a single 946 request; this effectively ignores the 947 authentication in the spec for a single request. 948 :type _request_auth: dict, optional 949 :param _content_type: force content-type for the request. 950 :type _content_type: str, Optional 951 :param _headers: set to override the headers for a single 952 request; this effectively ignores the headers 953 in the spec for a single request. 954 :type _headers: dict, optional 955 :param _host_index: set to override the host_index for a single 956 request; this effectively ignores the host_index 957 in the spec for a single request. 958 :type _host_index: int, optional 959 :return: Returns the result object. 960 """ # noqa: E501 961 962 _param = self._simulate_bulk_feed_file_vcf_serialize( 963 simulate_bulk_feed_file_vcf_request=simulate_bulk_feed_file_vcf_request, 964 _request_auth=_request_auth, 965 _content_type=_content_type, 966 _headers=_headers, 967 _host_index=_host_index 968 ) 969 970 _response_types_map: Dict[str, Optional[str]] = { 971 '202': None, 972 '400': "ValidationProblem", 973 '401': "Problem", 974 '403': "Problem", 975 '413': "Problem", 976 '500': "Problem", 977 } 978 response_data = self.api_client.call_api( 979 *_param, 980 _request_timeout=_request_timeout 981 ) 982 response_data.read() 983 return self.api_client.response_deserialize( 984 response_data=response_data, 985 response_types_map=_response_types_map, 986 ).data 987 988 989 @validate_call 990 def simulate_bulk_feed_file_vcf_with_http_info( 991 self, 992 simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest, 993 _request_timeout: Union[ 994 None, 995 Annotated[StrictFloat, Field(gt=0)], 996 Tuple[ 997 Annotated[StrictFloat, Field(gt=0)], 998 Annotated[StrictFloat, Field(gt=0)] 999 ] 1000 ] = None, 1001 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1002 _content_type: Optional[StrictStr] = None, 1003 _headers: Optional[Dict[StrictStr, Any]] = None, 1004 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1005 ) -> ApiResponse[None]: 1006 """Simulate a Visa bulk file (sandbox only) 1007 1008 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of `type: VCF`) and processes it as if Visa had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 1009 1010 :param simulate_bulk_feed_file_vcf_request: (required) 1011 :type simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest 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._simulate_bulk_feed_file_vcf_serialize( 1035 simulate_bulk_feed_file_vcf_request=simulate_bulk_feed_file_vcf_request, 1036 _request_auth=_request_auth, 1037 _content_type=_content_type, 1038 _headers=_headers, 1039 _host_index=_host_index 1040 ) 1041 1042 _response_types_map: Dict[str, Optional[str]] = { 1043 '202': None, 1044 '400': "ValidationProblem", 1045 '401': "Problem", 1046 '403': "Problem", 1047 '413': "Problem", 1048 '500': "Problem", 1049 } 1050 response_data = self.api_client.call_api( 1051 *_param, 1052 _request_timeout=_request_timeout 1053 ) 1054 response_data.read() 1055 return self.api_client.response_deserialize( 1056 response_data=response_data, 1057 response_types_map=_response_types_map, 1058 ) 1059 1060 1061 @validate_call 1062 def simulate_bulk_feed_file_vcf_without_preload_content( 1063 self, 1064 simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest, 1065 _request_timeout: Union[ 1066 None, 1067 Annotated[StrictFloat, Field(gt=0)], 1068 Tuple[ 1069 Annotated[StrictFloat, Field(gt=0)], 1070 Annotated[StrictFloat, Field(gt=0)] 1071 ] 1072 ] = None, 1073 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1074 _content_type: Optional[StrictStr] = None, 1075 _headers: Optional[Dict[StrictStr, Any]] = None, 1076 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1077 ) -> RESTResponseType: 1078 """Simulate a Visa bulk file (sandbox only) 1079 1080 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of `type: VCF`) and processes it as if Visa had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 1081 1082 :param simulate_bulk_feed_file_vcf_request: (required) 1083 :type simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest 1084 :param _request_timeout: timeout setting for this request. If one 1085 number provided, it will be total request 1086 timeout. It can also be a pair (tuple) of 1087 (connection, read) timeouts. 1088 :type _request_timeout: int, tuple(int, int), optional 1089 :param _request_auth: set to override the auth_settings for an a single 1090 request; this effectively ignores the 1091 authentication in the spec for a single request. 1092 :type _request_auth: dict, optional 1093 :param _content_type: force content-type for the request. 1094 :type _content_type: str, Optional 1095 :param _headers: set to override the headers for a single 1096 request; this effectively ignores the headers 1097 in the spec for a single request. 1098 :type _headers: dict, optional 1099 :param _host_index: set to override the host_index for a single 1100 request; this effectively ignores the host_index 1101 in the spec for a single request. 1102 :type _host_index: int, optional 1103 :return: Returns the result object. 1104 """ # noqa: E501 1105 1106 _param = self._simulate_bulk_feed_file_vcf_serialize( 1107 simulate_bulk_feed_file_vcf_request=simulate_bulk_feed_file_vcf_request, 1108 _request_auth=_request_auth, 1109 _content_type=_content_type, 1110 _headers=_headers, 1111 _host_index=_host_index 1112 ) 1113 1114 _response_types_map: Dict[str, Optional[str]] = { 1115 '202': None, 1116 '400': "ValidationProblem", 1117 '401': "Problem", 1118 '403': "Problem", 1119 '413': "Problem", 1120 '500': "Problem", 1121 } 1122 response_data = self.api_client.call_api( 1123 *_param, 1124 _request_timeout=_request_timeout 1125 ) 1126 return response_data.response 1127 1128 1129 def _simulate_bulk_feed_file_vcf_serialize( 1130 self, 1131 simulate_bulk_feed_file_vcf_request, 1132 _request_auth, 1133 _content_type, 1134 _headers, 1135 _host_index, 1136 ) -> RequestSerialized: 1137 1138 _host = None 1139 1140 _collection_formats: Dict[str, str] = { 1141 } 1142 1143 _path_params: Dict[str, str] = {} 1144 _query_params: List[Tuple[str, str]] = [] 1145 _header_params: Dict[str, Optional[str]] = _headers or {} 1146 _form_params: List[Tuple[str, str]] = [] 1147 _files: Dict[ 1148 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 1149 ] = {} 1150 _body_params: Optional[bytes] = None 1151 1152 # process the path parameters 1153 # process the query parameters 1154 # process the header parameters 1155 # process the form parameters 1156 # process the body parameter 1157 if simulate_bulk_feed_file_vcf_request is not None: 1158 _body_params = simulate_bulk_feed_file_vcf_request 1159 1160 1161 # set the HTTP header `Accept` 1162 if 'Accept' not in _header_params: 1163 _header_params['Accept'] = self.api_client.select_header_accept( 1164 [ 1165 'application/problem+json' 1166 ] 1167 ) 1168 1169 # set the HTTP header `Content-Type` 1170 if _content_type: 1171 _header_params['Content-Type'] = _content_type 1172 else: 1173 _default_content_type = ( 1174 self.api_client.select_header_content_type( 1175 [ 1176 'application/json' 1177 ] 1178 ) 1179 ) 1180 if _default_content_type is not None: 1181 _header_params['Content-Type'] = _default_content_type 1182 1183 # authentication setting 1184 _auth_settings: List[str] = [ 1185 'main-auth' 1186 ] 1187 1188 return self.api_client.param_serialize( 1189 method='POST', 1190 resource_path='/simulate/ingestion/vcf', 1191 path_params=_path_params, 1192 query_params=_query_params, 1193 header_params=_header_params, 1194 body=_body_params, 1195 post_params=_form_params, 1196 files=_files, 1197 auth_settings=_auth_settings, 1198 collection_formats=_collection_formats, 1199 _host=_host, 1200 _request_auth=_request_auth 1201 ) 1202 1203 1204 1205 1206 @validate_call 1207 def simulate_transaction( 1208 self, 1209 simulate_transaction_request: SimulateTransactionRequest, 1210 _request_timeout: Union[ 1211 None, 1212 Annotated[StrictFloat, Field(gt=0)], 1213 Tuple[ 1214 Annotated[StrictFloat, Field(gt=0)], 1215 Annotated[StrictFloat, Field(gt=0)] 1216 ] 1217 ] = None, 1218 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1219 _content_type: Optional[StrictStr] = None, 1220 _headers: Optional[Dict[StrictStr, Any]] = None, 1221 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1222 ) -> SimulateTransactionAccepted: 1223 """Simulate a transaction (sandbox only) 1224 1225 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with `POST /simulate/transactions/{transactionId}` to add further messages to the transaction. Besides `simulation:write`, the access token needs `cards:read`: the card is read from the public API to resolve its subaccount and network. 1226 1227 :param simulate_transaction_request: (required) 1228 :type simulate_transaction_request: SimulateTransactionRequest 1229 :param _request_timeout: timeout setting for this request. If one 1230 number provided, it will be total request 1231 timeout. It can also be a pair (tuple) of 1232 (connection, read) timeouts. 1233 :type _request_timeout: int, tuple(int, int), optional 1234 :param _request_auth: set to override the auth_settings for an a single 1235 request; this effectively ignores the 1236 authentication in the spec for a single request. 1237 :type _request_auth: dict, optional 1238 :param _content_type: force content-type for the request. 1239 :type _content_type: str, Optional 1240 :param _headers: set to override the headers for a single 1241 request; this effectively ignores the headers 1242 in the spec for a single request. 1243 :type _headers: dict, optional 1244 :param _host_index: set to override the host_index for a single 1245 request; this effectively ignores the host_index 1246 in the spec for a single request. 1247 :type _host_index: int, optional 1248 :return: Returns the result object. 1249 """ # noqa: E501 1250 1251 _param = self._simulate_transaction_serialize( 1252 simulate_transaction_request=simulate_transaction_request, 1253 _request_auth=_request_auth, 1254 _content_type=_content_type, 1255 _headers=_headers, 1256 _host_index=_host_index 1257 ) 1258 1259 _response_types_map: Dict[str, Optional[str]] = { 1260 '202': "SimulateTransactionAccepted", 1261 '400': "ValidationProblem", 1262 '401': "Problem", 1263 '403': "Problem", 1264 '404': "Problem", 1265 '500': "Problem", 1266 '502': "Problem", 1267 } 1268 response_data = self.api_client.call_api( 1269 *_param, 1270 _request_timeout=_request_timeout 1271 ) 1272 response_data.read() 1273 return self.api_client.response_deserialize( 1274 response_data=response_data, 1275 response_types_map=_response_types_map, 1276 ).data 1277 1278 1279 @validate_call 1280 def simulate_transaction_with_http_info( 1281 self, 1282 simulate_transaction_request: SimulateTransactionRequest, 1283 _request_timeout: Union[ 1284 None, 1285 Annotated[StrictFloat, Field(gt=0)], 1286 Tuple[ 1287 Annotated[StrictFloat, Field(gt=0)], 1288 Annotated[StrictFloat, Field(gt=0)] 1289 ] 1290 ] = None, 1291 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1292 _content_type: Optional[StrictStr] = None, 1293 _headers: Optional[Dict[StrictStr, Any]] = None, 1294 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1295 ) -> ApiResponse[SimulateTransactionAccepted]: 1296 """Simulate a transaction (sandbox only) 1297 1298 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with `POST /simulate/transactions/{transactionId}` to add further messages to the transaction. Besides `simulation:write`, the access token needs `cards:read`: the card is read from the public API to resolve its subaccount and network. 1299 1300 :param simulate_transaction_request: (required) 1301 :type simulate_transaction_request: SimulateTransactionRequest 1302 :param _request_timeout: timeout setting for this request. If one 1303 number provided, it will be total request 1304 timeout. It can also be a pair (tuple) of 1305 (connection, read) timeouts. 1306 :type _request_timeout: int, tuple(int, int), optional 1307 :param _request_auth: set to override the auth_settings for an a single 1308 request; this effectively ignores the 1309 authentication in the spec for a single request. 1310 :type _request_auth: dict, optional 1311 :param _content_type: force content-type for the request. 1312 :type _content_type: str, Optional 1313 :param _headers: set to override the headers for a single 1314 request; this effectively ignores the headers 1315 in the spec for a single request. 1316 :type _headers: dict, optional 1317 :param _host_index: set to override the host_index for a single 1318 request; this effectively ignores the host_index 1319 in the spec for a single request. 1320 :type _host_index: int, optional 1321 :return: Returns the result object. 1322 """ # noqa: E501 1323 1324 _param = self._simulate_transaction_serialize( 1325 simulate_transaction_request=simulate_transaction_request, 1326 _request_auth=_request_auth, 1327 _content_type=_content_type, 1328 _headers=_headers, 1329 _host_index=_host_index 1330 ) 1331 1332 _response_types_map: Dict[str, Optional[str]] = { 1333 '202': "SimulateTransactionAccepted", 1334 '400': "ValidationProblem", 1335 '401': "Problem", 1336 '403': "Problem", 1337 '404': "Problem", 1338 '500': "Problem", 1339 '502': "Problem", 1340 } 1341 response_data = self.api_client.call_api( 1342 *_param, 1343 _request_timeout=_request_timeout 1344 ) 1345 response_data.read() 1346 return self.api_client.response_deserialize( 1347 response_data=response_data, 1348 response_types_map=_response_types_map, 1349 ) 1350 1351 1352 @validate_call 1353 def simulate_transaction_without_preload_content( 1354 self, 1355 simulate_transaction_request: SimulateTransactionRequest, 1356 _request_timeout: Union[ 1357 None, 1358 Annotated[StrictFloat, Field(gt=0)], 1359 Tuple[ 1360 Annotated[StrictFloat, Field(gt=0)], 1361 Annotated[StrictFloat, Field(gt=0)] 1362 ] 1363 ] = None, 1364 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1365 _content_type: Optional[StrictStr] = None, 1366 _headers: Optional[Dict[StrictStr, Any]] = None, 1367 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1368 ) -> RESTResponseType: 1369 """Simulate a transaction (sandbox only) 1370 1371 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with `POST /simulate/transactions/{transactionId}` to add further messages to the transaction. Besides `simulation:write`, the access token needs `cards:read`: the card is read from the public API to resolve its subaccount and network. 1372 1373 :param simulate_transaction_request: (required) 1374 :type simulate_transaction_request: SimulateTransactionRequest 1375 :param _request_timeout: timeout setting for this request. If one 1376 number provided, it will be total request 1377 timeout. It can also be a pair (tuple) of 1378 (connection, read) timeouts. 1379 :type _request_timeout: int, tuple(int, int), optional 1380 :param _request_auth: set to override the auth_settings for an a single 1381 request; this effectively ignores the 1382 authentication in the spec for a single request. 1383 :type _request_auth: dict, optional 1384 :param _content_type: force content-type for the request. 1385 :type _content_type: str, Optional 1386 :param _headers: set to override the headers for a single 1387 request; this effectively ignores the headers 1388 in the spec for a single request. 1389 :type _headers: dict, optional 1390 :param _host_index: set to override the host_index for a single 1391 request; this effectively ignores the host_index 1392 in the spec for a single request. 1393 :type _host_index: int, optional 1394 :return: Returns the result object. 1395 """ # noqa: E501 1396 1397 _param = self._simulate_transaction_serialize( 1398 simulate_transaction_request=simulate_transaction_request, 1399 _request_auth=_request_auth, 1400 _content_type=_content_type, 1401 _headers=_headers, 1402 _host_index=_host_index 1403 ) 1404 1405 _response_types_map: Dict[str, Optional[str]] = { 1406 '202': "SimulateTransactionAccepted", 1407 '400': "ValidationProblem", 1408 '401': "Problem", 1409 '403': "Problem", 1410 '404': "Problem", 1411 '500': "Problem", 1412 '502': "Problem", 1413 } 1414 response_data = self.api_client.call_api( 1415 *_param, 1416 _request_timeout=_request_timeout 1417 ) 1418 return response_data.response 1419 1420 1421 def _simulate_transaction_serialize( 1422 self, 1423 simulate_transaction_request, 1424 _request_auth, 1425 _content_type, 1426 _headers, 1427 _host_index, 1428 ) -> RequestSerialized: 1429 1430 _host = None 1431 1432 _collection_formats: Dict[str, str] = { 1433 } 1434 1435 _path_params: Dict[str, str] = {} 1436 _query_params: List[Tuple[str, str]] = [] 1437 _header_params: Dict[str, Optional[str]] = _headers or {} 1438 _form_params: List[Tuple[str, str]] = [] 1439 _files: Dict[ 1440 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 1441 ] = {} 1442 _body_params: Optional[bytes] = None 1443 1444 # process the path parameters 1445 # process the query parameters 1446 # process the header parameters 1447 # process the form parameters 1448 # process the body parameter 1449 if simulate_transaction_request is not None: 1450 _body_params = simulate_transaction_request 1451 1452 1453 # set the HTTP header `Accept` 1454 if 'Accept' not in _header_params: 1455 _header_params['Accept'] = self.api_client.select_header_accept( 1456 [ 1457 'application/json', 1458 'application/problem+json' 1459 ] 1460 ) 1461 1462 # set the HTTP header `Content-Type` 1463 if _content_type: 1464 _header_params['Content-Type'] = _content_type 1465 else: 1466 _default_content_type = ( 1467 self.api_client.select_header_content_type( 1468 [ 1469 'application/json' 1470 ] 1471 ) 1472 ) 1473 if _default_content_type is not None: 1474 _header_params['Content-Type'] = _default_content_type 1475 1476 # authentication setting 1477 _auth_settings: List[str] = [ 1478 'main-auth' 1479 ] 1480 1481 return self.api_client.param_serialize( 1482 method='POST', 1483 resource_path='/simulate/transactions', 1484 path_params=_path_params, 1485 query_params=_query_params, 1486 header_params=_header_params, 1487 body=_body_params, 1488 post_params=_form_params, 1489 files=_files, 1490 auth_settings=_auth_settings, 1491 collection_formats=_collection_formats, 1492 _host=_host, 1493 _request_auth=_request_auth 1494 ) 1495 1496 1497 1498 1499 @validate_call 1500 def simulate_transaction_message( 1501 self, 1502 transaction_id: UUID, 1503 simulate_transaction_message_request: SimulateTransactionMessageRequest, 1504 _request_timeout: Union[ 1505 None, 1506 Annotated[StrictFloat, Field(gt=0)], 1507 Tuple[ 1508 Annotated[StrictFloat, Field(gt=0)], 1509 Annotated[StrictFloat, Field(gt=0)] 1510 ] 1511 ] = None, 1512 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1513 _content_type: Optional[StrictStr] = None, 1514 _headers: Optional[Dict[StrictStr, Any]] = None, 1515 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1516 ) -> SimulateTransactionAccepted: 1517 """Simulate a transaction message (sandbox only) 1518 1519 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by `POST /simulate/transactions` or by the scenario endpoint; take its id from the `transaction.created` webhook or from `GET /transactions?transactionMessageId=`. Besides `simulation:write`, the access token needs `transactions:read` and `transaction-messages:read`: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. `adjustment` and `reversal` are checked against the hold Astrada has processed so far and rejected with `409` when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state. 1520 1521 :param transaction_id: (required) 1522 :type transaction_id: str 1523 :param simulate_transaction_message_request: (required) 1524 :type simulate_transaction_message_request: SimulateTransactionMessageRequest 1525 :param _request_timeout: timeout setting for this request. If one 1526 number provided, it will be total request 1527 timeout. It can also be a pair (tuple) of 1528 (connection, read) timeouts. 1529 :type _request_timeout: int, tuple(int, int), optional 1530 :param _request_auth: set to override the auth_settings for an a single 1531 request; this effectively ignores the 1532 authentication in the spec for a single request. 1533 :type _request_auth: dict, optional 1534 :param _content_type: force content-type for the request. 1535 :type _content_type: str, Optional 1536 :param _headers: set to override the headers for a single 1537 request; this effectively ignores the headers 1538 in the spec for a single request. 1539 :type _headers: dict, optional 1540 :param _host_index: set to override the host_index for a single 1541 request; this effectively ignores the host_index 1542 in the spec for a single request. 1543 :type _host_index: int, optional 1544 :return: Returns the result object. 1545 """ # noqa: E501 1546 1547 _param = self._simulate_transaction_message_serialize( 1548 transaction_id=transaction_id, 1549 simulate_transaction_message_request=simulate_transaction_message_request, 1550 _request_auth=_request_auth, 1551 _content_type=_content_type, 1552 _headers=_headers, 1553 _host_index=_host_index 1554 ) 1555 1556 _response_types_map: Dict[str, Optional[str]] = { 1557 '202': "SimulateTransactionAccepted", 1558 '400': "ValidationProblem", 1559 '401': "Problem", 1560 '403': "Problem", 1561 '404': "Problem", 1562 '409': "Conflict", 1563 '500': "Problem", 1564 '502': "Problem", 1565 } 1566 response_data = self.api_client.call_api( 1567 *_param, 1568 _request_timeout=_request_timeout 1569 ) 1570 response_data.read() 1571 return self.api_client.response_deserialize( 1572 response_data=response_data, 1573 response_types_map=_response_types_map, 1574 ).data 1575 1576 1577 @validate_call 1578 def simulate_transaction_message_with_http_info( 1579 self, 1580 transaction_id: UUID, 1581 simulate_transaction_message_request: SimulateTransactionMessageRequest, 1582 _request_timeout: Union[ 1583 None, 1584 Annotated[StrictFloat, Field(gt=0)], 1585 Tuple[ 1586 Annotated[StrictFloat, Field(gt=0)], 1587 Annotated[StrictFloat, Field(gt=0)] 1588 ] 1589 ] = None, 1590 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1591 _content_type: Optional[StrictStr] = None, 1592 _headers: Optional[Dict[StrictStr, Any]] = None, 1593 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1594 ) -> ApiResponse[SimulateTransactionAccepted]: 1595 """Simulate a transaction message (sandbox only) 1596 1597 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by `POST /simulate/transactions` or by the scenario endpoint; take its id from the `transaction.created` webhook or from `GET /transactions?transactionMessageId=`. Besides `simulation:write`, the access token needs `transactions:read` and `transaction-messages:read`: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. `adjustment` and `reversal` are checked against the hold Astrada has processed so far and rejected with `409` when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state. 1598 1599 :param transaction_id: (required) 1600 :type transaction_id: str 1601 :param simulate_transaction_message_request: (required) 1602 :type simulate_transaction_message_request: SimulateTransactionMessageRequest 1603 :param _request_timeout: timeout setting for this request. If one 1604 number provided, it will be total request 1605 timeout. It can also be a pair (tuple) of 1606 (connection, read) timeouts. 1607 :type _request_timeout: int, tuple(int, int), optional 1608 :param _request_auth: set to override the auth_settings for an a single 1609 request; this effectively ignores the 1610 authentication in the spec for a single request. 1611 :type _request_auth: dict, optional 1612 :param _content_type: force content-type for the request. 1613 :type _content_type: str, Optional 1614 :param _headers: set to override the headers for a single 1615 request; this effectively ignores the headers 1616 in the spec for a single request. 1617 :type _headers: dict, optional 1618 :param _host_index: set to override the host_index for a single 1619 request; this effectively ignores the host_index 1620 in the spec for a single request. 1621 :type _host_index: int, optional 1622 :return: Returns the result object. 1623 """ # noqa: E501 1624 1625 _param = self._simulate_transaction_message_serialize( 1626 transaction_id=transaction_id, 1627 simulate_transaction_message_request=simulate_transaction_message_request, 1628 _request_auth=_request_auth, 1629 _content_type=_content_type, 1630 _headers=_headers, 1631 _host_index=_host_index 1632 ) 1633 1634 _response_types_map: Dict[str, Optional[str]] = { 1635 '202': "SimulateTransactionAccepted", 1636 '400': "ValidationProblem", 1637 '401': "Problem", 1638 '403': "Problem", 1639 '404': "Problem", 1640 '409': "Conflict", 1641 '500': "Problem", 1642 '502': "Problem", 1643 } 1644 response_data = self.api_client.call_api( 1645 *_param, 1646 _request_timeout=_request_timeout 1647 ) 1648 response_data.read() 1649 return self.api_client.response_deserialize( 1650 response_data=response_data, 1651 response_types_map=_response_types_map, 1652 ) 1653 1654 1655 @validate_call 1656 def simulate_transaction_message_without_preload_content( 1657 self, 1658 transaction_id: UUID, 1659 simulate_transaction_message_request: SimulateTransactionMessageRequest, 1660 _request_timeout: Union[ 1661 None, 1662 Annotated[StrictFloat, Field(gt=0)], 1663 Tuple[ 1664 Annotated[StrictFloat, Field(gt=0)], 1665 Annotated[StrictFloat, Field(gt=0)] 1666 ] 1667 ] = None, 1668 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1669 _content_type: Optional[StrictStr] = None, 1670 _headers: Optional[Dict[StrictStr, Any]] = None, 1671 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1672 ) -> RESTResponseType: 1673 """Simulate a transaction message (sandbox only) 1674 1675 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by `POST /simulate/transactions` or by the scenario endpoint; take its id from the `transaction.created` webhook or from `GET /transactions?transactionMessageId=`. Besides `simulation:write`, the access token needs `transactions:read` and `transaction-messages:read`: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. `adjustment` and `reversal` are checked against the hold Astrada has processed so far and rejected with `409` when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state. 1676 1677 :param transaction_id: (required) 1678 :type transaction_id: str 1679 :param simulate_transaction_message_request: (required) 1680 :type simulate_transaction_message_request: SimulateTransactionMessageRequest 1681 :param _request_timeout: timeout setting for this request. If one 1682 number provided, it will be total request 1683 timeout. It can also be a pair (tuple) of 1684 (connection, read) timeouts. 1685 :type _request_timeout: int, tuple(int, int), optional 1686 :param _request_auth: set to override the auth_settings for an a single 1687 request; this effectively ignores the 1688 authentication in the spec for a single request. 1689 :type _request_auth: dict, optional 1690 :param _content_type: force content-type for the request. 1691 :type _content_type: str, Optional 1692 :param _headers: set to override the headers for a single 1693 request; this effectively ignores the headers 1694 in the spec for a single request. 1695 :type _headers: dict, optional 1696 :param _host_index: set to override the host_index for a single 1697 request; this effectively ignores the host_index 1698 in the spec for a single request. 1699 :type _host_index: int, optional 1700 :return: Returns the result object. 1701 """ # noqa: E501 1702 1703 _param = self._simulate_transaction_message_serialize( 1704 transaction_id=transaction_id, 1705 simulate_transaction_message_request=simulate_transaction_message_request, 1706 _request_auth=_request_auth, 1707 _content_type=_content_type, 1708 _headers=_headers, 1709 _host_index=_host_index 1710 ) 1711 1712 _response_types_map: Dict[str, Optional[str]] = { 1713 '202': "SimulateTransactionAccepted", 1714 '400': "ValidationProblem", 1715 '401': "Problem", 1716 '403': "Problem", 1717 '404': "Problem", 1718 '409': "Conflict", 1719 '500': "Problem", 1720 '502': "Problem", 1721 } 1722 response_data = self.api_client.call_api( 1723 *_param, 1724 _request_timeout=_request_timeout 1725 ) 1726 return response_data.response 1727 1728 1729 def _simulate_transaction_message_serialize( 1730 self, 1731 transaction_id, 1732 simulate_transaction_message_request, 1733 _request_auth, 1734 _content_type, 1735 _headers, 1736 _host_index, 1737 ) -> RequestSerialized: 1738 1739 _host = None 1740 1741 _collection_formats: Dict[str, str] = { 1742 } 1743 1744 _path_params: Dict[str, str] = {} 1745 _query_params: List[Tuple[str, str]] = [] 1746 _header_params: Dict[str, Optional[str]] = _headers or {} 1747 _form_params: List[Tuple[str, str]] = [] 1748 _files: Dict[ 1749 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 1750 ] = {} 1751 _body_params: Optional[bytes] = None 1752 1753 # process the path parameters 1754 if transaction_id is not None: 1755 _path_params['transactionId'] = transaction_id 1756 # process the query parameters 1757 # process the header parameters 1758 # process the form parameters 1759 # process the body parameter 1760 if simulate_transaction_message_request is not None: 1761 _body_params = simulate_transaction_message_request 1762 1763 1764 # set the HTTP header `Accept` 1765 if 'Accept' not in _header_params: 1766 _header_params['Accept'] = self.api_client.select_header_accept( 1767 [ 1768 'application/json', 1769 'application/problem+json' 1770 ] 1771 ) 1772 1773 # set the HTTP header `Content-Type` 1774 if _content_type: 1775 _header_params['Content-Type'] = _content_type 1776 else: 1777 _default_content_type = ( 1778 self.api_client.select_header_content_type( 1779 [ 1780 'application/json' 1781 ] 1782 ) 1783 ) 1784 if _default_content_type is not None: 1785 _header_params['Content-Type'] = _default_content_type 1786 1787 # authentication setting 1788 _auth_settings: List[str] = [ 1789 'main-auth' 1790 ] 1791 1792 return self.api_client.param_serialize( 1793 method='POST', 1794 resource_path='/simulate/transactions/{transactionId}', 1795 path_params=_path_params, 1796 query_params=_query_params, 1797 header_params=_header_params, 1798 body=_body_params, 1799 post_params=_form_params, 1800 files=_files, 1801 auth_settings=_auth_settings, 1802 collection_formats=_collection_formats, 1803 _host=_host, 1804 _request_auth=_request_auth 1805 ) 1806 1807 1808 1809 1810 @validate_call 1811 def simulate_transaction_scenario( 1812 self, 1813 simulate_transaction_scenario_request: SimulateTransactionScenarioRequest, 1814 _request_timeout: Union[ 1815 None, 1816 Annotated[StrictFloat, Field(gt=0)], 1817 Tuple[ 1818 Annotated[StrictFloat, Field(gt=0)], 1819 Annotated[StrictFloat, Field(gt=0)] 1820 ] 1821 ] = None, 1822 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1823 _content_type: Optional[StrictStr] = None, 1824 _headers: Optional[Dict[StrictStr, Any]] = None, 1825 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1826 ) -> SimulateTransactionScenarioAccepted: 1827 """Simulate a transaction scenario (sandbox only) 1828 1829 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns `202 Accepted` with their ids. The transactions arrive asynchronously through the `transaction.created` and `transaction.updated` webhooks. The call does not look the card up first: well-formed ids return `202` even when they do not name an enrolled card of your account. If no transaction appears, check that `cardId` is enrolled in `subaccountId`. 1830 1831 :param simulate_transaction_scenario_request: (required) 1832 :type simulate_transaction_scenario_request: SimulateTransactionScenarioRequest 1833 :param _request_timeout: timeout setting for this request. If one 1834 number provided, it will be total request 1835 timeout. It can also be a pair (tuple) of 1836 (connection, read) timeouts. 1837 :type _request_timeout: int, tuple(int, int), optional 1838 :param _request_auth: set to override the auth_settings for an a single 1839 request; this effectively ignores the 1840 authentication in the spec for a single request. 1841 :type _request_auth: dict, optional 1842 :param _content_type: force content-type for the request. 1843 :type _content_type: str, Optional 1844 :param _headers: set to override the headers for a single 1845 request; this effectively ignores the headers 1846 in the spec for a single request. 1847 :type _headers: dict, optional 1848 :param _host_index: set to override the host_index for a single 1849 request; this effectively ignores the host_index 1850 in the spec for a single request. 1851 :type _host_index: int, optional 1852 :return: Returns the result object. 1853 """ # noqa: E501 1854 1855 _param = self._simulate_transaction_scenario_serialize( 1856 simulate_transaction_scenario_request=simulate_transaction_scenario_request, 1857 _request_auth=_request_auth, 1858 _content_type=_content_type, 1859 _headers=_headers, 1860 _host_index=_host_index 1861 ) 1862 1863 _response_types_map: Dict[str, Optional[str]] = { 1864 '202': "SimulateTransactionScenarioAccepted", 1865 '400': "ValidationProblem", 1866 '401': "Problem", 1867 '403': "Problem", 1868 '500': "Problem", 1869 } 1870 response_data = self.api_client.call_api( 1871 *_param, 1872 _request_timeout=_request_timeout 1873 ) 1874 response_data.read() 1875 return self.api_client.response_deserialize( 1876 response_data=response_data, 1877 response_types_map=_response_types_map, 1878 ).data 1879 1880 1881 @validate_call 1882 def simulate_transaction_scenario_with_http_info( 1883 self, 1884 simulate_transaction_scenario_request: SimulateTransactionScenarioRequest, 1885 _request_timeout: Union[ 1886 None, 1887 Annotated[StrictFloat, Field(gt=0)], 1888 Tuple[ 1889 Annotated[StrictFloat, Field(gt=0)], 1890 Annotated[StrictFloat, Field(gt=0)] 1891 ] 1892 ] = None, 1893 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1894 _content_type: Optional[StrictStr] = None, 1895 _headers: Optional[Dict[StrictStr, Any]] = None, 1896 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1897 ) -> ApiResponse[SimulateTransactionScenarioAccepted]: 1898 """Simulate a transaction scenario (sandbox only) 1899 1900 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns `202 Accepted` with their ids. The transactions arrive asynchronously through the `transaction.created` and `transaction.updated` webhooks. The call does not look the card up first: well-formed ids return `202` even when they do not name an enrolled card of your account. If no transaction appears, check that `cardId` is enrolled in `subaccountId`. 1901 1902 :param simulate_transaction_scenario_request: (required) 1903 :type simulate_transaction_scenario_request: SimulateTransactionScenarioRequest 1904 :param _request_timeout: timeout setting for this request. If one 1905 number provided, it will be total request 1906 timeout. It can also be a pair (tuple) of 1907 (connection, read) timeouts. 1908 :type _request_timeout: int, tuple(int, int), optional 1909 :param _request_auth: set to override the auth_settings for an a single 1910 request; this effectively ignores the 1911 authentication in the spec for a single request. 1912 :type _request_auth: dict, optional 1913 :param _content_type: force content-type for the request. 1914 :type _content_type: str, Optional 1915 :param _headers: set to override the headers for a single 1916 request; this effectively ignores the headers 1917 in the spec for a single request. 1918 :type _headers: dict, optional 1919 :param _host_index: set to override the host_index for a single 1920 request; this effectively ignores the host_index 1921 in the spec for a single request. 1922 :type _host_index: int, optional 1923 :return: Returns the result object. 1924 """ # noqa: E501 1925 1926 _param = self._simulate_transaction_scenario_serialize( 1927 simulate_transaction_scenario_request=simulate_transaction_scenario_request, 1928 _request_auth=_request_auth, 1929 _content_type=_content_type, 1930 _headers=_headers, 1931 _host_index=_host_index 1932 ) 1933 1934 _response_types_map: Dict[str, Optional[str]] = { 1935 '202': "SimulateTransactionScenarioAccepted", 1936 '400': "ValidationProblem", 1937 '401': "Problem", 1938 '403': "Problem", 1939 '500': "Problem", 1940 } 1941 response_data = self.api_client.call_api( 1942 *_param, 1943 _request_timeout=_request_timeout 1944 ) 1945 response_data.read() 1946 return self.api_client.response_deserialize( 1947 response_data=response_data, 1948 response_types_map=_response_types_map, 1949 ) 1950 1951 1952 @validate_call 1953 def simulate_transaction_scenario_without_preload_content( 1954 self, 1955 simulate_transaction_scenario_request: SimulateTransactionScenarioRequest, 1956 _request_timeout: Union[ 1957 None, 1958 Annotated[StrictFloat, Field(gt=0)], 1959 Tuple[ 1960 Annotated[StrictFloat, Field(gt=0)], 1961 Annotated[StrictFloat, Field(gt=0)] 1962 ] 1963 ] = None, 1964 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1965 _content_type: Optional[StrictStr] = None, 1966 _headers: Optional[Dict[StrictStr, Any]] = None, 1967 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1968 ) -> RESTResponseType: 1969 """Simulate a transaction scenario (sandbox only) 1970 1971 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns `202 Accepted` with their ids. The transactions arrive asynchronously through the `transaction.created` and `transaction.updated` webhooks. The call does not look the card up first: well-formed ids return `202` even when they do not name an enrolled card of your account. If no transaction appears, check that `cardId` is enrolled in `subaccountId`. 1972 1973 :param simulate_transaction_scenario_request: (required) 1974 :type simulate_transaction_scenario_request: SimulateTransactionScenarioRequest 1975 :param _request_timeout: timeout setting for this request. If one 1976 number provided, it will be total request 1977 timeout. It can also be a pair (tuple) of 1978 (connection, read) timeouts. 1979 :type _request_timeout: int, tuple(int, int), optional 1980 :param _request_auth: set to override the auth_settings for an a single 1981 request; this effectively ignores the 1982 authentication in the spec for a single request. 1983 :type _request_auth: dict, optional 1984 :param _content_type: force content-type for the request. 1985 :type _content_type: str, Optional 1986 :param _headers: set to override the headers for a single 1987 request; this effectively ignores the headers 1988 in the spec for a single request. 1989 :type _headers: dict, optional 1990 :param _host_index: set to override the host_index for a single 1991 request; this effectively ignores the host_index 1992 in the spec for a single request. 1993 :type _host_index: int, optional 1994 :return: Returns the result object. 1995 """ # noqa: E501 1996 1997 _param = self._simulate_transaction_scenario_serialize( 1998 simulate_transaction_scenario_request=simulate_transaction_scenario_request, 1999 _request_auth=_request_auth, 2000 _content_type=_content_type, 2001 _headers=_headers, 2002 _host_index=_host_index 2003 ) 2004 2005 _response_types_map: Dict[str, Optional[str]] = { 2006 '202': "SimulateTransactionScenarioAccepted", 2007 '400': "ValidationProblem", 2008 '401': "Problem", 2009 '403': "Problem", 2010 '500': "Problem", 2011 } 2012 response_data = self.api_client.call_api( 2013 *_param, 2014 _request_timeout=_request_timeout 2015 ) 2016 return response_data.response 2017 2018 2019 def _simulate_transaction_scenario_serialize( 2020 self, 2021 simulate_transaction_scenario_request, 2022 _request_auth, 2023 _content_type, 2024 _headers, 2025 _host_index, 2026 ) -> RequestSerialized: 2027 2028 _host = None 2029 2030 _collection_formats: Dict[str, str] = { 2031 } 2032 2033 _path_params: Dict[str, str] = {} 2034 _query_params: List[Tuple[str, str]] = [] 2035 _header_params: Dict[str, Optional[str]] = _headers or {} 2036 _form_params: List[Tuple[str, str]] = [] 2037 _files: Dict[ 2038 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 2039 ] = {} 2040 _body_params: Optional[bytes] = None 2041 2042 # process the path parameters 2043 # process the query parameters 2044 # process the header parameters 2045 # process the form parameters 2046 # process the body parameter 2047 if simulate_transaction_scenario_request is not None: 2048 _body_params = simulate_transaction_scenario_request 2049 2050 2051 # set the HTTP header `Accept` 2052 if 'Accept' not in _header_params: 2053 _header_params['Accept'] = self.api_client.select_header_accept( 2054 [ 2055 'application/json', 2056 'application/problem+json' 2057 ] 2058 ) 2059 2060 # set the HTTP header `Content-Type` 2061 if _content_type: 2062 _header_params['Content-Type'] = _content_type 2063 else: 2064 _default_content_type = ( 2065 self.api_client.select_header_content_type( 2066 [ 2067 'application/json' 2068 ] 2069 ) 2070 ) 2071 if _default_content_type is not None: 2072 _header_params['Content-Type'] = _default_content_type 2073 2074 # authentication setting 2075 _auth_settings: List[str] = [ 2076 'main-auth' 2077 ] 2078 2079 return self.api_client.param_serialize( 2080 method='POST', 2081 resource_path='/simulate/transaction/scenario', 2082 path_params=_path_params, 2083 query_params=_query_params, 2084 header_params=_header_params, 2085 body=_body_params, 2086 post_params=_form_params, 2087 files=_files, 2088 auth_settings=_auth_settings, 2089 collection_formats=_collection_formats, 2090 _host=_host, 2091 _request_auth=_request_auth 2092 )
NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech
Do not edit the class manually.
50 @validate_call 51 def simulate_bulk_feed_file_gl( 52 self, 53 simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest, 54 _request_timeout: Union[ 55 None, 56 Annotated[StrictFloat, Field(gt=0)], 57 Tuple[ 58 Annotated[StrictFloat, Field(gt=0)], 59 Annotated[StrictFloat, Field(gt=0)] 60 ] 61 ] = None, 62 _request_auth: Optional[Dict[StrictStr, Any]] = None, 63 _content_type: Optional[StrictStr] = None, 64 _headers: Optional[Dict[StrictStr, Any]] = None, 65 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 66 ) -> None: 67 """Simulate an American Express bulk file (sandbox only) 68 69 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when `transactionsPerCard` is above `0`, and processes it as if American Express had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. For a feed registered `tokenized` (see `panFormat` on `POST /network-bulk-feeds`), `cardCount` draws American Express network tokens instead of raw card numbers, and `newCardCount` is not supported (there is no tokenized new-card pool). 70 71 :param simulate_bulk_feed_file_gl_request: (required) 72 :type simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest 73 :param _request_timeout: timeout setting for this request. If one 74 number provided, it will be total request 75 timeout. It can also be a pair (tuple) of 76 (connection, read) timeouts. 77 :type _request_timeout: int, tuple(int, int), optional 78 :param _request_auth: set to override the auth_settings for an a single 79 request; this effectively ignores the 80 authentication in the spec for a single request. 81 :type _request_auth: dict, optional 82 :param _content_type: force content-type for the request. 83 :type _content_type: str, Optional 84 :param _headers: set to override the headers for a single 85 request; this effectively ignores the headers 86 in the spec for a single request. 87 :type _headers: dict, optional 88 :param _host_index: set to override the host_index for a single 89 request; this effectively ignores the host_index 90 in the spec for a single request. 91 :type _host_index: int, optional 92 :return: Returns the result object. 93 """ # noqa: E501 94 95 _param = self._simulate_bulk_feed_file_gl_serialize( 96 simulate_bulk_feed_file_gl_request=simulate_bulk_feed_file_gl_request, 97 _request_auth=_request_auth, 98 _content_type=_content_type, 99 _headers=_headers, 100 _host_index=_host_index 101 ) 102 103 _response_types_map: Dict[str, Optional[str]] = { 104 '202': None, 105 '400': "ValidationProblem", 106 '401': "Problem", 107 '403': "Problem", 108 '413': "Problem", 109 '500': "Problem", 110 } 111 response_data = self.api_client.call_api( 112 *_param, 113 _request_timeout=_request_timeout 114 ) 115 response_data.read() 116 return self.api_client.response_deserialize( 117 response_data=response_data, 118 response_types_map=_response_types_map, 119 ).data
Simulate an American Express bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when transactionsPerCard is above 0, and processes it as if American Express had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh ids and recent dates, so repeat calls always produce transaction.* webhooks. For a feed registered tokenized (see panFormat on POST /network-bulk-feeds), cardCount draws American Express network tokens instead of raw card numbers, and newCardCount is not supported (there is no tokenized new-card pool).
Parameters
- simulate_bulk_feed_file_gl_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
122 @validate_call 123 def simulate_bulk_feed_file_gl_with_http_info( 124 self, 125 simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest, 126 _request_timeout: Union[ 127 None, 128 Annotated[StrictFloat, Field(gt=0)], 129 Tuple[ 130 Annotated[StrictFloat, Field(gt=0)], 131 Annotated[StrictFloat, Field(gt=0)] 132 ] 133 ] = None, 134 _request_auth: Optional[Dict[StrictStr, Any]] = None, 135 _content_type: Optional[StrictStr] = None, 136 _headers: Optional[Dict[StrictStr, Any]] = None, 137 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 138 ) -> ApiResponse[None]: 139 """Simulate an American Express bulk file (sandbox only) 140 141 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when `transactionsPerCard` is above `0`, and processes it as if American Express had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. For a feed registered `tokenized` (see `panFormat` on `POST /network-bulk-feeds`), `cardCount` draws American Express network tokens instead of raw card numbers, and `newCardCount` is not supported (there is no tokenized new-card pool). 142 143 :param simulate_bulk_feed_file_gl_request: (required) 144 :type simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest 145 :param _request_timeout: timeout setting for this request. If one 146 number provided, it will be total request 147 timeout. It can also be a pair (tuple) of 148 (connection, read) timeouts. 149 :type _request_timeout: int, tuple(int, int), optional 150 :param _request_auth: set to override the auth_settings for an a single 151 request; this effectively ignores the 152 authentication in the spec for a single request. 153 :type _request_auth: dict, optional 154 :param _content_type: force content-type for the request. 155 :type _content_type: str, Optional 156 :param _headers: set to override the headers for a single 157 request; this effectively ignores the headers 158 in the spec for a single request. 159 :type _headers: dict, optional 160 :param _host_index: set to override the host_index for a single 161 request; this effectively ignores the host_index 162 in the spec for a single request. 163 :type _host_index: int, optional 164 :return: Returns the result object. 165 """ # noqa: E501 166 167 _param = self._simulate_bulk_feed_file_gl_serialize( 168 simulate_bulk_feed_file_gl_request=simulate_bulk_feed_file_gl_request, 169 _request_auth=_request_auth, 170 _content_type=_content_type, 171 _headers=_headers, 172 _host_index=_host_index 173 ) 174 175 _response_types_map: Dict[str, Optional[str]] = { 176 '202': None, 177 '400': "ValidationProblem", 178 '401': "Problem", 179 '403': "Problem", 180 '413': "Problem", 181 '500': "Problem", 182 } 183 response_data = self.api_client.call_api( 184 *_param, 185 _request_timeout=_request_timeout 186 ) 187 response_data.read() 188 return self.api_client.response_deserialize( 189 response_data=response_data, 190 response_types_map=_response_types_map, 191 )
Simulate an American Express bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when transactionsPerCard is above 0, and processes it as if American Express had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh ids and recent dates, so repeat calls always produce transaction.* webhooks. For a feed registered tokenized (see panFormat on POST /network-bulk-feeds), cardCount draws American Express network tokens instead of raw card numbers, and newCardCount is not supported (there is no tokenized new-card pool).
Parameters
- simulate_bulk_feed_file_gl_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
194 @validate_call 195 def simulate_bulk_feed_file_gl_without_preload_content( 196 self, 197 simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest, 198 _request_timeout: Union[ 199 None, 200 Annotated[StrictFloat, Field(gt=0)], 201 Tuple[ 202 Annotated[StrictFloat, Field(gt=0)], 203 Annotated[StrictFloat, Field(gt=0)] 204 ] 205 ] = None, 206 _request_auth: Optional[Dict[StrictStr, Any]] = None, 207 _content_type: Optional[StrictStr] = None, 208 _headers: Optional[Dict[StrictStr, Any]] = None, 209 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 210 ) -> RESTResponseType: 211 """Simulate an American Express bulk file (sandbox only) 212 213 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when `transactionsPerCard` is above `0`, and processes it as if American Express had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. For a feed registered `tokenized` (see `panFormat` on `POST /network-bulk-feeds`), `cardCount` draws American Express network tokens instead of raw card numbers, and `newCardCount` is not supported (there is no tokenized new-card pool). 214 215 :param simulate_bulk_feed_file_gl_request: (required) 216 :type simulate_bulk_feed_file_gl_request: SimulateBulkFeedFileGlRequest 217 :param _request_timeout: timeout setting for this request. If one 218 number provided, it will be total request 219 timeout. It can also be a pair (tuple) of 220 (connection, read) timeouts. 221 :type _request_timeout: int, tuple(int, int), optional 222 :param _request_auth: set to override the auth_settings for an a single 223 request; this effectively ignores the 224 authentication in the spec for a single request. 225 :type _request_auth: dict, optional 226 :param _content_type: force content-type for the request. 227 :type _content_type: str, Optional 228 :param _headers: set to override the headers for a single 229 request; this effectively ignores the headers 230 in the spec for a single request. 231 :type _headers: dict, optional 232 :param _host_index: set to override the host_index for a single 233 request; this effectively ignores the host_index 234 in the spec for a single request. 235 :type _host_index: int, optional 236 :return: Returns the result object. 237 """ # noqa: E501 238 239 _param = self._simulate_bulk_feed_file_gl_serialize( 240 simulate_bulk_feed_file_gl_request=simulate_bulk_feed_file_gl_request, 241 _request_auth=_request_auth, 242 _content_type=_content_type, 243 _headers=_headers, 244 _host_index=_host_index 245 ) 246 247 _response_types_map: Dict[str, Optional[str]] = { 248 '202': None, 249 '400': "ValidationProblem", 250 '401': "Problem", 251 '403': "Problem", 252 '413': "Problem", 253 '500': "Problem", 254 } 255 response_data = self.api_client.call_api( 256 *_param, 257 _request_timeout=_request_timeout 258 ) 259 return response_data.response
Simulate an American Express bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated American Express bulk-enrollment file, plus a companion settlement file when transactionsPerCard is above 0, and processes it as if American Express had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes, and their settlements follow shortly after. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox account pool (encrypted feeds; for tokenized feeds see below): the same accounts every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws accounts the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh ids and recent dates, so repeat calls always produce transaction.* webhooks. For a feed registered tokenized (see panFormat on POST /network-bulk-feeds), cardCount draws American Express network tokens instead of raw card numbers, and newCardCount is not supported (there is no tokenized new-card pool).
Parameters
- simulate_bulk_feed_file_gl_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
339 @validate_call 340 def simulate_bulk_feed_file_smartdata( 341 self, 342 simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest, 343 _request_timeout: Union[ 344 None, 345 Annotated[StrictFloat, Field(gt=0)], 346 Tuple[ 347 Annotated[StrictFloat, Field(gt=0)], 348 Annotated[StrictFloat, Field(gt=0)] 349 ] 350 ] = None, 351 _request_auth: Optional[Dict[StrictStr, Any]] = None, 352 _content_type: Optional[StrictStr] = None, 353 _headers: Optional[Dict[StrictStr, Any]] = None, 354 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 355 ) -> None: 356 """Simulate a Mastercard bulk file (sandbox only) 357 358 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 359 360 :param simulate_bulk_feed_file_smartdata_request: (required) 361 :type simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest 362 :param _request_timeout: timeout setting for this request. If one 363 number provided, it will be total request 364 timeout. It can also be a pair (tuple) of 365 (connection, read) timeouts. 366 :type _request_timeout: int, tuple(int, int), optional 367 :param _request_auth: set to override the auth_settings for an a single 368 request; this effectively ignores the 369 authentication in the spec for a single request. 370 :type _request_auth: dict, optional 371 :param _content_type: force content-type for the request. 372 :type _content_type: str, Optional 373 :param _headers: set to override the headers for a single 374 request; this effectively ignores the headers 375 in the spec for a single request. 376 :type _headers: dict, optional 377 :param _host_index: set to override the host_index for a single 378 request; this effectively ignores the host_index 379 in the spec for a single request. 380 :type _host_index: int, optional 381 :return: Returns the result object. 382 """ # noqa: E501 383 384 _param = self._simulate_bulk_feed_file_smartdata_serialize( 385 simulate_bulk_feed_file_smartdata_request=simulate_bulk_feed_file_smartdata_request, 386 _request_auth=_request_auth, 387 _content_type=_content_type, 388 _headers=_headers, 389 _host_index=_host_index 390 ) 391 392 _response_types_map: Dict[str, Optional[str]] = { 393 '202': None, 394 '400': "ValidationProblem", 395 '401': "Problem", 396 '403': "Problem", 397 '413': "Problem", 398 '500': "Problem", 399 } 400 response_data = self.api_client.call_api( 401 *_param, 402 _request_timeout=_request_timeout 403 ) 404 response_data.read() 405 return self.api_client.response_deserialize( 406 response_data=response_data, 407 response_types_map=_response_types_map, 408 ).data
Simulate a Mastercard bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh references and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_smartdata_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
411 @validate_call 412 def simulate_bulk_feed_file_smartdata_with_http_info( 413 self, 414 simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest, 415 _request_timeout: Union[ 416 None, 417 Annotated[StrictFloat, Field(gt=0)], 418 Tuple[ 419 Annotated[StrictFloat, Field(gt=0)], 420 Annotated[StrictFloat, Field(gt=0)] 421 ] 422 ] = None, 423 _request_auth: Optional[Dict[StrictStr, Any]] = None, 424 _content_type: Optional[StrictStr] = None, 425 _headers: Optional[Dict[StrictStr, Any]] = None, 426 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 427 ) -> ApiResponse[None]: 428 """Simulate a Mastercard bulk file (sandbox only) 429 430 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 431 432 :param simulate_bulk_feed_file_smartdata_request: (required) 433 :type simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest 434 :param _request_timeout: timeout setting for this request. If one 435 number provided, it will be total request 436 timeout. It can also be a pair (tuple) of 437 (connection, read) timeouts. 438 :type _request_timeout: int, tuple(int, int), optional 439 :param _request_auth: set to override the auth_settings for an a single 440 request; this effectively ignores the 441 authentication in the spec for a single request. 442 :type _request_auth: dict, optional 443 :param _content_type: force content-type for the request. 444 :type _content_type: str, Optional 445 :param _headers: set to override the headers for a single 446 request; this effectively ignores the headers 447 in the spec for a single request. 448 :type _headers: dict, optional 449 :param _host_index: set to override the host_index for a single 450 request; this effectively ignores the host_index 451 in the spec for a single request. 452 :type _host_index: int, optional 453 :return: Returns the result object. 454 """ # noqa: E501 455 456 _param = self._simulate_bulk_feed_file_smartdata_serialize( 457 simulate_bulk_feed_file_smartdata_request=simulate_bulk_feed_file_smartdata_request, 458 _request_auth=_request_auth, 459 _content_type=_content_type, 460 _headers=_headers, 461 _host_index=_host_index 462 ) 463 464 _response_types_map: Dict[str, Optional[str]] = { 465 '202': None, 466 '400': "ValidationProblem", 467 '401': "Problem", 468 '403': "Problem", 469 '413': "Problem", 470 '500': "Problem", 471 } 472 response_data = self.api_client.call_api( 473 *_param, 474 _request_timeout=_request_timeout 475 ) 476 response_data.read() 477 return self.api_client.response_deserialize( 478 response_data=response_data, 479 response_types_map=_response_types_map, 480 )
Simulate a Mastercard bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh references and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_smartdata_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
483 @validate_call 484 def simulate_bulk_feed_file_smartdata_without_preload_content( 485 self, 486 simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest, 487 _request_timeout: Union[ 488 None, 489 Annotated[StrictFloat, Field(gt=0)], 490 Tuple[ 491 Annotated[StrictFloat, Field(gt=0)], 492 Annotated[StrictFloat, Field(gt=0)] 493 ] 494 ] = None, 495 _request_auth: Optional[Dict[StrictStr, Any]] = None, 496 _content_type: Optional[StrictStr] = None, 497 _headers: Optional[Dict[StrictStr, Any]] = None, 498 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 499 ) -> RESTResponseType: 500 """Simulate a Mastercard bulk file (sandbox only) 501 502 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 503 504 :param simulate_bulk_feed_file_smartdata_request: (required) 505 :type simulate_bulk_feed_file_smartdata_request: SimulateBulkFeedFileSmartdataRequest 506 :param _request_timeout: timeout setting for this request. If one 507 number provided, it will be total request 508 timeout. It can also be a pair (tuple) of 509 (connection, read) timeouts. 510 :type _request_timeout: int, tuple(int, int), optional 511 :param _request_auth: set to override the auth_settings for an a single 512 request; this effectively ignores the 513 authentication in the spec for a single request. 514 :type _request_auth: dict, optional 515 :param _content_type: force content-type for the request. 516 :type _content_type: str, Optional 517 :param _headers: set to override the headers for a single 518 request; this effectively ignores the headers 519 in the spec for a single request. 520 :type _headers: dict, optional 521 :param _host_index: set to override the host_index for a single 522 request; this effectively ignores the host_index 523 in the spec for a single request. 524 :type _host_index: int, optional 525 :return: Returns the result object. 526 """ # noqa: E501 527 528 _param = self._simulate_bulk_feed_file_smartdata_serialize( 529 simulate_bulk_feed_file_smartdata_request=simulate_bulk_feed_file_smartdata_request, 530 _request_auth=_request_auth, 531 _content_type=_content_type, 532 _headers=_headers, 533 _host_index=_host_index 534 ) 535 536 _response_types_map: Dict[str, Optional[str]] = { 537 '202': None, 538 '400': "ValidationProblem", 539 '401': "Problem", 540 '403': "Problem", 541 '413': "Problem", 542 '500': "Problem", 543 } 544 response_data = self.api_client.call_api( 545 *_param, 546 _request_timeout=_request_timeout 547 ) 548 return response_data.response
Simulate a Mastercard bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated Mastercard bulk-enrollment file and processes it as if Mastercard had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh references and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_smartdata_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
628 @validate_call 629 def simulate_bulk_feed_file_vbds( 630 self, 631 simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest, 632 _request_timeout: Union[ 633 None, 634 Annotated[StrictFloat, Field(gt=0)], 635 Tuple[ 636 Annotated[StrictFloat, Field(gt=0)], 637 Annotated[StrictFloat, Field(gt=0)] 638 ] 639 ] = None, 640 _request_auth: Optional[Dict[StrictStr, Any]] = None, 641 _content_type: Optional[StrictStr] = None, 642 _headers: Optional[Dict[StrictStr, Any]] = None, 643 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 644 ) -> None: 645 """Simulate a pulled Visa bulk feed delivery (sandbox only) 646 647 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Simulates one delivery on a Visa bulk feed of `type: VBDS`, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when `transactionsPerCard` is above `0`, adds settlements for them. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`; otherwise the call returns `400`. `cardCount` replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a delivery that arrives twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. 648 649 :param simulate_bulk_feed_file_vbds_request: (required) 650 :type simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest 651 :param _request_timeout: timeout setting for this request. If one 652 number provided, it will be total request 653 timeout. It can also be a pair (tuple) of 654 (connection, read) timeouts. 655 :type _request_timeout: int, tuple(int, int), optional 656 :param _request_auth: set to override the auth_settings for an a single 657 request; this effectively ignores the 658 authentication in the spec for a single request. 659 :type _request_auth: dict, optional 660 :param _content_type: force content-type for the request. 661 :type _content_type: str, Optional 662 :param _headers: set to override the headers for a single 663 request; this effectively ignores the headers 664 in the spec for a single request. 665 :type _headers: dict, optional 666 :param _host_index: set to override the host_index for a single 667 request; this effectively ignores the host_index 668 in the spec for a single request. 669 :type _host_index: int, optional 670 :return: Returns the result object. 671 """ # noqa: E501 672 673 _param = self._simulate_bulk_feed_file_vbds_serialize( 674 simulate_bulk_feed_file_vbds_request=simulate_bulk_feed_file_vbds_request, 675 _request_auth=_request_auth, 676 _content_type=_content_type, 677 _headers=_headers, 678 _host_index=_host_index 679 ) 680 681 _response_types_map: Dict[str, Optional[str]] = { 682 '202': None, 683 '400': "ValidationProblem", 684 '401': "Problem", 685 '403': "Problem", 686 '413': "Problem", 687 '500': "Problem", 688 } 689 response_data = self.api_client.call_api( 690 *_param, 691 _request_timeout=_request_timeout 692 ) 693 response_data.read() 694 return self.api_client.response_deserialize( 695 response_data=response_data, 696 response_types_map=_response_types_map, 697 ).data
Simulate a pulled Visa bulk feed delivery (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Simulates one delivery on a Visa bulk feed of type: VBDS, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when transactionsPerCard is above 0, adds settlements for them. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds; otherwise the call returns 400. cardCount replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a delivery that arrives twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh ids and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_vbds_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
700 @validate_call 701 def simulate_bulk_feed_file_vbds_with_http_info( 702 self, 703 simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest, 704 _request_timeout: Union[ 705 None, 706 Annotated[StrictFloat, Field(gt=0)], 707 Tuple[ 708 Annotated[StrictFloat, Field(gt=0)], 709 Annotated[StrictFloat, Field(gt=0)] 710 ] 711 ] = None, 712 _request_auth: Optional[Dict[StrictStr, Any]] = None, 713 _content_type: Optional[StrictStr] = None, 714 _headers: Optional[Dict[StrictStr, Any]] = None, 715 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 716 ) -> ApiResponse[None]: 717 """Simulate a pulled Visa bulk feed delivery (sandbox only) 718 719 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Simulates one delivery on a Visa bulk feed of `type: VBDS`, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when `transactionsPerCard` is above `0`, adds settlements for them. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`; otherwise the call returns `400`. `cardCount` replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a delivery that arrives twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. 720 721 :param simulate_bulk_feed_file_vbds_request: (required) 722 :type simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest 723 :param _request_timeout: timeout setting for this request. If one 724 number provided, it will be total request 725 timeout. It can also be a pair (tuple) of 726 (connection, read) timeouts. 727 :type _request_timeout: int, tuple(int, int), optional 728 :param _request_auth: set to override the auth_settings for an a single 729 request; this effectively ignores the 730 authentication in the spec for a single request. 731 :type _request_auth: dict, optional 732 :param _content_type: force content-type for the request. 733 :type _content_type: str, Optional 734 :param _headers: set to override the headers for a single 735 request; this effectively ignores the headers 736 in the spec for a single request. 737 :type _headers: dict, optional 738 :param _host_index: set to override the host_index for a single 739 request; this effectively ignores the host_index 740 in the spec for a single request. 741 :type _host_index: int, optional 742 :return: Returns the result object. 743 """ # noqa: E501 744 745 _param = self._simulate_bulk_feed_file_vbds_serialize( 746 simulate_bulk_feed_file_vbds_request=simulate_bulk_feed_file_vbds_request, 747 _request_auth=_request_auth, 748 _content_type=_content_type, 749 _headers=_headers, 750 _host_index=_host_index 751 ) 752 753 _response_types_map: Dict[str, Optional[str]] = { 754 '202': None, 755 '400': "ValidationProblem", 756 '401': "Problem", 757 '403': "Problem", 758 '413': "Problem", 759 '500': "Problem", 760 } 761 response_data = self.api_client.call_api( 762 *_param, 763 _request_timeout=_request_timeout 764 ) 765 response_data.read() 766 return self.api_client.response_deserialize( 767 response_data=response_data, 768 response_types_map=_response_types_map, 769 )
Simulate a pulled Visa bulk feed delivery (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Simulates one delivery on a Visa bulk feed of type: VBDS, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when transactionsPerCard is above 0, adds settlements for them. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds; otherwise the call returns 400. cardCount replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a delivery that arrives twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh ids and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_vbds_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
772 @validate_call 773 def simulate_bulk_feed_file_vbds_without_preload_content( 774 self, 775 simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest, 776 _request_timeout: Union[ 777 None, 778 Annotated[StrictFloat, Field(gt=0)], 779 Tuple[ 780 Annotated[StrictFloat, Field(gt=0)], 781 Annotated[StrictFloat, Field(gt=0)] 782 ] 783 ] = None, 784 _request_auth: Optional[Dict[StrictStr, Any]] = None, 785 _content_type: Optional[StrictStr] = None, 786 _headers: Optional[Dict[StrictStr, Any]] = None, 787 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 788 ) -> RESTResponseType: 789 """Simulate a pulled Visa bulk feed delivery (sandbox only) 790 791 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Simulates one delivery on a Visa bulk feed of `type: VBDS`, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when `transactionsPerCard` is above `0`, adds settlements for them. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`; otherwise the call returns `400`. `cardCount` replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a delivery that arrives twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh ids and recent dates, so repeat calls always produce `transaction.*` webhooks. 792 793 :param simulate_bulk_feed_file_vbds_request: (required) 794 :type simulate_bulk_feed_file_vbds_request: SimulateBulkFeedFileVbdsRequest 795 :param _request_timeout: timeout setting for this request. If one 796 number provided, it will be total request 797 timeout. It can also be a pair (tuple) of 798 (connection, read) timeouts. 799 :type _request_timeout: int, tuple(int, int), optional 800 :param _request_auth: set to override the auth_settings for an a single 801 request; this effectively ignores the 802 authentication in the spec for a single request. 803 :type _request_auth: dict, optional 804 :param _content_type: force content-type for the request. 805 :type _content_type: str, Optional 806 :param _headers: set to override the headers for a single 807 request; this effectively ignores the headers 808 in the spec for a single request. 809 :type _headers: dict, optional 810 :param _host_index: set to override the host_index for a single 811 request; this effectively ignores the host_index 812 in the spec for a single request. 813 :type _host_index: int, optional 814 :return: Returns the result object. 815 """ # noqa: E501 816 817 _param = self._simulate_bulk_feed_file_vbds_serialize( 818 simulate_bulk_feed_file_vbds_request=simulate_bulk_feed_file_vbds_request, 819 _request_auth=_request_auth, 820 _content_type=_content_type, 821 _headers=_headers, 822 _host_index=_host_index 823 ) 824 825 _response_types_map: Dict[str, Optional[str]] = { 826 '202': None, 827 '400': "ValidationProblem", 828 '401': "Problem", 829 '403': "Problem", 830 '413': "Problem", 831 '500': "Problem", 832 } 833 response_data = self.api_client.call_api( 834 *_param, 835 _request_timeout=_request_timeout 836 ) 837 return response_data.response
Simulate a pulled Visa bulk feed delivery (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Simulates one delivery on a Visa bulk feed of type: VBDS, the kind Astrada pulls from Visa instead of receiving a file. The delivery enrolls cards and, when transactionsPerCard is above 0, adds settlements for them. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds; otherwise the call returns 400. cardCount replays the fixed head of the sandbox card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a delivery that arrives twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh ids and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_vbds_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
917 @validate_call 918 def simulate_bulk_feed_file_vcf( 919 self, 920 simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest, 921 _request_timeout: Union[ 922 None, 923 Annotated[StrictFloat, Field(gt=0)], 924 Tuple[ 925 Annotated[StrictFloat, Field(gt=0)], 926 Annotated[StrictFloat, Field(gt=0)] 927 ] 928 ] = None, 929 _request_auth: Optional[Dict[StrictStr, Any]] = None, 930 _content_type: Optional[StrictStr] = None, 931 _headers: Optional[Dict[StrictStr, Any]] = None, 932 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 933 ) -> None: 934 """Simulate a Visa bulk file (sandbox only) 935 936 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of `type: VCF`) and processes it as if Visa had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 937 938 :param simulate_bulk_feed_file_vcf_request: (required) 939 :type simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest 940 :param _request_timeout: timeout setting for this request. If one 941 number provided, it will be total request 942 timeout. It can also be a pair (tuple) of 943 (connection, read) timeouts. 944 :type _request_timeout: int, tuple(int, int), optional 945 :param _request_auth: set to override the auth_settings for an a single 946 request; this effectively ignores the 947 authentication in the spec for a single request. 948 :type _request_auth: dict, optional 949 :param _content_type: force content-type for the request. 950 :type _content_type: str, Optional 951 :param _headers: set to override the headers for a single 952 request; this effectively ignores the headers 953 in the spec for a single request. 954 :type _headers: dict, optional 955 :param _host_index: set to override the host_index for a single 956 request; this effectively ignores the host_index 957 in the spec for a single request. 958 :type _host_index: int, optional 959 :return: Returns the result object. 960 """ # noqa: E501 961 962 _param = self._simulate_bulk_feed_file_vcf_serialize( 963 simulate_bulk_feed_file_vcf_request=simulate_bulk_feed_file_vcf_request, 964 _request_auth=_request_auth, 965 _content_type=_content_type, 966 _headers=_headers, 967 _host_index=_host_index 968 ) 969 970 _response_types_map: Dict[str, Optional[str]] = { 971 '202': None, 972 '400': "ValidationProblem", 973 '401': "Problem", 974 '403': "Problem", 975 '413': "Problem", 976 '500': "Problem", 977 } 978 response_data = self.api_client.call_api( 979 *_param, 980 _request_timeout=_request_timeout 981 ) 982 response_data.read() 983 return self.api_client.response_deserialize( 984 response_data=response_data, 985 response_types_map=_response_types_map, 986 ).data
Simulate a Visa bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of type: VCF) and processes it as if Visa had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh references and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_vcf_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
989 @validate_call 990 def simulate_bulk_feed_file_vcf_with_http_info( 991 self, 992 simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest, 993 _request_timeout: Union[ 994 None, 995 Annotated[StrictFloat, Field(gt=0)], 996 Tuple[ 997 Annotated[StrictFloat, Field(gt=0)], 998 Annotated[StrictFloat, Field(gt=0)] 999 ] 1000 ] = None, 1001 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1002 _content_type: Optional[StrictStr] = None, 1003 _headers: Optional[Dict[StrictStr, Any]] = None, 1004 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1005 ) -> ApiResponse[None]: 1006 """Simulate a Visa bulk file (sandbox only) 1007 1008 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of `type: VCF`) and processes it as if Visa had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 1009 1010 :param simulate_bulk_feed_file_vcf_request: (required) 1011 :type simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest 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._simulate_bulk_feed_file_vcf_serialize( 1035 simulate_bulk_feed_file_vcf_request=simulate_bulk_feed_file_vcf_request, 1036 _request_auth=_request_auth, 1037 _content_type=_content_type, 1038 _headers=_headers, 1039 _host_index=_host_index 1040 ) 1041 1042 _response_types_map: Dict[str, Optional[str]] = { 1043 '202': None, 1044 '400': "ValidationProblem", 1045 '401': "Problem", 1046 '403': "Problem", 1047 '413': "Problem", 1048 '500': "Problem", 1049 } 1050 response_data = self.api_client.call_api( 1051 *_param, 1052 _request_timeout=_request_timeout 1053 ) 1054 response_data.read() 1055 return self.api_client.response_deserialize( 1056 response_data=response_data, 1057 response_types_map=_response_types_map, 1058 )
Simulate a Visa bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of type: VCF) and processes it as if Visa had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh references and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_vcf_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1061 @validate_call 1062 def simulate_bulk_feed_file_vcf_without_preload_content( 1063 self, 1064 simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest, 1065 _request_timeout: Union[ 1066 None, 1067 Annotated[StrictFloat, Field(gt=0)], 1068 Tuple[ 1069 Annotated[StrictFloat, Field(gt=0)], 1070 Annotated[StrictFloat, Field(gt=0)] 1071 ] 1072 ] = None, 1073 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1074 _content_type: Optional[StrictStr] = None, 1075 _headers: Optional[Dict[StrictStr, Any]] = None, 1076 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1077 ) -> RESTResponseType: 1078 """Simulate a Visa bulk file (sandbox only) 1079 1080 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of `type: VCF`) and processes it as if Visa had delivered it. The call returns `202 Accepted` at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the `networkReference`, created with `POST /network-bulk-feeds`. `cardCount` replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new `cardsubscription.created`), exactly like a file that is delivered twice. `newCardCount` draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get `transactionsPerCard` transactions with fresh references and recent dates, so repeat calls always produce `transaction.*` webhooks. 1081 1082 :param simulate_bulk_feed_file_vcf_request: (required) 1083 :type simulate_bulk_feed_file_vcf_request: SimulateBulkFeedFileVcfRequest 1084 :param _request_timeout: timeout setting for this request. If one 1085 number provided, it will be total request 1086 timeout. It can also be a pair (tuple) of 1087 (connection, read) timeouts. 1088 :type _request_timeout: int, tuple(int, int), optional 1089 :param _request_auth: set to override the auth_settings for an a single 1090 request; this effectively ignores the 1091 authentication in the spec for a single request. 1092 :type _request_auth: dict, optional 1093 :param _content_type: force content-type for the request. 1094 :type _content_type: str, Optional 1095 :param _headers: set to override the headers for a single 1096 request; this effectively ignores the headers 1097 in the spec for a single request. 1098 :type _headers: dict, optional 1099 :param _host_index: set to override the host_index for a single 1100 request; this effectively ignores the host_index 1101 in the spec for a single request. 1102 :type _host_index: int, optional 1103 :return: Returns the result object. 1104 """ # noqa: E501 1105 1106 _param = self._simulate_bulk_feed_file_vcf_serialize( 1107 simulate_bulk_feed_file_vcf_request=simulate_bulk_feed_file_vcf_request, 1108 _request_auth=_request_auth, 1109 _content_type=_content_type, 1110 _headers=_headers, 1111 _host_index=_host_index 1112 ) 1113 1114 _response_types_map: Dict[str, Optional[str]] = { 1115 '202': None, 1116 '400': "ValidationProblem", 1117 '401': "Problem", 1118 '403': "Problem", 1119 '413': "Problem", 1120 '500': "Problem", 1121 } 1122 response_data = self.api_client.call_api( 1123 *_param, 1124 _request_timeout=_request_timeout 1125 ) 1126 return response_data.response
Simulate a Visa bulk file (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Creates a simulated Visa bulk-enrollment file (a feed of type: VCF) and processes it as if Visa had delivered it. The call returns 202 Accepted at once; enrolled cards appear as card subscriptions when processing finishes. A bulk feed must already exist for the networkReference, created with POST /network-bulk-feeds. cardCount replays the fixed head of the sandbox test-card pool: the same cards every call, so once enrolled in a subaccount they deduplicate (no new cardsubscription.created), exactly like a file that is delivered twice. newCardCount draws cards the subaccount has never seen from a reserved pool, so every call enrolls that many new cards. All included cards get transactionsPerCard transactions with fresh references and recent dates, so repeat calls always produce transaction.* webhooks.
Parameters
- simulate_bulk_feed_file_vcf_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1206 @validate_call 1207 def simulate_transaction( 1208 self, 1209 simulate_transaction_request: SimulateTransactionRequest, 1210 _request_timeout: Union[ 1211 None, 1212 Annotated[StrictFloat, Field(gt=0)], 1213 Tuple[ 1214 Annotated[StrictFloat, Field(gt=0)], 1215 Annotated[StrictFloat, Field(gt=0)] 1216 ] 1217 ] = None, 1218 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1219 _content_type: Optional[StrictStr] = None, 1220 _headers: Optional[Dict[StrictStr, Any]] = None, 1221 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1222 ) -> SimulateTransactionAccepted: 1223 """Simulate a transaction (sandbox only) 1224 1225 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with `POST /simulate/transactions/{transactionId}` to add further messages to the transaction. Besides `simulation:write`, the access token needs `cards:read`: the card is read from the public API to resolve its subaccount and network. 1226 1227 :param simulate_transaction_request: (required) 1228 :type simulate_transaction_request: SimulateTransactionRequest 1229 :param _request_timeout: timeout setting for this request. If one 1230 number provided, it will be total request 1231 timeout. It can also be a pair (tuple) of 1232 (connection, read) timeouts. 1233 :type _request_timeout: int, tuple(int, int), optional 1234 :param _request_auth: set to override the auth_settings for an a single 1235 request; this effectively ignores the 1236 authentication in the spec for a single request. 1237 :type _request_auth: dict, optional 1238 :param _content_type: force content-type for the request. 1239 :type _content_type: str, Optional 1240 :param _headers: set to override the headers for a single 1241 request; this effectively ignores the headers 1242 in the spec for a single request. 1243 :type _headers: dict, optional 1244 :param _host_index: set to override the host_index for a single 1245 request; this effectively ignores the host_index 1246 in the spec for a single request. 1247 :type _host_index: int, optional 1248 :return: Returns the result object. 1249 """ # noqa: E501 1250 1251 _param = self._simulate_transaction_serialize( 1252 simulate_transaction_request=simulate_transaction_request, 1253 _request_auth=_request_auth, 1254 _content_type=_content_type, 1255 _headers=_headers, 1256 _host_index=_host_index 1257 ) 1258 1259 _response_types_map: Dict[str, Optional[str]] = { 1260 '202': "SimulateTransactionAccepted", 1261 '400': "ValidationProblem", 1262 '401': "Problem", 1263 '403': "Problem", 1264 '404': "Problem", 1265 '500': "Problem", 1266 '502': "Problem", 1267 } 1268 response_data = self.api_client.call_api( 1269 *_param, 1270 _request_timeout=_request_timeout 1271 ) 1272 response_data.read() 1273 return self.api_client.response_deserialize( 1274 response_data=response_data, 1275 response_types_map=_response_types_map, 1276 ).data
Simulate a transaction (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with POST /simulate/transactions/{transactionId} to add further messages to the transaction. Besides simulation:write, the access token needs cards:read: the card is read from the public API to resolve its subaccount and network.
Parameters
- simulate_transaction_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1279 @validate_call 1280 def simulate_transaction_with_http_info( 1281 self, 1282 simulate_transaction_request: SimulateTransactionRequest, 1283 _request_timeout: Union[ 1284 None, 1285 Annotated[StrictFloat, Field(gt=0)], 1286 Tuple[ 1287 Annotated[StrictFloat, Field(gt=0)], 1288 Annotated[StrictFloat, Field(gt=0)] 1289 ] 1290 ] = None, 1291 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1292 _content_type: Optional[StrictStr] = None, 1293 _headers: Optional[Dict[StrictStr, Any]] = None, 1294 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1295 ) -> ApiResponse[SimulateTransactionAccepted]: 1296 """Simulate a transaction (sandbox only) 1297 1298 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with `POST /simulate/transactions/{transactionId}` to add further messages to the transaction. Besides `simulation:write`, the access token needs `cards:read`: the card is read from the public API to resolve its subaccount and network. 1299 1300 :param simulate_transaction_request: (required) 1301 :type simulate_transaction_request: SimulateTransactionRequest 1302 :param _request_timeout: timeout setting for this request. If one 1303 number provided, it will be total request 1304 timeout. It can also be a pair (tuple) of 1305 (connection, read) timeouts. 1306 :type _request_timeout: int, tuple(int, int), optional 1307 :param _request_auth: set to override the auth_settings for an a single 1308 request; this effectively ignores the 1309 authentication in the spec for a single request. 1310 :type _request_auth: dict, optional 1311 :param _content_type: force content-type for the request. 1312 :type _content_type: str, Optional 1313 :param _headers: set to override the headers for a single 1314 request; this effectively ignores the headers 1315 in the spec for a single request. 1316 :type _headers: dict, optional 1317 :param _host_index: set to override the host_index for a single 1318 request; this effectively ignores the host_index 1319 in the spec for a single request. 1320 :type _host_index: int, optional 1321 :return: Returns the result object. 1322 """ # noqa: E501 1323 1324 _param = self._simulate_transaction_serialize( 1325 simulate_transaction_request=simulate_transaction_request, 1326 _request_auth=_request_auth, 1327 _content_type=_content_type, 1328 _headers=_headers, 1329 _host_index=_host_index 1330 ) 1331 1332 _response_types_map: Dict[str, Optional[str]] = { 1333 '202': "SimulateTransactionAccepted", 1334 '400': "ValidationProblem", 1335 '401': "Problem", 1336 '403': "Problem", 1337 '404': "Problem", 1338 '500': "Problem", 1339 '502': "Problem", 1340 } 1341 response_data = self.api_client.call_api( 1342 *_param, 1343 _request_timeout=_request_timeout 1344 ) 1345 response_data.read() 1346 return self.api_client.response_deserialize( 1347 response_data=response_data, 1348 response_types_map=_response_types_map, 1349 )
Simulate a transaction (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with POST /simulate/transactions/{transactionId} to add further messages to the transaction. Besides simulation:write, the access token needs cards:read: the card is read from the public API to resolve its subaccount and network.
Parameters
- simulate_transaction_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1352 @validate_call 1353 def simulate_transaction_without_preload_content( 1354 self, 1355 simulate_transaction_request: SimulateTransactionRequest, 1356 _request_timeout: Union[ 1357 None, 1358 Annotated[StrictFloat, Field(gt=0)], 1359 Tuple[ 1360 Annotated[StrictFloat, Field(gt=0)], 1361 Annotated[StrictFloat, Field(gt=0)] 1362 ] 1363 ] = None, 1364 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1365 _content_type: Optional[StrictStr] = None, 1366 _headers: Optional[Dict[StrictStr, Any]] = None, 1367 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1368 ) -> RESTResponseType: 1369 """Simulate a transaction (sandbox only) 1370 1371 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with `POST /simulate/transactions/{transactionId}` to add further messages to the transaction. Besides `simulation:write`, the access token needs `cards:read`: the card is read from the public API to resolve its subaccount and network. 1372 1373 :param simulate_transaction_request: (required) 1374 :type simulate_transaction_request: SimulateTransactionRequest 1375 :param _request_timeout: timeout setting for this request. If one 1376 number provided, it will be total request 1377 timeout. It can also be a pair (tuple) of 1378 (connection, read) timeouts. 1379 :type _request_timeout: int, tuple(int, int), optional 1380 :param _request_auth: set to override the auth_settings for an a single 1381 request; this effectively ignores the 1382 authentication in the spec for a single request. 1383 :type _request_auth: dict, optional 1384 :param _content_type: force content-type for the request. 1385 :type _content_type: str, Optional 1386 :param _headers: set to override the headers for a single 1387 request; this effectively ignores the headers 1388 in the spec for a single request. 1389 :type _headers: dict, optional 1390 :param _host_index: set to override the host_index for a single 1391 request; this effectively ignores the host_index 1392 in the spec for a single request. 1393 :type _host_index: int, optional 1394 :return: Returns the result object. 1395 """ # noqa: E501 1396 1397 _param = self._simulate_transaction_serialize( 1398 simulate_transaction_request=simulate_transaction_request, 1399 _request_auth=_request_auth, 1400 _content_type=_content_type, 1401 _headers=_headers, 1402 _host_index=_host_index 1403 ) 1404 1405 _response_types_map: Dict[str, Optional[str]] = { 1406 '202': "SimulateTransactionAccepted", 1407 '400': "ValidationProblem", 1408 '401': "Problem", 1409 '403': "Problem", 1410 '404': "Problem", 1411 '500': "Problem", 1412 '502': "Problem", 1413 } 1414 response_data = self.api_client.call_api( 1415 *_param, 1416 _request_timeout=_request_timeout 1417 ) 1418 return response_data.response
Simulate a transaction (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Starts a new simulated transaction on an enrolled card by publishing one transaction message, an authorization or a settlement, as if a card network had sent it. Follow it with POST /simulate/transactions/{transactionId} to add further messages to the transaction. Besides simulation:write, the access token needs cards:read: the card is read from the public API to resolve its subaccount and network.
Parameters
- simulate_transaction_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1499 @validate_call 1500 def simulate_transaction_message( 1501 self, 1502 transaction_id: UUID, 1503 simulate_transaction_message_request: SimulateTransactionMessageRequest, 1504 _request_timeout: Union[ 1505 None, 1506 Annotated[StrictFloat, Field(gt=0)], 1507 Tuple[ 1508 Annotated[StrictFloat, Field(gt=0)], 1509 Annotated[StrictFloat, Field(gt=0)] 1510 ] 1511 ] = None, 1512 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1513 _content_type: Optional[StrictStr] = None, 1514 _headers: Optional[Dict[StrictStr, Any]] = None, 1515 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1516 ) -> SimulateTransactionAccepted: 1517 """Simulate a transaction message (sandbox only) 1518 1519 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by `POST /simulate/transactions` or by the scenario endpoint; take its id from the `transaction.created` webhook or from `GET /transactions?transactionMessageId=`. Besides `simulation:write`, the access token needs `transactions:read` and `transaction-messages:read`: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. `adjustment` and `reversal` are checked against the hold Astrada has processed so far and rejected with `409` when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state. 1520 1521 :param transaction_id: (required) 1522 :type transaction_id: str 1523 :param simulate_transaction_message_request: (required) 1524 :type simulate_transaction_message_request: SimulateTransactionMessageRequest 1525 :param _request_timeout: timeout setting for this request. If one 1526 number provided, it will be total request 1527 timeout. It can also be a pair (tuple) of 1528 (connection, read) timeouts. 1529 :type _request_timeout: int, tuple(int, int), optional 1530 :param _request_auth: set to override the auth_settings for an a single 1531 request; this effectively ignores the 1532 authentication in the spec for a single request. 1533 :type _request_auth: dict, optional 1534 :param _content_type: force content-type for the request. 1535 :type _content_type: str, Optional 1536 :param _headers: set to override the headers for a single 1537 request; this effectively ignores the headers 1538 in the spec for a single request. 1539 :type _headers: dict, optional 1540 :param _host_index: set to override the host_index for a single 1541 request; this effectively ignores the host_index 1542 in the spec for a single request. 1543 :type _host_index: int, optional 1544 :return: Returns the result object. 1545 """ # noqa: E501 1546 1547 _param = self._simulate_transaction_message_serialize( 1548 transaction_id=transaction_id, 1549 simulate_transaction_message_request=simulate_transaction_message_request, 1550 _request_auth=_request_auth, 1551 _content_type=_content_type, 1552 _headers=_headers, 1553 _host_index=_host_index 1554 ) 1555 1556 _response_types_map: Dict[str, Optional[str]] = { 1557 '202': "SimulateTransactionAccepted", 1558 '400': "ValidationProblem", 1559 '401': "Problem", 1560 '403': "Problem", 1561 '404': "Problem", 1562 '409': "Conflict", 1563 '500': "Problem", 1564 '502': "Problem", 1565 } 1566 response_data = self.api_client.call_api( 1567 *_param, 1568 _request_timeout=_request_timeout 1569 ) 1570 response_data.read() 1571 return self.api_client.response_deserialize( 1572 response_data=response_data, 1573 response_types_map=_response_types_map, 1574 ).data
Simulate a transaction message (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by POST /simulate/transactions or by the scenario endpoint; take its id from the transaction.created webhook or from GET /transactions?transactionMessageId=. Besides simulation:write, the access token needs transactions:read and transaction-messages:read: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. adjustment and reversal are checked against the hold Astrada has processed so far and rejected with 409 when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state.
Parameters
- transaction_id: (required)
- simulate_transaction_message_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1577 @validate_call 1578 def simulate_transaction_message_with_http_info( 1579 self, 1580 transaction_id: UUID, 1581 simulate_transaction_message_request: SimulateTransactionMessageRequest, 1582 _request_timeout: Union[ 1583 None, 1584 Annotated[StrictFloat, Field(gt=0)], 1585 Tuple[ 1586 Annotated[StrictFloat, Field(gt=0)], 1587 Annotated[StrictFloat, Field(gt=0)] 1588 ] 1589 ] = None, 1590 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1591 _content_type: Optional[StrictStr] = None, 1592 _headers: Optional[Dict[StrictStr, Any]] = None, 1593 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1594 ) -> ApiResponse[SimulateTransactionAccepted]: 1595 """Simulate a transaction message (sandbox only) 1596 1597 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by `POST /simulate/transactions` or by the scenario endpoint; take its id from the `transaction.created` webhook or from `GET /transactions?transactionMessageId=`. Besides `simulation:write`, the access token needs `transactions:read` and `transaction-messages:read`: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. `adjustment` and `reversal` are checked against the hold Astrada has processed so far and rejected with `409` when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state. 1598 1599 :param transaction_id: (required) 1600 :type transaction_id: str 1601 :param simulate_transaction_message_request: (required) 1602 :type simulate_transaction_message_request: SimulateTransactionMessageRequest 1603 :param _request_timeout: timeout setting for this request. If one 1604 number provided, it will be total request 1605 timeout. It can also be a pair (tuple) of 1606 (connection, read) timeouts. 1607 :type _request_timeout: int, tuple(int, int), optional 1608 :param _request_auth: set to override the auth_settings for an a single 1609 request; this effectively ignores the 1610 authentication in the spec for a single request. 1611 :type _request_auth: dict, optional 1612 :param _content_type: force content-type for the request. 1613 :type _content_type: str, Optional 1614 :param _headers: set to override the headers for a single 1615 request; this effectively ignores the headers 1616 in the spec for a single request. 1617 :type _headers: dict, optional 1618 :param _host_index: set to override the host_index for a single 1619 request; this effectively ignores the host_index 1620 in the spec for a single request. 1621 :type _host_index: int, optional 1622 :return: Returns the result object. 1623 """ # noqa: E501 1624 1625 _param = self._simulate_transaction_message_serialize( 1626 transaction_id=transaction_id, 1627 simulate_transaction_message_request=simulate_transaction_message_request, 1628 _request_auth=_request_auth, 1629 _content_type=_content_type, 1630 _headers=_headers, 1631 _host_index=_host_index 1632 ) 1633 1634 _response_types_map: Dict[str, Optional[str]] = { 1635 '202': "SimulateTransactionAccepted", 1636 '400': "ValidationProblem", 1637 '401': "Problem", 1638 '403': "Problem", 1639 '404': "Problem", 1640 '409': "Conflict", 1641 '500': "Problem", 1642 '502': "Problem", 1643 } 1644 response_data = self.api_client.call_api( 1645 *_param, 1646 _request_timeout=_request_timeout 1647 ) 1648 response_data.read() 1649 return self.api_client.response_deserialize( 1650 response_data=response_data, 1651 response_types_map=_response_types_map, 1652 )
Simulate a transaction message (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by POST /simulate/transactions or by the scenario endpoint; take its id from the transaction.created webhook or from GET /transactions?transactionMessageId=. Besides simulation:write, the access token needs transactions:read and transaction-messages:read: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. adjustment and reversal are checked against the hold Astrada has processed so far and rejected with 409 when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state.
Parameters
- transaction_id: (required)
- simulate_transaction_message_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1655 @validate_call 1656 def simulate_transaction_message_without_preload_content( 1657 self, 1658 transaction_id: UUID, 1659 simulate_transaction_message_request: SimulateTransactionMessageRequest, 1660 _request_timeout: Union[ 1661 None, 1662 Annotated[StrictFloat, Field(gt=0)], 1663 Tuple[ 1664 Annotated[StrictFloat, Field(gt=0)], 1665 Annotated[StrictFloat, Field(gt=0)] 1666 ] 1667 ] = None, 1668 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1669 _content_type: Optional[StrictStr] = None, 1670 _headers: Optional[Dict[StrictStr, Any]] = None, 1671 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1672 ) -> RESTResponseType: 1673 """Simulate a transaction message (sandbox only) 1674 1675 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by `POST /simulate/transactions` or by the scenario endpoint; take its id from the `transaction.created` webhook or from `GET /transactions?transactionMessageId=`. Besides `simulation:write`, the access token needs `transactions:read` and `transaction-messages:read`: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. `adjustment` and `reversal` are checked against the hold Astrada has processed so far and rejected with `409` when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state. 1676 1677 :param transaction_id: (required) 1678 :type transaction_id: str 1679 :param simulate_transaction_message_request: (required) 1680 :type simulate_transaction_message_request: SimulateTransactionMessageRequest 1681 :param _request_timeout: timeout setting for this request. If one 1682 number provided, it will be total request 1683 timeout. It can also be a pair (tuple) of 1684 (connection, read) timeouts. 1685 :type _request_timeout: int, tuple(int, int), optional 1686 :param _request_auth: set to override the auth_settings for an a single 1687 request; this effectively ignores the 1688 authentication in the spec for a single request. 1689 :type _request_auth: dict, optional 1690 :param _content_type: force content-type for the request. 1691 :type _content_type: str, Optional 1692 :param _headers: set to override the headers for a single 1693 request; this effectively ignores the headers 1694 in the spec for a single request. 1695 :type _headers: dict, optional 1696 :param _host_index: set to override the host_index for a single 1697 request; this effectively ignores the host_index 1698 in the spec for a single request. 1699 :type _host_index: int, optional 1700 :return: Returns the result object. 1701 """ # noqa: E501 1702 1703 _param = self._simulate_transaction_message_serialize( 1704 transaction_id=transaction_id, 1705 simulate_transaction_message_request=simulate_transaction_message_request, 1706 _request_auth=_request_auth, 1707 _content_type=_content_type, 1708 _headers=_headers, 1709 _host_index=_host_index 1710 ) 1711 1712 _response_types_map: Dict[str, Optional[str]] = { 1713 '202': "SimulateTransactionAccepted", 1714 '400': "ValidationProblem", 1715 '401': "Problem", 1716 '403': "Problem", 1717 '404': "Problem", 1718 '409': "Conflict", 1719 '500': "Problem", 1720 '502': "Problem", 1721 } 1722 response_data = self.api_client.call_api( 1723 *_param, 1724 _request_timeout=_request_timeout 1725 ) 1726 return response_data.response
Simulate a transaction message (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Publishes one more transaction message (authorization, adjustment, reversal, settlement or refund) on an existing sandbox transaction. The transaction can have been created by POST /simulate/transactions or by the scenario endpoint; take its id from the transaction.created webhook or from GET /transactions?transactionMessageId=. Besides simulation:write, the access token needs transactions:read and transaction-messages:read: the transaction and its messages are read from the public API to carry over the network reference and the current hold and settled amounts. adjustment and reversal are checked against the hold Astrada has processed so far and rejected with 409 when there is nothing to adjust or reverse. The check is best effort: a step published immediately after another may see the earlier state.
Parameters
- transaction_id: (required)
- simulate_transaction_message_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1810 @validate_call 1811 def simulate_transaction_scenario( 1812 self, 1813 simulate_transaction_scenario_request: SimulateTransactionScenarioRequest, 1814 _request_timeout: Union[ 1815 None, 1816 Annotated[StrictFloat, Field(gt=0)], 1817 Tuple[ 1818 Annotated[StrictFloat, Field(gt=0)], 1819 Annotated[StrictFloat, Field(gt=0)] 1820 ] 1821 ] = None, 1822 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1823 _content_type: Optional[StrictStr] = None, 1824 _headers: Optional[Dict[StrictStr, Any]] = None, 1825 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1826 ) -> SimulateTransactionScenarioAccepted: 1827 """Simulate a transaction scenario (sandbox only) 1828 1829 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns `202 Accepted` with their ids. The transactions arrive asynchronously through the `transaction.created` and `transaction.updated` webhooks. The call does not look the card up first: well-formed ids return `202` even when they do not name an enrolled card of your account. If no transaction appears, check that `cardId` is enrolled in `subaccountId`. 1830 1831 :param simulate_transaction_scenario_request: (required) 1832 :type simulate_transaction_scenario_request: SimulateTransactionScenarioRequest 1833 :param _request_timeout: timeout setting for this request. If one 1834 number provided, it will be total request 1835 timeout. It can also be a pair (tuple) of 1836 (connection, read) timeouts. 1837 :type _request_timeout: int, tuple(int, int), optional 1838 :param _request_auth: set to override the auth_settings for an a single 1839 request; this effectively ignores the 1840 authentication in the spec for a single request. 1841 :type _request_auth: dict, optional 1842 :param _content_type: force content-type for the request. 1843 :type _content_type: str, Optional 1844 :param _headers: set to override the headers for a single 1845 request; this effectively ignores the headers 1846 in the spec for a single request. 1847 :type _headers: dict, optional 1848 :param _host_index: set to override the host_index for a single 1849 request; this effectively ignores the host_index 1850 in the spec for a single request. 1851 :type _host_index: int, optional 1852 :return: Returns the result object. 1853 """ # noqa: E501 1854 1855 _param = self._simulate_transaction_scenario_serialize( 1856 simulate_transaction_scenario_request=simulate_transaction_scenario_request, 1857 _request_auth=_request_auth, 1858 _content_type=_content_type, 1859 _headers=_headers, 1860 _host_index=_host_index 1861 ) 1862 1863 _response_types_map: Dict[str, Optional[str]] = { 1864 '202': "SimulateTransactionScenarioAccepted", 1865 '400': "ValidationProblem", 1866 '401': "Problem", 1867 '403': "Problem", 1868 '500': "Problem", 1869 } 1870 response_data = self.api_client.call_api( 1871 *_param, 1872 _request_timeout=_request_timeout 1873 ) 1874 response_data.read() 1875 return self.api_client.response_deserialize( 1876 response_data=response_data, 1877 response_types_map=_response_types_map, 1878 ).data
Simulate a transaction scenario (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns 202 Accepted with their ids. The transactions arrive asynchronously through the transaction.created and transaction.updated webhooks. The call does not look the card up first: well-formed ids return 202 even when they do not name an enrolled card of your account. If no transaction appears, check that cardId is enrolled in subaccountId.
Parameters
- simulate_transaction_scenario_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1881 @validate_call 1882 def simulate_transaction_scenario_with_http_info( 1883 self, 1884 simulate_transaction_scenario_request: SimulateTransactionScenarioRequest, 1885 _request_timeout: Union[ 1886 None, 1887 Annotated[StrictFloat, Field(gt=0)], 1888 Tuple[ 1889 Annotated[StrictFloat, Field(gt=0)], 1890 Annotated[StrictFloat, Field(gt=0)] 1891 ] 1892 ] = None, 1893 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1894 _content_type: Optional[StrictStr] = None, 1895 _headers: Optional[Dict[StrictStr, Any]] = None, 1896 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1897 ) -> ApiResponse[SimulateTransactionScenarioAccepted]: 1898 """Simulate a transaction scenario (sandbox only) 1899 1900 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns `202 Accepted` with their ids. The transactions arrive asynchronously through the `transaction.created` and `transaction.updated` webhooks. The call does not look the card up first: well-formed ids return `202` even when they do not name an enrolled card of your account. If no transaction appears, check that `cardId` is enrolled in `subaccountId`. 1901 1902 :param simulate_transaction_scenario_request: (required) 1903 :type simulate_transaction_scenario_request: SimulateTransactionScenarioRequest 1904 :param _request_timeout: timeout setting for this request. If one 1905 number provided, it will be total request 1906 timeout. It can also be a pair (tuple) of 1907 (connection, read) timeouts. 1908 :type _request_timeout: int, tuple(int, int), optional 1909 :param _request_auth: set to override the auth_settings for an a single 1910 request; this effectively ignores the 1911 authentication in the spec for a single request. 1912 :type _request_auth: dict, optional 1913 :param _content_type: force content-type for the request. 1914 :type _content_type: str, Optional 1915 :param _headers: set to override the headers for a single 1916 request; this effectively ignores the headers 1917 in the spec for a single request. 1918 :type _headers: dict, optional 1919 :param _host_index: set to override the host_index for a single 1920 request; this effectively ignores the host_index 1921 in the spec for a single request. 1922 :type _host_index: int, optional 1923 :return: Returns the result object. 1924 """ # noqa: E501 1925 1926 _param = self._simulate_transaction_scenario_serialize( 1927 simulate_transaction_scenario_request=simulate_transaction_scenario_request, 1928 _request_auth=_request_auth, 1929 _content_type=_content_type, 1930 _headers=_headers, 1931 _host_index=_host_index 1932 ) 1933 1934 _response_types_map: Dict[str, Optional[str]] = { 1935 '202': "SimulateTransactionScenarioAccepted", 1936 '400': "ValidationProblem", 1937 '401': "Problem", 1938 '403': "Problem", 1939 '500': "Problem", 1940 } 1941 response_data = self.api_client.call_api( 1942 *_param, 1943 _request_timeout=_request_timeout 1944 ) 1945 response_data.read() 1946 return self.api_client.response_deserialize( 1947 response_data=response_data, 1948 response_types_map=_response_types_map, 1949 )
Simulate a transaction scenario (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns 202 Accepted with their ids. The transactions arrive asynchronously through the transaction.created and transaction.updated webhooks. The call does not look the card up first: well-formed ids return 202 even when they do not name an enrolled card of your account. If no transaction appears, check that cardId is enrolled in subaccountId.
Parameters
- simulate_transaction_scenario_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
1952 @validate_call 1953 def simulate_transaction_scenario_without_preload_content( 1954 self, 1955 simulate_transaction_scenario_request: SimulateTransactionScenarioRequest, 1956 _request_timeout: Union[ 1957 None, 1958 Annotated[StrictFloat, Field(gt=0)], 1959 Tuple[ 1960 Annotated[StrictFloat, Field(gt=0)], 1961 Annotated[StrictFloat, Field(gt=0)] 1962 ] 1963 ] = None, 1964 _request_auth: Optional[Dict[StrictStr, Any]] = None, 1965 _content_type: Optional[StrictStr] = None, 1966 _headers: Optional[Dict[StrictStr, Any]] = None, 1967 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 1968 ) -> RESTResponseType: 1969 """Simulate a transaction scenario (sandbox only) 1970 1971 Works in the sandbox only (`https://api.sandbox.astrada.co`). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns `202 Accepted` with their ids. The transactions arrive asynchronously through the `transaction.created` and `transaction.updated` webhooks. The call does not look the card up first: well-formed ids return `202` even when they do not name an enrolled card of your account. If no transaction appears, check that `cardId` is enrolled in `subaccountId`. 1972 1973 :param simulate_transaction_scenario_request: (required) 1974 :type simulate_transaction_scenario_request: SimulateTransactionScenarioRequest 1975 :param _request_timeout: timeout setting for this request. If one 1976 number provided, it will be total request 1977 timeout. It can also be a pair (tuple) of 1978 (connection, read) timeouts. 1979 :type _request_timeout: int, tuple(int, int), optional 1980 :param _request_auth: set to override the auth_settings for an a single 1981 request; this effectively ignores the 1982 authentication in the spec for a single request. 1983 :type _request_auth: dict, optional 1984 :param _content_type: force content-type for the request. 1985 :type _content_type: str, Optional 1986 :param _headers: set to override the headers for a single 1987 request; this effectively ignores the headers 1988 in the spec for a single request. 1989 :type _headers: dict, optional 1990 :param _host_index: set to override the host_index for a single 1991 request; this effectively ignores the host_index 1992 in the spec for a single request. 1993 :type _host_index: int, optional 1994 :return: Returns the result object. 1995 """ # noqa: E501 1996 1997 _param = self._simulate_transaction_scenario_serialize( 1998 simulate_transaction_scenario_request=simulate_transaction_scenario_request, 1999 _request_auth=_request_auth, 2000 _content_type=_content_type, 2001 _headers=_headers, 2002 _host_index=_host_index 2003 ) 2004 2005 _response_types_map: Dict[str, Optional[str]] = { 2006 '202': "SimulateTransactionScenarioAccepted", 2007 '400': "ValidationProblem", 2008 '401': "Problem", 2009 '403': "Problem", 2010 '500': "Problem", 2011 } 2012 response_data = self.api_client.call_api( 2013 *_param, 2014 _request_timeout=_request_timeout 2015 ) 2016 return response_data.response
Simulate a transaction scenario (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co). Production has no such call. Runs a predefined transaction scenario, such as a purchase followed by a refund, on an enrolled card. The call publishes every transaction message of the scenario as if a card network had sent them and returns 202 Accepted with their ids. The transactions arrive asynchronously through the transaction.created and transaction.updated webhooks. The call does not look the card up first: well-formed ids return 202 even when they do not name an enrolled card of your account. If no transaction appears, check that cardId is enrolled in subaccountId.
Parameters
- simulate_transaction_scenario_request: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
28class SubaccountsApi: 29 """NOTE: This class is auto generated by OpenAPI Generator 30 Ref: https://openapi-generator.tech 31 32 Do not edit the class manually. 33 """ 34 35 def __init__(self, api_client=None) -> None: 36 if api_client is None: 37 api_client = ApiClient.get_default() 38 self.api_client = api_client 39 40 41 @validate_call 42 def delete_subaccount( 43 self, 44 subaccount_id: UUID, 45 _request_timeout: Union[ 46 None, 47 Annotated[StrictFloat, Field(gt=0)], 48 Tuple[ 49 Annotated[StrictFloat, Field(gt=0)], 50 Annotated[StrictFloat, Field(gt=0)] 51 ] 52 ] = None, 53 _request_auth: Optional[Dict[StrictStr, Any]] = None, 54 _content_type: Optional[StrictStr] = None, 55 _headers: Optional[Dict[StrictStr, Any]] = None, 56 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 57 ) -> None: 58 """Delete subaccount (sandbox only) 59 60 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 61 62 :param subaccount_id: (required) 63 :type subaccount_id: str 64 :param _request_timeout: timeout setting for this request. If one 65 number provided, it will be total request 66 timeout. It can also be a pair (tuple) of 67 (connection, read) timeouts. 68 :type _request_timeout: int, tuple(int, int), optional 69 :param _request_auth: set to override the auth_settings for an a single 70 request; this effectively ignores the 71 authentication in the spec for a single request. 72 :type _request_auth: dict, optional 73 :param _content_type: force content-type for the request. 74 :type _content_type: str, Optional 75 :param _headers: set to override the headers for a single 76 request; this effectively ignores the headers 77 in the spec for a single request. 78 :type _headers: dict, optional 79 :param _host_index: set to override the host_index for a single 80 request; this effectively ignores the host_index 81 in the spec for a single request. 82 :type _host_index: int, optional 83 :return: Returns the result object. 84 """ # noqa: E501 85 86 _param = self._delete_subaccount_serialize( 87 subaccount_id=subaccount_id, 88 _request_auth=_request_auth, 89 _content_type=_content_type, 90 _headers=_headers, 91 _host_index=_host_index 92 ) 93 94 _response_types_map: Dict[str, Optional[str]] = { 95 '204': None, 96 '400': "ValidationProblem", 97 '401': "Problem", 98 '403': "Problem", 99 '404': "Problem", 100 '500': "Problem", 101 '502': "Problem", 102 } 103 response_data = self.api_client.call_api( 104 *_param, 105 _request_timeout=_request_timeout 106 ) 107 response_data.read() 108 return self.api_client.response_deserialize( 109 response_data=response_data, 110 response_types_map=_response_types_map, 111 ).data 112 113 114 @validate_call 115 def delete_subaccount_with_http_info( 116 self, 117 subaccount_id: UUID, 118 _request_timeout: Union[ 119 None, 120 Annotated[StrictFloat, Field(gt=0)], 121 Tuple[ 122 Annotated[StrictFloat, Field(gt=0)], 123 Annotated[StrictFloat, Field(gt=0)] 124 ] 125 ] = None, 126 _request_auth: Optional[Dict[StrictStr, Any]] = None, 127 _content_type: Optional[StrictStr] = None, 128 _headers: Optional[Dict[StrictStr, Any]] = None, 129 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 130 ) -> ApiResponse[None]: 131 """Delete subaccount (sandbox only) 132 133 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 134 135 :param subaccount_id: (required) 136 :type subaccount_id: str 137 :param _request_timeout: timeout setting for this request. If one 138 number provided, it will be total request 139 timeout. It can also be a pair (tuple) of 140 (connection, read) timeouts. 141 :type _request_timeout: int, tuple(int, int), optional 142 :param _request_auth: set to override the auth_settings for an a single 143 request; this effectively ignores the 144 authentication in the spec for a single request. 145 :type _request_auth: dict, optional 146 :param _content_type: force content-type for the request. 147 :type _content_type: str, Optional 148 :param _headers: set to override the headers for a single 149 request; this effectively ignores the headers 150 in the spec for a single request. 151 :type _headers: dict, optional 152 :param _host_index: set to override the host_index for a single 153 request; this effectively ignores the host_index 154 in the spec for a single request. 155 :type _host_index: int, optional 156 :return: Returns the result object. 157 """ # noqa: E501 158 159 _param = self._delete_subaccount_serialize( 160 subaccount_id=subaccount_id, 161 _request_auth=_request_auth, 162 _content_type=_content_type, 163 _headers=_headers, 164 _host_index=_host_index 165 ) 166 167 _response_types_map: Dict[str, Optional[str]] = { 168 '204': None, 169 '400': "ValidationProblem", 170 '401': "Problem", 171 '403': "Problem", 172 '404': "Problem", 173 '500': "Problem", 174 '502': "Problem", 175 } 176 response_data = self.api_client.call_api( 177 *_param, 178 _request_timeout=_request_timeout 179 ) 180 response_data.read() 181 return self.api_client.response_deserialize( 182 response_data=response_data, 183 response_types_map=_response_types_map, 184 ) 185 186 187 @validate_call 188 def delete_subaccount_without_preload_content( 189 self, 190 subaccount_id: UUID, 191 _request_timeout: Union[ 192 None, 193 Annotated[StrictFloat, Field(gt=0)], 194 Tuple[ 195 Annotated[StrictFloat, Field(gt=0)], 196 Annotated[StrictFloat, Field(gt=0)] 197 ] 198 ] = None, 199 _request_auth: Optional[Dict[StrictStr, Any]] = None, 200 _content_type: Optional[StrictStr] = None, 201 _headers: Optional[Dict[StrictStr, Any]] = None, 202 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 203 ) -> RESTResponseType: 204 """Delete subaccount (sandbox only) 205 206 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 207 208 :param subaccount_id: (required) 209 :type subaccount_id: str 210 :param _request_timeout: timeout setting for this request. If one 211 number provided, it will be total request 212 timeout. It can also be a pair (tuple) of 213 (connection, read) timeouts. 214 :type _request_timeout: int, tuple(int, int), optional 215 :param _request_auth: set to override the auth_settings for an a single 216 request; this effectively ignores the 217 authentication in the spec for a single request. 218 :type _request_auth: dict, optional 219 :param _content_type: force content-type for the request. 220 :type _content_type: str, Optional 221 :param _headers: set to override the headers for a single 222 request; this effectively ignores the headers 223 in the spec for a single request. 224 :type _headers: dict, optional 225 :param _host_index: set to override the host_index for a single 226 request; this effectively ignores the host_index 227 in the spec for a single request. 228 :type _host_index: int, optional 229 :return: Returns the result object. 230 """ # noqa: E501 231 232 _param = self._delete_subaccount_serialize( 233 subaccount_id=subaccount_id, 234 _request_auth=_request_auth, 235 _content_type=_content_type, 236 _headers=_headers, 237 _host_index=_host_index 238 ) 239 240 _response_types_map: Dict[str, Optional[str]] = { 241 '204': None, 242 '400': "ValidationProblem", 243 '401': "Problem", 244 '403': "Problem", 245 '404': "Problem", 246 '500': "Problem", 247 '502': "Problem", 248 } 249 response_data = self.api_client.call_api( 250 *_param, 251 _request_timeout=_request_timeout 252 ) 253 return response_data.response 254 255 256 def _delete_subaccount_serialize( 257 self, 258 subaccount_id, 259 _request_auth, 260 _content_type, 261 _headers, 262 _host_index, 263 ) -> RequestSerialized: 264 265 _host = None 266 267 _collection_formats: Dict[str, str] = { 268 } 269 270 _path_params: Dict[str, str] = {} 271 _query_params: List[Tuple[str, str]] = [] 272 _header_params: Dict[str, Optional[str]] = _headers or {} 273 _form_params: List[Tuple[str, str]] = [] 274 _files: Dict[ 275 str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] 276 ] = {} 277 _body_params: Optional[bytes] = None 278 279 # process the path parameters 280 if subaccount_id is not None: 281 _path_params['subaccountId'] = subaccount_id 282 # process the query parameters 283 # process the header parameters 284 # process the form parameters 285 # process the body parameter 286 287 288 # set the HTTP header `Accept` 289 if 'Accept' not in _header_params: 290 _header_params['Accept'] = self.api_client.select_header_accept( 291 [ 292 'application/problem+json' 293 ] 294 ) 295 296 297 # authentication setting 298 _auth_settings: List[str] = [ 299 'main-auth' 300 ] 301 302 return self.api_client.param_serialize( 303 method='DELETE', 304 resource_path='/subaccounts/{subaccountId}', 305 path_params=_path_params, 306 query_params=_query_params, 307 header_params=_header_params, 308 body=_body_params, 309 post_params=_form_params, 310 files=_files, 311 auth_settings=_auth_settings, 312 collection_formats=_collection_formats, 313 _host=_host, 314 _request_auth=_request_auth 315 )
NOTE: This class is auto generated by OpenAPI Generator Ref: https://openapi-generator.tech
Do not edit the class manually.
41 @validate_call 42 def delete_subaccount( 43 self, 44 subaccount_id: UUID, 45 _request_timeout: Union[ 46 None, 47 Annotated[StrictFloat, Field(gt=0)], 48 Tuple[ 49 Annotated[StrictFloat, Field(gt=0)], 50 Annotated[StrictFloat, Field(gt=0)] 51 ] 52 ] = None, 53 _request_auth: Optional[Dict[StrictStr, Any]] = None, 54 _content_type: Optional[StrictStr] = None, 55 _headers: Optional[Dict[StrictStr, Any]] = None, 56 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 57 ) -> None: 58 """Delete subaccount (sandbox only) 59 60 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 61 62 :param subaccount_id: (required) 63 :type subaccount_id: str 64 :param _request_timeout: timeout setting for this request. If one 65 number provided, it will be total request 66 timeout. It can also be a pair (tuple) of 67 (connection, read) timeouts. 68 :type _request_timeout: int, tuple(int, int), optional 69 :param _request_auth: set to override the auth_settings for an a single 70 request; this effectively ignores the 71 authentication in the spec for a single request. 72 :type _request_auth: dict, optional 73 :param _content_type: force content-type for the request. 74 :type _content_type: str, Optional 75 :param _headers: set to override the headers for a single 76 request; this effectively ignores the headers 77 in the spec for a single request. 78 :type _headers: dict, optional 79 :param _host_index: set to override the host_index for a single 80 request; this effectively ignores the host_index 81 in the spec for a single request. 82 :type _host_index: int, optional 83 :return: Returns the result object. 84 """ # noqa: E501 85 86 _param = self._delete_subaccount_serialize( 87 subaccount_id=subaccount_id, 88 _request_auth=_request_auth, 89 _content_type=_content_type, 90 _headers=_headers, 91 _host_index=_host_index 92 ) 93 94 _response_types_map: Dict[str, Optional[str]] = { 95 '204': None, 96 '400': "ValidationProblem", 97 '401': "Problem", 98 '403': "Problem", 99 '404': "Problem", 100 '500': "Problem", 101 '502': "Problem", 102 } 103 response_data = self.api_client.call_api( 104 *_param, 105 _request_timeout=_request_timeout 106 ) 107 response_data.read() 108 return self.api_client.response_deserialize( 109 response_data=response_data, 110 response_types_map=_response_types_map, 111 ).data
Delete subaccount (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with PATCH. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- subaccount_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
114 @validate_call 115 def delete_subaccount_with_http_info( 116 self, 117 subaccount_id: UUID, 118 _request_timeout: Union[ 119 None, 120 Annotated[StrictFloat, Field(gt=0)], 121 Tuple[ 122 Annotated[StrictFloat, Field(gt=0)], 123 Annotated[StrictFloat, Field(gt=0)] 124 ] 125 ] = None, 126 _request_auth: Optional[Dict[StrictStr, Any]] = None, 127 _content_type: Optional[StrictStr] = None, 128 _headers: Optional[Dict[StrictStr, Any]] = None, 129 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 130 ) -> ApiResponse[None]: 131 """Delete subaccount (sandbox only) 132 133 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 134 135 :param subaccount_id: (required) 136 :type subaccount_id: str 137 :param _request_timeout: timeout setting for this request. If one 138 number provided, it will be total request 139 timeout. It can also be a pair (tuple) of 140 (connection, read) timeouts. 141 :type _request_timeout: int, tuple(int, int), optional 142 :param _request_auth: set to override the auth_settings for an a single 143 request; this effectively ignores the 144 authentication in the spec for a single request. 145 :type _request_auth: dict, optional 146 :param _content_type: force content-type for the request. 147 :type _content_type: str, Optional 148 :param _headers: set to override the headers for a single 149 request; this effectively ignores the headers 150 in the spec for a single request. 151 :type _headers: dict, optional 152 :param _host_index: set to override the host_index for a single 153 request; this effectively ignores the host_index 154 in the spec for a single request. 155 :type _host_index: int, optional 156 :return: Returns the result object. 157 """ # noqa: E501 158 159 _param = self._delete_subaccount_serialize( 160 subaccount_id=subaccount_id, 161 _request_auth=_request_auth, 162 _content_type=_content_type, 163 _headers=_headers, 164 _host_index=_host_index 165 ) 166 167 _response_types_map: Dict[str, Optional[str]] = { 168 '204': None, 169 '400': "ValidationProblem", 170 '401': "Problem", 171 '403': "Problem", 172 '404': "Problem", 173 '500': "Problem", 174 '502': "Problem", 175 } 176 response_data = self.api_client.call_api( 177 *_param, 178 _request_timeout=_request_timeout 179 ) 180 response_data.read() 181 return self.api_client.response_deserialize( 182 response_data=response_data, 183 response_types_map=_response_types_map, 184 )
Delete subaccount (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with PATCH. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- subaccount_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
187 @validate_call 188 def delete_subaccount_without_preload_content( 189 self, 190 subaccount_id: UUID, 191 _request_timeout: Union[ 192 None, 193 Annotated[StrictFloat, Field(gt=0)], 194 Tuple[ 195 Annotated[StrictFloat, Field(gt=0)], 196 Annotated[StrictFloat, Field(gt=0)] 197 ] 198 ] = None, 199 _request_auth: Optional[Dict[StrictStr, Any]] = None, 200 _content_type: Optional[StrictStr] = None, 201 _headers: Optional[Dict[StrictStr, Any]] = None, 202 _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, 203 ) -> RESTResponseType: 204 """Delete subaccount (sandbox only) 205 206 Works in the sandbox only (`https://api.sandbox.astrada.co`), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with `PATCH`. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: `204` when it is done, `502` when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay. 207 208 :param subaccount_id: (required) 209 :type subaccount_id: str 210 :param _request_timeout: timeout setting for this request. If one 211 number provided, it will be total request 212 timeout. It can also be a pair (tuple) of 213 (connection, read) timeouts. 214 :type _request_timeout: int, tuple(int, int), optional 215 :param _request_auth: set to override the auth_settings for an a single 216 request; this effectively ignores the 217 authentication in the spec for a single request. 218 :type _request_auth: dict, optional 219 :param _content_type: force content-type for the request. 220 :type _content_type: str, Optional 221 :param _headers: set to override the headers for a single 222 request; this effectively ignores the headers 223 in the spec for a single request. 224 :type _headers: dict, optional 225 :param _host_index: set to override the host_index for a single 226 request; this effectively ignores the host_index 227 in the spec for a single request. 228 :type _host_index: int, optional 229 :return: Returns the result object. 230 """ # noqa: E501 231 232 _param = self._delete_subaccount_serialize( 233 subaccount_id=subaccount_id, 234 _request_auth=_request_auth, 235 _content_type=_content_type, 236 _headers=_headers, 237 _host_index=_host_index 238 ) 239 240 _response_types_map: Dict[str, Optional[str]] = { 241 '204': None, 242 '400': "ValidationProblem", 243 '401': "Problem", 244 '403': "Problem", 245 '404': "Problem", 246 '500': "Problem", 247 '502': "Problem", 248 } 249 response_data = self.api_client.call_api( 250 *_param, 251 _request_timeout=_request_timeout 252 ) 253 return response_data.response
Delete subaccount (sandbox only)
Works in the sandbox only (https://api.sandbox.astrada.co), for clearing test data between runs. Production has no delete call: there you deactivate card subscriptions with PATCH. Deletes a subaccount and everything under it, and cannot be undone. Its bank links (with their bank accounts, bank transactions and matches) go first, then every card subscription, card, cardholder, stored token, transaction, network bulk feed and webhook of the subaccount. The call returns when the delete has finished: 204 when it is done, 502 when a step failed. Retrying a failed delete is always safe: completed steps are skipped on replay.
Parameters
- subaccount_id: (required)
- _request_timeout: timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
- _content_type: force content-type for the request.
- _headers: set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.
- _host_index: set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.
Returns
Returns the result object.
10class ApiResponse(BaseModel, Generic[T]): 11 """ 12 API response object 13 """ 14 15 status_code: StrictInt = Field(description="HTTP status code") 16 headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") 17 data: T = Field(description="Deserialized data given the data type") 18 raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") 19 20 model_config = { 21 "arbitrary_types_allowed": True 22 }
API response object
52class ApiClient: 53 """Generic API client for OpenAPI client library builds. 54 55 OpenAPI generic API client. This client handles the client- 56 server communication, and is invariant across implementations. Specifics of 57 the methods and models for each application are generated from the OpenAPI 58 templates. 59 60 :param configuration: .Configuration object for this client 61 :param header_name: a header to pass when making calls to the API. 62 :param header_value: a header value to pass when making calls to 63 the API. 64 :param cookie: a cookie to include in the header when making calls 65 to the API 66 """ 67 68 PRIMITIVE_TYPES = (float, bool, bytes, str, int) 69 NATIVE_TYPES_MAPPING = { 70 'int': int, 71 'long': int, # TODO remove as only py3 is supported? 72 'float': float, 73 'str': str, 74 'bool': bool, 75 'date': datetime.date, 76 'datetime': datetime.datetime, 77 'decimal': decimal.Decimal, 78 'object': object, 79 } 80 _pool = None 81 82 def __init__( 83 self, 84 configuration=None, 85 header_name=None, 86 header_value=None, 87 cookie=None 88 ) -> None: 89 # use default configuration if none is provided 90 if configuration is None: 91 configuration = Configuration.get_default() 92 self.configuration = configuration 93 94 self.rest_client = rest.RESTClientObject(configuration) 95 self.default_headers = {} 96 if header_name is not None: 97 self.default_headers[header_name] = header_value 98 self.cookie = cookie 99 # Set default User-Agent. 100 self.user_agent = 'astrada-python/' + _sdk_version 101 self.client_side_validation = configuration.client_side_validation 102 103 def __enter__(self): 104 return self 105 106 def __exit__(self, exc_type, exc_value, traceback): 107 pass 108 109 @property 110 def user_agent(self): 111 """User agent for this API client""" 112 return self.default_headers['User-Agent'] 113 114 @user_agent.setter 115 def user_agent(self, value): 116 self.default_headers['User-Agent'] = value 117 118 def set_default_header(self, header_name, header_value): 119 self.default_headers[header_name] = header_value 120 121 122 _default = None 123 124 @classmethod 125 def get_default(cls): 126 """Return new instance of ApiClient. 127 128 This method returns newly created, based on default constructor, 129 object of ApiClient class or returns a copy of default 130 ApiClient. 131 132 :return: The ApiClient object. 133 """ 134 if cls._default is None: 135 cls._default = ApiClient() 136 return cls._default 137 138 @classmethod 139 def set_default(cls, default): 140 """Set default instance of ApiClient. 141 142 It stores default ApiClient. 143 144 :param default: object of ApiClient. 145 """ 146 cls._default = default 147 148 def param_serialize( 149 self, 150 method, 151 resource_path, 152 path_params=None, 153 query_params=None, 154 header_params=None, 155 body=None, 156 post_params=None, 157 files=None, auth_settings=None, 158 collection_formats=None, 159 _host=None, 160 _request_auth=None 161 ) -> RequestSerialized: 162 163 """Builds the HTTP request params needed by the request. 164 :param method: Method to call. 165 :param resource_path: Path to method endpoint. 166 :param path_params: Path parameters in the url. 167 :param query_params: Query parameters in the url. 168 :param header_params: Header parameters to be 169 placed in the request header. 170 :param body: Request body. 171 :param post_params dict: Request post form parameters, 172 for `application/x-www-form-urlencoded`, `multipart/form-data`. 173 :param auth_settings list: Auth Settings names for the request. 174 :param files dict: key -> filename, value -> filepath, 175 for `multipart/form-data`. 176 :param collection_formats: dict of collection formats for path, query, 177 header, and post parameters. 178 :param _request_auth: set to override the auth_settings for an a single 179 request; this effectively ignores the authentication 180 in the spec for a single request. 181 :return: tuple of form (path, http_method, query_params, header_params, 182 body, post_params, files) 183 """ 184 # Sandbox-only API: refuse before anything is sent (not even the login) unless this 185 # client is set up for the sandbox (astrada._sandbox_guard). 186 _sandbox_guard.check(self.configuration) 187 188 config = self.configuration 189 190 # header parameters 191 header_params = header_params or {} 192 header_params.update(self.default_headers) 193 if self.cookie: 194 header_params['Cookie'] = self.cookie 195 if header_params: 196 header_params = self.sanitize_for_serialization(header_params) 197 header_params = dict( 198 self.parameters_to_tuples(header_params,collection_formats) 199 ) 200 201 # path parameters 202 if path_params: 203 path_params = self.sanitize_for_serialization(path_params) 204 path_params = self.parameters_to_tuples( 205 path_params, 206 collection_formats 207 ) 208 for k, v in path_params: 209 # specified safe chars, encode everything 210 resource_path = resource_path.replace( 211 '{%s}' % k, 212 quote(str(v), safe=config.safe_chars_for_path_param) 213 ) 214 215 # post parameters 216 if post_params or files: 217 post_params = post_params if post_params else [] 218 post_params = self.sanitize_for_serialization(post_params) 219 post_params = self.parameters_to_tuples( 220 post_params, 221 collection_formats 222 ) 223 if files: 224 post_params.extend(self.files_parameters(files)) 225 226 # auth setting 227 self.update_params_for_auth( 228 header_params, 229 query_params, 230 auth_settings, 231 resource_path, 232 method, 233 body, 234 request_auth=_request_auth 235 ) 236 237 # body 238 if body: 239 body = self.sanitize_for_serialization(body) 240 241 # request url 242 if _host is None or self.configuration.ignore_operation_servers: 243 url = self.configuration.host + resource_path 244 else: 245 # use server/host defined in path or operation instead 246 url = _host + resource_path 247 248 # query parameters 249 if query_params: 250 query_params = self.sanitize_for_serialization(query_params) 251 url_query = self.parameters_to_url_query( 252 query_params, 253 collection_formats 254 ) 255 url += "?" + url_query 256 257 return method, url, header_params, body, post_params 258 259 260 def call_api( 261 self, 262 method, 263 url, 264 header_params=None, 265 body=None, 266 post_params=None, 267 _request_timeout=None 268 ) -> rest.RESTResponse: 269 """Makes the HTTP request (synchronous) 270 :param method: Method to call. 271 :param url: Path to method endpoint. 272 :param header_params: Header parameters to be 273 placed in the request header. 274 :param body: Request body. 275 :param post_params dict: Request post form parameters, 276 for `application/x-www-form-urlencoded`, `multipart/form-data`. 277 :param _request_timeout: timeout setting for this request. 278 :return: RESTResponse 279 """ 280 281 retries = None 282 if method.upper() == "DELETE": 283 # The sandbox deletes cascade and answer only when done. A second call while the first 284 # still runs is not safe, so they are never retried, and they wait at least 285 # SANDBOX_DELETE_TIMEOUT unless the call or the client turned the timeout off. 286 retries = False 287 configured = getattr(self.rest_client, "default_timeout", None) 288 if _request_timeout is None and isinstance(configured, (int, float)) and configured: 289 # (connect, read): connecting keeps the client's timeout, only the answer waits longer. 290 _request_timeout = (float(configured), max(float(configured), SANDBOX_DELETE_TIMEOUT)) 291 try: 292 # perform request and return response 293 response_data = self.rest_client.request( 294 method, url, 295 headers=header_params, 296 body=body, post_params=post_params, 297 _request_timeout=_request_timeout, 298 _retries=retries 299 ) 300 301 except ApiException as e: 302 raise e 303 304 return response_data 305 306 def response_deserialize( 307 self, 308 response_data: rest.RESTResponse, 309 response_types_map: Optional[Dict[str, ApiResponseT]]=None 310 ) -> ApiResponse[ApiResponseT]: 311 """Deserializes response into an object. 312 :param response_data: RESTResponse object to be deserialized. 313 :param response_types_map: dict of response types. 314 :return: ApiResponse 315 """ 316 317 msg = "RESTResponse.read() must be called before passing it to response_deserialize()" 318 assert response_data.data is not None, msg 319 320 response_type = response_types_map.get(str(response_data.status), None) 321 if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: 322 # if not found, look for '1XX', '2XX', etc. 323 response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) 324 325 # deserialize response data 326 response_text = None 327 return_data = None 328 try: 329 if response_type == "bytearray": 330 return_data = response_data.data 331 elif response_type == "file": 332 return_data = self.__deserialize_file(response_data) 333 elif response_type is not None: 334 match = None 335 content_type = response_data.getheader('content-type') 336 if content_type is not None: 337 match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) 338 encoding = match.group(1) if match else "utf-8" 339 response_text = response_data.data.decode(encoding) 340 # Values added to the API after this release (a new enum value) are kept as 341 # strings instead of failing the call (astrada._lenient). 342 with _lenient(): 343 return_data = self.deserialize(response_text, response_type, content_type) 344 finally: 345 if not 200 <= response_data.status <= 299: 346 raise ApiException.from_response( 347 http_resp=response_data, 348 body=response_text, 349 data=return_data, 350 ) 351 352 return ApiResponse( 353 status_code = response_data.status, 354 data = return_data, 355 headers = response_data.getheaders(), 356 raw_data = response_data.data 357 ) 358 359 def sanitize_for_serialization(self, obj): 360 """Builds a JSON POST object. 361 362 If obj is None, return None. 363 If obj is SecretStr, return obj.get_secret_value() 364 If obj is str, int, long, float, bool, return directly. 365 If obj is datetime.datetime, datetime.date 366 convert to string in iso8601 format. 367 If obj is decimal.Decimal return string representation. 368 If obj is list, sanitize each element in the list. 369 If obj is dict, return the dict. 370 If obj is OpenAPI model, return the properties dict. 371 372 :param obj: The data to serialize. 373 :return: The serialized form of data. 374 """ 375 if obj is None: 376 return None 377 elif isinstance(obj, Enum): 378 return obj.value 379 elif isinstance(obj, SecretStr): 380 return obj.get_secret_value() 381 elif isinstance(obj, self.PRIMITIVE_TYPES): 382 return obj 383 elif isinstance(obj, uuid.UUID): 384 return str(obj) 385 elif isinstance(obj, list): 386 return [ 387 self.sanitize_for_serialization(sub_obj) for sub_obj in obj 388 ] 389 elif isinstance(obj, tuple): 390 return tuple( 391 self.sanitize_for_serialization(sub_obj) for sub_obj in obj 392 ) 393 elif isinstance(obj, (datetime.datetime, datetime.date)): 394 return obj.isoformat() 395 elif isinstance(obj, decimal.Decimal): 396 return str(obj) 397 398 elif isinstance(obj, dict): 399 obj_dict = obj 400 else: 401 # Convert model obj to dict except 402 # attributes `openapi_types`, `attribute_map` 403 # and attributes which value is not None. 404 # Convert attribute name to json key in 405 # model definition for request. 406 if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): 407 obj_dict = obj.to_dict() 408 else: 409 obj_dict = obj.__dict__ 410 411 if isinstance(obj_dict, list): 412 # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() 413 return self.sanitize_for_serialization(obj_dict) 414 415 return { 416 key: self.sanitize_for_serialization(val) 417 for key, val in obj_dict.items() 418 } 419 420 def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): 421 """Deserializes response into an object. 422 423 :param response: RESTResponse object to be deserialized. 424 :param response_type: class literal for 425 deserialized object, or string of class name. 426 :param content_type: content type of response. 427 428 :return: deserialized object. 429 """ 430 431 # fetch data from response object 432 if content_type is None: 433 try: 434 data = json.loads(response_text) 435 except ValueError: 436 data = response_text 437 elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): 438 if response_text == "": 439 data = "" 440 else: 441 data = json.loads(response_text) 442 elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): 443 data = response_text 444 else: 445 raise ApiException( 446 status=0, 447 reason="Unsupported content type: {0}".format(content_type) 448 ) 449 450 return self.__deserialize(data, response_type) 451 452 def __deserialize(self, data, klass): 453 """Deserializes dict, list, str into an object. 454 455 :param data: dict, list or str. 456 :param klass: class literal, or string of class name. 457 458 :return: object. 459 """ 460 if data is None: 461 return None 462 463 if isinstance(klass, str): 464 if klass.startswith('List['): 465 m = re.match(r'List\[(.*)]', klass) 466 assert m is not None, "Malformed List type definition" 467 sub_kls = m.group(1) 468 return [self.__deserialize(sub_data, sub_kls) 469 for sub_data in data] 470 471 if klass.startswith('Dict['): 472 m = re.match(r'Dict\[([^,]*), (.*)]', klass) 473 assert m is not None, "Malformed Dict type definition" 474 sub_kls = m.group(2) 475 return {k: self.__deserialize(v, sub_kls) 476 for k, v in data.items()} 477 478 # convert str to class 479 if klass in self.NATIVE_TYPES_MAPPING: 480 klass = self.NATIVE_TYPES_MAPPING[klass] 481 else: 482 klass = getattr(astrada.sandbox.models, klass) 483 484 if klass in self.PRIMITIVE_TYPES: 485 return self.__deserialize_primitive(data, klass) 486 elif klass is object: 487 return self.__deserialize_object(data) 488 elif klass is datetime.date: 489 return self.__deserialize_date(data) 490 elif klass is datetime.datetime: 491 return self.__deserialize_datetime(data) 492 elif klass is decimal.Decimal: 493 return decimal.Decimal(data) 494 elif issubclass(klass, Enum): 495 return self.__deserialize_enum(data, klass) 496 else: 497 return self.__deserialize_model(data, klass) 498 499 def parameters_to_tuples(self, params, collection_formats): 500 """Get parameters as list of tuples, formatting collections. 501 502 :param params: Parameters as dict or list of two-tuples 503 :param dict collection_formats: Parameter collection formats 504 :return: Parameters as list of tuples, collections formatted 505 """ 506 new_params: List[Tuple[str, str]] = [] 507 if collection_formats is None: 508 collection_formats = {} 509 for k, v in params.items() if isinstance(params, dict) else params: 510 if k in collection_formats: 511 collection_format = collection_formats[k] 512 if collection_format == 'multi': 513 new_params.extend((k, value) for value in v) 514 else: 515 if collection_format == 'ssv': 516 delimiter = ' ' 517 elif collection_format == 'tsv': 518 delimiter = '\t' 519 elif collection_format == 'pipes': 520 delimiter = '|' 521 else: # csv is the default 522 delimiter = ',' 523 new_params.append( 524 (k, delimiter.join(str(value) for value in v))) 525 else: 526 new_params.append((k, v)) 527 return new_params 528 529 def parameters_to_url_query(self, params, collection_formats): 530 """Get parameters as list of tuples, formatting collections. 531 532 :param params: Parameters as dict or list of two-tuples 533 :param dict collection_formats: Parameter collection formats 534 :return: URL query string (e.g. a=Hello%20World&b=123) 535 """ 536 new_params: List[Tuple[str, str]] = [] 537 if collection_formats is None: 538 collection_formats = {} 539 for k, v in params.items() if isinstance(params, dict) else params: 540 if isinstance(v, bool): 541 v = str(v).lower() 542 if isinstance(v, (int, float)): 543 v = str(v) 544 if isinstance(v, dict): 545 v = json.dumps(v) 546 547 if k in collection_formats: 548 collection_format = collection_formats[k] 549 if collection_format == 'multi': 550 new_params.extend((k, quote(str(value))) for value in v) 551 else: 552 if collection_format == 'ssv': 553 delimiter = ' ' 554 elif collection_format == 'tsv': 555 delimiter = '\t' 556 elif collection_format == 'pipes': 557 delimiter = '|' 558 else: # csv is the default 559 delimiter = ',' 560 new_params.append( 561 (k, delimiter.join(quote(str(value)) for value in v)) 562 ) 563 else: 564 new_params.append((k, quote(str(v)))) 565 566 return "&".join(["=".join(map(str, item)) for item in new_params]) 567 568 def files_parameters( 569 self, 570 files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], 571 ): 572 """Builds form parameters. 573 574 :param files: File parameters. 575 :return: Form parameters with files. 576 """ 577 params = [] 578 for k, v in files.items(): 579 if isinstance(v, str): 580 with open(v, 'rb') as f: 581 filename = os.path.basename(f.name) 582 filedata = f.read() 583 elif isinstance(v, bytes): 584 filename = k 585 filedata = v 586 elif isinstance(v, tuple): 587 filename, filedata = v 588 elif isinstance(v, list): 589 for file_param in v: 590 params.extend(self.files_parameters({k: file_param})) 591 continue 592 else: 593 raise ValueError("Unsupported file value") 594 mimetype = ( 595 mimetypes.guess_type(filename)[0] 596 or 'application/octet-stream' 597 ) 598 params.append( 599 tuple([k, tuple([filename, filedata, mimetype])]) 600 ) 601 return params 602 603 def select_header_accept(self, accepts: List[str]) -> Optional[str]: 604 """Returns `Accept` based on an array of accepts provided. 605 606 :param accepts: List of headers. 607 :return: Accept (e.g. application/json). 608 """ 609 if not accepts: 610 return None 611 612 for accept in accepts: 613 if re.search('json', accept, re.IGNORECASE): 614 return accept 615 616 return accepts[0] 617 618 def select_header_content_type(self, content_types): 619 """Returns `Content-Type` based on an array of content_types provided. 620 621 :param content_types: List of content-types. 622 :return: Content-Type (e.g. application/json). 623 """ 624 if not content_types: 625 return None 626 627 for content_type in content_types: 628 if re.search('json', content_type, re.IGNORECASE): 629 return content_type 630 631 return content_types[0] 632 633 def update_params_for_auth( 634 self, 635 headers, 636 queries, 637 auth_settings, 638 resource_path, 639 method, 640 body, 641 request_auth=None 642 ) -> None: 643 """Updates header and query params based on authentication setting. 644 645 :param headers: Header parameters dict to be updated. 646 :param queries: Query parameters tuple list to be updated. 647 :param auth_settings: Authentication setting identifiers list. 648 :resource_path: A string representation of the HTTP request resource path. 649 :method: A string representation of the HTTP request method. 650 :body: A object representing the body of the HTTP request. 651 The object type is the return value of sanitize_for_serialization(). 652 :param request_auth: if set, the provided settings will 653 override the token in the configuration. 654 """ 655 if not auth_settings: 656 return 657 658 if request_auth: 659 self._apply_auth_params( 660 headers, 661 queries, 662 resource_path, 663 method, 664 body, 665 request_auth 666 ) 667 else: 668 for auth in auth_settings: 669 auth_setting = self.configuration.auth_settings().get(auth) 670 if auth_setting: 671 self._apply_auth_params( 672 headers, 673 queries, 674 resource_path, 675 method, 676 body, 677 auth_setting 678 ) 679 680 def _apply_auth_params( 681 self, 682 headers, 683 queries, 684 resource_path, 685 method, 686 body, 687 auth_setting 688 ) -> None: 689 """Updates the request parameters based on a single auth_setting 690 691 :param headers: Header parameters dict to be updated. 692 :param queries: Query parameters tuple list to be updated. 693 :resource_path: A string representation of the HTTP request resource path. 694 :method: A string representation of the HTTP request method. 695 :body: A object representing the body of the HTTP request. 696 The object type is the return value of sanitize_for_serialization(). 697 :param auth_setting: auth settings for the endpoint 698 """ 699 if auth_setting['in'] == 'cookie': 700 headers['Cookie'] = auth_setting['value'] 701 elif auth_setting['in'] == 'header': 702 if auth_setting['type'] != 'http-signature': 703 headers[auth_setting['key']] = auth_setting['value'] 704 elif auth_setting['in'] == 'query': 705 queries.append((auth_setting['key'], auth_setting['value'])) 706 else: 707 raise ApiValueError( 708 'Authentication token must be in `query` or `header`' 709 ) 710 711 def __deserialize_file(self, response): 712 """Deserializes body to file 713 714 Saves response body into a file in a temporary folder, 715 using the filename from the `Content-Disposition` header if provided. 716 717 handle file downloading 718 save response body into a tmp file and return the instance 719 720 :param response: RESTResponse. 721 :return: file path. 722 """ 723 fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) 724 os.close(fd) 725 os.remove(path) 726 727 content_disposition = response.getheader("Content-Disposition") 728 if content_disposition: 729 m = re.search( 730 r'filename=[\'"]?([^\'"\s]+)[\'"]?', 731 content_disposition 732 ) 733 assert m is not None, "Unexpected 'content-disposition' header value" 734 filename = m.group(1) 735 path = os.path.join(os.path.dirname(path), filename) 736 737 with open(path, "wb") as f: 738 f.write(response.data) 739 740 return path 741 742 def __deserialize_primitive(self, data, klass): 743 """Deserializes string to primitive type. 744 745 :param data: str. 746 :param klass: class literal. 747 748 :return: int, long, float, str, bool. 749 """ 750 try: 751 return klass(data) 752 except UnicodeEncodeError: 753 return str(data) 754 except TypeError: 755 return data 756 757 def __deserialize_object(self, value): 758 """Return an original value. 759 760 :return: object. 761 """ 762 return value 763 764 def __deserialize_date(self, string): 765 """Deserializes string to date. 766 767 :param string: str. 768 :return: date. 769 """ 770 try: 771 return parse(string).date() 772 except ImportError: 773 return string 774 except ValueError: 775 raise rest.ApiException( 776 status=0, 777 reason="Failed to parse `{0}` as date object".format(string) 778 ) 779 780 def __deserialize_datetime(self, string): 781 """Deserializes string to datetime. 782 783 The string should be in iso8601 datetime format. 784 785 :param string: str. 786 :return: datetime. 787 """ 788 try: 789 return parse(string) 790 except ImportError: 791 return string 792 except ValueError: 793 raise rest.ApiException( 794 status=0, 795 reason=( 796 "Failed to parse `{0}` as datetime object" 797 .format(string) 798 ) 799 ) 800 801 def __deserialize_enum(self, data, klass): 802 """Deserializes primitive type to enum. 803 804 :param data: primitive type. 805 :param klass: class literal. 806 :return: enum value. 807 """ 808 try: 809 return klass(data) 810 except ValueError: 811 raise rest.ApiException( 812 status=0, 813 reason=( 814 "Failed to parse `{0}` as `{1}`" 815 .format(data, klass) 816 ) 817 ) 818 819 def __deserialize_model(self, data, klass): 820 """Deserializes list or dict to model. 821 822 :param data: dict, list. 823 :param klass: class literal. 824 :return: model object. 825 """ 826 827 return klass.from_dict(data)
Generic API client for OpenAPI client library builds.
OpenAPI generic API client. This client handles the client- server communication, and is invariant across implementations. Specifics of the methods and models for each application are generated from the OpenAPI templates.
Parameters
- configuration: .Configuration object for this client
- header_name: a header to pass when making calls to the API.
- header_value: a header value to pass when making calls to the API.
- cookie: a cookie to include in the header when making calls to the API
82 def __init__( 83 self, 84 configuration=None, 85 header_name=None, 86 header_value=None, 87 cookie=None 88 ) -> None: 89 # use default configuration if none is provided 90 if configuration is None: 91 configuration = Configuration.get_default() 92 self.configuration = configuration 93 94 self.rest_client = rest.RESTClientObject(configuration) 95 self.default_headers = {} 96 if header_name is not None: 97 self.default_headers[header_name] = header_value 98 self.cookie = cookie 99 # Set default User-Agent. 100 self.user_agent = 'astrada-python/' + _sdk_version 101 self.client_side_validation = configuration.client_side_validation
109 @property 110 def user_agent(self): 111 """User agent for this API client""" 112 return self.default_headers['User-Agent']
User agent for this API client
124 @classmethod 125 def get_default(cls): 126 """Return new instance of ApiClient. 127 128 This method returns newly created, based on default constructor, 129 object of ApiClient class or returns a copy of default 130 ApiClient. 131 132 :return: The ApiClient object. 133 """ 134 if cls._default is None: 135 cls._default = ApiClient() 136 return cls._default
Return new instance of ApiClient.
This method returns newly created, based on default constructor, object of ApiClient class or returns a copy of default ApiClient.
Returns
The ApiClient object.
138 @classmethod 139 def set_default(cls, default): 140 """Set default instance of ApiClient. 141 142 It stores default ApiClient. 143 144 :param default: object of ApiClient. 145 """ 146 cls._default = default
Set default instance of ApiClient.
It stores default ApiClient.
Parameters
- default: object of ApiClient.
148 def param_serialize( 149 self, 150 method, 151 resource_path, 152 path_params=None, 153 query_params=None, 154 header_params=None, 155 body=None, 156 post_params=None, 157 files=None, auth_settings=None, 158 collection_formats=None, 159 _host=None, 160 _request_auth=None 161 ) -> RequestSerialized: 162 163 """Builds the HTTP request params needed by the request. 164 :param method: Method to call. 165 :param resource_path: Path to method endpoint. 166 :param path_params: Path parameters in the url. 167 :param query_params: Query parameters in the url. 168 :param header_params: Header parameters to be 169 placed in the request header. 170 :param body: Request body. 171 :param post_params dict: Request post form parameters, 172 for `application/x-www-form-urlencoded`, `multipart/form-data`. 173 :param auth_settings list: Auth Settings names for the request. 174 :param files dict: key -> filename, value -> filepath, 175 for `multipart/form-data`. 176 :param collection_formats: dict of collection formats for path, query, 177 header, and post parameters. 178 :param _request_auth: set to override the auth_settings for an a single 179 request; this effectively ignores the authentication 180 in the spec for a single request. 181 :return: tuple of form (path, http_method, query_params, header_params, 182 body, post_params, files) 183 """ 184 # Sandbox-only API: refuse before anything is sent (not even the login) unless this 185 # client is set up for the sandbox (astrada._sandbox_guard). 186 _sandbox_guard.check(self.configuration) 187 188 config = self.configuration 189 190 # header parameters 191 header_params = header_params or {} 192 header_params.update(self.default_headers) 193 if self.cookie: 194 header_params['Cookie'] = self.cookie 195 if header_params: 196 header_params = self.sanitize_for_serialization(header_params) 197 header_params = dict( 198 self.parameters_to_tuples(header_params,collection_formats) 199 ) 200 201 # path parameters 202 if path_params: 203 path_params = self.sanitize_for_serialization(path_params) 204 path_params = self.parameters_to_tuples( 205 path_params, 206 collection_formats 207 ) 208 for k, v in path_params: 209 # specified safe chars, encode everything 210 resource_path = resource_path.replace( 211 '{%s}' % k, 212 quote(str(v), safe=config.safe_chars_for_path_param) 213 ) 214 215 # post parameters 216 if post_params or files: 217 post_params = post_params if post_params else [] 218 post_params = self.sanitize_for_serialization(post_params) 219 post_params = self.parameters_to_tuples( 220 post_params, 221 collection_formats 222 ) 223 if files: 224 post_params.extend(self.files_parameters(files)) 225 226 # auth setting 227 self.update_params_for_auth( 228 header_params, 229 query_params, 230 auth_settings, 231 resource_path, 232 method, 233 body, 234 request_auth=_request_auth 235 ) 236 237 # body 238 if body: 239 body = self.sanitize_for_serialization(body) 240 241 # request url 242 if _host is None or self.configuration.ignore_operation_servers: 243 url = self.configuration.host + resource_path 244 else: 245 # use server/host defined in path or operation instead 246 url = _host + resource_path 247 248 # query parameters 249 if query_params: 250 query_params = self.sanitize_for_serialization(query_params) 251 url_query = self.parameters_to_url_query( 252 query_params, 253 collection_formats 254 ) 255 url += "?" + url_query 256 257 return method, url, header_params, body, post_params
Builds the HTTP request params needed by the request.
Parameters
- method: Method to call.
- resource_path: Path to method endpoint.
- path_params: Path parameters in the url.
- query_params: Query parameters in the url.
- header_params: Header parameters to be placed in the request header.
- body: Request body.
- post_params dict: Request post form parameters,
for
application/x-www-form-urlencoded,multipart/form-data. - auth_settings list: Auth Settings names for the request.
- files dict: key -> filename, value -> filepath,
for
multipart/form-data. - collection_formats: dict of collection formats for path, query, header, and post parameters.
- _request_auth: set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.
Returns
tuple of form (path, http_method, query_params, header_params, body, post_params, files)
260 def call_api( 261 self, 262 method, 263 url, 264 header_params=None, 265 body=None, 266 post_params=None, 267 _request_timeout=None 268 ) -> rest.RESTResponse: 269 """Makes the HTTP request (synchronous) 270 :param method: Method to call. 271 :param url: Path to method endpoint. 272 :param header_params: Header parameters to be 273 placed in the request header. 274 :param body: Request body. 275 :param post_params dict: Request post form parameters, 276 for `application/x-www-form-urlencoded`, `multipart/form-data`. 277 :param _request_timeout: timeout setting for this request. 278 :return: RESTResponse 279 """ 280 281 retries = None 282 if method.upper() == "DELETE": 283 # The sandbox deletes cascade and answer only when done. A second call while the first 284 # still runs is not safe, so they are never retried, and they wait at least 285 # SANDBOX_DELETE_TIMEOUT unless the call or the client turned the timeout off. 286 retries = False 287 configured = getattr(self.rest_client, "default_timeout", None) 288 if _request_timeout is None and isinstance(configured, (int, float)) and configured: 289 # (connect, read): connecting keeps the client's timeout, only the answer waits longer. 290 _request_timeout = (float(configured), max(float(configured), SANDBOX_DELETE_TIMEOUT)) 291 try: 292 # perform request and return response 293 response_data = self.rest_client.request( 294 method, url, 295 headers=header_params, 296 body=body, post_params=post_params, 297 _request_timeout=_request_timeout, 298 _retries=retries 299 ) 300 301 except ApiException as e: 302 raise e 303 304 return response_data
Makes the HTTP request (synchronous)
Parameters
- method: Method to call.
- url: Path to method endpoint.
- header_params: Header parameters to be placed in the request header.
- body: Request body.
- post_params dict: Request post form parameters,
for
application/x-www-form-urlencoded,multipart/form-data. - _request_timeout: timeout setting for this request.
Returns
RESTResponse
306 def response_deserialize( 307 self, 308 response_data: rest.RESTResponse, 309 response_types_map: Optional[Dict[str, ApiResponseT]]=None 310 ) -> ApiResponse[ApiResponseT]: 311 """Deserializes response into an object. 312 :param response_data: RESTResponse object to be deserialized. 313 :param response_types_map: dict of response types. 314 :return: ApiResponse 315 """ 316 317 msg = "RESTResponse.read() must be called before passing it to response_deserialize()" 318 assert response_data.data is not None, msg 319 320 response_type = response_types_map.get(str(response_data.status), None) 321 if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: 322 # if not found, look for '1XX', '2XX', etc. 323 response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) 324 325 # deserialize response data 326 response_text = None 327 return_data = None 328 try: 329 if response_type == "bytearray": 330 return_data = response_data.data 331 elif response_type == "file": 332 return_data = self.__deserialize_file(response_data) 333 elif response_type is not None: 334 match = None 335 content_type = response_data.getheader('content-type') 336 if content_type is not None: 337 match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) 338 encoding = match.group(1) if match else "utf-8" 339 response_text = response_data.data.decode(encoding) 340 # Values added to the API after this release (a new enum value) are kept as 341 # strings instead of failing the call (astrada._lenient). 342 with _lenient(): 343 return_data = self.deserialize(response_text, response_type, content_type) 344 finally: 345 if not 200 <= response_data.status <= 299: 346 raise ApiException.from_response( 347 http_resp=response_data, 348 body=response_text, 349 data=return_data, 350 ) 351 352 return ApiResponse( 353 status_code = response_data.status, 354 data = return_data, 355 headers = response_data.getheaders(), 356 raw_data = response_data.data 357 )
Deserializes response into an object.
Parameters
- response_data: RESTResponse object to be deserialized.
- response_types_map: dict of response types.
Returns
ApiResponse
359 def sanitize_for_serialization(self, obj): 360 """Builds a JSON POST object. 361 362 If obj is None, return None. 363 If obj is SecretStr, return obj.get_secret_value() 364 If obj is str, int, long, float, bool, return directly. 365 If obj is datetime.datetime, datetime.date 366 convert to string in iso8601 format. 367 If obj is decimal.Decimal return string representation. 368 If obj is list, sanitize each element in the list. 369 If obj is dict, return the dict. 370 If obj is OpenAPI model, return the properties dict. 371 372 :param obj: The data to serialize. 373 :return: The serialized form of data. 374 """ 375 if obj is None: 376 return None 377 elif isinstance(obj, Enum): 378 return obj.value 379 elif isinstance(obj, SecretStr): 380 return obj.get_secret_value() 381 elif isinstance(obj, self.PRIMITIVE_TYPES): 382 return obj 383 elif isinstance(obj, uuid.UUID): 384 return str(obj) 385 elif isinstance(obj, list): 386 return [ 387 self.sanitize_for_serialization(sub_obj) for sub_obj in obj 388 ] 389 elif isinstance(obj, tuple): 390 return tuple( 391 self.sanitize_for_serialization(sub_obj) for sub_obj in obj 392 ) 393 elif isinstance(obj, (datetime.datetime, datetime.date)): 394 return obj.isoformat() 395 elif isinstance(obj, decimal.Decimal): 396 return str(obj) 397 398 elif isinstance(obj, dict): 399 obj_dict = obj 400 else: 401 # Convert model obj to dict except 402 # attributes `openapi_types`, `attribute_map` 403 # and attributes which value is not None. 404 # Convert attribute name to json key in 405 # model definition for request. 406 if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): 407 obj_dict = obj.to_dict() 408 else: 409 obj_dict = obj.__dict__ 410 411 if isinstance(obj_dict, list): 412 # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() 413 return self.sanitize_for_serialization(obj_dict) 414 415 return { 416 key: self.sanitize_for_serialization(val) 417 for key, val in obj_dict.items() 418 }
Builds a JSON POST object.
If obj is None, return None. If obj is SecretStr, return obj.get_secret_value() If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict.
Parameters
- obj: The data to serialize.
Returns
The serialized form of data.
420 def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): 421 """Deserializes response into an object. 422 423 :param response: RESTResponse object to be deserialized. 424 :param response_type: class literal for 425 deserialized object, or string of class name. 426 :param content_type: content type of response. 427 428 :return: deserialized object. 429 """ 430 431 # fetch data from response object 432 if content_type is None: 433 try: 434 data = json.loads(response_text) 435 except ValueError: 436 data = response_text 437 elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): 438 if response_text == "": 439 data = "" 440 else: 441 data = json.loads(response_text) 442 elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): 443 data = response_text 444 else: 445 raise ApiException( 446 status=0, 447 reason="Unsupported content type: {0}".format(content_type) 448 ) 449 450 return self.__deserialize(data, response_type)
Deserializes response into an object.
Parameters
- response: RESTResponse object to be deserialized.
- response_type: class literal for deserialized object, or string of class name.
- content_type: content type of response.
Returns
deserialized object.
499 def parameters_to_tuples(self, params, collection_formats): 500 """Get parameters as list of tuples, formatting collections. 501 502 :param params: Parameters as dict or list of two-tuples 503 :param dict collection_formats: Parameter collection formats 504 :return: Parameters as list of tuples, collections formatted 505 """ 506 new_params: List[Tuple[str, str]] = [] 507 if collection_formats is None: 508 collection_formats = {} 509 for k, v in params.items() if isinstance(params, dict) else params: 510 if k in collection_formats: 511 collection_format = collection_formats[k] 512 if collection_format == 'multi': 513 new_params.extend((k, value) for value in v) 514 else: 515 if collection_format == 'ssv': 516 delimiter = ' ' 517 elif collection_format == 'tsv': 518 delimiter = '\t' 519 elif collection_format == 'pipes': 520 delimiter = '|' 521 else: # csv is the default 522 delimiter = ',' 523 new_params.append( 524 (k, delimiter.join(str(value) for value in v))) 525 else: 526 new_params.append((k, v)) 527 return new_params
Get parameters as list of tuples, formatting collections.
Parameters
- params: Parameters as dict or list of two-tuples
- dict collection_formats: Parameter collection formats
Returns
Parameters as list of tuples, collections formatted
529 def parameters_to_url_query(self, params, collection_formats): 530 """Get parameters as list of tuples, formatting collections. 531 532 :param params: Parameters as dict or list of two-tuples 533 :param dict collection_formats: Parameter collection formats 534 :return: URL query string (e.g. a=Hello%20World&b=123) 535 """ 536 new_params: List[Tuple[str, str]] = [] 537 if collection_formats is None: 538 collection_formats = {} 539 for k, v in params.items() if isinstance(params, dict) else params: 540 if isinstance(v, bool): 541 v = str(v).lower() 542 if isinstance(v, (int, float)): 543 v = str(v) 544 if isinstance(v, dict): 545 v = json.dumps(v) 546 547 if k in collection_formats: 548 collection_format = collection_formats[k] 549 if collection_format == 'multi': 550 new_params.extend((k, quote(str(value))) for value in v) 551 else: 552 if collection_format == 'ssv': 553 delimiter = ' ' 554 elif collection_format == 'tsv': 555 delimiter = '\t' 556 elif collection_format == 'pipes': 557 delimiter = '|' 558 else: # csv is the default 559 delimiter = ',' 560 new_params.append( 561 (k, delimiter.join(quote(str(value)) for value in v)) 562 ) 563 else: 564 new_params.append((k, quote(str(v)))) 565 566 return "&".join(["=".join(map(str, item)) for item in new_params])
Get parameters as list of tuples, formatting collections.
Parameters
- params: Parameters as dict or list of two-tuples
- dict collection_formats: Parameter collection formats
Returns
URL query string (e.g. a=Hello%20World&b=123)
568 def files_parameters( 569 self, 570 files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], 571 ): 572 """Builds form parameters. 573 574 :param files: File parameters. 575 :return: Form parameters with files. 576 """ 577 params = [] 578 for k, v in files.items(): 579 if isinstance(v, str): 580 with open(v, 'rb') as f: 581 filename = os.path.basename(f.name) 582 filedata = f.read() 583 elif isinstance(v, bytes): 584 filename = k 585 filedata = v 586 elif isinstance(v, tuple): 587 filename, filedata = v 588 elif isinstance(v, list): 589 for file_param in v: 590 params.extend(self.files_parameters({k: file_param})) 591 continue 592 else: 593 raise ValueError("Unsupported file value") 594 mimetype = ( 595 mimetypes.guess_type(filename)[0] 596 or 'application/octet-stream' 597 ) 598 params.append( 599 tuple([k, tuple([filename, filedata, mimetype])]) 600 ) 601 return params
Builds form parameters.
Parameters
- files: File parameters.
Returns
Form parameters with files.
603 def select_header_accept(self, accepts: List[str]) -> Optional[str]: 604 """Returns `Accept` based on an array of accepts provided. 605 606 :param accepts: List of headers. 607 :return: Accept (e.g. application/json). 608 """ 609 if not accepts: 610 return None 611 612 for accept in accepts: 613 if re.search('json', accept, re.IGNORECASE): 614 return accept 615 616 return accepts[0]
Returns Accept based on an array of accepts provided.
Parameters
- accepts: List of headers.
Returns
Accept (e.g. application/json).
618 def select_header_content_type(self, content_types): 619 """Returns `Content-Type` based on an array of content_types provided. 620 621 :param content_types: List of content-types. 622 :return: Content-Type (e.g. application/json). 623 """ 624 if not content_types: 625 return None 626 627 for content_type in content_types: 628 if re.search('json', content_type, re.IGNORECASE): 629 return content_type 630 631 return content_types[0]
Returns Content-Type based on an array of content_types provided.
Parameters
- content_types: List of content-types.
Returns
Content-Type (e.g. application/json).
633 def update_params_for_auth( 634 self, 635 headers, 636 queries, 637 auth_settings, 638 resource_path, 639 method, 640 body, 641 request_auth=None 642 ) -> None: 643 """Updates header and query params based on authentication setting. 644 645 :param headers: Header parameters dict to be updated. 646 :param queries: Query parameters tuple list to be updated. 647 :param auth_settings: Authentication setting identifiers list. 648 :resource_path: A string representation of the HTTP request resource path. 649 :method: A string representation of the HTTP request method. 650 :body: A object representing the body of the HTTP request. 651 The object type is the return value of sanitize_for_serialization(). 652 :param request_auth: if set, the provided settings will 653 override the token in the configuration. 654 """ 655 if not auth_settings: 656 return 657 658 if request_auth: 659 self._apply_auth_params( 660 headers, 661 queries, 662 resource_path, 663 method, 664 body, 665 request_auth 666 ) 667 else: 668 for auth in auth_settings: 669 auth_setting = self.configuration.auth_settings().get(auth) 670 if auth_setting: 671 self._apply_auth_params( 672 headers, 673 queries, 674 resource_path, 675 method, 676 body, 677 auth_setting 678 )
Updates header and query params based on authentication setting.
Parameters
- headers: Header parameters dict to be updated.
- queries: Query parameters tuple list to be updated.
- auth_settings: Authentication setting identifiers list. :resource_path: A string representation of the HTTP request resource path. :method: A string representation of the HTTP request method. :body: A object representing the body of the HTTP request. The object type is the return value of sanitize_for_serialization().
- request_auth: if set, the provided settings will override the token in the configuration.
145class Configuration: 146 """This class contains various settings of the API client. 147 148 :param environment: ``"sandbox"`` or ``"production"`` (see :class:`astrada.Environment`). 149 Production is used when neither ``environment`` nor ``host`` is given. 150 :param host: Base url instead of the environment's own (for example a proxy or a local mock). 151 :param sandbox_base_url: Marks a custom ``host`` as a sandbox, so ``astrada.sandbox`` calls go 152 through it (with ``environment="sandbox"``). Sandbox calls are refused everywhere else. 153 :param account_id: Your Astrada account ID (the login realm). 154 :param client_id: Your API client's ID. 155 :param client_secret: Your API client's secret. With the three, the SDK logs in with OAuth2 156 client credentials, caches the token and renews it before it expires. 157 :param timeout: Seconds to wait for each request (default 60). A call can also pass 158 ``_request_timeout``. 159 :param auth_client: An :class:`astrada.AuthenticationClient` to share one login and token 160 cache between configurations (``astrada.Astrada`` does this for the Banking API). 161 :param ignore_operation_servers 162 Boolean to ignore operation servers for the API client. 163 Config will use `host` as the base url regardless of the operation servers. 164 :param api_key: Dict to store API key(s). 165 Each entry in the dict specifies an API key. 166 The dict key is the name of the security scheme in the OAS specification. 167 The dict value is the API key secret. 168 :param api_key_prefix: Dict to store API prefix (e.g. Bearer). 169 The dict key is the name of the security scheme in the OAS specification. 170 The dict value is an API key prefix when generating the auth data. 171 :param username: Username for HTTP basic authentication. 172 :param password: Password for HTTP basic authentication. 173 :param access_token: Access token. 174 :param server_index: Index to servers configuration. 175 :param server_variables: Mapping with string values to replace variables in 176 templated server configuration. The validation of enums is performed for 177 variables with defined enum values before. 178 :param server_operation_index: Mapping from operation ID to an index to server 179 configuration. 180 :param server_operation_variables: Mapping from operation ID to a mapping with 181 string values to replace variables in templated server configuration. 182 The validation of enums is performed for variables with defined enum 183 values before. 184 :param ssl_ca_cert: str - the path to a file of concatenated CA certificates 185 in PEM format. 186 :param retries: Retries after a failed attempt (default 2), or a urllib3 ``Retry``. Connection 187 failures are retried for every call except the sandbox deletes (never retried); 429 and 5xx 188 answers only for GET, HEAD, PUT, DELETE and 189 OPTIONS. Retry-After is honoured. ``0`` turns retries off. 190 :param ca_cert_data: verify the peer using concatenated CA certificate data 191 in PEM (str) or DER (bytes) format. 192 :param cert_file: the path to a client certificate file, for mTLS. 193 :param key_file: the path to a client key file, for mTLS. 194 195 :Example: 196 """ 197 198 _default: ClassVar[Optional[Self]] = None 199 200 def __init__( 201 self, 202 host: Optional[str]=None, 203 api_key: Optional[Dict[str, str]]=None, 204 api_key_prefix: Optional[Dict[str, str]]=None, 205 username: Optional[str]=None, 206 password: Optional[str]=None, 207 access_token: Optional[str]=None, 208 server_index: Optional[int]=None, 209 server_variables: Optional[ServerVariablesT]=None, 210 server_operation_index: Optional[Dict[int, int]]=None, 211 server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, 212 ignore_operation_servers: bool=False, 213 ssl_ca_cert: Optional[str]=None, 214 retries: Union[None, int, Retry] = None, 215 ca_cert_data: Optional[Union[str, bytes]] = None, 216 cert_file: Optional[str]=None, 217 key_file: Optional[str]=None, 218 *, 219 debug: Optional[bool] = None, 220 environment: Optional[str] = None, 221 account_id: Optional[str] = None, 222 client_id: Optional[str] = None, 223 client_secret: Optional[str] = None, 224 timeout: Optional[float] = None, 225 auth_client: Optional[Any] = None, 226 sandbox_base_url: bool = False, 227 ) -> None: 228 """Constructor 229 """ 230 self.environment: Optional[str] = ( 231 _environments.name(environment) if environment is not None 232 else (None if host is not None else "production") 233 ) 234 """The environment name ("sandbox" or "production"); None for a bare host 235 """ 236 self.sandbox_base_url = sandbox_base_url 237 """True when a custom host is marked as a sandbox (needed for astrada.sandbox calls) 238 """ 239 if host is None: 240 host = _environments.base_url(self.environment or "production") 241 self._base_path = host 242 """Default Base url 243 """ 244 self.server_index = server_index 245 self.server_operation_index = server_operation_index or {} 246 """Default server index 247 """ 248 self.server_variables = server_variables or {} 249 self.server_operation_variables = server_operation_variables or {} 250 """Default server variables 251 """ 252 self.ignore_operation_servers = ignore_operation_servers 253 """Ignore operation servers 254 """ 255 self.temp_folder_path = None 256 """Temp file folder for downloading files 257 """ 258 # Authentication Settings 259 self.api_key = {} 260 if api_key: 261 self.api_key = api_key 262 """dict to store API key(s) 263 """ 264 self.api_key_prefix = {} 265 if api_key_prefix: 266 self.api_key_prefix = api_key_prefix 267 """dict to store API prefix (e.g. Bearer) 268 """ 269 self.refresh_api_key_hook = None 270 """function hook to refresh API key if expired 271 """ 272 self.username = username 273 """Username for HTTP basic authentication 274 """ 275 self.password = password 276 """Password for HTTP basic authentication 277 """ 278 self.access_token = access_token 279 """Access token 280 """ 281 self.account_id = account_id 282 """Account ID for the OAuth2 login 283 """ 284 self.client_id = client_id 285 """API client ID for the OAuth2 login 286 """ 287 self.client_secret = client_secret 288 """API client secret for the OAuth2 login 289 """ 290 self._auth_client = auth_client 291 self.timeout = _timeout_or_default(timeout) 292 """Seconds to wait for each request 293 """ 294 self.logger = {} 295 """Logging Settings 296 """ 297 self.logger["package_logger"] = logging.getLogger("astrada.sandbox") 298 self.logger["urllib3_logger"] = logging.getLogger("urllib3") 299 self.logger_format = '%(asctime)s %(levelname)s %(message)s' 300 """Log format 301 """ 302 self.logger_stream_handler = None 303 """Log stream handler 304 """ 305 self.logger_file_handler: Optional[FileHandler] = None 306 """Log file handler 307 """ 308 self.logger_file = None 309 """Debug file location 310 """ 311 if debug is not None: 312 self.debug = debug 313 else: 314 self.__debug = False 315 """Debug switch 316 """ 317 318 self.verify_ssl = True 319 """SSL/TLS verification 320 Set this to false to skip verifying SSL certificate when calling API 321 from https server. 322 """ 323 self.ssl_ca_cert = ssl_ca_cert 324 """Set this to customize the certificate file to verify the peer. 325 """ 326 self.ca_cert_data = ca_cert_data 327 """Set this to verify the peer using PEM (str) or DER (bytes) 328 certificate data. 329 """ 330 self.cert_file = cert_file 331 """client certificate file 332 """ 333 self.key_file = key_file 334 """client key file 335 """ 336 self.assert_hostname = None 337 """Set this to True/False to enable/disable SSL hostname verification. 338 """ 339 self.tls_server_name = None 340 """SSL/TLS Server Name Indication (SNI) 341 Set this to the SNI value expected by the server. 342 """ 343 344 self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 345 """urllib3 connection pool's maximum number of connections saved 346 per pool. urllib3 uses 1 connection as default value, but this is 347 not the best value when you are making a lot of possibly parallel 348 requests to the same host, which is often the case here. 349 cpu_count * 5 is used as default value to increase performance. 350 """ 351 352 self.proxy: Optional[str] = None 353 """Proxy URL 354 """ 355 self.proxy_headers = None 356 """Proxy headers 357 """ 358 self.safe_chars_for_path_param = '' 359 """Safe chars for path_param 360 """ 361 self.retries = retries 362 """Retries: None for the default policy (astrada._retry), a count, or a urllib3 Retry 363 """ 364 # Enable client side validation 365 self.client_side_validation = True 366 367 self.socket_options = None 368 """Options to pass down to the underlying urllib3 socket 369 """ 370 371 self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" 372 """datetime format 373 """ 374 375 self.date_format = "%Y-%m-%d" 376 """date format 377 """ 378 379 def __deepcopy__(self, memo: Dict[int, Any]) -> Self: 380 cls = self.__class__ 381 result = cls.__new__(cls) 382 memo[id(self)] = result 383 for k, v in self.__dict__.items(): 384 if k not in ('logger', 'logger_file_handler'): 385 setattr(result, k, copy.deepcopy(v, memo)) 386 # shallow copy of loggers 387 result.logger = copy.copy(self.logger) 388 # use setters to configure loggers 389 result.logger_file = self.logger_file 390 result.debug = self.debug 391 return result 392 393 def __setattr__(self, name: str, value: Any) -> None: 394 object.__setattr__(self, name, value) 395 396 @classmethod 397 def set_default(cls, default: Optional[Self]) -> None: 398 """Set default instance of configuration. 399 400 It stores default configuration, which can be 401 returned by get_default_copy method. 402 403 :param default: object of Configuration 404 """ 405 cls._default = default 406 407 @classmethod 408 def get_default_copy(cls) -> Self: 409 """Deprecated. Please use `get_default` instead. 410 411 Deprecated. Please use `get_default` instead. 412 413 :return: The configuration object. 414 """ 415 return cls.get_default() 416 417 @classmethod 418 def get_default(cls) -> Self: 419 """Return the default configuration. 420 421 This method returns newly created, based on default constructor, 422 object of Configuration class or returns a copy of default 423 configuration. 424 425 :return: The configuration object. 426 """ 427 if cls._default is None: 428 cls._default = cls() 429 return cls._default 430 431 @property 432 def logger_file(self) -> Optional[str]: 433 """The logger file. 434 435 If the logger_file is None, then add stream handler and remove file 436 handler. Otherwise, add file handler and remove stream handler. 437 438 :param value: The logger_file path. 439 :type: str 440 """ 441 return self.__logger_file 442 443 @logger_file.setter 444 def logger_file(self, value: Optional[str]) -> None: 445 """The logger file. 446 447 If the logger_file is None, then add stream handler and remove file 448 handler. Otherwise, add file handler and remove stream handler. 449 450 :param value: The logger_file path. 451 :type: str 452 """ 453 self.__logger_file = value 454 if self.__logger_file: 455 # If set logging file, 456 # then add file handler and remove stream handler. 457 self.logger_file_handler = logging.FileHandler(self.__logger_file) 458 self.logger_file_handler.setFormatter(self.logger_formatter) 459 for _, logger in self.logger.items(): 460 logger.addHandler(self.logger_file_handler) 461 462 @property 463 def debug(self) -> bool: 464 """Debug status 465 466 :param value: The debug status, True or False. 467 :type: bool 468 """ 469 return self.__debug 470 471 @debug.setter 472 def debug(self, value: bool) -> None: 473 """Debug status 474 475 :param value: The debug status, True or False. 476 :type: bool 477 """ 478 self.__debug = value 479 if self.__debug: 480 # if debug status is True, turn on debug logging 481 for _, logger in self.logger.items(): 482 logger.setLevel(logging.DEBUG) 483 # turn on httplib debug 484 httplib.HTTPConnection.debuglevel = 1 485 else: 486 # if debug status is False, turn off debug logging, 487 # setting log level to default `logging.WARNING` 488 for _, logger in self.logger.items(): 489 logger.setLevel(logging.WARNING) 490 # turn off httplib debug 491 httplib.HTTPConnection.debuglevel = 0 492 493 @property 494 def logger_format(self) -> str: 495 """The logger format. 496 497 The logger_formatter will be updated when sets logger_format. 498 499 :param value: The format string. 500 :type: str 501 """ 502 return self.__logger_format 503 504 @logger_format.setter 505 def logger_format(self, value: str) -> None: 506 """The logger format. 507 508 The logger_formatter will be updated when sets logger_format. 509 510 :param value: The format string. 511 :type: str 512 """ 513 self.__logger_format = value 514 self.logger_formatter = logging.Formatter(self.__logger_format) 515 516 def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: 517 """Gets API key (with prefix if set). 518 519 :param identifier: The identifier of apiKey. 520 :param alias: The alternative identifier of apiKey. 521 :return: The token for api key authentication. 522 """ 523 if self.refresh_api_key_hook is not None: 524 self.refresh_api_key_hook(self) 525 key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) 526 if key: 527 prefix = self.api_key_prefix.get(identifier) 528 if prefix: 529 return "%s %s" % (prefix, key) 530 else: 531 return key 532 533 return None 534 535 def get_basic_auth_token(self) -> Optional[str]: 536 """Gets HTTP basic authentication header (string). 537 538 :return: The token for basic HTTP authentication. 539 """ 540 username = "" 541 if self.username is not None: 542 username = self.username 543 password = "" 544 if self.password is not None: 545 password = self.password 546 return urllib3.util.make_headers( 547 basic_auth=username + ':' + password 548 ).get('authorization') 549 550 def get_auth_client(self) -> Optional[Any]: 551 """The AuthenticationClient that logs in with account_id, client_id and client_secret. 552 553 :return: the shared or new AuthenticationClient, or None without credentials 554 """ 555 if self._auth_client is None and all( 556 [self.account_id, self.client_id, self.client_secret] 557 ): 558 from astrada.auth_client import AuthenticationClient 559 from astrada.sandbox.rest import RESTClientObject 560 561 self._auth_client = AuthenticationClient( 562 account_id=str(self.account_id), 563 client_id=str(self.client_id), 564 client_secret=str(self.client_secret), 565 base_path=self._base_path, 566 pool_manager=RESTClientObject(self).pool_manager, 567 timeout=self.timeout, 568 retries=self.retries, 569 ) 570 return self._auth_client 571 572 def auth_settings(self)-> AuthSettings: 573 """Gets Auth Settings dict for api client. 574 575 :return: The Auth Settings information dict. 576 """ 577 auth: AuthSettings = {} 578 auth_client = self.get_auth_client() if self.access_token is None else None 579 if auth_client is not None: 580 # A failed login raises AuthenticationError with the token endpoint's message; the 581 # call is never sent without a token. 582 auth['main-auth'] = { 583 'type': 'oauth2', 584 'in': 'header', 585 'key': 'Authorization', 586 'value': auth_client.get_access_token() 587 } 588 elif self.access_token is not None: 589 auth['main-auth'] = { 590 'type': 'oauth2', 591 'in': 'header', 592 'key': 'Authorization', 593 'value': 'Bearer ' + self.access_token 594 } 595 return auth 596 597 def to_debug_report(self) -> str: 598 """Gets the essential information for debugging. 599 600 :return: The report for debugging. 601 """ 602 return "Python SDK Debug Report:\n"\ 603 "OS: {env}\n"\ 604 "Python Version: {pyversion}\n"\ 605 "Version of the API: 2024-02-28\n"\ 606 "SDK Package Version: {version}\n"\ 607 "Base URL: {host}".\ 608 format(env=sys.platform, pyversion=sys.version, version=_sdk_version(), host=self.host) 609 610 def get_host_settings(self) -> List[HostSetting]: 611 """Gets an array of host settings 612 613 :return: An array of host settings 614 """ 615 return [ 616 { 617 'url': "https://api.sandbox.astrada.co", 618 'description': "Sandbox", 619 } 620 ] 621 622 def get_host_from_settings( 623 self, 624 index: Optional[int], 625 variables: Optional[ServerVariablesT]=None, 626 servers: Optional[List[HostSetting]]=None, 627 ) -> str: 628 """Gets host URL based on the index and variables 629 :param index: array index of the host settings 630 :param variables: hash of variable and the corresponding value 631 :param servers: an array of host settings or None 632 :return: URL based on host settings 633 """ 634 if index is None: 635 return self._base_path 636 637 variables = {} if variables is None else variables 638 servers = self.get_host_settings() if servers is None else servers 639 640 try: 641 server = servers[index] 642 except IndexError: 643 raise ValueError( 644 "Invalid index {0} when selecting the host settings. " 645 "Must be less than {1}".format(index, len(servers))) 646 647 url = server['url'] 648 649 # go through variables and replace placeholders 650 for variable_name, variable in server.get('variables', {}).items(): 651 used_value = variables.get( 652 variable_name, variable['default_value']) 653 654 if 'enum_values' in variable \ 655 and used_value not in variable['enum_values']: 656 raise ValueError( 657 "The variable `{0}` in the host URL has invalid value " 658 "{1}. Must be {2}.".format( 659 variable_name, variables[variable_name], 660 variable['enum_values'])) 661 662 url = url.replace("{" + variable_name + "}", used_value) 663 664 return url 665 666 @property 667 def host(self) -> str: 668 """Return generated host.""" 669 return self.get_host_from_settings(self.server_index, variables=self.server_variables) 670 671 @host.setter 672 def host(self, value: str) -> None: 673 """Fix base path.""" 674 self._base_path = value 675 self.server_index = None
This class contains various settings of the API client.
Parameters
- environment:
"sandbox"or"production"(seeastrada.Environment). Production is used when neitherenvironmentnorhostis given. - host: Base url instead of the environment's own (for example a proxy or a local mock).
- sandbox_base_url: Marks a custom
hostas a sandbox, soastrada.sandboxcalls go through it (withenvironment="sandbox"). Sandbox calls are refused everywhere else. - account_id: Your Astrada account ID (the login realm).
- client_id: Your API client's ID.
- client_secret: Your API client's secret. With the three, the SDK logs in with OAuth2 client credentials, caches the token and renews it before it expires.
- timeout: Seconds to wait for each request (default 60). A call can also pass
_request_timeout. - auth_client: An
astrada.AuthenticationClientto share one login and token cache between configurations (astrada.Astradadoes this for the Banking API). :param ignore_operation_servers Boolean to ignore operation servers for the API client. Config will usehostas the base url regardless of the operation servers. - api_key: Dict to store API key(s). Each entry in the dict specifies an API key. The dict key is the name of the security scheme in the OAS specification. The dict value is the API key secret.
- api_key_prefix: Dict to store API prefix (e.g. Bearer). The dict key is the name of the security scheme in the OAS specification. The dict value is an API key prefix when generating the auth data.
- username: Username for HTTP basic authentication.
- password: Password for HTTP basic authentication.
- access_token: Access token.
- server_index: Index to servers configuration.
- server_variables: Mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before.
- server_operation_index: Mapping from operation ID to an index to server configuration.
- server_operation_variables: Mapping from operation ID to a mapping with string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before.
- ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format.
- retries: Retries after a failed attempt (default 2), or a urllib3
Retry. Connection failures are retried for every call except the sandbox deletes (never retried); 429 and 5xx answers only for GET, HEAD, PUT, DELETE and OPTIONS. Retry-After is honoured.0turns retries off. - ca_cert_data: verify the peer using concatenated CA certificate data in PEM (str) or DER (bytes) format.
- cert_file: the path to a client certificate file, for mTLS.
- key_file: the path to a client key file, for mTLS.
:Example:
200 def __init__( 201 self, 202 host: Optional[str]=None, 203 api_key: Optional[Dict[str, str]]=None, 204 api_key_prefix: Optional[Dict[str, str]]=None, 205 username: Optional[str]=None, 206 password: Optional[str]=None, 207 access_token: Optional[str]=None, 208 server_index: Optional[int]=None, 209 server_variables: Optional[ServerVariablesT]=None, 210 server_operation_index: Optional[Dict[int, int]]=None, 211 server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, 212 ignore_operation_servers: bool=False, 213 ssl_ca_cert: Optional[str]=None, 214 retries: Union[None, int, Retry] = None, 215 ca_cert_data: Optional[Union[str, bytes]] = None, 216 cert_file: Optional[str]=None, 217 key_file: Optional[str]=None, 218 *, 219 debug: Optional[bool] = None, 220 environment: Optional[str] = None, 221 account_id: Optional[str] = None, 222 client_id: Optional[str] = None, 223 client_secret: Optional[str] = None, 224 timeout: Optional[float] = None, 225 auth_client: Optional[Any] = None, 226 sandbox_base_url: bool = False, 227 ) -> None: 228 """Constructor 229 """ 230 self.environment: Optional[str] = ( 231 _environments.name(environment) if environment is not None 232 else (None if host is not None else "production") 233 ) 234 """The environment name ("sandbox" or "production"); None for a bare host 235 """ 236 self.sandbox_base_url = sandbox_base_url 237 """True when a custom host is marked as a sandbox (needed for astrada.sandbox calls) 238 """ 239 if host is None: 240 host = _environments.base_url(self.environment or "production") 241 self._base_path = host 242 """Default Base url 243 """ 244 self.server_index = server_index 245 self.server_operation_index = server_operation_index or {} 246 """Default server index 247 """ 248 self.server_variables = server_variables or {} 249 self.server_operation_variables = server_operation_variables or {} 250 """Default server variables 251 """ 252 self.ignore_operation_servers = ignore_operation_servers 253 """Ignore operation servers 254 """ 255 self.temp_folder_path = None 256 """Temp file folder for downloading files 257 """ 258 # Authentication Settings 259 self.api_key = {} 260 if api_key: 261 self.api_key = api_key 262 """dict to store API key(s) 263 """ 264 self.api_key_prefix = {} 265 if api_key_prefix: 266 self.api_key_prefix = api_key_prefix 267 """dict to store API prefix (e.g. Bearer) 268 """ 269 self.refresh_api_key_hook = None 270 """function hook to refresh API key if expired 271 """ 272 self.username = username 273 """Username for HTTP basic authentication 274 """ 275 self.password = password 276 """Password for HTTP basic authentication 277 """ 278 self.access_token = access_token 279 """Access token 280 """ 281 self.account_id = account_id 282 """Account ID for the OAuth2 login 283 """ 284 self.client_id = client_id 285 """API client ID for the OAuth2 login 286 """ 287 self.client_secret = client_secret 288 """API client secret for the OAuth2 login 289 """ 290 self._auth_client = auth_client 291 self.timeout = _timeout_or_default(timeout) 292 """Seconds to wait for each request 293 """ 294 self.logger = {} 295 """Logging Settings 296 """ 297 self.logger["package_logger"] = logging.getLogger("astrada.sandbox") 298 self.logger["urllib3_logger"] = logging.getLogger("urllib3") 299 self.logger_format = '%(asctime)s %(levelname)s %(message)s' 300 """Log format 301 """ 302 self.logger_stream_handler = None 303 """Log stream handler 304 """ 305 self.logger_file_handler: Optional[FileHandler] = None 306 """Log file handler 307 """ 308 self.logger_file = None 309 """Debug file location 310 """ 311 if debug is not None: 312 self.debug = debug 313 else: 314 self.__debug = False 315 """Debug switch 316 """ 317 318 self.verify_ssl = True 319 """SSL/TLS verification 320 Set this to false to skip verifying SSL certificate when calling API 321 from https server. 322 """ 323 self.ssl_ca_cert = ssl_ca_cert 324 """Set this to customize the certificate file to verify the peer. 325 """ 326 self.ca_cert_data = ca_cert_data 327 """Set this to verify the peer using PEM (str) or DER (bytes) 328 certificate data. 329 """ 330 self.cert_file = cert_file 331 """client certificate file 332 """ 333 self.key_file = key_file 334 """client key file 335 """ 336 self.assert_hostname = None 337 """Set this to True/False to enable/disable SSL hostname verification. 338 """ 339 self.tls_server_name = None 340 """SSL/TLS Server Name Indication (SNI) 341 Set this to the SNI value expected by the server. 342 """ 343 344 self.connection_pool_maxsize = multiprocessing.cpu_count() * 5 345 """urllib3 connection pool's maximum number of connections saved 346 per pool. urllib3 uses 1 connection as default value, but this is 347 not the best value when you are making a lot of possibly parallel 348 requests to the same host, which is often the case here. 349 cpu_count * 5 is used as default value to increase performance. 350 """ 351 352 self.proxy: Optional[str] = None 353 """Proxy URL 354 """ 355 self.proxy_headers = None 356 """Proxy headers 357 """ 358 self.safe_chars_for_path_param = '' 359 """Safe chars for path_param 360 """ 361 self.retries = retries 362 """Retries: None for the default policy (astrada._retry), a count, or a urllib3 Retry 363 """ 364 # Enable client side validation 365 self.client_side_validation = True 366 367 self.socket_options = None 368 """Options to pass down to the underlying urllib3 socket 369 """ 370 371 self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" 372 """datetime format 373 """ 374 375 self.date_format = "%Y-%m-%d" 376 """date format 377 """
Constructor
493 @property 494 def logger_format(self) -> str: 495 """The logger format. 496 497 The logger_formatter will be updated when sets logger_format. 498 499 :param value: The format string. 500 :type: str 501 """ 502 return self.__logger_format
Log format
431 @property 432 def logger_file(self) -> Optional[str]: 433 """The logger file. 434 435 If the logger_file is None, then add stream handler and remove file 436 handler. Otherwise, add file handler and remove stream handler. 437 438 :param value: The logger_file path. 439 :type: str 440 """ 441 return self.__logger_file
Debug file location
SSL/TLS verification Set this to false to skip verifying SSL certificate when calling API from https server.
SSL/TLS Server Name Indication (SNI) Set this to the SNI value expected by the server.
urllib3 connection pool's maximum number of connections saved per pool. urllib3 uses 1 connection as default value, but this is not the best value when you are making a lot of possibly parallel requests to the same host, which is often the case here. cpu_count * 5 is used as default value to increase performance.
396 @classmethod 397 def set_default(cls, default: Optional[Self]) -> None: 398 """Set default instance of configuration. 399 400 It stores default configuration, which can be 401 returned by get_default_copy method. 402 403 :param default: object of Configuration 404 """ 405 cls._default = default
Set default instance of configuration.
It stores default configuration, which can be returned by get_default_copy method.
Parameters
- default: object of Configuration
407 @classmethod 408 def get_default_copy(cls) -> Self: 409 """Deprecated. Please use `get_default` instead. 410 411 Deprecated. Please use `get_default` instead. 412 413 :return: The configuration object. 414 """ 415 return cls.get_default()
Deprecated. Please use get_default instead.
Deprecated. Please use get_default instead.
Returns
The configuration object.
417 @classmethod 418 def get_default(cls) -> Self: 419 """Return the default configuration. 420 421 This method returns newly created, based on default constructor, 422 object of Configuration class or returns a copy of default 423 configuration. 424 425 :return: The configuration object. 426 """ 427 if cls._default is None: 428 cls._default = cls() 429 return cls._default
Return the default configuration.
This method returns newly created, based on default constructor, object of Configuration class or returns a copy of default configuration.
Returns
The configuration object.
462 @property 463 def debug(self) -> bool: 464 """Debug status 465 466 :param value: The debug status, True or False. 467 :type: bool 468 """ 469 return self.__debug
Debug status
Parameters
- value: The debug status, True or False.
516 def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: 517 """Gets API key (with prefix if set). 518 519 :param identifier: The identifier of apiKey. 520 :param alias: The alternative identifier of apiKey. 521 :return: The token for api key authentication. 522 """ 523 if self.refresh_api_key_hook is not None: 524 self.refresh_api_key_hook(self) 525 key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) 526 if key: 527 prefix = self.api_key_prefix.get(identifier) 528 if prefix: 529 return "%s %s" % (prefix, key) 530 else: 531 return key 532 533 return None
Gets API key (with prefix if set).
Parameters
- identifier: The identifier of apiKey.
- alias: The alternative identifier of apiKey.
Returns
The token for api key authentication.
535 def get_basic_auth_token(self) -> Optional[str]: 536 """Gets HTTP basic authentication header (string). 537 538 :return: The token for basic HTTP authentication. 539 """ 540 username = "" 541 if self.username is not None: 542 username = self.username 543 password = "" 544 if self.password is not None: 545 password = self.password 546 return urllib3.util.make_headers( 547 basic_auth=username + ':' + password 548 ).get('authorization')
Gets HTTP basic authentication header (string).
Returns
The token for basic HTTP authentication.
550 def get_auth_client(self) -> Optional[Any]: 551 """The AuthenticationClient that logs in with account_id, client_id and client_secret. 552 553 :return: the shared or new AuthenticationClient, or None without credentials 554 """ 555 if self._auth_client is None and all( 556 [self.account_id, self.client_id, self.client_secret] 557 ): 558 from astrada.auth_client import AuthenticationClient 559 from astrada.sandbox.rest import RESTClientObject 560 561 self._auth_client = AuthenticationClient( 562 account_id=str(self.account_id), 563 client_id=str(self.client_id), 564 client_secret=str(self.client_secret), 565 base_path=self._base_path, 566 pool_manager=RESTClientObject(self).pool_manager, 567 timeout=self.timeout, 568 retries=self.retries, 569 ) 570 return self._auth_client
The AuthenticationClient that logs in with account_id, client_id and client_secret.
Returns
the shared or new AuthenticationClient, or None without credentials
572 def auth_settings(self)-> AuthSettings: 573 """Gets Auth Settings dict for api client. 574 575 :return: The Auth Settings information dict. 576 """ 577 auth: AuthSettings = {} 578 auth_client = self.get_auth_client() if self.access_token is None else None 579 if auth_client is not None: 580 # A failed login raises AuthenticationError with the token endpoint's message; the 581 # call is never sent without a token. 582 auth['main-auth'] = { 583 'type': 'oauth2', 584 'in': 'header', 585 'key': 'Authorization', 586 'value': auth_client.get_access_token() 587 } 588 elif self.access_token is not None: 589 auth['main-auth'] = { 590 'type': 'oauth2', 591 'in': 'header', 592 'key': 'Authorization', 593 'value': 'Bearer ' + self.access_token 594 } 595 return auth
Gets Auth Settings dict for api client.
Returns
The Auth Settings information dict.
597 def to_debug_report(self) -> str: 598 """Gets the essential information for debugging. 599 600 :return: The report for debugging. 601 """ 602 return "Python SDK Debug Report:\n"\ 603 "OS: {env}\n"\ 604 "Python Version: {pyversion}\n"\ 605 "Version of the API: 2024-02-28\n"\ 606 "SDK Package Version: {version}\n"\ 607 "Base URL: {host}".\ 608 format(env=sys.platform, pyversion=sys.version, version=_sdk_version(), host=self.host)
Gets the essential information for debugging.
Returns
The report for debugging.
610 def get_host_settings(self) -> List[HostSetting]: 611 """Gets an array of host settings 612 613 :return: An array of host settings 614 """ 615 return [ 616 { 617 'url': "https://api.sandbox.astrada.co", 618 'description': "Sandbox", 619 } 620 ]
Gets an array of host settings
Returns
An array of host settings
622 def get_host_from_settings( 623 self, 624 index: Optional[int], 625 variables: Optional[ServerVariablesT]=None, 626 servers: Optional[List[HostSetting]]=None, 627 ) -> str: 628 """Gets host URL based on the index and variables 629 :param index: array index of the host settings 630 :param variables: hash of variable and the corresponding value 631 :param servers: an array of host settings or None 632 :return: URL based on host settings 633 """ 634 if index is None: 635 return self._base_path 636 637 variables = {} if variables is None else variables 638 servers = self.get_host_settings() if servers is None else servers 639 640 try: 641 server = servers[index] 642 except IndexError: 643 raise ValueError( 644 "Invalid index {0} when selecting the host settings. " 645 "Must be less than {1}".format(index, len(servers))) 646 647 url = server['url'] 648 649 # go through variables and replace placeholders 650 for variable_name, variable in server.get('variables', {}).items(): 651 used_value = variables.get( 652 variable_name, variable['default_value']) 653 654 if 'enum_values' in variable \ 655 and used_value not in variable['enum_values']: 656 raise ValueError( 657 "The variable `{0}` in the host URL has invalid value " 658 "{1}. Must be {2}.".format( 659 variable_name, variables[variable_name], 660 variable['enum_values'])) 661 662 url = url.replace("{" + variable_name + "}", used_value) 663 664 return url
Gets host URL based on the index and variables
Parameters
- index: array index of the host settings
- variables: hash of variable and the corresponding value
- servers: an array of host settings or None
Returns
URL based on host settings
92class AuthenticationClient: 93 """Requests and caches the OAuth2 token for one set of credentials.""" 94 95 def __init__( 96 self, 97 account_id: str, 98 client_id: str, 99 client_secret: str, 100 base_path: str, 101 pool_manager: Optional[urllib3.PoolManager] = None, 102 timeout: Optional[float] = None, 103 retries: Union[None, int, Retry] = None, 104 ) -> None: 105 """ 106 :param account_id: the Astrada account ID (the login realm) 107 :param client_id: the API client's ID 108 :param client_secret: the API client's secret 109 :param base_path: the environment's base URL, for example https://api.sandbox.astrada.co 110 :param pool_manager: urllib3 pool to send the token request through 111 :param timeout: seconds to wait for the token endpoint (default 60) 112 :param retries: the client's ``retries`` setting; a 429 or 5xx from the token endpoint is 113 retried under it (see :func:`astrada._retry.build_login_retry`) 114 """ 115 self.account_id = account_id 116 self.client_id = client_id 117 self.client_secret = client_secret 118 self.base_path = base_path.rstrip("/") 119 self.timeout = timeout_or_default(timeout) 120 self.retries = build_login_retry(retries) 121 self._cached_token: Optional[AccessToken] = None 122 self._token_expiry: float = 0 123 self._lock = threading.Lock() 124 if pool_manager is None: 125 pool_manager = urllib3.PoolManager(cert_reqs="CERT_REQUIRED", retries=build_retry(None)) 126 self.pool_manager = pool_manager 127 128 @property 129 def token_url(self) -> str: 130 return f"{self.base_path}/auth/realms/{self.account_id}/protocol/openid-connect/token" 131 132 def get_access_token( 133 self, name: Optional[str] = None, scopes: Optional[List[str]] = None 134 ) -> str: 135 """The Authorization header value ("Bearer ..."), logging in first if needed. 136 137 :param name: unused; kept for the generated Configuration's call 138 :param scopes: unused; the token carries every scope the API client has 139 :raises AuthenticationError: the token endpoint refused the credentials (400 or 401) 140 :raises RateLimitError: the token endpoint answered 429, after the retries 141 :raises ServiceException: the token endpoint answered 5xx, after the retries 142 :raises NotFoundException: no such account (404) 143 :raises ApiConnectionError: the token endpoint could not be reached 144 """ 145 with self._lock: 146 if not self._is_token_valid(): 147 self._cache_token(self._request_new_token()) 148 assert self._cached_token is not None 149 return self._format_token(self._cached_token) 150 151 def _format_token(self, token: AccessToken) -> str: 152 token_type = token.token_type or "Bearer" 153 if token_type.lower() == "bearer": 154 token_type = "Bearer" 155 return f"{token_type} {token.access_token}" 156 157 def _request_new_token(self) -> AccessToken: 158 fields = { 159 "client_id": self.client_id, 160 "client_secret": self.client_secret, 161 "grant_type": "client_credentials", 162 } 163 try: 164 response = self.pool_manager.request( 165 "POST", 166 self.token_url, 167 fields=fields, 168 headers={"Content-Type": "application/x-www-form-urlencoded"}, 169 encode_multipart=False, 170 timeout=urllib3.Timeout(total=self.timeout), 171 # Never follow a redirect: it would send the client secret to another address. 172 retries=self.retries.new(redirect=False), 173 redirect=False, 174 ) 175 body = response.data 176 except urllib3.exceptions.HTTPError as e: 177 raise ApiConnectionError( 178 reason=f"Could not reach the Astrada login at {self.base_path}: {e}" 179 ) from e 180 181 text = body.decode("utf-8", errors="replace") if body else "" 182 data: Dict[str, Any] = {} 183 try: 184 parsed = json.loads(text) if text else {} 185 if isinstance(parsed, dict): 186 data = parsed 187 except ValueError: 188 pass 189 190 if 200 <= response.status < 300 and isinstance(data.get("access_token"), str): 191 return AccessToken( 192 access_token=data["access_token"], 193 token_type=data.get("token_type"), 194 expires_in=_expires_in(data.get("expires_in")), 195 scope=data.get("scope"), 196 ) 197 198 if 300 <= response.status < 400: 199 # The origin only: a redirect's query string can carry tokens, so neither the Location 200 # header nor the redirect page goes into the exception. 201 target = "another address" 202 try: 203 parts = urlsplit(urljoin(self.token_url, response.headers.get("Location") or "")) 204 host = parts.netloc.rsplit("@", 1)[-1] # keeps IPv6 brackets and the port 205 _ = parts.port # raises ValueError for a port that is not a number in range 206 if parts.scheme in ("http", "https") and parts.hostname: 207 target = "%s://%s" % (parts.scheme, host) 208 except ValueError: 209 pass # a malformed Location (bad port, broken IPv6): say only that it redirects 210 raise ApiException( 211 status=response.status, 212 reason=(f"Login failed ({response.status}): the login answered with a redirect to " 213 f"{target}. The SDK does not send the client secret there; check base_url " 214 f"({self.base_path})."), 215 headers={k: v for k, v in response.headers.items() if k.lower() != "location"}, 216 ) 217 218 error = data.get("error") if isinstance(data.get("error"), str) else None 219 description = data.get("error_description") 220 message = description or error or (text.strip()[:200] if text else "") or response.reason 221 reason = f"Login failed ({response.status}): {message}.{_login_hint(response.status, error)}" 222 raise _login_error(response.status)( 223 status=response.status, 224 reason=reason, 225 body=text, 226 headers=dict(response.headers), 227 code=error, 228 detail=description if isinstance(description, str) else None, 229 ) 230 231 def _cache_token(self, token: AccessToken) -> None: 232 self._cached_token = token 233 self._token_expiry = time.time() + token.expires_in - _EXPIRY_MARGIN_SECONDS 234 235 def _is_token_valid(self) -> bool: 236 return self._cached_token is not None and time.time() < self._token_expiry 237 238 def clear_cache(self) -> None: 239 """Forget the cached token, so the next call logs in again.""" 240 with self._lock: 241 self._cached_token = None 242 self._token_expiry = 0
Requests and caches the OAuth2 token for one set of credentials.
95 def __init__( 96 self, 97 account_id: str, 98 client_id: str, 99 client_secret: str, 100 base_path: str, 101 pool_manager: Optional[urllib3.PoolManager] = None, 102 timeout: Optional[float] = None, 103 retries: Union[None, int, Retry] = None, 104 ) -> None: 105 """ 106 :param account_id: the Astrada account ID (the login realm) 107 :param client_id: the API client's ID 108 :param client_secret: the API client's secret 109 :param base_path: the environment's base URL, for example https://api.sandbox.astrada.co 110 :param pool_manager: urllib3 pool to send the token request through 111 :param timeout: seconds to wait for the token endpoint (default 60) 112 :param retries: the client's ``retries`` setting; a 429 or 5xx from the token endpoint is 113 retried under it (see :func:`astrada._retry.build_login_retry`) 114 """ 115 self.account_id = account_id 116 self.client_id = client_id 117 self.client_secret = client_secret 118 self.base_path = base_path.rstrip("/") 119 self.timeout = timeout_or_default(timeout) 120 self.retries = build_login_retry(retries) 121 self._cached_token: Optional[AccessToken] = None 122 self._token_expiry: float = 0 123 self._lock = threading.Lock() 124 if pool_manager is None: 125 pool_manager = urllib3.PoolManager(cert_reqs="CERT_REQUIRED", retries=build_retry(None)) 126 self.pool_manager = pool_manager
Parameters
- account_id: the Astrada account ID (the login realm)
- client_id: the API client's ID
- client_secret: the API client's secret
- base_path: the environment's base URL, for example https: //api.sandbox.astrada.co
- pool_manager: urllib3 pool to send the token request through
- timeout: seconds to wait for the token endpoint (default 60)
- retries: the client's
retriessetting; a 429 or 5xx from the token endpoint is retried under it (seeastrada._retry.build_login_retry())
132 def get_access_token( 133 self, name: Optional[str] = None, scopes: Optional[List[str]] = None 134 ) -> str: 135 """The Authorization header value ("Bearer ..."), logging in first if needed. 136 137 :param name: unused; kept for the generated Configuration's call 138 :param scopes: unused; the token carries every scope the API client has 139 :raises AuthenticationError: the token endpoint refused the credentials (400 or 401) 140 :raises RateLimitError: the token endpoint answered 429, after the retries 141 :raises ServiceException: the token endpoint answered 5xx, after the retries 142 :raises NotFoundException: no such account (404) 143 :raises ApiConnectionError: the token endpoint could not be reached 144 """ 145 with self._lock: 146 if not self._is_token_valid(): 147 self._cache_token(self._request_new_token()) 148 assert self._cached_token is not None 149 return self._format_token(self._cached_token)
The Authorization header value ("Bearer ..."), logging in first if needed.
Parameters
- name: unused; kept for the generated Configuration's call
- scopes: unused; the token carries every scope the API client has
Raises
- AuthenticationError: the token endpoint refused the credentials (400 or 401)
- RateLimitError: the token endpoint answered 429, after the retries
- ServiceException: the token endpoint answered 5xx, after the retries
- NotFoundException: no such account (404)
- ApiConnectionError: the token endpoint could not be reached
38class AccessToken: 39 """An OAuth2 access token from the token endpoint.""" 40 41 def __init__( 42 self, 43 access_token: str, 44 token_type: Optional[str], 45 expires_in: int, 46 scope: Optional[str] = None, 47 ) -> None: 48 self.access_token = access_token 49 self.token_type = token_type 50 self.expires_in = expires_in 51 self.scope = scope
An OAuth2 access token from the token endpoint.
The base exception class for all OpenAPIExceptions
26class ApiTypeError(OpenApiException, TypeError): 27 def __init__(self, msg, path_to_item=None, valid_classes=None, 28 key_type=None) -> None: 29 """ Raises an exception for TypeErrors 30 31 Args: 32 msg (str): the exception message 33 34 Keyword Args: 35 path_to_item (list): a list of keys an indices to get to the 36 current_item 37 None if unset 38 valid_classes (tuple): the primitive classes that current item 39 should be an instance of 40 None if unset 41 key_type (bool): False if our value is a value in a dict 42 True if it is a key in a dict 43 False if our item is an item in a list 44 None if unset 45 """ 46 self.path_to_item = path_to_item 47 self.valid_classes = valid_classes 48 self.key_type = key_type 49 full_msg = msg 50 if path_to_item: 51 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 52 super(ApiTypeError, self).__init__(full_msg)
The base exception class for all OpenAPIExceptions
27 def __init__(self, msg, path_to_item=None, valid_classes=None, 28 key_type=None) -> None: 29 """ Raises an exception for TypeErrors 30 31 Args: 32 msg (str): the exception message 33 34 Keyword Args: 35 path_to_item (list): a list of keys an indices to get to the 36 current_item 37 None if unset 38 valid_classes (tuple): the primitive classes that current item 39 should be an instance of 40 None if unset 41 key_type (bool): False if our value is a value in a dict 42 True if it is a key in a dict 43 False if our item is an item in a list 44 None if unset 45 """ 46 self.path_to_item = path_to_item 47 self.valid_classes = valid_classes 48 self.key_type = key_type 49 full_msg = msg 50 if path_to_item: 51 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 52 super(ApiTypeError, self).__init__(full_msg)
Raises an exception for TypeErrors
Args: msg (str): the exception message
Keyword Args: path_to_item (list): a list of keys an indices to get to the current_item None if unset valid_classes (tuple): the primitive classes that current item should be an instance of None if unset key_type (bool): False if our value is a value in a dict True if it is a key in a dict False if our item is an item in a list None if unset
55class ApiValueError(OpenApiException, ValueError): 56 def __init__(self, msg, path_to_item=None) -> None: 57 """ 58 Args: 59 msg (str): the exception message 60 61 Keyword Args: 62 path_to_item (list) the path to the exception in the 63 received_data dict. None if unset 64 """ 65 66 self.path_to_item = path_to_item 67 full_msg = msg 68 if path_to_item: 69 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 70 super(ApiValueError, self).__init__(full_msg)
The base exception class for all OpenAPIExceptions
56 def __init__(self, msg, path_to_item=None) -> None: 57 """ 58 Args: 59 msg (str): the exception message 60 61 Keyword Args: 62 path_to_item (list) the path to the exception in the 63 received_data dict. None if unset 64 """ 65 66 self.path_to_item = path_to_item 67 full_msg = msg 68 if path_to_item: 69 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 70 super(ApiValueError, self).__init__(full_msg)
Args: msg (str): the exception message
Keyword Args: path_to_item (list) the path to the exception in the received_data dict. None if unset
92class ApiKeyError(OpenApiException, KeyError): 93 def __init__(self, msg, path_to_item=None) -> None: 94 """ 95 Args: 96 msg (str): the exception message 97 98 Keyword Args: 99 path_to_item (None/list) the path to the exception in the 100 received_data dict 101 """ 102 self.path_to_item = path_to_item 103 full_msg = msg 104 if path_to_item: 105 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 106 super(ApiKeyError, self).__init__(full_msg)
The base exception class for all OpenAPIExceptions
93 def __init__(self, msg, path_to_item=None) -> None: 94 """ 95 Args: 96 msg (str): the exception message 97 98 Keyword Args: 99 path_to_item (None/list) the path to the exception in the 100 received_data dict 101 """ 102 self.path_to_item = path_to_item 103 full_msg = msg 104 if path_to_item: 105 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 106 super(ApiKeyError, self).__init__(full_msg)
Args: msg (str): the exception message
Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict
73class ApiAttributeError(OpenApiException, AttributeError): 74 def __init__(self, msg, path_to_item=None) -> None: 75 """ 76 Raised when an attribute reference or assignment fails. 77 78 Args: 79 msg (str): the exception message 80 81 Keyword Args: 82 path_to_item (None/list) the path to the exception in the 83 received_data dict 84 """ 85 self.path_to_item = path_to_item 86 full_msg = msg 87 if path_to_item: 88 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 89 super(ApiAttributeError, self).__init__(full_msg)
The base exception class for all OpenAPIExceptions
74 def __init__(self, msg, path_to_item=None) -> None: 75 """ 76 Raised when an attribute reference or assignment fails. 77 78 Args: 79 msg (str): the exception message 80 81 Keyword Args: 82 path_to_item (None/list) the path to the exception in the 83 received_data dict 84 """ 85 self.path_to_item = path_to_item 86 full_msg = msg 87 if path_to_item: 88 full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) 89 super(ApiAttributeError, self).__init__(full_msg)
Raised when an attribute reference or assignment fails.
Args: msg (str): the exception message
Keyword Args: path_to_item (None/list) the path to the exception in the received_data dict
109class ApiException(OpenApiException): 110 """An error answer from the Astrada API, or no answer at all. 111 112 ``status`` is the HTTP status (0 when no answer arrived). ``title``, ``detail``, ``code`` and 113 ``errors`` are read from the error body whatever its shape (the card APIs send ``title`` and 114 ``detail``; the Banking API sends ``message`` and sometimes ``code``), so they are set even when 115 the body has a field or code this SDK does not know. ``body`` is the raw text, ``data`` the 116 parsed error model when the body matched one, and ``headers`` the response headers. 117 """ 118 119 def __init__( 120 self, 121 status=None, 122 reason=None, 123 http_resp=None, 124 *, 125 body: Optional[str] = None, 126 data: Optional[Any] = None, 127 headers: Optional[Mapping[str, str]] = None, 128 code: Optional[str] = None, 129 detail: Optional[str] = None, 130 ) -> None: 131 self.status = status 132 self.reason = reason 133 self.body = body 134 self.data = data 135 self.headers = headers 136 self.title: Optional[str] = None 137 self.detail: Optional[str] = detail 138 self.code: Optional[str] = code 139 self.errors: List[Dict[str, Any]] = [] 140 141 if http_resp: 142 if self.status is None: 143 self.status = http_resp.status 144 if self.reason is None: 145 self.reason = http_resp.reason 146 if self.body is None: 147 try: 148 self.body = http_resp.data.decode('utf-8') 149 except Exception: 150 pass 151 self.headers = http_resp.getheaders() 152 if self.status is None: 153 self.status = 0 154 self._read_body() 155 super().__init__(str(self)) 156 157 def _read_body(self) -> None: 158 if not self.body: 159 return 160 try: 161 parsed = json.loads(self.body) 162 except ValueError: 163 return 164 if not isinstance(parsed, dict): 165 return 166 title = parsed.get("title") 167 if isinstance(title, str): 168 self.title = title 169 for key in ("detail", "message", "error_description"): 170 value = parsed.get(key) 171 if self.detail is None and isinstance(value, str): 172 self.detail = value 173 for key in ("code", "error"): 174 value = parsed.get(key) 175 if self.code is None and isinstance(value, str): 176 self.code = value 177 errors = parsed.get("errors") 178 if isinstance(errors, list): 179 self.errors = [e for e in errors if isinstance(e, dict)] 180 181 @property 182 def request_id(self) -> Optional[str]: 183 """The request id the API answered with, if any (quote it to Astrada support).""" 184 return _header(self.headers, "x-request-id") or _header(self.headers, "x-amzn-requestid") 185 186 @classmethod 187 def from_response( 188 cls, 189 *, 190 http_resp, 191 body: Optional[str], 192 data: Optional[Any], 193 ) -> Self: 194 if http_resp.status == 400: 195 raise BadRequestException(http_resp=http_resp, body=body, data=data) 196 197 if http_resp.status == 401: 198 raise UnauthorizedException(http_resp=http_resp, body=body, data=data) 199 200 if http_resp.status == 403: 201 raise ForbiddenException(http_resp=http_resp, body=body, data=data) 202 203 if http_resp.status == 404: 204 raise NotFoundException(http_resp=http_resp, body=body, data=data) 205 206 if http_resp.status == 409: 207 raise ConflictException(http_resp=http_resp, body=body, data=data) 208 209 if http_resp.status == 422: 210 raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) 211 212 if http_resp.status == 429: 213 raise RateLimitError(http_resp=http_resp, body=body, data=data) 214 215 if 500 <= http_resp.status <= 599: 216 raise ServiceException(http_resp=http_resp, body=body, data=data) 217 raise ApiException(http_resp=http_resp, body=body, data=data) 218 219 def __str__(self): 220 """One line a developer can act on, then the details.""" 221 summary = " ".join( 222 part for part in ( 223 "({0})".format(self.status), 224 self.title or self.reason, 225 ) if part 226 ) 227 if self.detail: 228 summary += ": " + self.detail 229 if self.code: 230 summary += " [" + self.code + "]" 231 for error in self.errors: 232 summary += "\n - " + "; ".join( 233 str(error[k]) for k in ("title", "detail") if k in error 234 ) 235 if self.request_id: 236 summary += "\nRequest id: " + self.request_id 237 return summary
An error answer from the Astrada API, or no answer at all.
status is the HTTP status (0 when no answer arrived). title, detail, code and
errors are read from the error body whatever its shape (the card APIs send title and
detail; the Banking API sends message and sometimes code), so they are set even when
the body has a field or code this SDK does not know. body is the raw text, data the
parsed error model when the body matched one, and headers the response headers.
119 def __init__( 120 self, 121 status=None, 122 reason=None, 123 http_resp=None, 124 *, 125 body: Optional[str] = None, 126 data: Optional[Any] = None, 127 headers: Optional[Mapping[str, str]] = None, 128 code: Optional[str] = None, 129 detail: Optional[str] = None, 130 ) -> None: 131 self.status = status 132 self.reason = reason 133 self.body = body 134 self.data = data 135 self.headers = headers 136 self.title: Optional[str] = None 137 self.detail: Optional[str] = detail 138 self.code: Optional[str] = code 139 self.errors: List[Dict[str, Any]] = [] 140 141 if http_resp: 142 if self.status is None: 143 self.status = http_resp.status 144 if self.reason is None: 145 self.reason = http_resp.reason 146 if self.body is None: 147 try: 148 self.body = http_resp.data.decode('utf-8') 149 except Exception: 150 pass 151 self.headers = http_resp.getheaders() 152 if self.status is None: 153 self.status = 0 154 self._read_body() 155 super().__init__(str(self))
181 @property 182 def request_id(self) -> Optional[str]: 183 """The request id the API answered with, if any (quote it to Astrada support).""" 184 return _header(self.headers, "x-request-id") or _header(self.headers, "x-amzn-requestid")
The request id the API answered with, if any (quote it to Astrada support).
186 @classmethod 187 def from_response( 188 cls, 189 *, 190 http_resp, 191 body: Optional[str], 192 data: Optional[Any], 193 ) -> Self: 194 if http_resp.status == 400: 195 raise BadRequestException(http_resp=http_resp, body=body, data=data) 196 197 if http_resp.status == 401: 198 raise UnauthorizedException(http_resp=http_resp, body=body, data=data) 199 200 if http_resp.status == 403: 201 raise ForbiddenException(http_resp=http_resp, body=body, data=data) 202 203 if http_resp.status == 404: 204 raise NotFoundException(http_resp=http_resp, body=body, data=data) 205 206 if http_resp.status == 409: 207 raise ConflictException(http_resp=http_resp, body=body, data=data) 208 209 if http_resp.status == 422: 210 raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) 211 212 if http_resp.status == 429: 213 raise RateLimitError(http_resp=http_resp, body=body, data=data) 214 215 if 500 <= http_resp.status <= 599: 216 raise ServiceException(http_resp=http_resp, body=body, data=data) 217 raise ApiException(http_resp=http_resp, body=body, data=data)
249class AuthenticationError(ApiException): 250 """The credentials were refused. 251 252 Raised when the login (the OAuth2 token request) fails, with the token endpoint's own message 253 in ``detail`` and its error in ``code`` (for example ``invalid_client``), and, as the subclass 254 :class:`UnauthorizedException`, when the API answers 401. 255 """
The credentials were refused.
Raised when the login (the OAuth2 token request) fails, with the token endpoint's own message
in detail and its error in code (for example invalid_client), and, as the subclass
UnauthorizedException, when the API answers 401.
258class ApiConnectionError(ApiException): 259 """No answer from the API: the host could not be reached, TLS failed or the call timed out. 260 261 ``status`` is 0. Calls that are safe to repeat were already retried before this was raised. 262 """
No answer from the API: the host could not be reached, TLS failed or the call timed out.
status is 0. Calls that are safe to repeat were already retried before this was raised.
291class RateLimitError(ApiException): 292 """429 Too Many Requests, after the SDK's own retries (see ``Configuration.retries``). 293 294 ``retry_after`` is the number of seconds the API asked to wait, when it said. 295 """ 296 297 @property 298 def retry_after(self) -> Optional[float]: 299 value = _header(self.headers, "retry-after") 300 if value is None: 301 return None 302 try: 303 return max(0.0, float(value)) 304 except ValueError: 305 pass 306 # Retry-After can also be an HTTP date. 307 try: 308 when = email.utils.parsedate_to_datetime(value) 309 except (TypeError, ValueError): 310 return None 311 if when.tzinfo is None: 312 when = when.replace(tzinfo=datetime.timezone.utc) 313 return max(0.0, (when - datetime.datetime.now(datetime.timezone.utc)).total_seconds())
429 Too Many Requests, after the SDK's own retries (see Configuration.retries).
retry_after is the number of seconds the API asked to wait, when it said.
297 @property 298 def retry_after(self) -> Optional[float]: 299 value = _header(self.headers, "retry-after") 300 if value is None: 301 return None 302 try: 303 return max(0.0, float(value)) 304 except ValueError: 305 pass 306 # Retry-After can also be an HTTP date. 307 try: 308 when = email.utils.parsedate_to_datetime(value) 309 except (TypeError, ValueError): 310 return None 311 if when.tzinfo is None: 312 when = when.replace(tzinfo=datetime.timezone.utc) 313 return max(0.0, (when - datetime.datetime.now(datetime.timezone.utc)).total_seconds())
284class SandboxOnlyError(OpenApiException): 285 """A sandbox-only call (``client.sandbox``) on a client that is not set up for the sandbox. 286 287 Raised before any request is sent, including the login. 288 """
A sandbox-only call (client.sandbox) on a client that is not set up for the sandbox.
Raised before any request is sent, including the login.
346class ScopeRequiredError(ForbiddenException): 347 """403 on a Banking API operation that needs a scope (``required_scope``, such as 348 ``banking:admin``). The likely cause is that your API client does not have the scope (ask 349 Astrada to enable it if you need the operation), but as with any ForbiddenException the 350 resource may also not be your account's. 351 """ 352 353 def __init__(self, *args: Any, operation: Optional[str] = None, 354 required_scope: Optional[str] = None, **kwargs: Any) -> None: 355 self.operation = operation 356 self.required_scope = required_scope 357 super().__init__(*args, **kwargs) 358 359 def __str__(self): 360 summary = ( 361 "(403) {0} needs the `{1}` scope. The likely cause is that your API client does not " 362 "have it; if so, ask Astrada to enable it. A 403 can also mean the resource is not " 363 "this account's.".format( 364 self.operation or "This operation", self.required_scope or "required") 365 ) 366 if self.detail: 367 summary += "\nThe API said: " + self.detail 368 if self.request_id: 369 summary += "\nRequest id: " + self.request_id 370 return summary
403 on a Banking API operation that needs a scope (required_scope, such as
banking:admin). The likely cause is that your API client does not have the scope (ask
Astrada to enable it if you need the operation), but as with any ForbiddenException the
resource may also not be your account's.
316class BadRequestException(ApiException): 317 """400 Bad Request: ``errors`` lists each problem found in the request."""
400 Bad Request: errors lists each problem found in the request.
328class ForbiddenException(ApiException): 329 """403 Forbidden: often a scope the API client does not have."""
403 Forbidden: often a scope the API client does not have.
404 Not Found.
Exception for HTTP 409 Conflict.
341class UnprocessableEntityException(ApiException): 342 """Exception for HTTP 422 Unprocessable Entity.""" 343 pass
Exception for HTTP 422 Unprocessable Entity.
332class ServiceException(ApiException): 333 """5xx: the API failed. Calls safe to repeat were already retried."""
5xx: the API failed. Calls safe to repeat were already retried.
29class Conflict(BaseModel): 30 """ 31 Conflict 32 """ # noqa: E501 33 detail: StrictStr 34 title: Optional[StrictStr] = None 35 current_value: Optional[StrictStr] = Field(default=None, description="Current value for the property causing the conflict", alias="currentValue") 36 requested_value: Optional[StrictStr] = Field(default=None, description="Requested value for the property causing the conflict", alias="requestedValue") 37 additional_properties: Dict[str, Any] = {} 38 __properties: ClassVar[List[str]] = ["detail", "title", "currentValue", "requestedValue"] 39 40 @field_validator('title') 41 def title_validate_enum(cls, value): 42 """Validates the enum""" 43 if value is None: 44 return value 45 46 # Requests must use a known value; a response may carry one added after this release. 47 if value not in set(['Conflict']) and not _lenient_active(): 48 raise ValueError("must be one of enum values ('Conflict')") 49 return value 50 51 model_config = ConfigDict( 52 populate_by_name=True, 53 validate_assignment=True, 54 protected_namespaces=(), 55 ) 56 57 58 def to_str(self) -> str: 59 """Returns the string representation of the model using alias""" 60 return pprint.pformat(self.model_dump(by_alias=True)) 61 62 def to_json(self) -> str: 63 """Returns the JSON representation of the model using alias""" 64 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 65 # to_jsonable_python turns them into the JSON the API sends. 66 return json.dumps(to_jsonable_python(self.to_dict())) 67 68 @classmethod 69 def from_json(cls, json_str: str) -> Optional[Self]: 70 """Create an instance of Conflict from a JSON string""" 71 return cls.from_dict(json.loads(json_str)) 72 73 def to_dict(self) -> Dict[str, Any]: 74 """Return the dictionary representation of the model using alias. 75 76 This has the following differences from calling pydantic's 77 `self.model_dump(by_alias=True)`: 78 79 * `None` is only added to the output dict for nullable fields that 80 were set at model initialization. Other fields with value `None` 81 are ignored. 82 * Fields in `self.additional_properties` are added to the output dict. 83 """ 84 excluded_fields: Set[str] = set([ 85 "additional_properties", 86 ]) 87 88 _dict = self.model_dump( 89 by_alias=True, 90 exclude=excluded_fields, 91 exclude_none=True, 92 ) 93 # puts key-value pairs in additional_properties in the top level 94 if self.additional_properties is not None: 95 for _key, _value in self.additional_properties.items(): 96 _dict[_key] = _value 97 98 return _dict 99 100 @classmethod 101 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 102 """Create an instance of Conflict from a dict""" 103 if obj is None: 104 return None 105 106 if not isinstance(obj, dict): 107 return cls.model_validate(obj) 108 109 _obj = cls.model_validate({ 110 "detail": obj.get("detail"), 111 "title": obj.get("title"), 112 "currentValue": obj.get("currentValue"), 113 "requestedValue": obj.get("requestedValue") 114 }) 115 # store additional fields in additional_properties 116 for _key in obj.keys(): 117 if _key not in cls.__properties: 118 _obj.additional_properties[_key] = obj.get(_key) 119 120 return _obj
Conflict
Current value for the property causing the conflict
Requested value for the property causing the conflict
40 @field_validator('title') 41 def title_validate_enum(cls, value): 42 """Validates the enum""" 43 if value is None: 44 return value 45 46 # Requests must use a known value; a response may carry one added after this release. 47 if value not in set(['Conflict']) and not _lenient_active(): 48 raise ValueError("must be one of enum values ('Conflict')") 49 return value
Validates the enum
58 def to_str(self) -> str: 59 """Returns the string representation of the model using alias""" 60 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
62 def to_json(self) -> str: 63 """Returns the JSON representation of the model using alias""" 64 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 65 # to_jsonable_python turns them into the JSON the API sends. 66 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
68 @classmethod 69 def from_json(cls, json_str: str) -> Optional[Self]: 70 """Create an instance of Conflict from a JSON string""" 71 return cls.from_dict(json.loads(json_str))
Create an instance of Conflict from a JSON string
73 def to_dict(self) -> Dict[str, Any]: 74 """Return the dictionary representation of the model using alias. 75 76 This has the following differences from calling pydantic's 77 `self.model_dump(by_alias=True)`: 78 79 * `None` is only added to the output dict for nullable fields that 80 were set at model initialization. Other fields with value `None` 81 are ignored. 82 * Fields in `self.additional_properties` are added to the output dict. 83 """ 84 excluded_fields: Set[str] = set([ 85 "additional_properties", 86 ]) 87 88 _dict = self.model_dump( 89 by_alias=True, 90 exclude=excluded_fields, 91 exclude_none=True, 92 ) 93 # puts key-value pairs in additional_properties in the top level 94 if self.additional_properties is not None: 95 for _key, _value in self.additional_properties.items(): 96 _dict[_key] = _value 97 98 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
100 @classmethod 101 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 102 """Create an instance of Conflict from a dict""" 103 if obj is None: 104 return None 105 106 if not isinstance(obj, dict): 107 return cls.model_validate(obj) 108 109 _obj = cls.model_validate({ 110 "detail": obj.get("detail"), 111 "title": obj.get("title"), 112 "currentValue": obj.get("currentValue"), 113 "requestedValue": obj.get("requestedValue") 114 }) 115 # store additional fields in additional_properties 116 for _key in obj.keys(): 117 if _key not in cls.__properties: 118 _obj.additional_properties[_key] = obj.get(_key) 119 120 return _obj
Create an instance of Conflict from a dict
29class Problem(BaseModel): 30 """ 31 An error body in the problem details format (`application/problem+json`). Every error response without its own fields uses it. 32 """ # noqa: E501 33 type: Optional[StrictStr] = None 34 instance: Optional[StrictStr] = None 35 detail: StrictStr 36 title: StrictStr = Field(description="A short summary of the status, for example `Unauthorized`, `Forbidden`, `Not Found` or `Internal Server Error`. Each response's example shows its value. ") 37 additional_properties: Dict[str, Any] = {} 38 __properties: ClassVar[List[str]] = ["type", "instance", "detail", "title"] 39 40 model_config = ConfigDict( 41 populate_by_name=True, 42 validate_assignment=True, 43 protected_namespaces=(), 44 ) 45 46 47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True)) 50 51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 54 # to_jsonable_python turns them into the JSON the API sends. 55 return json.dumps(to_jsonable_python(self.to_dict())) 56 57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of Problem from a JSON string""" 60 return cls.from_dict(json.loads(json_str)) 61 62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 * Fields in `self.additional_properties` are added to the output dict. 72 """ 73 excluded_fields: Set[str] = set([ 74 "additional_properties", 75 ]) 76 77 _dict = self.model_dump( 78 by_alias=True, 79 exclude=excluded_fields, 80 exclude_none=True, 81 ) 82 # puts key-value pairs in additional_properties in the top level 83 if self.additional_properties is not None: 84 for _key, _value in self.additional_properties.items(): 85 _dict[_key] = _value 86 87 return _dict 88 89 @classmethod 90 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 91 """Create an instance of Problem from a dict""" 92 if obj is None: 93 return None 94 95 if not isinstance(obj, dict): 96 return cls.model_validate(obj) 97 98 _obj = cls.model_validate({ 99 "type": obj.get("type"), 100 "instance": obj.get("instance"), 101 "detail": obj.get("detail"), 102 "title": obj.get("title") 103 }) 104 # store additional fields in additional_properties 105 for _key in obj.keys(): 106 if _key not in cls.__properties: 107 _obj.additional_properties[_key] = obj.get(_key) 108 109 return _obj
An error body in the problem details format (application/problem+json). Every error response without its own fields uses it.
A short summary of the status, for example Unauthorized, Forbidden, Not Found or Internal Server Error. Each response's example shows its value.
47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 54 # to_jsonable_python turns them into the JSON the API sends. 55 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of Problem from a JSON string""" 60 return cls.from_dict(json.loads(json_str))
Create an instance of Problem from a JSON string
62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 * Fields in `self.additional_properties` are added to the output dict. 72 """ 73 excluded_fields: Set[str] = set([ 74 "additional_properties", 75 ]) 76 77 _dict = self.model_dump( 78 by_alias=True, 79 exclude=excluded_fields, 80 exclude_none=True, 81 ) 82 # puts key-value pairs in additional_properties in the top level 83 if self.additional_properties is not None: 84 for _key, _value in self.additional_properties.items(): 85 _dict[_key] = _value 86 87 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
89 @classmethod 90 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 91 """Create an instance of Problem from a dict""" 92 if obj is None: 93 return None 94 95 if not isinstance(obj, dict): 96 return cls.model_validate(obj) 97 98 _obj = cls.model_validate({ 99 "type": obj.get("type"), 100 "instance": obj.get("instance"), 101 "detail": obj.get("detail"), 102 "title": obj.get("title") 103 }) 104 # store additional fields in additional_properties 105 for _key in obj.keys(): 106 if _key not in cls.__properties: 107 _obj.additional_properties[_key] = obj.get(_key) 108 109 return _obj
Create an instance of Problem from a dict
30class SimulateBulkFeedFileGlRequest(BaseModel): 31 """ 32 SimulateBulkFeedFileGlRequest 33 """ # noqa: E501 34 network_reference: Annotated[str, Field(strict=True)] = Field(description="The Amex Recipient ID for the bulk feed, in the format 'R{RecipientId}', such as 'R12345', or the 6-digit Company ID the feed was created with. Must match the feed created via `POST /network-bulk-feeds`. ", alias="networkReference") 35 card_count: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=None, description="Number of cards to include. For an `encrypted` feed these are drawn from the head of the sandbox account pool: the same accounts every call; once enrolled in the subaccount they deduplicate. For a `tokenized` feed they are drawn from the enrollable 374290-BIN Amex token pool (two tokens). Requesting more than the tokenized pool holds does not error: the call still returns `202` and under-delivers (only the enrollable tokens are written), so do not build a retry on an expected `400`. When omitted, defaults to 3 for encrypted feeds and to the whole enrollable token pool for tokenized feeds. When `cardCount` is sent, `cardCount + newCardCount` must be at least 1. ", alias="cardCount") 36 new_card_count: Optional[Annotated[int, Field(le=20, strict=True, ge=0)]] = Field(default=0, description="Number of not-yet-enrolled accounts to draw from the sandbox pool for this feed's subaccount. Each call enrolls this many new cards (with `cardsubscription.created` webhooks). Requires an active feed for the `networkReference`; returns `400` when none exists or when the subaccount has exhausted the pool. Not supported on `tokenized` feeds: a value greater than 0 on a tokenized feed returns `400` (there is no tokenized new-card pool). ", alias="newCardCount") 37 transactions_per_card: Optional[Annotated[int, Field(le=10, strict=True, ge=0)]] = Field(default=3, description="Number of settlements generated for every included card (written as a companion settlement file), with fresh transaction ids and recent dates on each call. Use `0` for a cards-only file. ", alias="transactionsPerCard") 38 additional_properties: Dict[str, Any] = {} 39 __properties: ClassVar[List[str]] = ["networkReference", "cardCount", "newCardCount", "transactionsPerCard"] 40 41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^(R\d+|\d{6})$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^(R\d+|\d{6})$/") 47 return value 48 49 model_config = ConfigDict( 50 populate_by_name=True, 51 validate_assignment=True, 52 protected_namespaces=(), 53 ) 54 55 56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True)) 59 60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict())) 65 66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileGlRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str)) 70 71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict 97 98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileGlRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount"), 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
SimulateBulkFeedFileGlRequest
The Amex Recipient ID for the bulk feed, in the format 'R{RecipientId}', such as 'R12345', or the 6-digit Company ID the feed was created with. Must match the feed created via POST /network-bulk-feeds.
Number of cards to include. For an encrypted feed these are drawn from the head of the sandbox account pool: the same accounts every call; once enrolled in the subaccount they deduplicate. For a tokenized feed they are drawn from the enrollable 374290-BIN Amex token pool (two tokens). Requesting more than the tokenized pool holds does not error: the call still returns 202 and under-delivers (only the enrollable tokens are written), so do not build a retry on an expected 400. When omitted, defaults to 3 for encrypted feeds and to the whole enrollable token pool for tokenized feeds. When cardCount is sent, cardCount + newCardCount must be at least 1.
Number of not-yet-enrolled accounts to draw from the sandbox pool for this feed's subaccount. Each call enrolls this many new cards (with cardsubscription.created webhooks). Requires an active feed for the networkReference; returns 400 when none exists or when the subaccount has exhausted the pool. Not supported on tokenized feeds: a value greater than 0 on a tokenized feed returns 400 (there is no tokenized new-card pool).
Number of settlements generated for every included card (written as a companion settlement file), with fresh transaction ids and recent dates on each call. Use 0 for a cards-only file.
41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^(R\d+|\d{6})$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^(R\d+|\d{6})$/") 47 return value
Validates the regular expression
56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileGlRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateBulkFeedFileGlRequest from a JSON string
71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileGlRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount"), 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
Create an instance of SimulateBulkFeedFileGlRequest from a dict
30class SimulateBulkFeedFileSmartdataRequest(BaseModel): 31 """ 32 SimulateBulkFeedFileSmartdataRequest 33 """ # noqa: E501 34 network_reference: Annotated[str, Field(strict=True)] = Field(description="The Mastercard Delivery ID for the bulk feed, such as 'G1234567'. Must match the feed created via `POST /network-bulk-feeds`. ", alias="networkReference") 35 card_count: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=5, description="Number of cards from the head of the sandbox test-card pool to include. These are the same cards every call; once enrolled in the subaccount they deduplicate. `cardCount + newCardCount` must be at least 1. ", alias="cardCount") 36 new_card_count: Optional[Annotated[int, Field(le=20, strict=True, ge=0)]] = Field(default=0, description="Number of not-yet-enrolled cards to draw from the sandbox new-card pool for this feed's subaccount. Each call enrolls this many new cards (with `cardsubscription.created` webhooks). Requires an active feed for the `networkReference`; returns `400` when none exists or when the subaccount has exhausted the pool. ", alias="newCardCount") 37 transactions_per_card: Optional[Annotated[int, Field(le=10, strict=True, ge=0)]] = Field(default=3, description="Number of transactions generated for every included card, with fresh transaction references and recent dates on each call. Use `0` for a cards-only (starter) file. ", alias="transactionsPerCard") 38 additional_properties: Dict[str, Any] = {} 39 __properties: ClassVar[List[str]] = ["networkReference", "cardCount", "newCardCount", "transactionsPerCard"] 40 41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^[a-zA-Z0-9-]+$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9-]+$/") 47 return value 48 49 model_config = ConfigDict( 50 populate_by_name=True, 51 validate_assignment=True, 52 protected_namespaces=(), 53 ) 54 55 56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True)) 59 60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict())) 65 66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileSmartdataRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str)) 70 71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict 97 98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileSmartdataRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount") if obj.get("cardCount") is not None else 5, 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
SimulateBulkFeedFileSmartdataRequest
The Mastercard Delivery ID for the bulk feed, such as 'G1234567'. Must match the feed created via POST /network-bulk-feeds.
Number of cards from the head of the sandbox test-card pool to include. These are the same cards every call; once enrolled in the subaccount they deduplicate. cardCount + newCardCount must be at least 1.
Number of not-yet-enrolled cards to draw from the sandbox new-card pool for this feed's subaccount. Each call enrolls this many new cards (with cardsubscription.created webhooks). Requires an active feed for the networkReference; returns 400 when none exists or when the subaccount has exhausted the pool.
Number of transactions generated for every included card, with fresh transaction references and recent dates on each call. Use 0 for a cards-only (starter) file.
41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^[a-zA-Z0-9-]+$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9-]+$/") 47 return value
Validates the regular expression
56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileSmartdataRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateBulkFeedFileSmartdataRequest from a JSON string
71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileSmartdataRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount") if obj.get("cardCount") is not None else 5, 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
Create an instance of SimulateBulkFeedFileSmartdataRequest from a dict
30class SimulateBulkFeedFileVbdsRequest(BaseModel): 31 """ 32 SimulateBulkFeedFileVbdsRequest 33 """ # noqa: E501 34 network_reference: Annotated[str, Field(strict=True)] = Field(description="The Visa RPIC identifier for the bulk feed, made of the Visa region, processor, issuer and company segments joined by '_' ('{region}_{processor}_{issuer}_{company}'), such as '1_12345_67890_54321'. Must match the feed created via `POST /network-bulk-feeds`. ", alias="networkReference") 35 card_count: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=5, description="Number of cards from the head of the sandbox card pool to include. These are the same cards every call; once enrolled in the subaccount they deduplicate. `cardCount + newCardCount` must be at least 1. ", alias="cardCount") 36 new_card_count: Optional[Annotated[int, Field(le=20, strict=True, ge=0)]] = Field(default=0, description="Number of not-yet-enrolled cards to draw from the sandbox pool for this feed's subaccount. Each call enrolls this many new cards (with `cardsubscription.created` webhooks). Requires an active feed for the `networkReference`; returns `400` when none exists or when the subaccount has exhausted the pool. ", alias="newCardCount") 37 transactions_per_card: Optional[Annotated[int, Field(le=10, strict=True, ge=0)]] = Field(default=3, description="Number of settlements generated for every included card, with fresh transaction ids and recent dates on each call. Use `0` for a cards-only delivery. ", alias="transactionsPerCard") 38 additional_properties: Dict[str, Any] = {} 39 __properties: ClassVar[List[str]] = ["networkReference", "cardCount", "newCardCount", "transactionsPerCard"] 40 41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+$/") 47 return value 48 49 model_config = ConfigDict( 50 populate_by_name=True, 51 validate_assignment=True, 52 protected_namespaces=(), 53 ) 54 55 56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True)) 59 60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict())) 65 66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileVbdsRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str)) 70 71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict 97 98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileVbdsRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount") if obj.get("cardCount") is not None else 5, 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
SimulateBulkFeedFileVbdsRequest
The Visa RPIC identifier for the bulk feed, made of the Visa region, processor, issuer and company segments joined by '_' ('{region}_{processor}_{issuer}_{company}'), such as '1_12345_67890_54321'. Must match the feed created via POST /network-bulk-feeds.
Number of cards from the head of the sandbox card pool to include. These are the same cards every call; once enrolled in the subaccount they deduplicate. cardCount + newCardCount must be at least 1.
Number of not-yet-enrolled cards to draw from the sandbox pool for this feed's subaccount. Each call enrolls this many new cards (with cardsubscription.created webhooks). Requires an active feed for the networkReference; returns 400 when none exists or when the subaccount has exhausted the pool.
Number of settlements generated for every included card, with fresh transaction ids and recent dates on each call. Use 0 for a cards-only delivery.
41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+_[a-zA-Z0-9]+$/") 47 return value
Validates the regular expression
56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileVbdsRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateBulkFeedFileVbdsRequest from a JSON string
71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileVbdsRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount") if obj.get("cardCount") is not None else 5, 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
Create an instance of SimulateBulkFeedFileVbdsRequest from a dict
30class SimulateBulkFeedFileVcfRequest(BaseModel): 31 """ 32 SimulateBulkFeedFileVcfRequest 33 """ # noqa: E501 34 network_reference: Annotated[str, Field(strict=True)] = Field(description="The Visa reference for the bulk feed. Pass the same value used to create the feed via `POST /network-bulk-feeds`: the full RPIC '{region}_{processor}_{issuer}_{company}', such as '1_123_45_6789'; the region segment is ignored. The 3-segment PIC form '{processor}_{issuer}_{company}' is also accepted. ", alias="networkReference") 35 card_count: Optional[Annotated[int, Field(le=100, strict=True, ge=0)]] = Field(default=5, description="Number of cards from the head of the sandbox test-card pool to include. These are the same cards every call; once enrolled in the subaccount they deduplicate. `cardCount + newCardCount` must be at least 1. While a feed has not completed an ingestion (normally its first call), a call with `newCardCount` of `0` also adds one card the feed's subaccount has not seen before, so the feed can become active. ", alias="cardCount") 36 new_card_count: Optional[Annotated[int, Field(le=20, strict=True, ge=0)]] = Field(default=0, description="Number of not-yet-enrolled cards to draw from the sandbox new-card pool for this feed's subaccount. Each call enrolls this many new cards (with `cardsubscription.created` webhooks). Requires an active feed for the `networkReference`; returns `400` when none exists or when the subaccount has exhausted the pool. ", alias="newCardCount") 37 transactions_per_card: Optional[Annotated[int, Field(le=10, strict=True, ge=0)]] = Field(default=3, description="Number of transactions generated for every included card, with fresh transaction references and recent dates on each call. Use `0` for a cards-only (starter) file. ", alias="transactionsPerCard") 38 additional_properties: Dict[str, Any] = {} 39 __properties: ClassVar[List[str]] = ["networkReference", "cardCount", "newCardCount", "transactionsPerCard"] 40 41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^\d+(_\d+){2,3}$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^\d+(_\d+){2,3}$/") 47 return value 48 49 model_config = ConfigDict( 50 populate_by_name=True, 51 validate_assignment=True, 52 protected_namespaces=(), 53 ) 54 55 56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True)) 59 60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict())) 65 66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileVcfRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str)) 70 71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict 97 98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileVcfRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount") if obj.get("cardCount") is not None else 5, 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
SimulateBulkFeedFileVcfRequest
The Visa reference for the bulk feed. Pass the same value used to create the feed via POST /network-bulk-feeds: the full RPIC '{region}_{processor}_{issuer}_{company}', such as '1_123_45_6789'; the region segment is ignored. The 3-segment PIC form '{processor}_{issuer}_{company}' is also accepted.
Number of cards from the head of the sandbox test-card pool to include. These are the same cards every call; once enrolled in the subaccount they deduplicate. cardCount + newCardCount must be at least 1. While a feed has not completed an ingestion (normally its first call), a call with newCardCount of 0 also adds one card the feed's subaccount has not seen before, so the feed can become active.
Number of not-yet-enrolled cards to draw from the sandbox new-card pool for this feed's subaccount. Each call enrolls this many new cards (with cardsubscription.created webhooks). Requires an active feed for the networkReference; returns 400 when none exists or when the subaccount has exhausted the pool.
Number of transactions generated for every included card, with fresh transaction references and recent dates on each call. Use 0 for a cards-only (starter) file.
41 @field_validator('network_reference') 42 def network_reference_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^\d+(_\d+){2,3}$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^\d+(_\d+){2,3}$/") 47 return value
Validates the regular expression
56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateBulkFeedFileVcfRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateBulkFeedFileVcfRequest from a JSON string
71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateBulkFeedFileVcfRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "networkReference": obj.get("networkReference"), 109 "cardCount": obj.get("cardCount") if obj.get("cardCount") is not None else 5, 110 "newCardCount": obj.get("newCardCount") if obj.get("newCardCount") is not None else 0, 111 "transactionsPerCard": obj.get("transactionsPerCard") if obj.get("transactionsPerCard") is not None else 3 112 }) 113 # store additional fields in additional_properties 114 for _key in obj.keys(): 115 if _key not in cls.__properties: 116 _obj.additional_properties[_key] = obj.get(_key) 117 118 return _obj
Create an instance of SimulateBulkFeedFileVcfRequest from a dict
30class SimulateTransactionAccepted(BaseModel): 31 """ 32 SimulateTransactionAccepted 33 """ # noqa: E501 34 message_id: UUID = Field(description="The id of the transaction message that was published. Once it has been processed, use `GET /transaction-messages/{transactionMessageId}` to retrieve it, or `GET /transactions?transactionMessageId=` to find the transaction it created or updated. ", alias="messageId") 35 additional_properties: Dict[str, Any] = {} 36 __properties: ClassVar[List[str]] = ["messageId"] 37 38 model_config = ConfigDict( 39 populate_by_name=True, 40 validate_assignment=True, 41 protected_namespaces=(), 42 ) 43 44 45 def to_str(self) -> str: 46 """Returns the string representation of the model using alias""" 47 return pprint.pformat(self.model_dump(by_alias=True)) 48 49 def to_json(self) -> str: 50 """Returns the JSON representation of the model using alias""" 51 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 52 # to_jsonable_python turns them into the JSON the API sends. 53 return json.dumps(to_jsonable_python(self.to_dict())) 54 55 @classmethod 56 def from_json(cls, json_str: str) -> Optional[Self]: 57 """Create an instance of SimulateTransactionAccepted from a JSON string""" 58 return cls.from_dict(json.loads(json_str)) 59 60 def to_dict(self) -> Dict[str, Any]: 61 """Return the dictionary representation of the model using alias. 62 63 This has the following differences from calling pydantic's 64 `self.model_dump(by_alias=True)`: 65 66 * `None` is only added to the output dict for nullable fields that 67 were set at model initialization. Other fields with value `None` 68 are ignored. 69 * Fields in `self.additional_properties` are added to the output dict. 70 """ 71 excluded_fields: Set[str] = set([ 72 "additional_properties", 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 # puts key-value pairs in additional_properties in the top level 81 if self.additional_properties is not None: 82 for _key, _value in self.additional_properties.items(): 83 _dict[_key] = _value 84 85 return _dict 86 87 @classmethod 88 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 89 """Create an instance of SimulateTransactionAccepted from a dict""" 90 if obj is None: 91 return None 92 93 if not isinstance(obj, dict): 94 return cls.model_validate(obj) 95 96 _obj = cls.model_validate({ 97 "messageId": obj.get("messageId") 98 }) 99 # store additional fields in additional_properties 100 for _key in obj.keys(): 101 if _key not in cls.__properties: 102 _obj.additional_properties[_key] = obj.get(_key) 103 104 return _obj
SimulateTransactionAccepted
The id of the transaction message that was published. Once it has been processed, use GET /transaction-messages/{transactionMessageId} to retrieve it, or GET /transactions?transactionMessageId= to find the transaction it created or updated.
45 def to_str(self) -> str: 46 """Returns the string representation of the model using alias""" 47 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
49 def to_json(self) -> str: 50 """Returns the JSON representation of the model using alias""" 51 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 52 # to_jsonable_python turns them into the JSON the API sends. 53 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
55 @classmethod 56 def from_json(cls, json_str: str) -> Optional[Self]: 57 """Create an instance of SimulateTransactionAccepted from a JSON string""" 58 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionAccepted from a JSON string
60 def to_dict(self) -> Dict[str, Any]: 61 """Return the dictionary representation of the model using alias. 62 63 This has the following differences from calling pydantic's 64 `self.model_dump(by_alias=True)`: 65 66 * `None` is only added to the output dict for nullable fields that 67 were set at model initialization. Other fields with value `None` 68 are ignored. 69 * Fields in `self.additional_properties` are added to the output dict. 70 """ 71 excluded_fields: Set[str] = set([ 72 "additional_properties", 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 # puts key-value pairs in additional_properties in the top level 81 if self.additional_properties is not None: 82 for _key, _value in self.additional_properties.items(): 83 _dict[_key] = _value 84 85 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
87 @classmethod 88 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 89 """Create an instance of SimulateTransactionAccepted from a dict""" 90 if obj is None: 91 return None 92 93 if not isinstance(obj, dict): 94 return cls.model_validate(obj) 95 96 _obj = cls.model_validate({ 97 "messageId": obj.get("messageId") 98 }) 99 # store additional fields in additional_properties 100 for _key in obj.keys(): 101 if _key not in cls.__properties: 102 _obj.additional_properties[_key] = obj.get(_key) 103 104 return _obj
Create an instance of SimulateTransactionAccepted from a dict
31class SimulateTransactionMessageRequest(BaseModel): 32 """ 33 Publishes one more transaction message on an existing sandbox transaction. The message reuses the transaction's card, network, currency, merchant and network reference, so the new message joins the same transaction. 34 """ # noqa: E501 35 type: StrictStr = Field(description="The message to publish. `amount` is in minor units of the transaction's currency; whether it is required depends on the type: - `authorization`: an additional authorization that increases the hold. `amount` is required. - `adjustment`: replaces the current hold with `amount` (the new total). `amount` is required. Rejected with `409` when nothing is on hold. - `reversal`: releases `amount` from the hold. Defaults to the full remaining hold. Rejected with `409` when nothing is on hold or when `amount` exceeds the hold. - `settlement`: clears `amount`, moving it from the hold to the settled amount. Defaults to the remaining hold; required when nothing is on hold. - `refund`: negative settlement linked to this transaction. Nets into it while it is still PENDING or on accounts that correlate refunds; otherwise (the default for API-created accounts) a SETTLED transaction gets a separate refund transaction with its own `transaction.created`. Defaults to the settled amount; required when nothing has been settled. ") 36 amount: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Amount in minor units of the transaction's currency. See `type` for which types require it and what it defaults to otherwise. ") 37 date_time: Optional[datetime] = Field(default=None, description="Timestamp of the message, ISO 8601 with a timezone offset. Must not be in the future. Defaults to one second after the transaction's latest message, or to the time of the request if that is later; when the latest message is already ahead of the clock (an end-of-day message, see below), the time of the request. Set an earlier value to backdate a message (for example an authorization that joins a settlement-first transaction). As in production, Visa settlements and reversals and Amex settlements are published with an end-of-day `dateTime`: the UTC date of this value at `23:59:59Z`. ", alias="dateTime") 38 additional_properties: Dict[str, Any] = {} 39 __properties: ClassVar[List[str]] = ["type", "amount", "dateTime"] 40 41 @field_validator('type') 42 def type_validate_enum(cls, value): 43 """Validates the enum""" 44 # Requests must use a known value; a response may carry one added after this release. 45 if value not in set(['authorization', 'adjustment', 'reversal', 'settlement', 'refund']) and not _lenient_active(): 46 raise ValueError("must be one of enum values ('authorization', 'adjustment', 'reversal', 'settlement', 'refund')") 47 return value 48 49 model_config = ConfigDict( 50 populate_by_name=True, 51 validate_assignment=True, 52 protected_namespaces=(), 53 ) 54 55 56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True)) 59 60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict())) 65 66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateTransactionMessageRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str)) 70 71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict 97 98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateTransactionMessageRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "type": obj.get("type"), 109 "amount": obj.get("amount"), 110 "dateTime": obj.get("dateTime") 111 }) 112 # store additional fields in additional_properties 113 for _key in obj.keys(): 114 if _key not in cls.__properties: 115 _obj.additional_properties[_key] = obj.get(_key) 116 117 return _obj
Publishes one more transaction message on an existing sandbox transaction. The message reuses the transaction's card, network, currency, merchant and network reference, so the new message joins the same transaction.
The message to publish. amount is in minor units of the transaction's currency; whether it is required depends on the type: - authorization: an additional authorization that increases the hold. amount is required. - adjustment: replaces the current hold with amount (the new total). amount is required. Rejected with 409 when nothing is on hold. - reversal: releases amount from the hold. Defaults to the full remaining hold. Rejected with 409 when nothing is on hold or when amount exceeds the hold. - settlement: clears amount, moving it from the hold to the settled amount. Defaults to the remaining hold; required when nothing is on hold. - refund: negative settlement linked to this transaction. Nets into it while it is still PENDING or on accounts that correlate refunds; otherwise (the default for API-created accounts) a SETTLED transaction gets a separate refund transaction with its own transaction.created. Defaults to the settled amount; required when nothing has been settled.
Amount in minor units of the transaction's currency. See type for which types require it and what it defaults to otherwise.
Timestamp of the message, ISO 8601 with a timezone offset. Must not be in the future. Defaults to one second after the transaction's latest message, or to the time of the request if that is later; when the latest message is already ahead of the clock (an end-of-day message, see below), the time of the request. Set an earlier value to backdate a message (for example an authorization that joins a settlement-first transaction). As in production, Visa settlements and reversals and Amex settlements are published with an end-of-day dateTime: the UTC date of this value at 23:59:59Z.
41 @field_validator('type') 42 def type_validate_enum(cls, value): 43 """Validates the enum""" 44 # Requests must use a known value; a response may carry one added after this release. 45 if value not in set(['authorization', 'adjustment', 'reversal', 'settlement', 'refund']) and not _lenient_active(): 46 raise ValueError("must be one of enum values ('authorization', 'adjustment', 'reversal', 'settlement', 'refund')") 47 return value
Validates the enum
56 def to_str(self) -> str: 57 """Returns the string representation of the model using alias""" 58 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
60 def to_json(self) -> str: 61 """Returns the JSON representation of the model using alias""" 62 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 63 # to_jsonable_python turns them into the JSON the API sends. 64 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
66 @classmethod 67 def from_json(cls, json_str: str) -> Optional[Self]: 68 """Create an instance of SimulateTransactionMessageRequest from a JSON string""" 69 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionMessageRequest from a JSON string
71 def to_dict(self) -> Dict[str, Any]: 72 """Return the dictionary representation of the model using alias. 73 74 This has the following differences from calling pydantic's 75 `self.model_dump(by_alias=True)`: 76 77 * `None` is only added to the output dict for nullable fields that 78 were set at model initialization. Other fields with value `None` 79 are ignored. 80 * Fields in `self.additional_properties` are added to the output dict. 81 """ 82 excluded_fields: Set[str] = set([ 83 "additional_properties", 84 ]) 85 86 _dict = self.model_dump( 87 by_alias=True, 88 exclude=excluded_fields, 89 exclude_none=True, 90 ) 91 # puts key-value pairs in additional_properties in the top level 92 if self.additional_properties is not None: 93 for _key, _value in self.additional_properties.items(): 94 _dict[_key] = _value 95 96 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
98 @classmethod 99 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 100 """Create an instance of SimulateTransactionMessageRequest from a dict""" 101 if obj is None: 102 return None 103 104 if not isinstance(obj, dict): 105 return cls.model_validate(obj) 106 107 _obj = cls.model_validate({ 108 "type": obj.get("type"), 109 "amount": obj.get("amount"), 110 "dateTime": obj.get("dateTime") 111 }) 112 # store additional fields in additional_properties 113 for _key in obj.keys(): 114 if _key not in cls.__properties: 115 _obj.additional_properties[_key] = obj.get(_key) 116 117 return _obj
Create an instance of SimulateTransactionMessageRequest from a dict
33class SimulateTransactionRequest(BaseModel): 34 """ 35 Starts a new simulated transaction on an enrolled sandbox card by publishing a single transaction message. Every field other than `cardId` and `type` is optional and falls back to a default. 36 """ # noqa: E501 37 card_id: UUID = Field(description="The identifier of the enrolled card to transact against. The card must belong to the account of the access token; the subaccount and, unless `network` is given, the network are read from the card. ", alias="cardId") 38 type: StrictStr = Field(description="The first message of the new transaction. - `authorization`: publishes an authorization request, creating a `PENDING` transaction with `amount` on hold. - `settlement`: publishes a clearing with no prior authorization, creating a `SETTLED` transaction with `amount` settled and nothing on hold. A later `authorization` step on the transaction joins it. ") 39 amount: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Transaction amount in minor units of `currency` (for example `4500` for 45.00 USD). Defaults to `4500`. ") 40 currency: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=3)]] = Field(default=None, description="ISO 4217 three-letter currency code of the transaction, case insensitive. Must be a currency transactions can be made in; fund codes and precious metals are rejected with `400`. Defaults to `USD`. ") 41 network: Optional[StrictStr] = Field(default=None, description="Card network the message is published on. Defaults to the card's own network; the request is rejected with `400` when this field is omitted and the card has no network or one outside this list. ") 42 merchant: Optional[SimulateTransactionRequestMerchant] = None 43 date_time: Optional[datetime] = Field(default=None, description="Timestamp of the message, ISO 8601 with a timezone offset. Must not be in the future. Defaults to the time of the request. ", alias="dateTime") 44 additional_properties: Dict[str, Any] = {} 45 __properties: ClassVar[List[str]] = ["cardId", "type", "amount", "currency", "network", "merchant", "dateTime"] 46 47 @field_validator('type') 48 def type_validate_enum(cls, value): 49 """Validates the enum""" 50 # Requests must use a known value; a response may carry one added after this release. 51 if value not in set(['authorization', 'settlement']) and not _lenient_active(): 52 raise ValueError("must be one of enum values ('authorization', 'settlement')") 53 return value 54 55 @field_validator('network') 56 def network_validate_enum(cls, value): 57 """Validates the enum""" 58 if value is None: 59 return value 60 61 # Requests must use a known value; a response may carry one added after this release. 62 if value not in set(['VISA', 'MASTERCARD', 'AMEX']) and not _lenient_active(): 63 raise ValueError("must be one of enum values ('VISA', 'MASTERCARD', 'AMEX')") 64 return value 65 66 model_config = ConfigDict( 67 populate_by_name=True, 68 validate_assignment=True, 69 protected_namespaces=(), 70 ) 71 72 73 def to_str(self) -> str: 74 """Returns the string representation of the model using alias""" 75 return pprint.pformat(self.model_dump(by_alias=True)) 76 77 def to_json(self) -> str: 78 """Returns the JSON representation of the model using alias""" 79 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 80 # to_jsonable_python turns them into the JSON the API sends. 81 return json.dumps(to_jsonable_python(self.to_dict())) 82 83 @classmethod 84 def from_json(cls, json_str: str) -> Optional[Self]: 85 """Create an instance of SimulateTransactionRequest from a JSON string""" 86 return cls.from_dict(json.loads(json_str)) 87 88 def to_dict(self) -> Dict[str, Any]: 89 """Return the dictionary representation of the model using alias. 90 91 This has the following differences from calling pydantic's 92 `self.model_dump(by_alias=True)`: 93 94 * `None` is only added to the output dict for nullable fields that 95 were set at model initialization. Other fields with value `None` 96 are ignored. 97 * Fields in `self.additional_properties` are added to the output dict. 98 """ 99 excluded_fields: Set[str] = set([ 100 "additional_properties", 101 ]) 102 103 _dict = self.model_dump( 104 by_alias=True, 105 exclude=excluded_fields, 106 exclude_none=True, 107 ) 108 # override the default output from pydantic by calling `to_dict()` of merchant 109 if self.merchant: 110 _dict['merchant'] = self.merchant.to_dict() 111 # puts key-value pairs in additional_properties in the top level 112 if self.additional_properties is not None: 113 for _key, _value in self.additional_properties.items(): 114 _dict[_key] = _value 115 116 return _dict 117 118 @classmethod 119 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 120 """Create an instance of SimulateTransactionRequest from a dict""" 121 if obj is None: 122 return None 123 124 if not isinstance(obj, dict): 125 return cls.model_validate(obj) 126 127 _obj = cls.model_validate({ 128 "cardId": obj.get("cardId"), 129 "type": obj.get("type"), 130 "amount": obj.get("amount"), 131 "currency": obj.get("currency"), 132 "network": obj.get("network"), 133 "merchant": SimulateTransactionRequestMerchant.from_dict(obj["merchant"]) if obj.get("merchant") is not None else None, 134 "dateTime": obj.get("dateTime") 135 }) 136 # store additional fields in additional_properties 137 for _key in obj.keys(): 138 if _key not in cls.__properties: 139 _obj.additional_properties[_key] = obj.get(_key) 140 141 return _obj
Starts a new simulated transaction on an enrolled sandbox card by publishing a single transaction message. Every field other than cardId and type is optional and falls back to a default.
The identifier of the enrolled card to transact against. The card must belong to the account of the access token; the subaccount and, unless network is given, the network are read from the card.
The first message of the new transaction. - authorization: publishes an authorization request, creating a PENDING transaction with amount on hold. - settlement: publishes a clearing with no prior authorization, creating a SETTLED transaction with amount settled and nothing on hold. A later authorization step on the transaction joins it.
Transaction amount in minor units of currency (for example 4500 for 45.00 USD). Defaults to 4500.
ISO 4217 three-letter currency code of the transaction, case insensitive. Must be a currency transactions can be made in; fund codes and precious metals are rejected with 400. Defaults to USD.
Card network the message is published on. Defaults to the card's own network; the request is rejected with 400 when this field is omitted and the card has no network or one outside this list.
Timestamp of the message, ISO 8601 with a timezone offset. Must not be in the future. Defaults to the time of the request.
47 @field_validator('type') 48 def type_validate_enum(cls, value): 49 """Validates the enum""" 50 # Requests must use a known value; a response may carry one added after this release. 51 if value not in set(['authorization', 'settlement']) and not _lenient_active(): 52 raise ValueError("must be one of enum values ('authorization', 'settlement')") 53 return value
Validates the enum
55 @field_validator('network') 56 def network_validate_enum(cls, value): 57 """Validates the enum""" 58 if value is None: 59 return value 60 61 # Requests must use a known value; a response may carry one added after this release. 62 if value not in set(['VISA', 'MASTERCARD', 'AMEX']) and not _lenient_active(): 63 raise ValueError("must be one of enum values ('VISA', 'MASTERCARD', 'AMEX')") 64 return value
Validates the enum
73 def to_str(self) -> str: 74 """Returns the string representation of the model using alias""" 75 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
77 def to_json(self) -> str: 78 """Returns the JSON representation of the model using alias""" 79 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 80 # to_jsonable_python turns them into the JSON the API sends. 81 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
83 @classmethod 84 def from_json(cls, json_str: str) -> Optional[Self]: 85 """Create an instance of SimulateTransactionRequest from a JSON string""" 86 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionRequest from a JSON string
88 def to_dict(self) -> Dict[str, Any]: 89 """Return the dictionary representation of the model using alias. 90 91 This has the following differences from calling pydantic's 92 `self.model_dump(by_alias=True)`: 93 94 * `None` is only added to the output dict for nullable fields that 95 were set at model initialization. Other fields with value `None` 96 are ignored. 97 * Fields in `self.additional_properties` are added to the output dict. 98 """ 99 excluded_fields: Set[str] = set([ 100 "additional_properties", 101 ]) 102 103 _dict = self.model_dump( 104 by_alias=True, 105 exclude=excluded_fields, 106 exclude_none=True, 107 ) 108 # override the default output from pydantic by calling `to_dict()` of merchant 109 if self.merchant: 110 _dict['merchant'] = self.merchant.to_dict() 111 # puts key-value pairs in additional_properties in the top level 112 if self.additional_properties is not None: 113 for _key, _value in self.additional_properties.items(): 114 _dict[_key] = _value 115 116 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
118 @classmethod 119 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 120 """Create an instance of SimulateTransactionRequest from a dict""" 121 if obj is None: 122 return None 123 124 if not isinstance(obj, dict): 125 return cls.model_validate(obj) 126 127 _obj = cls.model_validate({ 128 "cardId": obj.get("cardId"), 129 "type": obj.get("type"), 130 "amount": obj.get("amount"), 131 "currency": obj.get("currency"), 132 "network": obj.get("network"), 133 "merchant": SimulateTransactionRequestMerchant.from_dict(obj["merchant"]) if obj.get("merchant") is not None else None, 134 "dateTime": obj.get("dateTime") 135 }) 136 # store additional fields in additional_properties 137 for _key in obj.keys(): 138 if _key not in cls.__properties: 139 _obj.additional_properties[_key] = obj.get(_key) 140 141 return _obj
Create an instance of SimulateTransactionRequest from a dict
30class SimulateTransactionRequestMerchant(BaseModel): 31 """ 32 The merchant (card acceptor) on the message. Defaults to a fixed sandbox coffee-shop merchant in the United States. 33 """ # noqa: E501 34 name: Annotated[str, Field(min_length=1, strict=True)] = Field(description="Merchant name, emitted as the transaction descriptor.") 35 mcc: Annotated[str, Field(strict=True)] = Field(description="Four-digit merchant category code.") 36 city: Optional[StrictStr] = Field(default=None, description="Merchant city.") 37 country: Optional[Annotated[str, Field(strict=True)]] = Field(default=None, description="Merchant country as an ISO 3166-1 alpha-3 code (for example `USA`, `GBR`, `FRA`), case insensitive; any other value is rejected with `400`. Defaults to `USA`. ") 38 additional_properties: Dict[str, Any] = {} 39 __properties: ClassVar[List[str]] = ["name", "mcc", "city", "country"] 40 41 @field_validator('mcc') 42 def mcc_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^\d{4}$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^\d{4}$/") 47 return value 48 49 @field_validator('country') 50 def country_validate_regular_expression(cls, value): 51 """Validates the regular expression""" 52 if value is None: 53 return value 54 55 # Requests must match; a response that does not is kept as sent (astrada._lenient). 56 if not re.match(r"^[A-Za-z]{3}$", value) and not _lenient_active(): 57 raise ValueError(r"must validate the regular expression /^[A-Za-z]{3}$/") 58 return value 59 60 model_config = ConfigDict( 61 populate_by_name=True, 62 validate_assignment=True, 63 protected_namespaces=(), 64 ) 65 66 67 def to_str(self) -> str: 68 """Returns the string representation of the model using alias""" 69 return pprint.pformat(self.model_dump(by_alias=True)) 70 71 def to_json(self) -> str: 72 """Returns the JSON representation of the model using alias""" 73 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 74 # to_jsonable_python turns them into the JSON the API sends. 75 return json.dumps(to_jsonable_python(self.to_dict())) 76 77 @classmethod 78 def from_json(cls, json_str: str) -> Optional[Self]: 79 """Create an instance of SimulateTransactionRequestMerchant from a JSON string""" 80 return cls.from_dict(json.loads(json_str)) 81 82 def to_dict(self) -> Dict[str, Any]: 83 """Return the dictionary representation of the model using alias. 84 85 This has the following differences from calling pydantic's 86 `self.model_dump(by_alias=True)`: 87 88 * `None` is only added to the output dict for nullable fields that 89 were set at model initialization. Other fields with value `None` 90 are ignored. 91 * Fields in `self.additional_properties` are added to the output dict. 92 """ 93 excluded_fields: Set[str] = set([ 94 "additional_properties", 95 ]) 96 97 _dict = self.model_dump( 98 by_alias=True, 99 exclude=excluded_fields, 100 exclude_none=True, 101 ) 102 # puts key-value pairs in additional_properties in the top level 103 if self.additional_properties is not None: 104 for _key, _value in self.additional_properties.items(): 105 _dict[_key] = _value 106 107 return _dict 108 109 @classmethod 110 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 111 """Create an instance of SimulateTransactionRequestMerchant from a dict""" 112 if obj is None: 113 return None 114 115 if not isinstance(obj, dict): 116 return cls.model_validate(obj) 117 118 _obj = cls.model_validate({ 119 "name": obj.get("name"), 120 "mcc": obj.get("mcc"), 121 "city": obj.get("city"), 122 "country": obj.get("country") 123 }) 124 # store additional fields in additional_properties 125 for _key in obj.keys(): 126 if _key not in cls.__properties: 127 _obj.additional_properties[_key] = obj.get(_key) 128 129 return _obj
The merchant (card acceptor) on the message. Defaults to a fixed sandbox coffee-shop merchant in the United States.
Merchant name, emitted as the transaction descriptor.
Four-digit merchant category code.
Merchant country as an ISO 3166-1 alpha-3 code (for example USA, GBR, FRA), case insensitive; any other value is rejected with 400. Defaults to USA.
41 @field_validator('mcc') 42 def mcc_validate_regular_expression(cls, value): 43 """Validates the regular expression""" 44 # Requests must match; a response that does not is kept as sent (astrada._lenient). 45 if not re.match(r"^\d{4}$", value) and not _lenient_active(): 46 raise ValueError(r"must validate the regular expression /^\d{4}$/") 47 return value
Validates the regular expression
49 @field_validator('country') 50 def country_validate_regular_expression(cls, value): 51 """Validates the regular expression""" 52 if value is None: 53 return value 54 55 # Requests must match; a response that does not is kept as sent (astrada._lenient). 56 if not re.match(r"^[A-Za-z]{3}$", value) and not _lenient_active(): 57 raise ValueError(r"must validate the regular expression /^[A-Za-z]{3}$/") 58 return value
Validates the regular expression
67 def to_str(self) -> str: 68 """Returns the string representation of the model using alias""" 69 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
71 def to_json(self) -> str: 72 """Returns the JSON representation of the model using alias""" 73 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 74 # to_jsonable_python turns them into the JSON the API sends. 75 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
77 @classmethod 78 def from_json(cls, json_str: str) -> Optional[Self]: 79 """Create an instance of SimulateTransactionRequestMerchant from a JSON string""" 80 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionRequestMerchant from a JSON string
82 def to_dict(self) -> Dict[str, Any]: 83 """Return the dictionary representation of the model using alias. 84 85 This has the following differences from calling pydantic's 86 `self.model_dump(by_alias=True)`: 87 88 * `None` is only added to the output dict for nullable fields that 89 were set at model initialization. Other fields with value `None` 90 are ignored. 91 * Fields in `self.additional_properties` are added to the output dict. 92 """ 93 excluded_fields: Set[str] = set([ 94 "additional_properties", 95 ]) 96 97 _dict = self.model_dump( 98 by_alias=True, 99 exclude=excluded_fields, 100 exclude_none=True, 101 ) 102 # puts key-value pairs in additional_properties in the top level 103 if self.additional_properties is not None: 104 for _key, _value in self.additional_properties.items(): 105 _dict[_key] = _value 106 107 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
109 @classmethod 110 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 111 """Create an instance of SimulateTransactionRequestMerchant from a dict""" 112 if obj is None: 113 return None 114 115 if not isinstance(obj, dict): 116 return cls.model_validate(obj) 117 118 _obj = cls.model_validate({ 119 "name": obj.get("name"), 120 "mcc": obj.get("mcc"), 121 "city": obj.get("city"), 122 "country": obj.get("country") 123 }) 124 # store additional fields in additional_properties 125 for _key in obj.keys(): 126 if _key not in cls.__properties: 127 _obj.additional_properties[_key] = obj.get(_key) 128 129 return _obj
Create an instance of SimulateTransactionRequestMerchant from a dict
31class SimulateTransactionScenarioAccepted(BaseModel): 32 """ 33 SimulateTransactionScenarioAccepted 34 """ # noqa: E501 35 transactions: Annotated[List[SimulateTransactionScenarioTransaction], Field(min_length=1)] = Field(description="The transactions created by the scenario. Each entry lists the ids of the transaction messages published for that transaction; use `GET /transaction-messages/{transactionMessageId}` to retrieve each message once it has been processed. ") 36 additional_properties: Dict[str, Any] = {} 37 __properties: ClassVar[List[str]] = ["transactions"] 38 39 model_config = ConfigDict( 40 populate_by_name=True, 41 validate_assignment=True, 42 protected_namespaces=(), 43 ) 44 45 46 def to_str(self) -> str: 47 """Returns the string representation of the model using alias""" 48 return pprint.pformat(self.model_dump(by_alias=True)) 49 50 def to_json(self) -> str: 51 """Returns the JSON representation of the model using alias""" 52 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 53 # to_jsonable_python turns them into the JSON the API sends. 54 return json.dumps(to_jsonable_python(self.to_dict())) 55 56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of SimulateTransactionScenarioAccepted from a JSON string""" 59 return cls.from_dict(json.loads(json_str)) 60 61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 * Fields in `self.additional_properties` are added to the output dict. 71 """ 72 excluded_fields: Set[str] = set([ 73 "additional_properties", 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 # override the default output from pydantic by calling `to_dict()` of each item in transactions (list) 82 _items = [] 83 if self.transactions: 84 for _item_transactions in self.transactions: 85 if _item_transactions: 86 _items.append(_item_transactions.to_dict()) 87 _dict['transactions'] = _items 88 # puts key-value pairs in additional_properties in the top level 89 if self.additional_properties is not None: 90 for _key, _value in self.additional_properties.items(): 91 _dict[_key] = _value 92 93 return _dict 94 95 @classmethod 96 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 97 """Create an instance of SimulateTransactionScenarioAccepted from a dict""" 98 if obj is None: 99 return None 100 101 if not isinstance(obj, dict): 102 return cls.model_validate(obj) 103 104 _obj = cls.model_validate({ 105 "transactions": [SimulateTransactionScenarioTransaction.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None 106 }) 107 # store additional fields in additional_properties 108 for _key in obj.keys(): 109 if _key not in cls.__properties: 110 _obj.additional_properties[_key] = obj.get(_key) 111 112 return _obj
SimulateTransactionScenarioAccepted
The transactions created by the scenario. Each entry lists the ids of the transaction messages published for that transaction; use GET /transaction-messages/{transactionMessageId} to retrieve each message once it has been processed.
46 def to_str(self) -> str: 47 """Returns the string representation of the model using alias""" 48 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
50 def to_json(self) -> str: 51 """Returns the JSON representation of the model using alias""" 52 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 53 # to_jsonable_python turns them into the JSON the API sends. 54 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of SimulateTransactionScenarioAccepted from a JSON string""" 59 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionScenarioAccepted from a JSON string
61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 * Fields in `self.additional_properties` are added to the output dict. 71 """ 72 excluded_fields: Set[str] = set([ 73 "additional_properties", 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 # override the default output from pydantic by calling `to_dict()` of each item in transactions (list) 82 _items = [] 83 if self.transactions: 84 for _item_transactions in self.transactions: 85 if _item_transactions: 86 _items.append(_item_transactions.to_dict()) 87 _dict['transactions'] = _items 88 # puts key-value pairs in additional_properties in the top level 89 if self.additional_properties is not None: 90 for _key, _value in self.additional_properties.items(): 91 _dict[_key] = _value 92 93 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
95 @classmethod 96 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 97 """Create an instance of SimulateTransactionScenarioAccepted from a dict""" 98 if obj is None: 99 return None 100 101 if not isinstance(obj, dict): 102 return cls.model_validate(obj) 103 104 _obj = cls.model_validate({ 105 "transactions": [SimulateTransactionScenarioTransaction.from_dict(_item) for _item in obj["transactions"]] if obj.get("transactions") is not None else None 106 }) 107 # store additional fields in additional_properties 108 for _key in obj.keys(): 109 if _key not in cls.__properties: 110 _obj.additional_properties[_key] = obj.get(_key) 111 112 return _obj
Create an instance of SimulateTransactionScenarioAccepted from a dict
31class SimulateTransactionScenarioRequest(BaseModel): 32 """ 33 SimulateTransactionScenarioRequest 34 """ # noqa: E501 35 scenario: StrictStr = Field(description="The predefined scenario to simulate.") 36 card_id: UUID = Field(description="The identifier of the enrolled card to transact against.", alias="cardId") 37 subaccount_id: UUID = Field(description="The subaccount identifier the card belongs to.", alias="subaccountId") 38 amount: Optional[Annotated[int, Field(strict=True, ge=1)]] = Field(default=None, description="Optional transaction amount in minor units (cents). When omitted, the scenario's default amount is used. ") 39 currency: Optional[Annotated[str, Field(min_length=3, strict=True, max_length=3)]] = Field(default=None, description="Optional ISO 4217 three-letter currency code, case insensitive. A code that is not a currency transactions can be made in is rejected with `400`. When omitted, the scenario's default currency is used. ") 40 network: Optional[StrictStr] = Field(default=None, description="Optional card network override, so one scenario can be run against any network. When omitted, the scenario's own default network is used. ") 41 source: Optional[StrictStr] = Field(default=None, description="Optional ingestion-source tag applied to every message the scenario emits, so simulated activity can be attributed to a given network feed. When omitted, defaults to the scenario's own source if it sets one (the `amex_auth_*` scenarios default to `amexrta`), else `tns`, or `amexgl` when the resolved network is AMEX. ") 42 additional_properties: Dict[str, Any] = {} 43 __properties: ClassVar[List[str]] = ["scenario", "cardId", "subaccountId", "amount", "currency", "network", "source"] 44 45 @field_validator('scenario') 46 def scenario_validate_enum(cls, value): 47 """Validates the enum""" 48 # Requests must use a known value; a response may carry one added after this release. 49 if value not in set(['simple_purchase', 'split_shipment', 'tip_adjustment', 'expired_auth', 'refund', 'hotel_preauth', 'car_rental', 'gas_pump', 'partial_clearing', 'recurring_subscription', 'fx_conversion', 'amex_auth_baseline', 'amex_auth_adjustment', 'amex_auth_reversal', 'uber_canada_reversal', 'uber_netherlands_positive_advice', 'uber_turkey_dual_auth', 'uber_brazil_cancelled', 'uber_korea_settle_at_auth', 'uber_turkey_fx_reversal', 'uber_india_fx_clearing']) and not _lenient_active(): 50 raise ValueError("must be one of enum values ('simple_purchase', 'split_shipment', 'tip_adjustment', 'expired_auth', 'refund', 'hotel_preauth', 'car_rental', 'gas_pump', 'partial_clearing', 'recurring_subscription', 'fx_conversion', 'amex_auth_baseline', 'amex_auth_adjustment', 'amex_auth_reversal', 'uber_canada_reversal', 'uber_netherlands_positive_advice', 'uber_turkey_dual_auth', 'uber_brazil_cancelled', 'uber_korea_settle_at_auth', 'uber_turkey_fx_reversal', 'uber_india_fx_clearing')") 51 return value 52 53 @field_validator('network') 54 def network_validate_enum(cls, value): 55 """Validates the enum""" 56 if value is None: 57 return value 58 59 # Requests must use a known value; a response may carry one added after this release. 60 if value not in set(['VISA', 'MASTERCARD', 'AMEX']) and not _lenient_active(): 61 raise ValueError("must be one of enum values ('VISA', 'MASTERCARD', 'AMEX')") 62 return value 63 64 @field_validator('source') 65 def source_validate_enum(cls, value): 66 """Validates the enum""" 67 if value is None: 68 return value 69 70 # Requests must use a known value; a response may carry one added after this release. 71 if value not in set(['amexgl', 'amexrta', 'smartdata', 'tns', 'vbds', 'vcf', 'vop']) and not _lenient_active(): 72 raise ValueError("must be one of enum values ('amexgl', 'amexrta', 'smartdata', 'tns', 'vbds', 'vcf', 'vop')") 73 return value 74 75 model_config = ConfigDict( 76 populate_by_name=True, 77 validate_assignment=True, 78 protected_namespaces=(), 79 ) 80 81 82 def to_str(self) -> str: 83 """Returns the string representation of the model using alias""" 84 return pprint.pformat(self.model_dump(by_alias=True)) 85 86 def to_json(self) -> str: 87 """Returns the JSON representation of the model using alias""" 88 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 89 # to_jsonable_python turns them into the JSON the API sends. 90 return json.dumps(to_jsonable_python(self.to_dict())) 91 92 @classmethod 93 def from_json(cls, json_str: str) -> Optional[Self]: 94 """Create an instance of SimulateTransactionScenarioRequest from a JSON string""" 95 return cls.from_dict(json.loads(json_str)) 96 97 def to_dict(self) -> Dict[str, Any]: 98 """Return the dictionary representation of the model using alias. 99 100 This has the following differences from calling pydantic's 101 `self.model_dump(by_alias=True)`: 102 103 * `None` is only added to the output dict for nullable fields that 104 were set at model initialization. Other fields with value `None` 105 are ignored. 106 * Fields in `self.additional_properties` are added to the output dict. 107 """ 108 excluded_fields: Set[str] = set([ 109 "additional_properties", 110 ]) 111 112 _dict = self.model_dump( 113 by_alias=True, 114 exclude=excluded_fields, 115 exclude_none=True, 116 ) 117 # puts key-value pairs in additional_properties in the top level 118 if self.additional_properties is not None: 119 for _key, _value in self.additional_properties.items(): 120 _dict[_key] = _value 121 122 return _dict 123 124 @classmethod 125 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 126 """Create an instance of SimulateTransactionScenarioRequest from a dict""" 127 if obj is None: 128 return None 129 130 if not isinstance(obj, dict): 131 return cls.model_validate(obj) 132 133 _obj = cls.model_validate({ 134 "scenario": obj.get("scenario"), 135 "cardId": obj.get("cardId"), 136 "subaccountId": obj.get("subaccountId"), 137 "amount": obj.get("amount"), 138 "currency": obj.get("currency"), 139 "network": obj.get("network"), 140 "source": obj.get("source") 141 }) 142 # store additional fields in additional_properties 143 for _key in obj.keys(): 144 if _key not in cls.__properties: 145 _obj.additional_properties[_key] = obj.get(_key) 146 147 return _obj
SimulateTransactionScenarioRequest
The predefined scenario to simulate.
Optional transaction amount in minor units (cents). When omitted, the scenario's default amount is used.
Optional ISO 4217 three-letter currency code, case insensitive. A code that is not a currency transactions can be made in is rejected with 400. When omitted, the scenario's default currency is used.
Optional card network override, so one scenario can be run against any network. When omitted, the scenario's own default network is used.
Optional ingestion-source tag applied to every message the scenario emits, so simulated activity can be attributed to a given network feed. When omitted, defaults to the scenario's own source if it sets one (the amex_auth_* scenarios default to amexrta), else tns, or amexgl when the resolved network is AMEX.
45 @field_validator('scenario') 46 def scenario_validate_enum(cls, value): 47 """Validates the enum""" 48 # Requests must use a known value; a response may carry one added after this release. 49 if value not in set(['simple_purchase', 'split_shipment', 'tip_adjustment', 'expired_auth', 'refund', 'hotel_preauth', 'car_rental', 'gas_pump', 'partial_clearing', 'recurring_subscription', 'fx_conversion', 'amex_auth_baseline', 'amex_auth_adjustment', 'amex_auth_reversal', 'uber_canada_reversal', 'uber_netherlands_positive_advice', 'uber_turkey_dual_auth', 'uber_brazil_cancelled', 'uber_korea_settle_at_auth', 'uber_turkey_fx_reversal', 'uber_india_fx_clearing']) and not _lenient_active(): 50 raise ValueError("must be one of enum values ('simple_purchase', 'split_shipment', 'tip_adjustment', 'expired_auth', 'refund', 'hotel_preauth', 'car_rental', 'gas_pump', 'partial_clearing', 'recurring_subscription', 'fx_conversion', 'amex_auth_baseline', 'amex_auth_adjustment', 'amex_auth_reversal', 'uber_canada_reversal', 'uber_netherlands_positive_advice', 'uber_turkey_dual_auth', 'uber_brazil_cancelled', 'uber_korea_settle_at_auth', 'uber_turkey_fx_reversal', 'uber_india_fx_clearing')") 51 return value
Validates the enum
53 @field_validator('network') 54 def network_validate_enum(cls, value): 55 """Validates the enum""" 56 if value is None: 57 return value 58 59 # Requests must use a known value; a response may carry one added after this release. 60 if value not in set(['VISA', 'MASTERCARD', 'AMEX']) and not _lenient_active(): 61 raise ValueError("must be one of enum values ('VISA', 'MASTERCARD', 'AMEX')") 62 return value
Validates the enum
64 @field_validator('source') 65 def source_validate_enum(cls, value): 66 """Validates the enum""" 67 if value is None: 68 return value 69 70 # Requests must use a known value; a response may carry one added after this release. 71 if value not in set(['amexgl', 'amexrta', 'smartdata', 'tns', 'vbds', 'vcf', 'vop']) and not _lenient_active(): 72 raise ValueError("must be one of enum values ('amexgl', 'amexrta', 'smartdata', 'tns', 'vbds', 'vcf', 'vop')") 73 return value
Validates the enum
82 def to_str(self) -> str: 83 """Returns the string representation of the model using alias""" 84 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
86 def to_json(self) -> str: 87 """Returns the JSON representation of the model using alias""" 88 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 89 # to_jsonable_python turns them into the JSON the API sends. 90 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
92 @classmethod 93 def from_json(cls, json_str: str) -> Optional[Self]: 94 """Create an instance of SimulateTransactionScenarioRequest from a JSON string""" 95 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionScenarioRequest from a JSON string
97 def to_dict(self) -> Dict[str, Any]: 98 """Return the dictionary representation of the model using alias. 99 100 This has the following differences from calling pydantic's 101 `self.model_dump(by_alias=True)`: 102 103 * `None` is only added to the output dict for nullable fields that 104 were set at model initialization. Other fields with value `None` 105 are ignored. 106 * Fields in `self.additional_properties` are added to the output dict. 107 """ 108 excluded_fields: Set[str] = set([ 109 "additional_properties", 110 ]) 111 112 _dict = self.model_dump( 113 by_alias=True, 114 exclude=excluded_fields, 115 exclude_none=True, 116 ) 117 # puts key-value pairs in additional_properties in the top level 118 if self.additional_properties is not None: 119 for _key, _value in self.additional_properties.items(): 120 _dict[_key] = _value 121 122 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
124 @classmethod 125 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 126 """Create an instance of SimulateTransactionScenarioRequest from a dict""" 127 if obj is None: 128 return None 129 130 if not isinstance(obj, dict): 131 return cls.model_validate(obj) 132 133 _obj = cls.model_validate({ 134 "scenario": obj.get("scenario"), 135 "cardId": obj.get("cardId"), 136 "subaccountId": obj.get("subaccountId"), 137 "amount": obj.get("amount"), 138 "currency": obj.get("currency"), 139 "network": obj.get("network"), 140 "source": obj.get("source") 141 }) 142 # store additional fields in additional_properties 143 for _key in obj.keys(): 144 if _key not in cls.__properties: 145 _obj.additional_properties[_key] = obj.get(_key) 146 147 return _obj
Create an instance of SimulateTransactionScenarioRequest from a dict
31class SimulateTransactionScenarioTransaction(BaseModel): 32 """ 33 One transaction the scenario created, with the ids of its published messages. 34 """ # noqa: E501 35 message_ids: Annotated[List[UUID], Field(min_length=1)] = Field(alias="messageIds") 36 additional_properties: Dict[str, Any] = {} 37 __properties: ClassVar[List[str]] = ["messageIds"] 38 39 model_config = ConfigDict( 40 populate_by_name=True, 41 validate_assignment=True, 42 protected_namespaces=(), 43 ) 44 45 46 def to_str(self) -> str: 47 """Returns the string representation of the model using alias""" 48 return pprint.pformat(self.model_dump(by_alias=True)) 49 50 def to_json(self) -> str: 51 """Returns the JSON representation of the model using alias""" 52 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 53 # to_jsonable_python turns them into the JSON the API sends. 54 return json.dumps(to_jsonable_python(self.to_dict())) 55 56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of SimulateTransactionScenarioTransaction from a JSON string""" 59 return cls.from_dict(json.loads(json_str)) 60 61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 * Fields in `self.additional_properties` are added to the output dict. 71 """ 72 excluded_fields: Set[str] = set([ 73 "additional_properties", 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 # puts key-value pairs in additional_properties in the top level 82 if self.additional_properties is not None: 83 for _key, _value in self.additional_properties.items(): 84 _dict[_key] = _value 85 86 return _dict 87 88 @classmethod 89 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 90 """Create an instance of SimulateTransactionScenarioTransaction from a dict""" 91 if obj is None: 92 return None 93 94 if not isinstance(obj, dict): 95 return cls.model_validate(obj) 96 97 _obj = cls.model_validate({ 98 "messageIds": obj.get("messageIds") 99 }) 100 # store additional fields in additional_properties 101 for _key in obj.keys(): 102 if _key not in cls.__properties: 103 _obj.additional_properties[_key] = obj.get(_key) 104 105 return _obj
One transaction the scenario created, with the ids of its published messages.
46 def to_str(self) -> str: 47 """Returns the string representation of the model using alias""" 48 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
50 def to_json(self) -> str: 51 """Returns the JSON representation of the model using alias""" 52 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 53 # to_jsonable_python turns them into the JSON the API sends. 54 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
56 @classmethod 57 def from_json(cls, json_str: str) -> Optional[Self]: 58 """Create an instance of SimulateTransactionScenarioTransaction from a JSON string""" 59 return cls.from_dict(json.loads(json_str))
Create an instance of SimulateTransactionScenarioTransaction from a JSON string
61 def to_dict(self) -> Dict[str, Any]: 62 """Return the dictionary representation of the model using alias. 63 64 This has the following differences from calling pydantic's 65 `self.model_dump(by_alias=True)`: 66 67 * `None` is only added to the output dict for nullable fields that 68 were set at model initialization. Other fields with value `None` 69 are ignored. 70 * Fields in `self.additional_properties` are added to the output dict. 71 """ 72 excluded_fields: Set[str] = set([ 73 "additional_properties", 74 ]) 75 76 _dict = self.model_dump( 77 by_alias=True, 78 exclude=excluded_fields, 79 exclude_none=True, 80 ) 81 # puts key-value pairs in additional_properties in the top level 82 if self.additional_properties is not None: 83 for _key, _value in self.additional_properties.items(): 84 _dict[_key] = _value 85 86 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
88 @classmethod 89 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 90 """Create an instance of SimulateTransactionScenarioTransaction from a dict""" 91 if obj is None: 92 return None 93 94 if not isinstance(obj, dict): 95 return cls.model_validate(obj) 96 97 _obj = cls.model_validate({ 98 "messageIds": obj.get("messageIds") 99 }) 100 # store additional fields in additional_properties 101 for _key in obj.keys(): 102 if _key not in cls.__properties: 103 _obj.additional_properties[_key] = obj.get(_key) 104 105 return _obj
Create an instance of SimulateTransactionScenarioTransaction from a dict
30class ValidationProblem(BaseModel): 31 """ 32 A `400 Bad Request` body. `errors`, when present, lists each problem found in the request. 33 """ # noqa: E501 34 detail: StrictStr 35 title: StrictStr = Field(description="A short summary of the status, `Bad Request` on this response.") 36 errors: Optional[List[ValidationProblemItem]] = None 37 additional_properties: Dict[str, Any] = {} 38 __properties: ClassVar[List[str]] = ["detail", "title", "errors"] 39 40 model_config = ConfigDict( 41 populate_by_name=True, 42 validate_assignment=True, 43 protected_namespaces=(), 44 ) 45 46 47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True)) 50 51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 54 # to_jsonable_python turns them into the JSON the API sends. 55 return json.dumps(to_jsonable_python(self.to_dict())) 56 57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of ValidationProblem from a JSON string""" 60 return cls.from_dict(json.loads(json_str)) 61 62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 * Fields in `self.additional_properties` are added to the output dict. 72 """ 73 excluded_fields: Set[str] = set([ 74 "additional_properties", 75 ]) 76 77 _dict = self.model_dump( 78 by_alias=True, 79 exclude=excluded_fields, 80 exclude_none=True, 81 ) 82 # override the default output from pydantic by calling `to_dict()` of each item in errors (list) 83 _items = [] 84 if self.errors: 85 for _item_errors in self.errors: 86 if _item_errors: 87 _items.append(_item_errors.to_dict()) 88 _dict['errors'] = _items 89 # puts key-value pairs in additional_properties in the top level 90 if self.additional_properties is not None: 91 for _key, _value in self.additional_properties.items(): 92 _dict[_key] = _value 93 94 return _dict 95 96 @classmethod 97 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 98 """Create an instance of ValidationProblem from a dict""" 99 if obj is None: 100 return None 101 102 if not isinstance(obj, dict): 103 return cls.model_validate(obj) 104 105 _obj = cls.model_validate({ 106 "detail": obj.get("detail"), 107 "title": obj.get("title"), 108 "errors": [ValidationProblemItem.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None 109 }) 110 # store additional fields in additional_properties 111 for _key in obj.keys(): 112 if _key not in cls.__properties: 113 _obj.additional_properties[_key] = obj.get(_key) 114 115 return _obj
A 400 Bad Request body. errors, when present, lists each problem found in the request.
A short summary of the status, Bad Request on this response.
47 def to_str(self) -> str: 48 """Returns the string representation of the model using alias""" 49 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
51 def to_json(self) -> str: 52 """Returns the JSON representation of the model using alias""" 53 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 54 # to_jsonable_python turns them into the JSON the API sends. 55 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
57 @classmethod 58 def from_json(cls, json_str: str) -> Optional[Self]: 59 """Create an instance of ValidationProblem from a JSON string""" 60 return cls.from_dict(json.loads(json_str))
Create an instance of ValidationProblem from a JSON string
62 def to_dict(self) -> Dict[str, Any]: 63 """Return the dictionary representation of the model using alias. 64 65 This has the following differences from calling pydantic's 66 `self.model_dump(by_alias=True)`: 67 68 * `None` is only added to the output dict for nullable fields that 69 were set at model initialization. Other fields with value `None` 70 are ignored. 71 * Fields in `self.additional_properties` are added to the output dict. 72 """ 73 excluded_fields: Set[str] = set([ 74 "additional_properties", 75 ]) 76 77 _dict = self.model_dump( 78 by_alias=True, 79 exclude=excluded_fields, 80 exclude_none=True, 81 ) 82 # override the default output from pydantic by calling `to_dict()` of each item in errors (list) 83 _items = [] 84 if self.errors: 85 for _item_errors in self.errors: 86 if _item_errors: 87 _items.append(_item_errors.to_dict()) 88 _dict['errors'] = _items 89 # puts key-value pairs in additional_properties in the top level 90 if self.additional_properties is not None: 91 for _key, _value in self.additional_properties.items(): 92 _dict[_key] = _value 93 94 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
96 @classmethod 97 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 98 """Create an instance of ValidationProblem from a dict""" 99 if obj is None: 100 return None 101 102 if not isinstance(obj, dict): 103 return cls.model_validate(obj) 104 105 _obj = cls.model_validate({ 106 "detail": obj.get("detail"), 107 "title": obj.get("title"), 108 "errors": [ValidationProblemItem.from_dict(_item) for _item in obj["errors"]] if obj.get("errors") is not None else None 109 }) 110 # store additional fields in additional_properties 111 for _key in obj.keys(): 112 if _key not in cls.__properties: 113 _obj.additional_properties[_key] = obj.get(_key) 114 115 return _obj
Create an instance of ValidationProblem from a dict
29class ValidationProblemItem(BaseModel): 30 """ 31 ValidationProblemItem 32 """ # noqa: E501 33 title: StrictStr 34 detail: StrictStr 35 additional_properties: Dict[str, Any] = {} 36 __properties: ClassVar[List[str]] = ["title", "detail"] 37 38 model_config = ConfigDict( 39 populate_by_name=True, 40 validate_assignment=True, 41 protected_namespaces=(), 42 ) 43 44 45 def to_str(self) -> str: 46 """Returns the string representation of the model using alias""" 47 return pprint.pformat(self.model_dump(by_alias=True)) 48 49 def to_json(self) -> str: 50 """Returns the JSON representation of the model using alias""" 51 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 52 # to_jsonable_python turns them into the JSON the API sends. 53 return json.dumps(to_jsonable_python(self.to_dict())) 54 55 @classmethod 56 def from_json(cls, json_str: str) -> Optional[Self]: 57 """Create an instance of ValidationProblemItem from a JSON string""" 58 return cls.from_dict(json.loads(json_str)) 59 60 def to_dict(self) -> Dict[str, Any]: 61 """Return the dictionary representation of the model using alias. 62 63 This has the following differences from calling pydantic's 64 `self.model_dump(by_alias=True)`: 65 66 * `None` is only added to the output dict for nullable fields that 67 were set at model initialization. Other fields with value `None` 68 are ignored. 69 * Fields in `self.additional_properties` are added to the output dict. 70 """ 71 excluded_fields: Set[str] = set([ 72 "additional_properties", 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 # puts key-value pairs in additional_properties in the top level 81 if self.additional_properties is not None: 82 for _key, _value in self.additional_properties.items(): 83 _dict[_key] = _value 84 85 return _dict 86 87 @classmethod 88 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 89 """Create an instance of ValidationProblemItem from a dict""" 90 if obj is None: 91 return None 92 93 if not isinstance(obj, dict): 94 return cls.model_validate(obj) 95 96 _obj = cls.model_validate({ 97 "title": obj.get("title"), 98 "detail": obj.get("detail") 99 }) 100 # store additional fields in additional_properties 101 for _key in obj.keys(): 102 if _key not in cls.__properties: 103 _obj.additional_properties[_key] = obj.get(_key) 104 105 return _obj
ValidationProblemItem
45 def to_str(self) -> str: 46 """Returns the string representation of the model using alias""" 47 return pprint.pformat(self.model_dump(by_alias=True))
Returns the string representation of the model using alias
49 def to_json(self) -> str: 50 """Returns the JSON representation of the model using alias""" 51 # to_dict() keeps Python values (UUID, datetime, date), which json.dumps cannot write; 52 # to_jsonable_python turns them into the JSON the API sends. 53 return json.dumps(to_jsonable_python(self.to_dict()))
Returns the JSON representation of the model using alias
55 @classmethod 56 def from_json(cls, json_str: str) -> Optional[Self]: 57 """Create an instance of ValidationProblemItem from a JSON string""" 58 return cls.from_dict(json.loads(json_str))
Create an instance of ValidationProblemItem from a JSON string
60 def to_dict(self) -> Dict[str, Any]: 61 """Return the dictionary representation of the model using alias. 62 63 This has the following differences from calling pydantic's 64 `self.model_dump(by_alias=True)`: 65 66 * `None` is only added to the output dict for nullable fields that 67 were set at model initialization. Other fields with value `None` 68 are ignored. 69 * Fields in `self.additional_properties` are added to the output dict. 70 """ 71 excluded_fields: Set[str] = set([ 72 "additional_properties", 73 ]) 74 75 _dict = self.model_dump( 76 by_alias=True, 77 exclude=excluded_fields, 78 exclude_none=True, 79 ) 80 # puts key-value pairs in additional_properties in the top level 81 if self.additional_properties is not None: 82 for _key, _value in self.additional_properties.items(): 83 _dict[_key] = _value 84 85 return _dict
Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
self.model_dump(by_alias=True):
Noneis only added to the output dict for nullable fields that were set at model initialization. Other fields with valueNoneare ignored.- Fields in
self.additional_propertiesare added to the output dict.
87 @classmethod 88 def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: 89 """Create an instance of ValidationProblemItem from a dict""" 90 if obj is None: 91 return None 92 93 if not isinstance(obj, dict): 94 return cls.model_validate(obj) 95 96 _obj = cls.model_validate({ 97 "title": obj.get("title"), 98 "detail": obj.get("detail") 99 }) 100 # store additional fields in additional_properties 101 for _key in obj.keys(): 102 if _key not in cls.__properties: 103 _obj.additional_properties[_key] = obj.get(_key) 104 105 return _obj
Create an instance of ValidationProblemItem from a dict